summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyrylo Yatsenko <hedrok@gmail.com>2026-01-11 22:46:51 +0200
committerKyrylo Yatsenko <hedrok@gmail.com>2026-01-12 23:08:58 +0200
commit892b8688021edbaf936d5180a64a3722ebdcb976 (patch)
treed4f8612e46f2932d6c4ae28ae1fab011a064031a
parent7fea6b6dbbd786bf6a32c496fc70ca9e9b5f8b1f (diff)
downloadvyos-1x-892b8688021edbaf936d5180a64a3722ebdcb976.tar.gz
vyos-1x-892b8688021edbaf936d5180a64a3722ebdcb976.zip
T8171: Make vyos-smoketest more user-friendly
* Output progress before each test * On finish, output list of failed tests if there were any. * Otuput "TIMEOUT" as result of test if it hanged
-rwxr-xr-xsmoketest/bin/vyos-smoketest39
1 files changed, 27 insertions, 12 deletions
diff --git a/smoketest/bin/vyos-smoketest b/smoketest/bin/vyos-smoketest
index d197499a7..e7d2d1fa1 100755
--- a/smoketest/bin/vyos-smoketest
+++ b/smoketest/bin/vyos-smoketest
@@ -18,25 +18,40 @@ import os
from sys import exit
from stat import S_IXOTH
-from subprocess import Popen, PIPE
+from subprocess import Popen, PIPE, TimeoutExpired
+
+timeout_minutes = 20 # 20 minutes per test should be enough?..
+timeout_seconds = timeout_minutes * 60
+tests = []
-success = True
for root, dirs, files in os.walk('/usr/libexec/vyos/tests/smoke'):
for name in files:
test_file = os.path.join(root, name)
mode = os.stat(test_file).st_mode
if name.startswith("test_") and mode & S_IXOTH:
- print('Running Testcase: ' + test_file)
- process = Popen([test_file], stdout=PIPE)
- (output, err) = process.communicate()
- exit_code = process.wait()
- # We do not want an instant fail - other tests should be run, too
- if exit_code != 0:
- success = False
-
-if success:
+ tests.append(test_file)
+
+fails = []
+n = len(tests)
+for i, test_file in enumerate(tests):
+ print(f'Running Testcase ({i+1}/{n}): {test_file}')
+ process = Popen([test_file], stdout=PIPE)
+ try:
+ (output, err) = process.communicate(timeout=timeout_seconds)
+ exit_code = process.returncode
+ except TimeoutExpired:
+ print(f'TIMEOUT ({timeout_minutes} minutes) expired - consider test failed!')
+ exit_code = 1
+ process.kill()
+ # We do not want an instant fail - other tests should be run, too
+ if exit_code != 0:
+ fails.append(test_file)
+
+if not len(fails):
+ print(f'SUCCESS! All {n} tests passed.')
exit(0)
-print("ERROR: One or more tests failed!")
+print(f'ERROR: {len(fails)}/{n} tests failed:')
+print('* ' + '\n* '.join(fails))
exit(1)