diff options
| author | Daniil Baturin <daniil@vyos.io> | 2026-01-14 10:27:48 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-14 10:27:48 +0000 |
| commit | 0c373c7c9cf0fff573e5acc5642f6af63c311da2 (patch) | |
| tree | fb0a2e069ec35d4d2688b4a0601a06bfbb7101eb | |
| parent | 5f233638951238afe55621dda9fce83b7d8bc209 (diff) | |
| parent | 892b8688021edbaf936d5180a64a3722ebdcb976 (diff) | |
| download | vyos-1x-0c373c7c9cf0fff573e5acc5642f6af63c311da2.tar.gz vyos-1x-0c373c7c9cf0fff573e5acc5642f6af63c311da2.zip | |
Merge pull request #4940 from hedrok/T8171-update-vyos-smoketest-script
T8171: Make vyos-smoketest more user-friendly
| -rwxr-xr-x | smoketest/bin/vyos-smoketest | 39 |
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) |
