|
12 | 12 |
|
13 | 13 | script_root = os.path.dirname(os.path.realpath(__file__)) |
14 | 14 | smbtorture_exec = "/bin/smbtorture" |
15 | | -filter_subunit_exec = script_root + "/selftest/filter-subunit" |
16 | | -format_subunit_exec = script_root + "/selftest/format-subunit" |
| 15 | +selftest_dir = script_root + "/selftest" |
| 16 | +filter_subunit_exec = selftest_dir + "/filter-subunit" |
| 17 | +format_subunit_exec = selftest_dir + "/format-subunit" |
17 | 18 | smbtorture_tests_file = script_root + "/smbtorture-tests-info.yml" |
18 | 19 |
|
19 | 20 | test_info_file = os.getenv("TEST_INFO_FILE") |
20 | 21 | test_info = testhelper.read_yaml(test_info_file) |
21 | 22 |
|
22 | 23 |
|
| 24 | +def flapping_file(backend: str, variant: str = "") -> str: |
| 25 | + file = "flapping." + backend |
| 26 | + if variant and variant != "default": |
| 27 | + file_variant = f"{file}-{variant}" |
| 28 | + if os.path.exists(os.path.join(selftest_dir, file_variant)): |
| 29 | + return file_variant |
| 30 | + if os.path.exists(os.path.join(selftest_dir, file)): |
| 31 | + return file |
| 32 | + return "" |
| 33 | + |
| 34 | + |
23 | 35 | def smbtorture(share_name: str, test: str, tmp_output: Path) -> bool: |
24 | 36 | # build smbtorture command |
25 | 37 | mount_params = testhelper.get_mount_parameters(test_info, share_name) |
@@ -50,13 +62,11 @@ def smbtorture(share_name: str, test: str, tmp_output: Path) -> bool: |
50 | 62 | flapping_list = ["flapping", "flapping.d"] |
51 | 63 | share = testhelper.get_share(test_info, share_name) |
52 | 64 | test_backend = share["backend"].get("name") |
| 65 | + test_backend_variant = share["backend"].get("variant") |
53 | 66 | if test_backend is not None: |
54 | | - flapping_file = "flapping." + test_backend |
55 | | - flapping_file_path = os.path.join( |
56 | | - script_root, "selftest", flapping_file |
57 | | - ) |
58 | | - if os.path.exists(flapping_file_path): |
59 | | - flapping_list.append(flapping_file) |
| 67 | + file = flapping_file(test_backend, test_backend_variant) |
| 68 | + if file is not None: |
| 69 | + flapping_list.append(file) |
60 | 70 | for filter in flapping_list: |
61 | 71 | filter_subunit_cmd.append( |
62 | 72 | "--flapping=" + script_root + "/selftest/" + filter |
|
0 commit comments