Skip to content

Commit c732b00

Browse files
committed
fix win fail
1 parent 1024631 commit c732b00

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

run_test.py

+25-17
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,21 @@ def __init__(self, single_run_config, case_name, command_file = "", command_text
8888
self.migrate_option = single_run_config.migrate_option
8989
self.timeout = single_run_config.timeout
9090
self.device_filter = single_run_config.device_filter
91+
self.cuda_ver = single_run_config.cuda_ver
92+
self.test_option = single_run_config.test_option
93+
self.device = single_run_config.device
9194

9295
class case_run_config:
93-
def __init__(self, DPCXX_COM, CT_TOOL, include_path, migrate_option, timeout, device_filter):
96+
def __init__(self, DPCXX_COM, CT_TOOL, include_path, migrate_option, timeout, device_filter, cuda_ver, test_option, backend_device):
9497
self.DPCXX_COM = DPCXX_COM
9598
self.CT_TOOL = CT_TOOL
9699
self.include_path = include_path
97100
self.migrate_option = migrate_option
98101
self.timeout = timeout
99102
self.device_filter = device_filter
103+
self.cuda_ver = cuda_ver
104+
self.test_option = test_option
105+
self.device = backend_device
100106

101107

102108
def parse_suite_cfg(suite_name, root_path):
@@ -276,37 +282,37 @@ def run_test_driver(module, single_case_text):
276282
# Rule1:skip < CUDA 9.2
277283
# Rule2:skip > CUDA 11.4
278284
# Not supported
279-
def is_platform_supported(platform_rule_list):
285+
def is_platform_supported(platform_rule_list, single_case_text):
280286
for platform_rule in platform_rule_list:
281287
if platform_rule.os_family != platform.system():
282288
continue
283289
if platform_rule.cuda_version:
284290
version = int(float(re.findall("\d+\.?\d*", platform_rule.cuda_version)[0])) * 1000
285291
print_debug_log("CUDA version is ", version)
286-
print_debug_log("default CUDA version is ", test_config.cuda_ver)
292+
print_debug_log("default CUDA version is ", single_case_text.cuda_ver)
287293
print_debug_log("default CUDA range is ", platform_rule.cuda_range)
288-
if platform_rule.cuda_range == "LATER_OR_EQUAL" and test_config.cuda_ver >= version and platform_rule.run_on_this_platform.upper() == "FALSE":
294+
if platform_rule.cuda_range == "LATER_OR_EQUAL" and single_case_text.cuda_ver >= version and platform_rule.run_on_this_platform.upper() == "FALSE":
289295
return False
290-
elif platform_rule.cuda_range == "OLDER" and test_config.cuda_ver < version and platform_rule.run_on_this_platform.upper() == "FALSE":
296+
elif platform_rule.cuda_range == "OLDER" and single_case_text.cuda_ver < version and platform_rule.run_on_this_platform.upper() == "FALSE":
291297
return False
292-
elif platform_rule.cuda_range == "LATER" and test_config.cuda_ver > version and platform_rule.run_on_this_platform.upper() == "FALSE":
298+
elif platform_rule.cuda_range == "LATER" and single_case_text.cuda_ver > version and platform_rule.run_on_this_platform.upper() == "FALSE":
293299
return False
294-
elif platform_rule.cuda_range == "OLDER_OR_EQUAL" and test_config.cuda_ver <= version and platform_rule.run_on_this_platform.upper() == "FALSE":
300+
elif platform_rule.cuda_range == "OLDER_OR_EQUAL" and single_case_text.cuda_ver <= version and platform_rule.run_on_this_platform.upper() == "FALSE":
295301
return False
296-
elif platform_rule.cuda_range == "EQUAL" and test_config.cuda_ver == version and platform_rule.run_on_this_platform.upper() == "FALSE":
302+
elif platform_rule.cuda_range == "EQUAL" and single_case_text.cuda_ver == version and platform_rule.run_on_this_platform.upper() == "FALSE":
297303
return False
298304
else:
299305
return platform_rule.run_on_this_platform.upper() == "TRUE"
300306
return True
301307

302-
def is_option_supported(option_rule_list):
308+
def is_option_supported(option_rule_list, single_case_text):
303309
for option_rule in option_rule_list:
304-
if option_rule.exclude_option != "" and option_rule.exclude_option in test_config.test_option and not option_rule.not_double_type_feature:
310+
if option_rule.exclude_option != "" and option_rule.exclude_option in single_case_text.test_option and not option_rule.not_double_type_feature:
305311
return False
306-
elif option_rule.only_option not in test_config.test_option:
312+
elif option_rule.only_option not in single_case_text.test_option:
307313
return False
308-
elif option_rule.exclude_option in test_config.test_option and option_rule.not_double_type_feature == "NOT double":
309-
if test_config.backend_device not in test_config.support_double_gpu:
314+
elif option_rule.exclude_option in single_case_text.test_option and option_rule.not_double_type_feature == "NOT double":
315+
if single_case_text.device not in test_config.support_double_gpu:
310316
return False
311317
return True
312318

@@ -315,12 +321,12 @@ def test_single_case(current_test, single_case_config, workspace, suite_root_pa
315321
os.path.join(workspace, current_test + ".lf"), "",
316322
os.path.join(workspace, "result.md"), "", "")
317323
module = import_test_driver(suite_root_path)
318-
if single_case_config.platform_rule_list and not is_platform_supported(single_case_config.platform_rule_list):
324+
if single_case_config.platform_rule_list and not is_platform_supported(single_case_config.platform_rule_list, single_case_text):
319325
single_case_text.result_text += current_test + " Skip " + "\n"
320326
single_case_text.run_flag = True
321327
return single_case_text
322328

323-
if single_case_config.option_rule_list and not is_option_supported(single_case_config.option_rule_list):
329+
if single_case_config.option_rule_list and not is_option_supported(single_case_config.option_rule_list, single_case_text):
324330
single_case_text.result_text += current_test + " Skip " + "\n"
325331
single_case_text.run_flag = True
326332
return single_case_text
@@ -382,7 +388,8 @@ def test_suite(suite_root_path, suite_name, opt):
382388

383389
for current_test, single_case_config in test_config.suite_cfg.test_config_map.items():
384390
single_run_config = case_run_config(test_config.DPCXX_COM, test_config.CT_TOOL, test_config.include_path,
385-
test_config.migrate_option, test_config.timeout, test_config.device_filter)
391+
test_config.migrate_option, test_config.timeout, test_config.device_filter,
392+
test_config.cuda_ver, test_config.test_option, test_config.backend_device)
386393
result = pool.apply_async(test_single_case, (current_test, single_case_config, test_workspace,
387394
suite_root_path, single_run_config,))
388395
# store all msg
@@ -415,7 +422,8 @@ def test_single_case_in_suite(suite_root_path, suite_name, case, option):
415422
exit("The test case " + case + " is not in the " + suite_name + " test suite! Please double check.")
416423
single_case_config = suite_cfg.test_config_map[case]
417424
single_run_config = case_run_config(test_config.DPCXX_COM, test_config.CT_TOOL, test_config.include_path,
418-
test_config.migrate_option, test_config.timeout, test_config.device_filter)
425+
test_config.migrate_option, test_config.timeout, test_config.device_filter,
426+
test_config.cuda_ver, test_config.test_option, test_config.backend_device)
419427
single_case_text = test_single_case(case, single_case_config, test_workspace, suite_root_path, single_run_config)
420428
record_msg_case(single_case_text)
421429
return single_case_text.run_flag

0 commit comments

Comments
 (0)