Skip to content

Commit 5426d82

Browse files
spuiukanoopcs9
authored andcommitted
testcases/smbtorture: use filesystem variant to set flapping list
The smbtorture results could vary based on the filesystem variant used. We use the variant passed in the test-info.yml to set the flapping list used. Signed-off-by: Sachin Prabhu <sp@spui.uk>
1 parent c03c7e8 commit 5426d82

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

testcases/smbtorture/test_smbtorture.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,26 @@
1212

1313
script_root = os.path.dirname(os.path.realpath(__file__))
1414
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"
1718
smbtorture_tests_file = script_root + "/smbtorture-tests-info.yml"
1819

1920
test_info_file = os.getenv("TEST_INFO_FILE")
2021
test_info = testhelper.read_yaml(test_info_file)
2122

2223

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+
2335
def smbtorture(share_name: str, test: str, tmp_output: Path) -> bool:
2436
# build smbtorture command
2537
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:
5062
flapping_list = ["flapping", "flapping.d"]
5163
share = testhelper.get_share(test_info, share_name)
5264
test_backend = share["backend"].get("name")
65+
test_backend_variant = share["backend"].get("variant")
5366
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)
6070
for filter in flapping_list:
6171
filter_subunit_cmd.append(
6272
"--flapping=" + script_root + "/selftest/" + filter

0 commit comments

Comments
 (0)