diff --git a/README.md b/README.md index c36d0ea77..1722bf04a 100644 --- a/README.md +++ b/README.md @@ -113,10 +113,10 @@ For example, for test suite: internal_samples, there is a test driver configure The test driver implementation file test_samples.py needs to implement the following 4 interfaces: - 1. setup_test(): Setup the execution environment. eg. setup CPATH or LD_LIBRARY_PATH in Linux to contain library required for the test case. - 2. migrate_test(): Migration command for each test case. - 3. build_test(): Compile and link command for each test case. - 4. run_test(): Run the test cases in the test suite. + 1. setup_test(single_case_text): Setup the execution environment. eg. setup CPATH or LD_LIBRARY_PATH in Linux to contain library required for the test case. + 2. migrate_test(single_case_text): Migration command for each test case. + 3. build_test(single_case_text): Compile and link command for each test case. + 4. run_test(single_case_text): Run the test cases in the test suite. # Add or modify test case diff --git a/api_coverage/test_api_coverage.py b/api_coverage/test_api_coverage.py index d5f0bfcb7..d513db3c0 100644 --- a/api_coverage/test_api_coverage.py +++ b/api_coverage/test_api_coverage.py @@ -15,37 +15,37 @@ from test_utils import * -def setup_test(): +def setup_test(single_case_text): return True -def migrate_test(): +def migrate_test(single_case_text): src = [] extra_args = [] - in_root = os.path.join(os.getcwd(), test_config.current_test) - test_config.out_root = os.path.join(in_root, 'out_root') + in_root = os.path.join(os.getcwd(), single_case_text.name) + single_case_text.out_root = os.path.join(in_root, 'out_root') for dirpath, dirnames, filenames in os.walk(in_root): for filename in [f for f in filenames if re.match('.*(cu|cpp|c)$', f)]: src.append(os.path.abspath(os.path.join(dirpath, filename))) - return do_migrate(src, in_root, test_config.out_root, extra_args) + return do_migrate(src, in_root, single_case_text.out_root, single_case_text, extra_args) -def build_test(): - if (os.path.exists(test_config.current_test)): - os.chdir(test_config.current_test) +def build_test(single_case_text): + if (os.path.exists(single_case_text.name)): + os.chdir(single_case_text.name) srcs = [] cmp_opts = '' link_opts = '' objects = '' - for dirpath, dirnames, filenames in os.walk(test_config.out_root): + for dirpath, dirnames, filenames in os.walk(single_case_text.out_root): for filename in [f for f in filenames if re.match('.*(cpp|c)$', f)]: srcs.append(os.path.abspath(os.path.join(dirpath, filename))) ret = False - ret = compile_files(srcs, cmp_opts) + ret = compile_files(srcs, single_case_text, cmp_opts) return ret -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/array_size_fold/do_test.py b/behavior_tests/src/array_size_fold/do_test.py index d6967e877..9582e46d8 100644 --- a/behavior_tests/src/array_size_fold/do_test.py +++ b/behavior_tests/src/array_size_fold/do_test.py @@ -14,14 +14,14 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): call_subprocess( - test_config.CT_TOOL + " test.cu --out-root=out --cuda-include-path=" + test_config.include_path) + single_case_text.CT_TOOL + " test.cu --out-root=out --cuda-include-path=" + single_case_text.include_path, single_case_text) with open(os.path.join("out", "test.dp.cpp"), 'r') as f: ret_str = f.read() @@ -37,9 +37,9 @@ def migrate_test(): return res -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/bad_input_1/do_test.py b/behavior_tests/src/bad_input_1/do_test.py index 18ce0f583..807b66b01 100644 --- a/behavior_tests/src/bad_input_1/do_test.py +++ b/behavior_tests/src/bad_input_1/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " " + - os.path.join("cuda", "migrate_nonbuilding_code.cu")) - return is_sub_string("unknown type name", test_config.command_output) -def build_test(): + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " " + + os.path.join("cuda", "migrate_nonbuilding_code.cu"), single_case_text) + return is_sub_string("unknown type name", single_case_text.print_text) +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-analysis-scope-path1/do_test.py b/behavior_tests/src/bt-analysis-scope-path1/do_test.py index 1d1e52290..465635a1b 100644 --- a/behavior_tests/src/bt-analysis-scope-path1/do_test.py +++ b/behavior_tests/src/bt-analysis-scope-path1/do_test.py @@ -15,27 +15,27 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): # clean previous migration output if (os.path.exists("out")): shutil.rmtree("out") - migrate_cmd = test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " " + os.path.join( + migrate_cmd = single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " " + os.path.join( "cuda", "call_device_func_outside.cu") + " --in-root=cuda" + " --out-root=out" # migrate with implicit --analysis-scope-path which defaults to --in-root - call_subprocess(migrate_cmd) + call_subprocess(migrate_cmd, single_case_text) if (not os.path.exists( os.path.join("out", "call_device_func_outside.dp.cpp"))): return False shutil.rmtree("out") # migrate with specified --analysis-scope-path which equals --in-root - call_subprocess(migrate_cmd + " --analysis-scope-path=cuda") + call_subprocess(migrate_cmd + " --analysis-scope-path=cuda", single_case_text) if (not os.path.exists( os.path.join("out", "call_device_func_outside.dp.cpp"))): return False @@ -43,16 +43,16 @@ def migrate_test(): # migrate with specified --analysis-scope-path which is the parent of --in-root call_subprocess(migrate_cmd + " --analysis-scope-path=" + - os.path.join("cuda", "..")) + os.path.join("cuda", ".."), single_case_text) if (not os.path.exists( os.path.join("out", "call_device_func_outside.dp.cpp"))): return False return True -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-analysis-scope-path2/do_test.py b/behavior_tests/src/bt-analysis-scope-path2/do_test.py index 6a43f99c4..cfb59adb8 100644 --- a/behavior_tests/src/bt-analysis-scope-path2/do_test.py +++ b/behavior_tests/src/bt-analysis-scope-path2/do_test.py @@ -15,47 +15,47 @@ from test_utils import * -def setup_test(): - cur_dir = os.path.join(os.getcwd(), test_config.current_test) +def setup_test(single_case_text): + cur_dir = os.path.join(os.getcwd(), single_case_text.name) if platform.system() == 'Windows': # windows current working directory might start with lowercased drive(e.g., "d:\path") in some cases # so make the drive symbol in cwd to be upper explicitly to avoid inconsistent paths. if cur_dir[1] == ":" and cur_dir[0].islower(): cur_dir = cur_dir[0].upper() + cur_dir[1:] - change_dir(cur_dir) + change_dir(cur_dir, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): # clean previous migration output if (os.path.exists("out")): shutil.rmtree("out") - migrate_cmd = test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " " + os.path.join( + migrate_cmd = single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " " + os.path.join( "cuda", "call_device_func_outside.cu") + " --in-root=cuda" + " --out-root=out" # migrate with implicit --analysis-scope-path which defaults to --in-root - call_subprocess(migrate_cmd) + call_subprocess(migrate_cmd, single_case_text) if (not os.path.exists( os.path.join("out", "call_device_func_outside.dp.cpp"))): return False # expect incremental migration with specified --analysis-scope-path which equals --in-root - call_subprocess(migrate_cmd + " --analysis-scope-path=cuda") + call_subprocess(migrate_cmd + " --analysis-scope-path=cuda", single_case_text) if (not os.path.exists( os.path.join("out", "call_device_func_outside.dp.cpp"))): return False # not expect incremental migration with specified --analysis-scope-path which is the parent of --in-root call_subprocess(migrate_cmd + " --analysis-scope-path=" + - os.path.join("cuda", "..")) + os.path.join("cuda", ".."), single_case_text) return is_sub_string( f"use the same option set as in previous migration: \"--analysis-scope-path=", - test_config.command_output) + single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-analysis-scope-path3/do_test.py b/behavior_tests/src/bt-analysis-scope-path3/do_test.py index f11102f91..deba98862 100644 --- a/behavior_tests/src/bt-analysis-scope-path3/do_test.py +++ b/behavior_tests/src/bt-analysis-scope-path3/do_test.py @@ -16,21 +16,21 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): # clean previous migration output if (os.path.exists("out")): shutil.rmtree("out") - migrate_cmd = test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " " + os.path.join( + migrate_cmd = single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " " + os.path.join( "cuda", "call_device_func_outside.cu") + " --in-root=cuda" + " --out-root=out" call_subprocess(migrate_cmd + " --analysis-scope-path=" + - os.path.join("cuda", "..")) + os.path.join("cuda", ".."), single_case_text) expected_files = [ os.path.join("out", "call_device_func_outside.dp.cpp"), ] @@ -54,9 +54,9 @@ def migrate_test(): return True -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-analysis-scope-path4/do_test.py b/behavior_tests/src/bt-analysis-scope-path4/do_test.py index cd5c9bf97..b1a53f846 100644 --- a/behavior_tests/src/bt-analysis-scope-path4/do_test.py +++ b/behavior_tests/src/bt-analysis-scope-path4/do_test.py @@ -16,33 +16,33 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) if os.path.exists("cuda_symlink"): os.unlink("cuda_symlink") os.symlink("cuda", "cuda_symlink") return True -def migrate_test(): +def migrate_test(single_case_text): # clean previous migration output if (os.path.exists("out")): shutil.rmtree("out") - migrate_cmd = test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " " + os.path.join( + migrate_cmd = single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " " + os.path.join( "cuda", "call_device_func_outside.cu") + " --in-root=cuda" + " --out-root=out" - call_subprocess(migrate_cmd + " --analysis-scope-path=cuda_symlink") + call_subprocess(migrate_cmd + " --analysis-scope-path=cuda_symlink", single_case_text) if (not os.path.exists( os.path.join("out", "call_device_func_outside.dp.cpp"))): return False return True -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-autocomplete/do_test.py b/behavior_tests/src/bt-autocomplete/do_test.py index f8ead03fa..9ca4bf31c 100644 --- a/behavior_tests/src/bt-autocomplete/do_test.py +++ b/behavior_tests/src/bt-autocomplete/do_test.py @@ -12,104 +12,104 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): res = True - call_subprocess(test_config.CT_TOOL + " --autocomplete=--gen-build") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=--gen-build", single_case_text) reference = '--gen-build-script\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=-gen-build") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=-gen-build", single_case_text) reference = '-gen-build-script\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=foo") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=foo", single_case_text) reference = '\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=--output-verbosity=#d") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=--output-verbosity=#d", single_case_text) reference = 'detailed\n' + \ 'diagnostics\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=-output-verbosity=#d") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=-output-verbosity=#d", single_case_text) reference = 'detailed\n' + \ 'diagnostics\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=--output-verbosity=") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=--output-verbosity=", single_case_text) reference = 'detailed\n' + \ 'diagnostics\n' + \ 'normal\n' + \ 'silent\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=-output-verbosity=") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=-output-verbosity=", single_case_text) reference = 'detailed\n' + \ 'diagnostics\n' + \ 'normal\n' + \ 'silent\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=foo#bar##--enable-c") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=foo#bar##--enable-c", single_case_text) reference = '--enable-ctad\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=foo#bar###--format-range=#a") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=foo#bar###--format-range=#a", single_case_text) reference = 'all\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=--rule-file=") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=--rule-file=", single_case_text) reference = '\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=--rule-file") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=--rule-file", single_case_text) reference = '--rule-file\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=-p=") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=-p=", single_case_text) reference = '\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=-p") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=-p", single_case_text) reference = '-p\n' + \ '-process-all\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=--usm-level=#none,restricted#--use-explicit-namespace=#cl,sycl,") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=--usm-level=#none,restricted#--use-explicit-namespace=#cl,sycl,", single_case_text) reference = 'cl,sycl,cl\n' + \ 'cl,sycl,dpct\n' + \ 'cl,sycl,none\n' + \ 'cl,sycl,sycl\n' + \ 'cl,sycl,sycl-math\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=--usm-level=#none,restricted#--use-explicit-namespace=#cl,sycl,s") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=--usm-level=#none,restricted#--use-explicit-namespace=#cl,sycl,s", single_case_text) reference = 'cl,sycl,sycl\n' + \ 'cl,sycl,sycl-math\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=", single_case_text) reference = '\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=,") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=,", single_case_text) reference = '\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete==") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete==", single_case_text) reference = '\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=,,") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=,,", single_case_text) reference = '\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=-") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=-", single_case_text) opts = ['--always-use-async-handler\n', '--analysis-scope-path\n', '--assume-nd-range-dim=\n', @@ -152,20 +152,20 @@ def migrate_test(): '--version\n', '-p\n'] for opt in opts: - res = res and (opt in test_config.command_output) + res = res and (opt in single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=##") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=##", single_case_text) reference = '\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) - call_subprocess(test_config.CT_TOOL + " --autocomplete=#") + call_subprocess(single_case_text.CT_TOOL + " --autocomplete=#", single_case_text) reference = '\n' - res = res and (reference == test_config.command_output) + res = res and (reference == single_case_text.print_text) return res -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-cdb-default-out-folder/do_test.py b/behavior_tests/src/bt-cdb-default-out-folder/do_test.py index 559c54ebb..a6ff16b22 100644 --- a/behavior_tests/src/bt-cdb-default-out-folder/do_test.py +++ b/behavior_tests/src/bt-cdb-default-out-folder/do_test.py @@ -10,23 +10,23 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess("intercept-build /usr/bin/make") +def migrate_test(single_case_text): + call_subprocess("intercept-build /usr/bin/make", single_case_text) in_root = "" extra_args = "" - return call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " " + - "-p .") + return call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " " + + "-p .", single_case_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/bt-check-c2s/do_test.py b/behavior_tests/src/bt-check-c2s/do_test.py index 05b4fed89..2d61d4575 100644 --- a/behavior_tests/src/bt-check-c2s/do_test.py +++ b/behavior_tests/src/bt-check-c2s/do_test.py @@ -14,11 +14,11 @@ from test_utils import * from hashlib import md5 -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): dpct_path = shutil.which("dpct") c2s_path = shutil.which("c2s") @@ -34,8 +34,8 @@ def migrate_test(): c2s_file.close() return c2s_md5 == dpct_md5 -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-check-conflict-insertion/do_test.py b/behavior_tests/src/bt-check-conflict-insertion/do_test.py index ee4be7d4a..d6dbdb0fd 100644 --- a/behavior_tests/src/bt-check-conflict-insertion/do_test.py +++ b/behavior_tests/src/bt-check-conflict-insertion/do_test.py @@ -10,23 +10,23 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess("intercept-build /usr/bin/make") +def migrate_test(single_case_text): + call_subprocess("intercept-build /usr/bin/make", single_case_text) in_root = "" extra_args = "" - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " " + - "-p .") + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " " + + "-p .", single_case_text) return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-check-install-files/do_test.py b/behavior_tests/src/bt-check-install-files/do_test.py index aab44191e..291ff7812 100644 --- a/behavior_tests/src/bt-check-install-files/do_test.py +++ b/behavior_tests/src/bt-check-install-files/do_test.py @@ -14,11 +14,11 @@ from test_utils import * from hashlib import md5 -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): install_root = os.path.join(os.path.dirname(shutil.which("dpct")), '..') res = True @@ -35,9 +35,9 @@ def migrate_test(): return res -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/bt-check-unexpected-message/do_test.py b/behavior_tests/src/bt-check-unexpected-message/do_test.py index 4f43a3fcd..69c374089 100644 --- a/behavior_tests/src/bt-check-unexpected-message/do_test.py +++ b/behavior_tests/src/bt-check-unexpected-message/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " test.cu --out-root=out --cuda-include-path=" + test_config.include_path + " --extra-arg=-xc++") - return not is_sub_string("warning: '-x c' after last input file has no effect [-Wunused-command-line-argument]", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " test.cu --out-root=out --cuda-include-path=" + single_case_text.include_path + " --extra-arg=-xc++", single_case_text) + return not is_sub_string("warning: '-x c' after last input file has no effect [-Wunused-command-line-argument]", single_case_text.print_text) -def build_test(): - return call_subprocess("icpx -fsycl out/test.dp.cpp") +def build_test(single_case_text): + return call_subprocess("icpx -fsycl out/test.dp.cpp", single_case_text) -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-check-warning1083/do_test.py b/behavior_tests/src/bt-check-warning1083/do_test.py index 2b1f8f1cd..f48cc4ac1 100644 --- a/behavior_tests/src/bt-check-warning1083/do_test.py +++ b/behavior_tests/src/bt-check-warning1083/do_test.py @@ -13,25 +13,25 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): ret_file = "" - call_subprocess(test_config.CT_TOOL + " test.cu --out-root=out --cuda-include-path=" + test_config.include_path) + call_subprocess(single_case_text.CT_TOOL + " test.cu --out-root=out --cuda-include-path=" + single_case_text.include_path, single_case_text) ret = "" with open(os.path.join("out", "test.dp.cpp"), 'r') as f: ret = f.read() if not is_sub_string("1083", ret): return False - change_dir("out") + change_dir("out", single_case_text) return True -def build_test(): +def build_test(single_case_text): src_files = ["test.dp.cpp"] - return compile_files(src_files) + return compile_files(src_files, single_case_text) -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-comments/do_test.py b/behavior_tests/src/bt-comments/do_test.py index 5b8168508..b0dfb5982 100644 --- a/behavior_tests/src/bt-comments/do_test.py +++ b/behavior_tests/src/bt-comments/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): ret_file = "" - call_subprocess(test_config.CT_TOOL + " --comments comments.cu --out-root=out --cuda-include-path=" + test_config.include_path) + call_subprocess(single_case_text.CT_TOOL + " --comments comments.cu --out-root=out --cuda-include-path=" + single_case_text.include_path, single_case_text) with open(os.path.join("out", "comments.dp.cpp"), 'r') as f: ret_file = f.read() return is_sub_string("//", ret_file) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-ct-default-out-folder/do_test.py b/behavior_tests/src/bt-ct-default-out-folder/do_test.py index 187d0c256..03332a7e5 100644 --- a/behavior_tests/src/bt-ct-default-out-folder/do_test.py +++ b/behavior_tests/src/bt-ct-default-out-folder/do_test.py @@ -13,26 +13,26 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): src = ["hello.cu", "hello2.cu"] in_root = "" extra_args = "" out_root_path = "out" - do_migrate(src, in_root, out_root_path, extra_args) + do_migrate(src, in_root, out_root_path, single_case_text, extra_args) if os.path.exists(os.path.join("out", "hello.dp.cpp")): return True return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/bt-empty-cdb-default-out-folder/do_test.py b/behavior_tests/src/bt-empty-cdb-default-out-folder/do_test.py index 3aa8b13e1..865d5e0ef 100644 --- a/behavior_tests/src/bt-empty-cdb-default-out-folder/do_test.py +++ b/behavior_tests/src/bt-empty-cdb-default-out-folder/do_test.py @@ -10,18 +10,18 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " -p=./ --cuda-include-path=" + test_config.include_path) - return is_sub_string("Migration not necessary; no CUDA code detected", test_config.command_output) -def build_test(): +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " -p=./ --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Migration not necessary; no CUDA code detected", single_case_text.print_text) +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-extra-arg-comma-separate/do_test.py b/behavior_tests/src/bt-extra-arg-comma-separate/do_test.py index 637502091..14e9ae4e6 100644 --- a/behavior_tests/src/bt-extra-arg-comma-separate/do_test.py +++ b/behavior_tests/src/bt-extra-arg-comma-separate/do_test.py @@ -10,21 +10,21 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - return call_subprocess(test_config.CT_TOOL + " --extra-arg=-I\"" + os.path.dirname(__file__) + +def migrate_test(single_case_text): + return call_subprocess(single_case_text.CT_TOOL + " --extra-arg=-I\"" + os.path.dirname(__file__) + "/header1 "+",-I" + os.path.dirname(__file__) + "/header2\"" + - " --cuda-include-path=" + test_config.include_path + " test.cu") + " --cuda-include-path=" + single_case_text.include_path + " test.cu", single_case_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-extra-arg/do_test.py b/behavior_tests/src/bt-extra-arg/do_test.py index 08a69828f..9918d68ee 100644 --- a/behavior_tests/src/bt-extra-arg/do_test.py +++ b/behavior_tests/src/bt-extra-arg/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - return (call_subprocess(test_config.CT_TOOL + " --extra-arg=\"--cuda-path=" + test_config.include_path + "\" vector_add.cu") - and is_sub_string("Parsing", test_config.command_output) - and is_sub_string("Analyzing", test_config.command_output) - and is_sub_string("Migrating", test_config.command_output)) +def migrate_test(single_case_text): + return (call_subprocess(single_case_text.CT_TOOL + " --extra-arg=\"--cuda-path=" + single_case_text.include_path + "\" vector_add.cu", single_case_text) + and is_sub_string("Parsing", single_case_text.print_text) + and is_sub_string("Analyzing", single_case_text.print_text) + and is_sub_string("Migrating", single_case_text.print_text)) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/bt-format-range/do_test.py b/behavior_tests/src/bt-format-range/do_test.py index 7ee48926c..16d0a6697 100644 --- a/behavior_tests/src/bt-format-range/do_test.py +++ b/behavior_tests/src/bt-format-range/do_test.py @@ -13,18 +13,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): os.mkdir("out_migrated") os.mkdir("out_all") os.mkdir("out_none") - call_subprocess(test_config.CT_TOOL + " --format-range=migrated --out-root=./out_migrated vector_add.cu --cuda-include-path=" + test_config.include_path) - call_subprocess(test_config.CT_TOOL + " --format-range=all --out-root=./out_all vector_add.cu --cuda-include-path=" + test_config.include_path) - call_subprocess(test_config.CT_TOOL + " -format-range=none --out-root=./out_none vector_add.cu --cuda-include-path=" + test_config.include_path) + call_subprocess(single_case_text.CT_TOOL + " --format-range=migrated --out-root=./out_migrated vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) + call_subprocess(single_case_text.CT_TOOL + " --format-range=all --out-root=./out_all vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) + call_subprocess(single_case_text.CT_TOOL + " -format-range=none --out-root=./out_none vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) ret = is_sub_string(";\/\/ variable declearation", "./out_llvm/vector_add.dp.cpp") ret = is_sub_string(";\/\/ allocate device memory", "./out_google/vector_add.dp.cpp") or ret @@ -33,8 +33,8 @@ def migrate_test(): ret = is_sub_string("; // variable declearation", "./out_custom/vector_add.dp.cpp") or ret ret = is_sub_string("; // allocate device memory", "./out_custom/vector_add.dp.cpp") or ret return not ret -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/bt-format-style/do_test.py b/behavior_tests/src/bt-format-style/do_test.py index 70ebd3852..a0fb258a9 100644 --- a/behavior_tests/src/bt-format-style/do_test.py +++ b/behavior_tests/src/bt-format-style/do_test.py @@ -13,17 +13,17 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): os.mkdir("out_custom") os.mkdir("out_llvm") os.mkdir("out_google") - call_subprocess(test_config.CT_TOOL + " --format-style=custom --out-root=./out_custom vector_add.cu --cuda-include-path=" + test_config.include_path) - call_subprocess(test_config.CT_TOOL + " --format-style=llvm --out-root=./out_llvm vector_add.cu --cuda-include-path=" + test_config.include_path) - call_subprocess(test_config.CT_TOOL + " --format-style=google --out-root=./out_google vector_add.cu --cuda-include-path=" + test_config.include_path) + call_subprocess(single_case_text.CT_TOOL + " --format-style=custom --out-root=./out_custom vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) + call_subprocess(single_case_text.CT_TOOL + " --format-style=llvm --out-root=./out_llvm vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) + call_subprocess(single_case_text.CT_TOOL + " --format-style=google --out-root=./out_google vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) ret = False with open(os.path.join("out_llvm", "vector_add.dp.cpp")) as f: file_str = f.read() @@ -38,8 +38,8 @@ def migrate_test(): ret = is_sub_string("; //", file_str) or ret return ret -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/bt-gen-helper-function/do_test.py b/behavior_tests/src/bt-gen-helper-function/do_test.py index 71f3fdbb6..eae2118a8 100644 --- a/behavior_tests/src/bt-gen-helper-function/do_test.py +++ b/behavior_tests/src/bt-gen-helper-function/do_test.py @@ -14,13 +14,13 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): ret_file = "" - ret = call_subprocess(test_config.CT_TOOL + " --gen-helper-function --out-root=out") + ret = call_subprocess(single_case_text.CT_TOOL + " --gen-helper-function --out-root=out", single_case_text) installed_header_file_root = os.path.join(os.path.dirname(get_ct_path()), "..", "include", "dpct") generated_header_file_root = os.path.join(os.getcwd(), "out", "include", "dpct") @@ -35,8 +35,8 @@ def migrate_test(): return False return True -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/bt-help/do_test.py b/behavior_tests/src/bt-help/do_test.py index b0a047c11..d387960ff 100644 --- a/behavior_tests/src/bt-help/do_test.py +++ b/behavior_tests/src/bt-help/do_test.py @@ -13,17 +13,17 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL +" --help") - return is_sub_string("USAGE", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL +" --help", single_case_text) + return is_sub_string("USAGE", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-in-root-empty-process-all/do_test.py b/behavior_tests/src/bt-in-root-empty-process-all/do_test.py index c66dae6b8..7404c9bf8 100644 --- a/behavior_tests/src/bt-in-root-empty-process-all/do_test.py +++ b/behavior_tests/src/bt-in-root-empty-process-all/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --process-all --cuda-include-path=" + test_config.include_path + " --in-root=") - return is_sub_string("Error: The option --process-all requires that the --in-root be specified explicitly", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --process-all --cuda-include-path=" + single_case_text.include_path + " --in-root=", single_case_text) + return is_sub_string("Error: The option --process-all requires that the --in-root be specified explicitly", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-invalid-cuda-version/do_test.py b/behavior_tests/src/bt-invalid-cuda-version/do_test.py index 1c3567109..11c6c59b1 100644 --- a/behavior_tests/src/bt-invalid-cuda-version/do_test.py +++ b/behavior_tests/src/bt-invalid-cuda-version/do_test.py @@ -13,18 +13,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): include_path = os.path.join(os.getcwd(), "include") in_root = os.getcwd() test_case_path = os.path.join(in_root, "vector_add.cu") - call_subprocess(test_config.CT_TOOL + " " + test_case_path + " --out-root=out --in-root=" + in_root + " --cuda-include-path=" + include_path) - return is_sub_string("Error: The version of CUDA header files specified by --cuda-include-path is not supported. See Release Notes for supported versions.", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " " + test_case_path + " --out-root=out --in-root=" + in_root + " --cuda-include-path=" + include_path, single_case_text) + return is_sub_string("Error: The version of CUDA header files specified by --cuda-include-path is not supported. See Release Notes for supported versions.", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-kernel-function-limitation/do_test.py b/behavior_tests/src/bt-kernel-function-limitation/do_test.py index 451b49016..94757dda0 100644 --- a/behavior_tests/src/bt-kernel-function-limitation/do_test.py +++ b/behavior_tests/src/bt-kernel-function-limitation/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --optimize-migration --out-root=./out kernel-func.cu --cuda-include-path=" + test_config.include_path) + call_subprocess(single_case_text.CT_TOOL + " --optimize-migration --out-root=./out kernel-func.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) - ret = is_sub_string("Recursive functions cannot be called in SYCL device code", test_config.command_output) - ret = is_sub_string("Virtual functions cannot be called in SYCL device code", test_config.command_output) and ret + ret = is_sub_string("Recursive functions cannot be called in SYCL device code", single_case_text.print_text) + ret = is_sub_string("Virtual functions cannot be called in SYCL device code", single_case_text.print_text) and ret return ret -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/bt-language-warning/do_test.py b/behavior_tests/src/bt-language-warning/do_test.py index e673cecd9..c1f55c5b0 100644 --- a/behavior_tests/src/bt-language-warning/do_test.py +++ b/behavior_tests/src/bt-language-warning/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " test.cpp --out-root=out --cuda-include-path=" + test_config.include_path) - return is_sub_string("NOTE: test.cpp is treated as a CUDA file by default. Use the --extra-arg=-xc++ option to treat test.cpp as a C++ file if needed.", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " test.cpp --out-root=out --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("NOTE: test.cpp is treated as a CUDA file by default. Use the --extra-arg=-xc++ option to treat test.cpp as a C++ file if needed.", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-modified-yaml/do_test.py b/behavior_tests/src/bt-modified-yaml/do_test.py index 2a4aa51b3..d7d825700 100644 --- a/behavior_tests/src/bt-modified-yaml/do_test.py +++ b/behavior_tests/src/bt-modified-yaml/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): yml_file = os.path.join("out", "test.h.yaml") test_file = os.path.join("out", "test.h") ret_str = "" ret = [] - call_subprocess(test_config.CT_TOOL + " test.cu --out-root=out --extra-arg=\"-xc\" --cuda-include-path=" + test_config.include_path) + call_subprocess(single_case_text.CT_TOOL + " test.cu --out-root=out --extra-arg=\"-xc\" --cuda-include-path=" + single_case_text.include_path, single_case_text) if not os.path.exists(yml_file): return False with open(yml_file, 'r') as f: @@ -32,14 +32,14 @@ def migrate_test(): ret.append(line) with open(yml_file, 'w') as f: f.writelines(ret) - call_subprocess(test_config.CT_TOOL + " test.cu --out-root=out --extra-arg=\"-xcuda\" --cuda-include-path=" + test_config.include_path) + call_subprocess(single_case_text.CT_TOOL + " test.cu --out-root=out --extra-arg=\"-xcuda\" --cuda-include-path=" + single_case_text.include_path, single_case_text) with open(test_file, 'r') as f: ret_str = f.read() if ret_str.count("DPCT1056") == 1: return True return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-multi-cuda-inc-path/do_test.py b/behavior_tests/src/bt-multi-cuda-inc-path/do_test.py index 159b67b02..ef223c995 100644 --- a/behavior_tests/src/bt-multi-cuda-inc-path/do_test.py +++ b/behavior_tests/src/bt-multi-cuda-inc-path/do_test.py @@ -12,18 +12,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) - call_subprocess("cp -r --dereference " + test_config.include_path + " + .") - change_dir("src") +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) + call_subprocess("cp -r --dereference " + single_case_text.include_path + " + .", single_case_text) + change_dir("src", single_case_text) return True -def migrate_test(): - command = test_config.CT_TOOL + " --out-root out test.cu --cuda-include-path ../include --extra-arg=\"-I" + test_config.include_path + "\"" +def migrate_test(single_case_text): + command = single_case_text.CT_TOOL + " --out-root out test.cu --cuda-include-path ../include --extra-arg=\"-I" + single_case_text.include_path + "\"" print(command) - return call_subprocess(command) + return call_subprocess(command, single_case_text) -def build_test(): - return call_subprocess("icpx -fsycl out/test.dp.cpp") -def run_test(): +def build_test(single_case_text): + return call_subprocess("icpx -fsycl out/test.dp.cpp", single_case_text) +def run_test(single_case_text): return True diff --git a/behavior_tests/src/bt-output/do_test.py b/behavior_tests/src/bt-output/do_test.py index f6c2a316f..cb3d8747b 100644 --- a/behavior_tests/src/bt-output/do_test.py +++ b/behavior_tests/src/bt-output/do_test.py @@ -13,15 +13,15 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - return call_subprocess(test_config.CT_TOOL + " hello.cu hello2.cu --cuda-include-path=" + test_config.include_path + " > output.txt") +def migrate_test(single_case_text): + return call_subprocess(single_case_text.CT_TOOL + " hello.cu hello2.cu --cuda-include-path=" + single_case_text.include_path + " > output.txt", single_case_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-report-only/do_test.py b/behavior_tests/src/bt-report-only/do_test.py index 82c4ab2fd..6c51323b6 100644 --- a/behavior_tests/src/bt-report-only/do_test.py +++ b/behavior_tests/src/bt-report-only/do_test.py @@ -13,18 +13,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " --report-only vector_add.cu --out-root=out --cuda-include-path=" + test_config.include_path) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " --report-only vector_add.cu --out-root=out --cuda-include-path=" + single_case_text.include_path, single_case_text) if os.path.exists("out"): return False return True -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-stop-on-parse-err/do_test.py b/behavior_tests/src/bt-stop-on-parse-err/do_test.py index 4e263b1fd..5b314bc6f 100644 --- a/behavior_tests/src/bt-stop-on-parse-err/do_test.py +++ b/behavior_tests/src/bt-stop-on-parse-err/do_test.py @@ -14,18 +14,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --stop-on-parse-err vector_add.cu --out-root=out --cuda-include-path=" + test_config.include_path) + call_subprocess(single_case_text.CT_TOOL + " --stop-on-parse-err vector_add.cu --out-root=out --cuda-include-path=" + single_case_text.include_path, single_case_text) if os.path.exists(os.path.join("out", "vector_add.dp.cpp")): return False return True -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-suppress-warnings-all/do_test.py b/behavior_tests/src/bt-suppress-warnings-all/do_test.py index c4274092c..1fee42b0d 100644 --- a/behavior_tests/src/bt-suppress-warnings-all/do_test.py +++ b/behavior_tests/src/bt-suppress-warnings-all/do_test.py @@ -13,15 +13,15 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " --suppress-warnings-all vector_add.cu --cuda-include-path=" + test_config.include_path) - return not is_sub_string("DPCT1015", test_config.command_output) -def build_test(): +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " --suppress-warnings-all vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) + return not is_sub_string("DPCT1015", single_case_text.print_text) +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-suppress-warnings/do_test.py b/behavior_tests/src/bt-suppress-warnings/do_test.py index f8f81573a..8145f9267 100644 --- a/behavior_tests/src/bt-suppress-warnings/do_test.py +++ b/behavior_tests/src/bt-suppress-warnings/do_test.py @@ -13,15 +13,15 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " hello.cu --suppress-warnings=1000-1003,1008 --cuda-include-path=" + test_config.include_path) - return not is_sub_string("warning: DPCT10", test_config.command_output) -def build_test(): +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " hello.cu --suppress-warnings=1000-1003,1008 --cuda-include-path=" + single_case_text.include_path, single_case_text) + return not is_sub_string("warning: DPCT10", single_case_text.print_text) +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-tilde-path/do_test.py b/behavior_tests/src/bt-tilde-path/do_test.py index 450a022f3..a6ec1a0b4 100644 --- a/behavior_tests/src/bt-tilde-path/do_test.py +++ b/behavior_tests/src/bt-tilde-path/do_test.py @@ -15,23 +15,23 @@ from test_utils import * user_root_path = "" old_tilde = "" -def setup_test(): +def setup_test(single_case_text): global old_tilde - change_dir(test_config.current_test) + change_dir(single_case_text.name, single_case_text) old_tilde = os.path.expanduser("~") os.environ["HOME"] = "/tmp" return True -def migrate_test(): +def migrate_test(single_case_text): global user_root_path user_root_path = os.path.expanduser("~") + "/workspace" if os.path.exists(user_root_path): shutil.rmtree(user_root_path) os.makedirs(user_root_path) - distutils.dir_util.copy_tree(test_config.include_path + "/..", user_root_path) - return call_subprocess("dpct vector_add.cu --cuda-include-path=" + "~/workspace/include") + distutils.dir_util.copy_tree(single_case_text.include_path + "/..", user_root_path) + return call_subprocess("dpct vector_add.cu --cuda-include-path=" + "~/workspace/include", single_case_text) -def build_test(): +def build_test(single_case_text): global old_tilde global user_root_path if os.path.exists(user_root_path): @@ -39,5 +39,5 @@ def build_test(): os.environ["HOME"] = old_tilde return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-unsupported-type-function/do_test.py b/behavior_tests/src/bt-unsupported-type-function/do_test.py index 5f9c442a2..c578f65e5 100644 --- a/behavior_tests/src/bt-unsupported-type-function/do_test.py +++ b/behavior_tests/src/bt-unsupported-type-function/do_test.py @@ -13,13 +13,13 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): migrated_file = os.path.join("out_nvml", "test.dp.cpp") - call_subprocess(test_config.CT_TOOL + " test.cu --out-root=./out_nvml --cuda-include-path=" + test_config.include_path) + call_subprocess(single_case_text.CT_TOOL + " test.cu --out-root=./out_nvml --cuda-include-path=" + single_case_text.include_path, single_case_text) warn_1007_count = 0 warn_1082_count = 0 with open(migrated_file, "r") as f: @@ -32,8 +32,8 @@ def migrate_test(): if warn_1007_count == 5 and warn_1082_count == 19: return True return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-use-explicit-namespace1/do_test.py b/behavior_tests/src/bt-use-explicit-namespace1/do_test.py index 48f621c40..c8dede324 100644 --- a/behavior_tests/src/bt-use-explicit-namespace1/do_test.py +++ b/behavior_tests/src/bt-use-explicit-namespace1/do_test.py @@ -13,20 +13,20 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " --use-explicit-namespace=none --out-root=./sycl vector_add.cu --cuda-include-path=" + test_config.include_path) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " --use-explicit-namespace=none --out-root=./sycl vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) return True -def build_test(): +def build_test(single_case_text): srcs = [] srcs.append(os.path.join("sycl", "vector_add.dp.cpp")) - return compile_and_link(srcs) + return compile_and_link(srcs, single_case_text) -def run_test(): - os.environ["ONEAPI_DEVICE_SELECTOR"] = test_config.device_filter - return run_binary_with_args() +def run_test(single_case_text): + os.environ["ONEAPI_DEVICE_SELECTOR"] = single_case_text.device_filter + return run_binary_with_args(single_case_text) \ No newline at end of file diff --git a/behavior_tests/src/bt-use-explicit-namespace2/do_test.py b/behavior_tests/src/bt-use-explicit-namespace2/do_test.py index c0cec7a91..c3094fbce 100644 --- a/behavior_tests/src/bt-use-explicit-namespace2/do_test.py +++ b/behavior_tests/src/bt-use-explicit-namespace2/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - ret = call_subprocess(test_config.CT_TOOL + " --use-explicit-namespace=dpct --out-root=./sycl vector_add.cu --cuda-include-path=" + test_config.include_path) +def migrate_test(single_case_text): + ret = call_subprocess(single_case_text.CT_TOOL + " --use-explicit-namespace=dpct --out-root=./sycl vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) return ret -def build_test(): +def build_test(single_case_text): srcs = [] srcs.append(os.path.join("sycl", "vector_add.dp.cpp")) - return compile_and_link(srcs) + return compile_and_link(srcs, single_case_text) -def run_test(): - os.environ["ONEAPI_DEVICE_SELECTOR"] = test_config.device_filter - return run_binary_with_args() \ No newline at end of file +def run_test(single_case_text): + os.environ["ONEAPI_DEVICE_SELECTOR"] = single_case_text.device_filter + return run_binary_with_args(single_case_text) \ No newline at end of file diff --git a/behavior_tests/src/bt-use-explicit-namespace3/do_test.py b/behavior_tests/src/bt-use-explicit-namespace3/do_test.py index 2ed5dbb6b..cdc503532 100644 --- a/behavior_tests/src/bt-use-explicit-namespace3/do_test.py +++ b/behavior_tests/src/bt-use-explicit-namespace3/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - ret = call_subprocess(test_config.CT_TOOL + " --use-explicit-namespace=sycl-math --out-root=./sycl vector_add.cu --cuda-include-path=" + test_config.include_path) +def migrate_test(single_case_text): + ret = call_subprocess(single_case_text.CT_TOOL + " --use-explicit-namespace=sycl-math --out-root=./sycl vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) return ret -def build_test(): +def build_test(single_case_text): srcs = [] srcs.append(os.path.join("sycl", "vector_add.dp.cpp")) - return compile_and_link(srcs) + return compile_and_link(srcs, single_case_text) -def run_test(): - os.environ["ONEAPI_DEVICE_SELECTOR"] = test_config.device_filter - return run_binary_with_args() \ No newline at end of file +def run_test(single_case_text): + os.environ["ONEAPI_DEVICE_SELECTOR"] = single_case_text.device_filter + return run_binary_with_args(single_case_text) \ No newline at end of file diff --git a/behavior_tests/src/bt-use-explicit-namespace4/do_test.py b/behavior_tests/src/bt-use-explicit-namespace4/do_test.py index 73f88d467..eb7698931 100644 --- a/behavior_tests/src/bt-use-explicit-namespace4/do_test.py +++ b/behavior_tests/src/bt-use-explicit-namespace4/do_test.py @@ -13,15 +13,15 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - ret = call_subprocess(test_config.CT_TOOL + " --use-explicit-namespace=cl --out-root=./sycl vector_add.cu --cuda-include-path=" + test_config.include_path) +def migrate_test(single_case_text): + ret = call_subprocess(single_case_text.CT_TOOL + " --use-explicit-namespace=cl --out-root=./sycl vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) return ret -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/bt-use-explicit-namespace5/do_test.py b/behavior_tests/src/bt-use-explicit-namespace5/do_test.py index 182cee8be..74a5c4b56 100644 --- a/behavior_tests/src/bt-use-explicit-namespace5/do_test.py +++ b/behavior_tests/src/bt-use-explicit-namespace5/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - ret = call_subprocess(test_config.CT_TOOL + " --use-explicit-namespace=sycl --out-root=./sycl vector_add.cu --cuda-include-path=" + test_config.include_path) +def migrate_test(single_case_text): + ret = call_subprocess(single_case_text.CT_TOOL + " --use-explicit-namespace=sycl --out-root=./sycl vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) return ret -def build_test(): +def build_test(single_case_text): srcs = [] srcs.append(os.path.join("sycl", "vector_add.dp.cpp")) - return compile_and_link(srcs) + return compile_and_link(srcs, single_case_text) -def run_test(): - os.environ["ONEAPI_DEVICE_SELECTOR"] = test_config.device_filter - return run_binary_with_args() +def run_test(single_case_text): + os.environ["ONEAPI_DEVICE_SELECTOR"] = single_case_text.device_filter + return run_binary_with_args(single_case_text) diff --git a/behavior_tests/src/bt-use-explicit-namespace6/do_test.py b/behavior_tests/src/bt-use-explicit-namespace6/do_test.py index 71e79ac04..5f76f5ed1 100644 --- a/behavior_tests/src/bt-use-explicit-namespace6/do_test.py +++ b/behavior_tests/src/bt-use-explicit-namespace6/do_test.py @@ -13,18 +13,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - ret = call_subprocess(test_config.CT_TOOL + " --use-explicit-namespace=sycl-math,dpct --out-root=./sycl vector_add.cu --cuda-include-path=" + test_config.include_path) +def migrate_test(single_case_text): + ret = call_subprocess(single_case_text.CT_TOOL + " --use-explicit-namespace=sycl-math,dpct --out-root=./sycl vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) return ret -def build_test(): +def build_test(single_case_text): srcs = [] srcs.append(os.path.join("sycl", "vector_add.dp.cpp")) - return compile_and_link(srcs) + return compile_and_link(srcs, single_case_text) -def run_test(): - os.environ["ONEAPI_DEVICE_SELECTOR"] = test_config.device_filter - return run_binary_with_args() +def run_test(single_case_text): + os.environ["ONEAPI_DEVICE_SELECTOR"] = single_case_text.device_filter + return run_binary_with_args(single_case_text) diff --git a/behavior_tests/src/bt-version/do_test.py b/behavior_tests/src/bt-version/do_test.py index 63f3ac1ae..53583317d 100644 --- a/behavior_tests/src/bt-version/do_test.py +++ b/behavior_tests/src/bt-version/do_test.py @@ -13,20 +13,20 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " --version") +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " --version", single_case_text) ct_clang_version = get_ct_clang_version() expected_output = "dpct version {0}".format(ct_clang_version) print("expected dpct version output: {0}".format(expected_output)) - print("\n'dpct --version' outputs {0}".format(test_config.command_output)) - return is_sub_string(expected_output, test_config.command_output) + print("\n'dpct --version' outputs {0}".format(single_case_text.print_text)) + return is_sub_string(expected_output, single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-yaml-with-different-ct-version/do_test.py b/behavior_tests/src/bt-yaml-with-different-ct-version/do_test.py index 90f8c08ee..985dc3683 100644 --- a/behavior_tests/src/bt-yaml-with-different-ct-version/do_test.py +++ b/behavior_tests/src/bt-yaml-with-different-ct-version/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " test.cu --out-root=out --cuda-include-path=" + test_config.include_path) - return is_sub_string("Incremental migration requires the same version of dpct. Migration continues with incremental migration disabled", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " test.cu --out-root=out --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Incremental migration requires the same version of dpct. Migration continues with incremental migration disabled", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-yaml-with-different-options1/do_test.py b/behavior_tests/src/bt-yaml-with-different-options1/do_test.py index 6b04f8faf..500bd1481 100644 --- a/behavior_tests/src/bt-yaml-with-different-options1/do_test.py +++ b/behavior_tests/src/bt-yaml-with-different-options1/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " test.cu --in-root . --out-root out --always-use-async-handler --assume-nd-range-dim=1 --comments --enable-ctad --no-dpcpp-extensions=enqueued_barriers --no-dry-pattern --process-all -p . --sycl-named-lambda --use-experimental-features=free-function-queries,nd_range_barrier --use-explicit-namespace=cl,dpct --usm-level=none --cuda-include-path=" + test_config.include_path) - call_subprocess(test_config.CT_TOOL + " test.cu --out-root out --cuda-include-path=" + test_config.include_path) - return is_sub_string("\"--analysis-scope-path=\"", test_config.command_output) and \ - is_sub_string("--always-use-async-handler --comments --compilation-database=\"", test_config.command_output) and \ - is_sub_string("--enable-ctad --use-experimental-features=free-function-queries,nd_range_barrier --use-explicit-namespace=cl,dpct --no-dpcpp-extensions=enqueued_barriers --assume-nd-range-dim=1 --no-dry-pattern --process-all --sycl-named-lambda --usm-level=none\".", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " test.cu --in-root . --out-root out --always-use-async-handler --assume-nd-range-dim=1 --comments --enable-ctad --no-dpcpp-extensions=enqueued_barriers --no-dry-pattern --process-all -p . --sycl-named-lambda --use-experimental-features=free-function-queries,nd_range_barrier --use-explicit-namespace=cl,dpct --usm-level=none --cuda-include-path=" + single_case_text.include_path, single_case_text) + call_subprocess(single_case_text.CT_TOOL + " test.cu --out-root out --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("\"--analysis-scope-path=\"", single_case_text.print_text) and \ + is_sub_string("--always-use-async-handler --comments --compilation-database=\"", single_case_text.print_text) and \ + is_sub_string("--enable-ctad --use-experimental-features=free-function-queries,nd_range_barrier --use-explicit-namespace=cl,dpct --no-dpcpp-extensions=enqueued_barriers --assume-nd-range-dim=1 --no-dry-pattern --process-all --sycl-named-lambda --usm-level=none\".", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-yaml-with-different-options2/do_test.py b/behavior_tests/src/bt-yaml-with-different-options2/do_test.py index 68cfe7139..780b629fb 100644 --- a/behavior_tests/src/bt-yaml-with-different-options2/do_test.py +++ b/behavior_tests/src/bt-yaml-with-different-options2/do_test.py @@ -13,17 +13,17 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " test.cu --out-root out --no-cl-namespace-inline --cuda-include-path=" + test_config.include_path) - call_subprocess(test_config.CT_TOOL + " test.cu --out-root out --cuda-include-path=" + test_config.include_path) - return is_sub_string("--no-cl-namespace-inline\".", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " test.cu --out-root out --no-cl-namespace-inline --cuda-include-path=" + single_case_text.include_path, single_case_text) + call_subprocess(single_case_text.CT_TOOL + " test.cu --out-root out --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("--no-cl-namespace-inline\".", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-yaml-with-different-options3/do_test.py b/behavior_tests/src/bt-yaml-with-different-options3/do_test.py index d34346c64..96a2a0624 100644 --- a/behavior_tests/src/bt-yaml-with-different-options3/do_test.py +++ b/behavior_tests/src/bt-yaml-with-different-options3/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " test.cu --out-root out --usm-level=none --cuda-include-path=" + test_config.include_path) - return call_subprocess(test_config.CT_TOOL + " test.cu --out-root out --no-incremental-migration --cuda-include-path=" + test_config.include_path) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " test.cu --out-root out --usm-level=none --cuda-include-path=" + single_case_text.include_path, single_case_text) + return call_subprocess(single_case_text.CT_TOOL + " test.cu --out-root out --no-incremental-migration --cuda-include-path=" + single_case_text.include_path, single_case_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/bt-yaml-without-ct-version/do_test.py b/behavior_tests/src/bt-yaml-without-ct-version/do_test.py index 62d557501..1efaa781b 100644 --- a/behavior_tests/src/bt-yaml-without-ct-version/do_test.py +++ b/behavior_tests/src/bt-yaml-without-ct-version/do_test.py @@ -13,18 +13,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " test.cu --out-root=out --cuda-include-path=" + test_config.include_path) - return is_sub_string("Failed to load", test_config.command_output) and \ - is_sub_string("Migration continues with incremental migration disabled", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " test.cu --out-root=out --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Failed to load", single_case_text.print_text) and \ + is_sub_string("Migration continues with incremental migration disabled", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/cannot-acc-dir-in-db/do_test.py b/behavior_tests/src/cannot-acc-dir-in-db/do_test.py index b16a5c252..55a55828d 100644 --- a/behavior_tests/src/cannot-acc-dir-in-db/do_test.py +++ b/behavior_tests/src/cannot-acc-dir-in-db/do_test.py @@ -13,25 +13,25 @@ from test_utils import * -def setup_test(): +def setup_test(single_case_text): return True -def migrate_test(): - change_dir('cannot-acc-dir-in-db/helloworld') - call_subprocess('intercept-build /usr/bin/make') - change_dir('..') - call_subprocess('mv helloworld helloworld_tst') +def migrate_test(single_case_text): + change_dir('cannot-acc-dir-in-db/helloworld', single_case_text) + call_subprocess('intercept-build /usr/bin/make', single_case_text) + change_dir('..', single_case_text) + call_subprocess('mv helloworld helloworld_tst', single_case_text) - call_subprocess(test_config.CT_TOOL + ' -p ./helloworld_tst/compile_commands.json --cuda-include-path=' + \ - os.environ['CUDA_INCLUDE_PATH']) + call_subprocess(single_case_text.CT_TOOL + ' -p ./helloworld_tst/compile_commands.json --cuda-include-path=' + \ + os.environ['CUDA_INCLUDE_PATH'], single_case_text) - if 'check if the directory exists and can be accessed by the tool' in test_config.command_output: + if 'check if the directory exists and can be accessed by the tool' in single_case_text.print_text: return True print("could not get expected message: check if the directory exists and can be accessed by the tool") return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/change-filename-extension/do_test.py b/behavior_tests/src/change-filename-extension/do_test.py index 060a5e176..dc461ff87 100644 --- a/behavior_tests/src/change-filename-extension/do_test.py +++ b/behavior_tests/src/change-filename-extension/do_test.py @@ -14,47 +14,47 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): call_subprocess( - test_config.CT_TOOL + " -p=. --change-cuda-files-extension-only --out-root=out --cuda-include-path=" + test_config.include_path) - print(test_config.command_output) + single_case_text.CT_TOOL + " -p=. --change-cuda-files-extension-only --out-root=out --cuda-include-path=" + single_case_text.include_path, single_case_text) + print(single_case_text.print_text) reference = 'main.dp.cpp' - call_subprocess("ls out | grep " + reference) + call_subprocess("ls out | grep " + reference, single_case_text) res = True - if reference not in test_config.command_output: + if reference not in single_case_text.print_text: res = False print("there should be a file: " + reference) reference = 'test.cpp' - call_subprocess("ls out | grep " + reference) - if reference not in test_config.command_output: + call_subprocess("ls out | grep " + reference, single_case_text) + if reference not in single_case_text.print_text: res = False print("there should be a file: " + reference) reference = 'test.dp.hpp' - call_subprocess("ls out | grep " + reference) - if reference not in test_config.command_output: + call_subprocess("ls out | grep " + reference, single_case_text) + if reference not in single_case_text.print_text: res = False print("there should be a file: " + reference) reference = 'test.h' - call_subprocess("ls out | grep " + reference) - if reference not in test_config.command_output: + call_subprocess("ls out | grep " + reference, single_case_text) + if reference not in single_case_text.print_text: res = False print("there should be a file: " + reference) return res -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/check-device-unsupport-aspect/do_test.py b/behavior_tests/src/check-device-unsupport-aspect/do_test.py index 9fa2127bc..0d73ccbac 100644 --- a/behavior_tests/src/check-device-unsupport-aspect/do_test.py +++ b/behavior_tests/src/check-device-unsupport-aspect/do_test.py @@ -11,21 +11,21 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): res = True - cmd = test_config.CT_TOOL + " --out-root=out double.cu --cuda-include-path=" + test_config.include_path - if not call_subprocess(cmd): + cmd = single_case_text.CT_TOOL + " --out-root=out double.cu --cuda-include-path=" + single_case_text.include_path + if not call_subprocess(cmd, single_case_text): res = False print("double.cu migrate failed") else: print("double.cu migrate pass") - cmd = test_config.CT_TOOL + " --out-root=out half.cu --cuda-include-path=" + test_config.include_path - if not call_subprocess(cmd): + cmd = single_case_text.CT_TOOL + " --out-root=out half.cu --cuda-include-path=" + single_case_text.include_path + if not call_subprocess(cmd, single_case_text): res = False print("half.cu migrate failed") else: @@ -33,26 +33,26 @@ def migrate_test(): return res -def build_test(): +def build_test(single_case_text): res = True - if not compile_files([os.path.join("out", "double.dp.cpp")]): + if not compile_files([os.path.join("out", "double.dp.cpp")], single_case_text): res = False print("double.dp.cpp compile failed") else: print("double.dp.cpp compile pass") - cmd = test_config.DPCXX_COM + ' ' + prepare_obj_name(os.path.join("out", "double.dp.cpp")) + " -o double.run" - if not call_subprocess(cmd): + cmd = single_case_text.DPCXX_COM + ' ' + prepare_obj_name(os.path.join("out", "double.dp.cpp")) + " -o double.run" + if not call_subprocess(cmd, single_case_text): res = False print("double.dp.cpp link failed") else: print("double.dp.cpp link pass") - if not compile_files([os.path.join("out", "half.dp.cpp")]): + if not compile_files([os.path.join("out", "half.dp.cpp")], single_case_text): res = False print("half.dp.cpp compile failed") else: print("half.dp.cpp compile pass") - cmd = test_config.DPCXX_COM + ' ' + prepare_obj_name(os.path.join("out", "half.dp.cpp")) + " -o half.run" - if not call_subprocess(cmd): + cmd = single_case_text.DPCXX_COM + ' ' + prepare_obj_name(os.path.join("out", "half.dp.cpp")) + " -o half.run" + if not call_subprocess(cmd, single_case_text): res = False print("half.dp.cpp link failed") else: @@ -60,26 +60,26 @@ def build_test(): return res -def run_test(): - os.environ["ONEAPI_DEVICE_SELECTOR"] = test_config.device_filter +def run_test(single_case_text): + os.environ["ONEAPI_DEVICE_SELECTOR"] = single_case_text.device_filter res = 0 cmd = os.path.join(os.path.curdir, 'double.run') - if call_subprocess(cmd): + if call_subprocess(cmd, single_case_text): res += 1 print("double.run run pass") print("double.run output:") - print(test_config.command_output) + print(single_case_text.print_text) if res != 1: print("case 'double' failed") return False cmd = os.path.join(os.path.curdir, 'half.run') - if call_subprocess(cmd): + if call_subprocess(cmd, single_case_text): res += 1 print("half.run run pass") print("half.run output:") - print(test_config.command_output) + print(single_case_text.print_text) if res != 2: print("case 'half' failed") return False diff --git a/behavior_tests/src/check-windows-version/do_test.py b/behavior_tests/src/check-windows-version/do_test.py index 6fdd37511..cf0807108 100644 --- a/behavior_tests/src/check-windows-version/do_test.py +++ b/behavior_tests/src/check-windows-version/do_test.py @@ -10,19 +10,18 @@ import platform import os import sys -import test_config from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def get_windows_version(arg1, arg2): - call_subprocess("powershell \"(Get-Item -path " + arg1 + ").VersionInfo." + arg2 + "\"") - return test_config.command_output +def get_windows_version(arg1, arg2, single_case_text): + call_subprocess("powershell \"(Get-Item -path " + arg1 + ").VersionInfo." + arg2 + "\"", single_case_text) + return single_case_text.print_text -def migrate_test(): +def migrate_test(single_case_text): ct_path = get_ct_path() if not ct_path: print('Cannot find the path to dpct!') @@ -33,11 +32,11 @@ def migrate_test(): return False print("dpct's bundled clang version is: {}".format(ct_clang_version)) - file_version = get_windows_version(ct_path, 'FileVersion').strip() - product_version = get_windows_version(ct_path, 'ProductVersion').strip() - product_name = get_windows_version(ct_path, 'ProductName').strip() - file_description = get_windows_version(ct_path, 'FileDescription').strip() - legal_copyright = get_windows_version(ct_path, 'LegalCopyright').strip() + file_version = get_windows_version(ct_path, 'FileVersion', single_case_text).strip() + product_version = get_windows_version(ct_path, 'ProductVersion', single_case_text).strip() + product_name = get_windows_version(ct_path, 'ProductName', single_case_text).strip() + file_description = get_windows_version(ct_path, 'FileDescription', single_case_text).strip() + legal_copyright = get_windows_version(ct_path, 'LegalCopyright', single_case_text).strip() print("====={}'s VersionInfo properties=====".format(ct_path)) print("FileVersion: {}".format(file_version)) @@ -50,8 +49,8 @@ def migrate_test(): return file_version == ct_clang_version and product_version == ct_clang_version and \ product_name == "SYCLomatic" and file_description == "" and legal_copyright == "" -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/cl_compile_test_1/do_test.py b/behavior_tests/src/cl_compile_test_1/do_test.py index 937c7d065..f4bbcc168 100644 --- a/behavior_tests/src/cl_compile_test_1/do_test.py +++ b/behavior_tests/src/cl_compile_test_1/do_test.py @@ -13,25 +13,25 @@ from test_utils import * -def setup_test(): +def setup_test(single_case_text): return True -def migrate_test(): - change_dir('cannot-acc-dir-in-db/helloworld') - call_subprocess('intercept-build /usr/bin/make') - change_dir('..') - call_subprocess('mv helloworld helloworld_tst') +def migrate_test(single_case_text): + change_dir('cannot-acc-dir-in-db/helloworld', single_case_text) + call_subprocess('intercept-build /usr/bin/make', single_case_text) + change_dir('..', single_case_text) + call_subprocess('mv helloworld helloworld_tst', single_case_text) - call_subprocess(test_config.CT_TOOL + ' helloworld_tst/src/test.cu --cuda-include-path=' + \ - os.environ['CUDA_INCLUDE_PATH']) + call_subprocess(single_case_text.CT_TOOL + ' helloworld_tst/src/test.cu --cuda-include-path=' + \ + os.environ['CUDA_INCLUDE_PATH'], single_case_text) - if 'check if the directory exists and can be accessed by the tool' in test_config.command_output: + if 'check if the directory exists and can be accessed by the tool' in single_case_text.print_text: return True print("could not get expected message: check if the directory exists and can be accessed by the tool") return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/cmp_intercept_build/do_test.py b/behavior_tests/src/cmp_intercept_build/do_test.py index 54229769d..ab3dd50b8 100644 --- a/behavior_tests/src/cmp_intercept_build/do_test.py +++ b/behavior_tests/src/cmp_intercept_build/do_test.py @@ -14,8 +14,8 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True def parse_compilation_database(compilation_database_name): @@ -30,9 +30,9 @@ def parse_compilation_database(compilation_database_name): database_source_files.append(os.path.basename(compilation_item)) return database_source_files -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess("intercept-build /usr/bin/make --no-linker-entry") + call_subprocess("intercept-build /usr/bin/make --no-linker-entry", single_case_text) new_database = parse_compilation_database("compile_commands.json") reference_database = parse_compilation_database("compile_commands.json_ref") new_database = list(set(new_database)) @@ -43,8 +43,8 @@ def migrate_test(): return True return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/cmps_cl_compile_test_1/do_test.py b/behavior_tests/src/cmps_cl_compile_test_1/do_test.py index 1e25d83cc..70ba616bc 100644 --- a/behavior_tests/src/cmps_cl_compile_test_1/do_test.py +++ b/behavior_tests/src/cmps_cl_compile_test_1/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): file_vcxproj = os.path.join(os.getcwd(), "cuda", "file_c.vcxproj") migrated_file = os.path.join(os.getcwd(), "cuda", "file.c") expected_str = "" migrated_str = "" - call_subprocess(test_config.CT_TOOL + " --report-file-prefix=report --out-root=out --vcxprojfile=\"" + \ + call_subprocess(single_case_text.CT_TOOL + " --report-file-prefix=report --out-root=out --vcxprojfile=\"" + \ file_vcxproj + "\" \"" + migrated_file + "\" --cuda-include-path=" + \ - os.environ['CUDA_INCLUDE_PATH']) + os.environ['CUDA_INCLUDE_PATH'], single_case_text) with open("expected.cpp", 'r') as f: lines = f.readlines() for line in lines: @@ -41,8 +41,8 @@ def migrate_test(): return True return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/cmps_cl_compile_test_2/do_test.py b/behavior_tests/src/cmps_cl_compile_test_2/do_test.py index badc4ad90..c46f4c0fb 100644 --- a/behavior_tests/src/cmps_cl_compile_test_2/do_test.py +++ b/behavior_tests/src/cmps_cl_compile_test_2/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): file_vcxproj = os.path.join(os.getcwd(), "cuda", "file_cu.vcxproj") migrated_file = os.path.join(os.getcwd(), "cuda", "file.cu") expected_str = "" migrated_str = "" - call_subprocess(test_config.CT_TOOL + " --report-file-prefix=report --out-root=out --vcxprojfile=\"" + \ + call_subprocess(single_case_text.CT_TOOL + " --report-file-prefix=report --out-root=out --vcxprojfile=\"" + \ file_vcxproj + "\" \"" + migrated_file + "\" --cuda-include-path=" + \ - os.environ['CUDA_INCLUDE_PATH']) + os.environ['CUDA_INCLUDE_PATH'], single_case_text) with open("expected.cpp", 'r') as f: lines = f.readlines() for line in lines: @@ -40,8 +40,8 @@ def migrate_test(): return True return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/cmps_cuda_compile_test_1/do_test.py b/behavior_tests/src/cmps_cuda_compile_test_1/do_test.py index 44d33db61..90d6dad44 100644 --- a/behavior_tests/src/cmps_cuda_compile_test_1/do_test.py +++ b/behavior_tests/src/cmps_cuda_compile_test_1/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): file_vcxproj = os.path.join(os.getcwd(), "cuda", "file_c.vcxproj") migrated_file = os.path.join(os.getcwd(), "cuda", "file.c") expected_str = "" migrated_str = "" - call_subprocess(test_config.CT_TOOL + " --report-file-prefix=report --out-root=out --vcxprojfile=\"" + \ + call_subprocess(single_case_text.CT_TOOL + " --report-file-prefix=report --out-root=out --vcxprojfile=\"" + \ file_vcxproj + "\" \"" + migrated_file + "\" --cuda-include-path=" + \ - os.environ['CUDA_INCLUDE_PATH']) + os.environ['CUDA_INCLUDE_PATH'], single_case_text) with open("expected.cpp", 'r') as f: lines = f.readlines() for line in lines: @@ -40,8 +40,8 @@ def migrate_test(): return True return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/cmps_cuda_compile_test_2/do_test.py b/behavior_tests/src/cmps_cuda_compile_test_2/do_test.py index 44d33db61..90d6dad44 100644 --- a/behavior_tests/src/cmps_cuda_compile_test_2/do_test.py +++ b/behavior_tests/src/cmps_cuda_compile_test_2/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): file_vcxproj = os.path.join(os.getcwd(), "cuda", "file_c.vcxproj") migrated_file = os.path.join(os.getcwd(), "cuda", "file.c") expected_str = "" migrated_str = "" - call_subprocess(test_config.CT_TOOL + " --report-file-prefix=report --out-root=out --vcxprojfile=\"" + \ + call_subprocess(single_case_text.CT_TOOL + " --report-file-prefix=report --out-root=out --vcxprojfile=\"" + \ file_vcxproj + "\" \"" + migrated_file + "\" --cuda-include-path=" + \ - os.environ['CUDA_INCLUDE_PATH']) + os.environ['CUDA_INCLUDE_PATH'], single_case_text) with open("expected.cpp", 'r') as f: lines = f.readlines() for line in lines: @@ -40,8 +40,8 @@ def migrate_test(): return True return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/copy_all_files/do_test.py b/behavior_tests/src/copy_all_files/do_test.py index 2bb44804b..ff6ae57f9 100644 --- a/behavior_tests/src/copy_all_files/do_test.py +++ b/behavior_tests/src/copy_all_files/do_test.py @@ -10,27 +10,27 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL +" --out-root=out --cuda-include-path=" + test_config.include_path + - " t.c t.cpp t.cu") - # return is_sub_string("Migration not necessary", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL +" --out-root=out --cuda-include-path=" + single_case_text.include_path + + " t.c t.cpp t.cu", single_case_text) + # return is_sub_string("Migration not necessary", single_case_text.print_text) if os.path.exists(os.path.join("out", "t.c")) or os.path.exists(os.path.join("out", "t.cpp")) or \ os.path.exists(os.path.join("out", "t.dp.cpp")): return True return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/execute_from_bundle_root/do_test.py b/behavior_tests/src/execute_from_bundle_root/do_test.py index 86a427dc1..481f80a6a 100644 --- a/behavior_tests/src/execute_from_bundle_root/do_test.py +++ b/behavior_tests/src/execute_from_bundle_root/do_test.py @@ -14,28 +14,28 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) - prepare_execution_folder() +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) + prepare_execution_folder(single_case_text) return True -def prepare_execution_folder(): - copy_ct_bin = os.path.dirname(str(shutil.which(test_config.CT_TOOL))) +def prepare_execution_folder(single_case_text): + copy_ct_bin = os.path.dirname(str(shutil.which(single_case_text.CT_TOOL))) distutils.dir_util.copy_tree(copy_ct_bin, "bin") -def migrate_test(): - ct_bin = os.path.join("bin", test_config.CT_TOOL) +def migrate_test(single_case_text): + ct_bin = os.path.join("bin", single_case_text.CT_TOOL) in_root = "" extra_args = "" - call_subprocess(ct_bin + " --cuda-include-path=" + test_config.include_path + - " " + "hellocuda.cu") - if ('or the same folder as' in test_config.command_output): + call_subprocess(ct_bin + " --cuda-include-path=" + single_case_text.include_path + + " " + "hellocuda.cu", single_case_text) + if ('or the same folder as' in single_case_text.print_text): return True return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/execute_from_cuda_path/do_test.py b/behavior_tests/src/execute_from_cuda_path/do_test.py index f884086cd..7e9849c27 100644 --- a/behavior_tests/src/execute_from_cuda_path/do_test.py +++ b/behavior_tests/src/execute_from_cuda_path/do_test.py @@ -10,31 +10,31 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) - prepare_execution_folder() +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) + prepare_execution_folder(single_case_text) return True -def prepare_execution_folder(): - distutils.dir_util.copy_tree(test_config.include_path, "include") +def prepare_execution_folder(single_case_text): + distutils.dir_util.copy_tree(single_case_text.include_path, "include") -def migrate_test(): +def migrate_test(single_case_text): src =os.path.join("include", "vector_types.h") in_root = "" extra_args = "" - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=./include " + src) - print("hello" + test_config.command_output) - if ('option is in the CUDA_PATH folder' in test_config.command_output): + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=./include " + src, single_case_text) + print("hello" + single_case_text.print_text, single_case_text) + if ('option is in the CUDA_PATH folder' in single_case_text.print_text): return True return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/integer-overflow/do_test.py b/behavior_tests/src/integer-overflow/do_test.py index 9d5ca2c68..0a736f0d4 100644 --- a/behavior_tests/src/integer-overflow/do_test.py +++ b/behavior_tests/src/integer-overflow/do_test.py @@ -13,22 +13,22 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) - change_dir("helloworld") +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) + change_dir("helloworld", single_case_text) return True -def migrate_test(): - call_subprocess("intercept-build /usr/bin/make") - change_dir("..") - call_subprocess("mv helloworld helloworld_tst") - call_subprocess(test_config.CT_TOOL + " helloworld_tst/src/test.cu --cuda-include-path=" + test_config.include_path + - " --suppress-warnings=-1,0,0x100,0x1000,0x3fffffff,0x7ffffffe,0x7fffffff,0x80000000,0xfffffffe,0xffffffff,0x10000,0x100000") +def migrate_test(single_case_text): + call_subprocess("intercept-build /usr/bin/make", single_case_text) + change_dir("..", single_case_text) + call_subprocess("mv helloworld helloworld_tst", single_case_text) + call_subprocess(single_case_text.CT_TOOL + " helloworld_tst/src/test.cu --cuda-include-path=" + single_case_text.include_path + + " --suppress-warnings=-1,0,0x100,0x1000,0x3fffffff,0x7ffffffe,0x7fffffff,0x80000000,0xfffffffe,0xffffffff,0x10000,0x100000", single_case_text) - return is_sub_string("Error: Invalid warning ID or range; valid warning IDs range from 1000 to", test_config.command_output) + return is_sub_string("Error: Invalid warning ID or range; valid warning IDs range from 1000 to", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-UDR-idx1/do_test.py b/behavior_tests/src/ngt-UDR-idx1/do_test.py index 6b42cca54..48b69aa57 100644 --- a/behavior_tests/src/ngt-UDR-idx1/do_test.py +++ b/behavior_tests/src/ngt-UDR-idx1/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " a.cu -rule-file=./rule.yaml --cuda-include-path=" + test_config.include_path) - return is_sub_string("Error: in rule sample_rule, unknown keyword: $abd))", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " a.cu -rule-file=./rule.yaml --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Error: in rule sample_rule, unknown keyword: $abd))", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-UDR-idx2/do_test.py b/behavior_tests/src/ngt-UDR-idx2/do_test.py index 4b7604ac7..db02e4b32 100644 --- a/behavior_tests/src/ngt-UDR-idx2/do_test.py +++ b/behavior_tests/src/ngt-UDR-idx2/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " a.cu -rule-file=./rule.yaml --cuda-include-path=" + test_config.include_path) - return is_sub_string("Error: in rule sample_rule, unknown keyword: $-1))", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " a.cu -rule-file=./rule.yaml --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Error: in rule sample_rule, unknown keyword: $-1))", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-UDR-idx3/do_test.py b/behavior_tests/src/ngt-UDR-idx3/do_test.py index 0bc09a798..f02001066 100644 --- a/behavior_tests/src/ngt-UDR-idx3/do_test.py +++ b/behavior_tests/src/ngt-UDR-idx3/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " a.cu -rule-file=./rule.yaml --cuda-include-path=" + test_config.include_path) - return is_sub_string("Error: in rule sample_rule, argument index out of range", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " a.cu -rule-file=./rule.yaml --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Error: in rule sample_rule, argument index out of range", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-UDR-keyword/do_test.py b/behavior_tests/src/ngt-UDR-keyword/do_test.py index ec203b982..6c0a3a09b 100644 --- a/behavior_tests/src/ngt-UDR-keyword/do_test.py +++ b/behavior_tests/src/ngt-UDR-keyword/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " a.cu -rule-file=./rule.yaml --cuda-include-path=" + test_config.include_path) - return is_sub_string("Error: in rule sample_rule, '(' is expected after $deref", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " a.cu -rule-file=./rule.yaml --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Error: in rule sample_rule, '(' is expected after $deref", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-UDR-path/do_test.py b/behavior_tests/src/ngt-UDR-path/do_test.py index e7af9350b..88222861a 100644 --- a/behavior_tests/src/ngt-UDR-path/do_test.py +++ b/behavior_tests/src/ngt-UDR-path/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " a.cu -rule-file=./ruleaaa.yaml --cuda-include-path=" + test_config.include_path) - return is_sub_string("Error: failed to read", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " a.cu -rule-file=./ruleaaa.yaml --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Error: failed to read", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-analysis-scope-path1/do_test.py b/behavior_tests/src/ngt-analysis-scope-path1/do_test.py index 3b14d8394..953e59528 100644 --- a/behavior_tests/src/ngt-analysis-scope-path1/do_test.py +++ b/behavior_tests/src/ngt-analysis-scope-path1/do_test.py @@ -15,33 +15,33 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): # clean previous migration output if (os.path.exists("out")): shutil.rmtree("out") - migrate_cmd = test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " " + os.path.join( + migrate_cmd = single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " " + os.path.join( "cuda", "call_device_func_outside.cu") + " --in-root=" + os.path.realpath( ".") + " --out-root=" + os.path.realpath("out") for analysis_scope in (os.path.join(".", "cuda"), os.path.join("non_exist_dir", "abc")): call_subprocess(migrate_cmd + " --analysis-scope-path=" + - os.path.realpath(analysis_scope)) + os.path.realpath(analysis_scope), single_case_text) if not is_sub_string( "Error: The path for --analysis-scope-path is not the same as or a parent directory of --in-root", - test_config.command_output): + single_case_text.print_text): return False return True -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-assume-nd-range-dim/do_test.py b/behavior_tests/src/ngt-assume-nd-range-dim/do_test.py index e0622fa47..e4306e5a3 100644 --- a/behavior_tests/src/ngt-assume-nd-range-dim/do_test.py +++ b/behavior_tests/src/ngt-assume-nd-range-dim/do_test.py @@ -13,17 +13,17 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --assume-nd-range-dim=2 --cuda-include-path=" + test_config.include_path) - return is_sub_string("Cannot find option named", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --assume-nd-range-dim=2 --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Cannot find option named", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-cannot-access-dir-in-db/do_test.py b/behavior_tests/src/ngt-cannot-access-dir-in-db/do_test.py index cd82cb752..5a7b6fc88 100644 --- a/behavior_tests/src/ngt-cannot-access-dir-in-db/do_test.py +++ b/behavior_tests/src/ngt-cannot-access-dir-in-db/do_test.py @@ -13,12 +13,12 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) - change_dir("helloworld") +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) + change_dir("helloworld", single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): cur_dr = os.getcwd() if (platform.system() == 'Windows'): cur_dr = cur_dr.replace('\\', '/') @@ -29,12 +29,12 @@ def migrate_test(): with open("compile_commands.json", 'w') as f: f.write(ret) - call_subprocess(test_config.CT_TOOL + " simple_foo.cu --cuda-include-path=" + test_config.include_path) + call_subprocess(single_case_text.CT_TOOL + " simple_foo.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) - return is_sub_string("Error: Cannot access directory", test_config.command_output) + return is_sub_string("Error: Cannot access directory", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-cannot-find-db/do_test.py b/behavior_tests/src/ngt-cannot-find-db/do_test.py index 669075f10..5af244a49 100644 --- a/behavior_tests/src/ngt-cannot-find-db/do_test.py +++ b/behavior_tests/src/ngt-cannot-find-db/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) - change_dir("helloworld") +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) + change_dir("helloworld",single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " -p ./ --cuda-include-path=" + test_config.include_path) + call_subprocess(single_case_text.CT_TOOL + " -p ./ --cuda-include-path=" + single_case_text.include_path, single_case_text) - return is_sub_string("Cannot find compilation database", test_config.command_output) + return is_sub_string("Cannot find compilation database", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-check-cannot-parse/do_test.py b/behavior_tests/src/ngt-check-cannot-parse/do_test.py index 264c3fb50..ea8bae9f1 100644 --- a/behavior_tests/src/ngt-check-cannot-parse/do_test.py +++ b/behavior_tests/src/ngt-check-cannot-parse/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " vector_add.cu") - return is_sub_string("Migration not necessary", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " vector_add.cu", single_case_text) + return is_sub_string("Migration not necessary", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-database-notfound/do_test.py b/behavior_tests/src/ngt-database-notfound/do_test.py index 29ad1f099..27a4ac901 100644 --- a/behavior_tests/src/ngt-database-notfound/do_test.py +++ b/behavior_tests/src/ngt-database-notfound/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " -p=.") - return is_sub_string("No compilation database found", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " -p=.", single_case_text) + return is_sub_string("No compilation database found", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-file-parsing-err/do_test.py b/behavior_tests/src/ngt-file-parsing-err/do_test.py index 9b9275188..4ee703f16 100644 --- a/behavior_tests/src/ngt-file-parsing-err/do_test.py +++ b/behavior_tests/src/ngt-file-parsing-err/do_test.py @@ -13,20 +13,20 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " simple_foo.cu -stop-on-parse-err --cuda-include-path=" + test_config.include_path) - return (is_sub_string("Cannot parse input file", test_config.command_output) - and is_sub_string("Parsing", test_config.command_output) - and not is_sub_string("Analyzing", test_config.command_output) - and not is_sub_string("Migrating", test_config.command_output)) + call_subprocess(single_case_text.CT_TOOL + " simple_foo.cu -stop-on-parse-err --cuda-include-path=" + single_case_text.include_path, single_case_text) + return (is_sub_string("Cannot parse input file", single_case_text.print_text) + and is_sub_string("Parsing", single_case_text.print_text) + and not is_sub_string("Analyzing", single_case_text.print_text) + and not is_sub_string("Migrating", single_case_text.print_text)) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-format-range/do_test.py b/behavior_tests/src/ngt-format-range/do_test.py index f74d139bb..7c9ecd7f4 100644 --- a/behavior_tests/src/ngt-format-range/do_test.py +++ b/behavior_tests/src/ngt-format-range/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --format-range=aaa") - return is_sub_string("Cannot find option named", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --format-range=aaa", single_case_text) + return is_sub_string("Cannot find option named", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-format-style/do_test.py b/behavior_tests/src/ngt-format-style/do_test.py index c0b629607..269a6a481 100644 --- a/behavior_tests/src/ngt-format-style/do_test.py +++ b/behavior_tests/src/ngt-format-style/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --format-style=aaa") - return is_sub_string("Cannot find option named", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --format-style=aaa", single_case_text) + return is_sub_string("Cannot find option named", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-in-root-len/do_test.py b/behavior_tests/src/ngt-in-root-len/do_test.py index 213dd2679..160725234 100644 --- a/behavior_tests/src/ngt-in-root-len/do_test.py +++ b/behavior_tests/src/ngt-in-root-len/do_test.py @@ -10,15 +10,15 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): max_len = 511 if (platform.system() == 'Windows'): max_len = 32 @@ -27,12 +27,12 @@ def migrate_test(): for num in range(0, max_len): long_path = os.path.join(long_path, "test_path") os.path.join(long_path, "name") - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path +" --out-root="+ - long_path) - return is_sub_string("should be less than", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path +" --out-root="+ + long_path, single_case_text) + return is_sub_string("should be less than", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-in-root-path/do_test.py b/behavior_tests/src/ngt-in-root-path/do_test.py index 577a09f61..70675f4d0 100644 --- a/behavior_tests/src/ngt-in-root-path/do_test.py +++ b/behavior_tests/src/ngt-in-root-path/do_test.py @@ -10,20 +10,20 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path +" --in-root=./inroot vector_add.cu") - return is_sub_string("is not under the specified input root directory", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path +" --in-root=./inroot vector_add.cu", single_case_text) + return is_sub_string("is not under the specified input root directory", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-include-path-len/do_test.py b/behavior_tests/src/ngt-include-path-len/do_test.py index 9aa50079b..4671d23cc 100644 --- a/behavior_tests/src/ngt-include-path-len/do_test.py +++ b/behavior_tests/src/ngt-include-path-len/do_test.py @@ -10,15 +10,15 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): max_len = 511 if (platform.system() == 'Windows'): max_len = 32 @@ -27,11 +27,11 @@ def migrate_test(): for num in range(0, max_len): long_path = os.path.join(long_path, "test_path") os.path.join(long_path, "name") - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + long_path) - return is_sub_string("should be less than", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + long_path, single_case_text) + return is_sub_string("should be less than", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-inroot-contain-cuda-path/do_test.py b/behavior_tests/src/ngt-inroot-contain-cuda-path/do_test.py index 8444b283e..95fb96b5c 100644 --- a/behavior_tests/src/ngt-inroot-contain-cuda-path/do_test.py +++ b/behavior_tests/src/ngt-inroot-contain-cuda-path/do_test.py @@ -13,18 +13,18 @@ import shutil from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - shutil.copytree(test_config.include_path, "cc") - call_subprocess(test_config.CT_TOOL + " --in-root=./ ./simple_foo.cu --cuda-include-path=./cc") - return is_sub_string("Error: Input folder specified by --in-root or --analysis-scope-path is the parent of, or the same folder", test_config.command_output) +def migrate_test(single_case_text): + shutil.copytree(single_case_text.include_path, "cc") + call_subprocess(single_case_text.CT_TOOL + " --in-root=./ ./simple_foo.cu --cuda-include-path=./cc", single_case_text) + return is_sub_string("Error: Input folder specified by --in-root or --analysis-scope-path is the parent of, or the same folder", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-invalid-cuda-include-path/do_test.py b/behavior_tests/src/ngt-invalid-cuda-include-path/do_test.py index 39547bf72..9ea6b53ea 100644 --- a/behavior_tests/src/ngt-invalid-cuda-include-path/do_test.py +++ b/behavior_tests/src/ngt-invalid-cuda-include-path/do_test.py @@ -13,17 +13,17 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + - " --extra-arg=\"--cuda-path=/usr/local/folder-does-not-contain-cuda\" vector_add.cu") - return is_sub_string("Could not detect path to CUDA header files", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + + " --extra-arg=\"--cuda-path=/usr/local/folder-does-not-contain-cuda\" vector_add.cu", single_case_text) + return is_sub_string("Could not detect path to CUDA header files", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-invalid-experimental-features/do_test.py b/behavior_tests/src/ngt-invalid-experimental-features/do_test.py index d123a60bc..199c68f2f 100644 --- a/behavior_tests/src/ngt-invalid-experimental-features/do_test.py +++ b/behavior_tests/src/ngt-invalid-experimental-features/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --use-experimental-features=logical-group,abc") - return is_sub_string("for the --use-experimental-features option: Cannot find option named \'abc\'!", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --use-experimental-features=logical-group,abc", single_case_text) + return is_sub_string("for the --use-experimental-features option: Cannot find option named \'abc\'!", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-explicit-namespace1/do_test.py b/behavior_tests/src/ngt-invalid-explicit-namespace1/do_test.py index 252ec61b6..b3fa32847 100644 --- a/behavior_tests/src/ngt-invalid-explicit-namespace1/do_test.py +++ b/behavior_tests/src/ngt-invalid-explicit-namespace1/do_test.py @@ -13,17 +13,17 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " --use-explicit-namespace=none,dpct vector_add.cu --cuda-include-path=" + test_config.include_path) - return is_sub_string("Error: The input for option --use-explicit-namespace is not valid.", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " --use-explicit-namespace=none,dpct vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Error: The input for option --use-explicit-namespace is not valid.", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-invalid-explicit-namespace2/do_test.py b/behavior_tests/src/ngt-invalid-explicit-namespace2/do_test.py index 0522d4e87..597609c7d 100644 --- a/behavior_tests/src/ngt-invalid-explicit-namespace2/do_test.py +++ b/behavior_tests/src/ngt-invalid-explicit-namespace2/do_test.py @@ -13,17 +13,17 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " --use-explicit-namespace=sycl,cl,dpct vector_add.cu --cuda-include-path=" + test_config.include_path) - return is_sub_string("Error: The input for option --use-explicit-namespace is not valid.", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " --use-explicit-namespace=sycl,cl,dpct vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Error: The input for option --use-explicit-namespace is not valid.", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-invalid-explicit-namespace3/do_test.py b/behavior_tests/src/ngt-invalid-explicit-namespace3/do_test.py index eeb602668..e13ced1bf 100644 --- a/behavior_tests/src/ngt-invalid-explicit-namespace3/do_test.py +++ b/behavior_tests/src/ngt-invalid-explicit-namespace3/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " --use-explicit-namespace=sycl,sycl-math vector_add.cu --cuda-include-path=" + test_config.include_path) - return is_sub_string("Error: The input for option --use-explicit-namespace is not valid.", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " --use-explicit-namespace=sycl,sycl-math vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Error: The input for option --use-explicit-namespace is not valid.", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-invalid-inroot/do_test.py b/behavior_tests/src/ngt-invalid-inroot/do_test.py index 7da8a27c9..f7b02b61d 100644 --- a/behavior_tests/src/ngt-invalid-inroot/do_test.py +++ b/behavior_tests/src/ngt-invalid-inroot/do_test.py @@ -13,18 +13,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + - " simple_foo.cu --in-root=/notavalidfolder --cuda-include-path=" + test_config.include_path) - return is_sub_string("The path for --in-root or --out-root is not valid", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + + " simple_foo.cu --in-root=/notavalidfolder --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("The path for --in-root or --out-root is not valid", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-invalid-inroot2/do_test.py b/behavior_tests/src/ngt-invalid-inroot2/do_test.py index 30cf1a293..4023e0d9e 100644 --- a/behavior_tests/src/ngt-invalid-inroot2/do_test.py +++ b/behavior_tests/src/ngt-invalid-inroot2/do_test.py @@ -13,18 +13,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + - " simple_foo.cu --in-root=/usr/local --cuda-include-path=" + test_config.include_path) - return is_sub_string("The path for --in-root is not valid", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + + " simple_foo.cu --in-root=/usr/local --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("The path for --in-root is not valid", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-invalid-inroot3/do_test.py b/behavior_tests/src/ngt-invalid-inroot3/do_test.py index 4db7e311b..19dade642 100644 --- a/behavior_tests/src/ngt-invalid-inroot3/do_test.py +++ b/behavior_tests/src/ngt-invalid-inroot3/do_test.py @@ -13,18 +13,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + - " simple_foo.cu --in-root=C:\Windows --cuda-include-path=" + test_config.include_path) - return is_sub_string("The path for --in-root is not valid", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + + " simple_foo.cu --in-root=C:\Windows --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("The path for --in-root is not valid", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-invalid-json1/do_test.py b/behavior_tests/src/ngt-invalid-json1/do_test.py index ee2ae54b7..f2c6ae2e8 100644 --- a/behavior_tests/src/ngt-invalid-json1/do_test.py +++ b/behavior_tests/src/ngt-invalid-json1/do_test.py @@ -10,30 +10,30 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): data = [] ret = [] - with open("compile_commands.json", 'r') as f: + with open(os.path.join(single_case_text.case_workspace, "compile_commands.json"), 'r') as f: data = f.readlines() for line in data: line = line.replace("directory_placeholder", os.getcwd().replace("\\", "\\\\")) ret.append(line) - with open("compile_commands.json", 'w') as f: + with open(os.path.join(single_case_text.case_workspace, "compile_commands.json"), 'w') as f: f.writelines(ret[1:]) - call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("Expected array", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + ' -p=./ --cuda-include-path=' + single_case_text.include_path, single_case_text) + return is_sub_string("Expected array", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-json10/do_test.py b/behavior_tests/src/ngt-invalid-json10/do_test.py index fdd11e4ef..d300ff720 100644 --- a/behavior_tests/src/ngt-invalid-json10/do_test.py +++ b/behavior_tests/src/ngt-invalid-json10/do_test.py @@ -10,15 +10,15 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): data = [] ret = [] with open("compile_commands.json", 'r') as f: @@ -29,13 +29,13 @@ def migrate_test(): with open("compile_commands.json", 'w') as f: f.writelines(ret) - call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("The file name(s) in the \"command\" and \"file\" fields of the compilation database are inconsistent", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + ' -p=./ --cuda-include-path=' + single_case_text.include_path, single_case_text) + return is_sub_string("The file name(s) in the \"command\" and \"file\" fields of the compilation database are inconsistent", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-json2/do_test.py b/behavior_tests/src/ngt-invalid-json2/do_test.py index abe94ced5..7ebb38bfa 100644 --- a/behavior_tests/src/ngt-invalid-json2/do_test.py +++ b/behavior_tests/src/ngt-invalid-json2/do_test.py @@ -11,15 +11,15 @@ import os import sys from unittest import TestCase -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): data = [] ret = [] with open("compile_commands.json", 'r') as f: @@ -30,12 +30,12 @@ def migrate_test(): ret.pop(1) with open("compile_commands.json", 'w') as f: f.writelines(ret) - call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("Missing key: \"file\"", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + ' -p=./ --cuda-include-path=' + single_case_text.include_path, single_case_text) + return is_sub_string("Missing key: \"file\"", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-json3/do_test.py b/behavior_tests/src/ngt-invalid-json3/do_test.py index cd035cb03..9cc3f5dc8 100644 --- a/behavior_tests/src/ngt-invalid-json3/do_test.py +++ b/behavior_tests/src/ngt-invalid-json3/do_test.py @@ -10,15 +10,15 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): data = [] ret = [] with open("compile_commands.json", 'r') as f: @@ -29,13 +29,13 @@ def migrate_test(): ret.pop(5) with open("compile_commands.json", 'w') as f: f.writelines(ret) - call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("Expected Key, Flow Entry, or Flow Mapping End", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + ' -p=./ --cuda-include-path=' + single_case_text.include_path, single_case_text) + return is_sub_string("Expected Key, Flow Entry, or Flow Mapping End", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-json4/do_test.py b/behavior_tests/src/ngt-invalid-json4/do_test.py index 36007cb20..dbb334b4c 100644 --- a/behavior_tests/src/ngt-invalid-json4/do_test.py +++ b/behavior_tests/src/ngt-invalid-json4/do_test.py @@ -10,15 +10,15 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): data = [] ret = [] with open("compile_commands.json", 'r') as f: @@ -29,13 +29,13 @@ def migrate_test(): with open("compile_commands.json", 'w') as f: ret.pop(6) f.writelines(ret) - call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("Could not find closing ]", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + ' -p=./ --cuda-include-path=' + single_case_text.include_path, single_case_text) + return is_sub_string("Could not find closing ]", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-json5/do_test.py b/behavior_tests/src/ngt-invalid-json5/do_test.py index e4f743867..5aa2f16fb 100644 --- a/behavior_tests/src/ngt-invalid-json5/do_test.py +++ b/behavior_tests/src/ngt-invalid-json5/do_test.py @@ -10,15 +10,15 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): data = [] ret = [] with open("compile_commands.json", 'r') as f: @@ -31,11 +31,11 @@ def migrate_test(): with open("compile_commands.json", 'w') as f: f.writelines(ret) - call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("The file name(s) in the \"command\" and \"file\" fields of the compilation database are inconsistent", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + ' -p=./ --cuda-include-path=' + single_case_text.include_path, single_case_text) + return is_sub_string("The file name(s) in the \"command\" and \"file\" fields of the compilation database are inconsistent", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-json6/do_test.py b/behavior_tests/src/ngt-invalid-json6/do_test.py index b03ca0ced..f9b7b2313 100644 --- a/behavior_tests/src/ngt-invalid-json6/do_test.py +++ b/behavior_tests/src/ngt-invalid-json6/do_test.py @@ -10,18 +10,18 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): data = [] ret = [] - with open("compile_commands.json", 'r') as f: + with open(os.path.join(single_case_text.case_workspace, "compile_commands.json"), 'r') as f: data = f.readlines() for line in data: line = line.replace("directory_placeholder", os.getcwd().replace("\\", "\\\\")) @@ -30,12 +30,12 @@ def migrate_test(): ret.append(line) with open("compile_commands.json", 'w') as f: f.writelines(ret) - call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("The file name(s) in the \"command\" and \"file\" fields of the compilation database are inconsistent", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + ' -p=./ --cuda-include-path=' + single_case_text.include_path, single_case_text) + return is_sub_string("The file name(s) in the \"command\" and \"file\" fields of the compilation database are inconsistent", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-json7/do_test.py b/behavior_tests/src/ngt-invalid-json7/do_test.py index 09b55d9e1..7bcdab6e5 100644 --- a/behavior_tests/src/ngt-invalid-json7/do_test.py +++ b/behavior_tests/src/ngt-invalid-json7/do_test.py @@ -10,15 +10,15 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): data = [] ret = [] with open("compile_commands.json", 'r') as f: @@ -31,12 +31,12 @@ def migrate_test(): with open("compile_commands.json", 'w') as f: f.writelines(ret) - call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("Unknown key: \"\"output\"\"", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + ' -p=./ --cuda-include-path=' + single_case_text.include_path, single_case_text) + return is_sub_string("Unknown key: \"\"output\"\"", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-json8/do_test.py b/behavior_tests/src/ngt-invalid-json8/do_test.py index eed7182e4..4b813b131 100644 --- a/behavior_tests/src/ngt-invalid-json8/do_test.py +++ b/behavior_tests/src/ngt-invalid-json8/do_test.py @@ -10,34 +10,34 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): data = [] ret = [] - with open("compile_commands.json", 'r') as f: + with open(os.path.join(single_case_text.case_workspace, "compile_commands.json"), 'r') as f: data = f.readlines() for line in data: if "directory_placeholder" in line: ret.append(" \"arguments\": [\"nvcc hello_aaa.c\"],\n") line = line.replace("directory_placeholder", os.getcwd().replace("\\", "\\\\")) ret.append(line) - with open("compile_commands.json", 'w') as f: + with open(os.path.join(single_case_text.case_workspace, "compile_commands.json"), 'w') as f: f.writelines(ret) - call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("Unknown key: \"\"arguments\"\"", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + ' -p=./ --cuda-include-path=' + single_case_text.include_path, single_case_text) + return is_sub_string("Unknown key: \"\"arguments\"\"", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-json9/do_test.py b/behavior_tests/src/ngt-invalid-json9/do_test.py index e051635d1..f670dc3f2 100644 --- a/behavior_tests/src/ngt-invalid-json9/do_test.py +++ b/behavior_tests/src/ngt-invalid-json9/do_test.py @@ -10,15 +10,15 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): data = [] ret = [] iter = 0 @@ -34,14 +34,14 @@ def migrate_test(): with open("compile_commands.json", 'w') as f: f.writelines(ret) - call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("Processed 1 file(s)", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + ' -p=./ --cuda-include-path=' + single_case_text.include_path, single_case_text) + return is_sub_string("Processed 1 file(s)", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-yaml-for-format1/do_test.py b/behavior_tests/src/ngt-invalid-yaml-for-format1/do_test.py index 6c48aaeb8..a04052150 100644 --- a/behavior_tests/src/ngt-invalid-yaml-for-format1/do_test.py +++ b/behavior_tests/src/ngt-invalid-yaml-for-format1/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " hello.cu") - return is_sub_string("invalid number", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " hello.cu", single_case_text) + return is_sub_string("invalid number", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-yaml-for-format2/do_test.py b/behavior_tests/src/ngt-invalid-yaml-for-format2/do_test.py index 737d56ec7..99dbdc060 100644 --- a/behavior_tests/src/ngt-invalid-yaml-for-format2/do_test.py +++ b/behavior_tests/src/ngt-invalid-yaml-for-format2/do_test.py @@ -11,22 +11,22 @@ import os import sys from unittest import TestCase -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " hello.cu") - return is_sub_string("invalid number", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " hello.cu", single_case_text) + return is_sub_string("invalid number", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-invalid-yaml-for-format3/do_test.py b/behavior_tests/src/ngt-invalid-yaml-for-format3/do_test.py index a2515c667..4ec4dade5 100644 --- a/behavior_tests/src/ngt-invalid-yaml-for-format3/do_test.py +++ b/behavior_tests/src/ngt-invalid-yaml-for-format3/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " hello.cu") - return is_sub_string("invalid number", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " hello.cu", single_case_text) + return is_sub_string("invalid number", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-invalid-yaml-for-format4/do_test.py b/behavior_tests/src/ngt-invalid-yaml-for-format4/do_test.py index b92ac6d2f..50585e4a9 100644 --- a/behavior_tests/src/ngt-invalid-yaml-for-format4/do_test.py +++ b/behavior_tests/src/ngt-invalid-yaml-for-format4/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " hello.cu") - return is_sub_string("unknown key \'ColumnLimi\'", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " hello.cu", single_case_text) + return is_sub_string("unknown key \'ColumnLimi\'", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-invalid-yaml-for-header1/do_test.py b/behavior_tests/src/ngt-invalid-yaml-for-header1/do_test.py index cb2bc8b3c..6071b7762 100644 --- a/behavior_tests/src/ngt-invalid-yaml-for-header1/do_test.py +++ b/behavior_tests/src/ngt-invalid-yaml-for-header1/do_test.py @@ -13,13 +13,13 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + ' hello.h --out-root=out --cuda-include-path=' + \ - os.environ['CUDA_INCLUDE_PATH']) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + ' hello.h --out-root=out --cuda-include-path=' + \ + os.environ['CUDA_INCLUDE_PATH'], single_case_text) with open('out/hello.h.yaml', 'r') as f: file_data = f.read() @@ -28,16 +28,16 @@ def migrate_test(): with open('out/hello.h.yaml', 'w') as f: f.write(file_data) - call_subprocess(test_config.CT_TOOL + ' hello.h --out-root=./out --cuda-include-path=' + \ - os.environ['CUDA_INCLUDE_PATH']) - if "error: unknown key \'ConstantFla\'" in test_config.command_output: + call_subprocess(single_case_text.CT_TOOL + ' hello.h --out-root=./out --cuda-include-path=' + \ + os.environ['CUDA_INCLUDE_PATH'], single_case_text) + if "error: unknown key \'ConstantFla\'" in single_case_text.print_text: return True print("not catch the error: unkown key constantFla") return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-yaml-for-header2/do_test.py b/behavior_tests/src/ngt-invalid-yaml-for-header2/do_test.py index 5b107dcf5..8e326ce8f 100644 --- a/behavior_tests/src/ngt-invalid-yaml-for-header2/do_test.py +++ b/behavior_tests/src/ngt-invalid-yaml-for-header2/do_test.py @@ -13,13 +13,13 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + ' hello.h --out-root=out --cuda-include-path=' + \ - os.environ['CUDA_INCLUDE_PATH']) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + ' hello.h --out-root=out --cuda-include-path=' + \ + os.environ['CUDA_INCLUDE_PATH'], single_case_text) with open('out/hello.h.yaml', 'r') as f: file_data = f.read() @@ -28,16 +28,16 @@ def migrate_test(): with open('out/hello.h.yaml', 'w') as f: f.write(file_data) - call_subprocess(test_config.CT_TOOL + ' hello.h --out-root=./out --cuda-include-path=' + \ - os.environ['CUDA_INCLUDE_PATH']) - if "Unexpected token. Expected Key or Block End" in test_config.command_output: + call_subprocess(single_case_text.CT_TOOL + ' hello.h --out-root=./out --cuda-include-path=' + \ + os.environ['CUDA_INCLUDE_PATH'], single_case_text) + if "Unexpected token. Expected Key or Block End" in single_case_text.print_text: return True print("not catch the error: unkown key constantFla") return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-yaml-for-header3/do_test.py b/behavior_tests/src/ngt-invalid-yaml-for-header3/do_test.py index 0ccdaa1cb..55c3b41a8 100644 --- a/behavior_tests/src/ngt-invalid-yaml-for-header3/do_test.py +++ b/behavior_tests/src/ngt-invalid-yaml-for-header3/do_test.py @@ -13,14 +13,14 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): print("test-----------------") - call_subprocess(test_config.CT_TOOL + ' hello.h --out-root=out --cuda-include-path=' + \ - os.environ['CUDA_INCLUDE_PATH']) + call_subprocess(single_case_text.CT_TOOL + ' hello.h --out-root=out --cuda-include-path=' + \ + os.environ['CUDA_INCLUDE_PATH'], single_case_text) file_data="" with open('out/hello.h.yaml', 'r') as f: file_data = f.read() @@ -30,17 +30,17 @@ def migrate_test(): with open('out/hello.h.yaml', 'w') as f: f.write(file_data) - call_subprocess(test_config.CT_TOOL + ' hello.h --out-root=./out --cuda-include-path=' + \ - os.environ['CUDA_INCLUDE_PATH']) - print(test_config.command_output) - if "Unexpected token. Expected Key or Block End" in test_config.command_output: + call_subprocess(single_case_text.CT_TOOL + ' hello.h --out-root=./out --cuda-include-path=' + \ + os.environ['CUDA_INCLUDE_PATH'], single_case_text) + print(single_case_text.print_text) + if "Unexpected token. Expected Key or Block End" in single_case_text.print_text: return True print("not catch the error: unkown key constantFla") return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-invalid-yaml-for-header4/do_test.py b/behavior_tests/src/ngt-invalid-yaml-for-header4/do_test.py index 1d85d6c08..813d47c08 100644 --- a/behavior_tests/src/ngt-invalid-yaml-for-header4/do_test.py +++ b/behavior_tests/src/ngt-invalid-yaml-for-header4/do_test.py @@ -13,13 +13,13 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " hello.h --out-root=out --cuda-include-path=" + \ - os.environ["CUDA_INCLUDE_PATH"]) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " hello.h --out-root=out --cuda-include-path=" + \ + os.environ["CUDA_INCLUDE_PATH"], single_case_text) migrated_yaml = os.path.join("out", "hello.h.yaml") with open(migrated_yaml, "r") as f: file_data = f.read() @@ -28,16 +28,16 @@ def migrate_test(): with open(migrated_yaml, "w") as f: f.write(file_data) - call_subprocess(test_config.CT_TOOL + " hello.h --out-root=./out --cuda-include-path=" + \ - os.environ["CUDA_INCLUDE_PATH"]) - if "differnt path" in test_config.command_output: + call_subprocess(single_case_text.CT_TOOL + " hello.h --out-root=./out --cuda-include-path=" + \ + os.environ["CUDA_INCLUDE_PATH"], single_case_text) + if "differnt path" in single_case_text.print_text: return True print("not catch the error: unkown key constantFla") return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-level-verbosity/do_test.py b/behavior_tests/src/ngt-level-verbosity/do_test.py index a3d5e992e..b5a9c31cd 100644 --- a/behavior_tests/src/ngt-level-verbosity/do_test.py +++ b/behavior_tests/src/ngt-level-verbosity/do_test.py @@ -11,22 +11,22 @@ import os import sys from unittest import TestCase -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --usm-level=abc --output-verbositi=abc") - return is_sub_string("Unknown command line argument '--output-verbositi=abc'", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --usm-level=abc --output-verbositi=abc", single_case_text) + return is_sub_string("Unknown command line argument '--output-verbositi=abc'", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-no-db-specified/do_test.py b/behavior_tests/src/ngt-no-db-specified/do_test.py index d64ebae72..79a259c8c 100644 --- a/behavior_tests/src/ngt-no-db-specified/do_test.py +++ b/behavior_tests/src/ngt-no-db-specified/do_test.py @@ -10,21 +10,21 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " -in-root=./ -out-root=out -p=./") - return is_sub_string("Error: Cannot find compilation database", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " -in-root=./ -out-root=out -p=./", single_case_text) + return is_sub_string("Error: Cannot find compilation database", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-no-explicit-inroot/do_test.py b/behavior_tests/src/ngt-no-explicit-inroot/do_test.py index a7a22982a..7da739be7 100644 --- a/behavior_tests/src/ngt-no-explicit-inroot/do_test.py +++ b/behavior_tests/src/ngt-no-explicit-inroot/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " simple_foo.cu --process-all --cuda-include-path=" + test_config.include_path) - return is_sub_string("Error: The option --process-all requires that the", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " simple_foo.cu --process-all --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Error: The option --process-all requires that the", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-no-file-type/do_test.py b/behavior_tests/src/ngt-no-file-type/do_test.py index e8b658cb3..7f8536101 100644 --- a/behavior_tests/src/ngt-no-file-type/do_test.py +++ b/behavior_tests/src/ngt-no-file-type/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " simple_foo --cuda-include-path=" + test_config.include_path) - return is_sub_string("File Type not available for input file", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " simple_foo --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("File Type not available for input file", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-no-source-name/do_test.py b/behavior_tests/src/ngt-no-source-name/do_test.py index 2ea78e2e6..61dadd8dd 100644 --- a/behavior_tests/src/ngt-no-source-name/do_test.py +++ b/behavior_tests/src/ngt-no-source-name/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " vector_add") - return is_sub_string("does not have an extension", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " vector_add", single_case_text) + return is_sub_string("does not have an extension", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-opt-parsing-err/do_test.py b/behavior_tests/src/ngt-opt-parsing-err/do_test.py index cae2a59a9..7c7a14331 100644 --- a/behavior_tests/src/ngt-opt-parsing-err/do_test.py +++ b/behavior_tests/src/ngt-opt-parsing-err/do_test.py @@ -13,17 +13,17 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " simple_foo.cu --in-rooooot=/aaa --cuda-include-path=" + test_config.include_path) - return is_sub_string("Option parsing error", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " simple_foo.cu --in-rooooot=/aaa --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Option parsing error", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-out-root-len/do_test.py b/behavior_tests/src/ngt-out-root-len/do_test.py index 213dd2679..160725234 100644 --- a/behavior_tests/src/ngt-out-root-len/do_test.py +++ b/behavior_tests/src/ngt-out-root-len/do_test.py @@ -10,15 +10,15 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): max_len = 511 if (platform.system() == 'Windows'): max_len = 32 @@ -27,12 +27,12 @@ def migrate_test(): for num in range(0, max_len): long_path = os.path.join(long_path, "test_path") os.path.join(long_path, "name") - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path +" --out-root="+ - long_path) - return is_sub_string("should be less than", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path +" --out-root="+ + long_path, single_case_text) + return is_sub_string("should be less than", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-output-access/do_test.py b/behavior_tests/src/ngt-output-access/do_test.py index 18eaa05b3..3c9ab96b7 100644 --- a/behavior_tests/src/ngt-output-access/do_test.py +++ b/behavior_tests/src/ngt-output-access/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): os.mkdir("dpct_output") - call_subprocess("chmod u-r dpct_output") - call_subprocess("dpct vector_add.cu --cuda-include-path=" + test_config.include_path ) - return is_sub_string("Could not access output directory", test_config.command_output) + call_subprocess("chmod u-r dpct_output", single_case_text) + call_subprocess("dpct vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Could not access output directory", single_case_text.print_text) -def build_test(): - call_subprocess("chmod 777 dpct_output") +def build_test(single_case_text): + call_subprocess("chmod 777 dpct_output", single_case_text) return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-output-create/do_test.py b/behavior_tests/src/ngt-output-create/do_test.py index cf9d0e550..fceb643f9 100644 --- a/behavior_tests/src/ngt-output-create/do_test.py +++ b/behavior_tests/src/ngt-output-create/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " vector_add.cu --out-root=out --cuda-include-path=" + test_config.include_path) - return is_sub_string("Unable to save the output to the specified directory", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " vector_add.cu --out-root=out --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Unable to save the output to the specified directory", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-output-file-len/do_test.py b/behavior_tests/src/ngt-output-file-len/do_test.py index 845f41904..31af5ead0 100644 --- a/behavior_tests/src/ngt-output-file-len/do_test.py +++ b/behavior_tests/src/ngt-output-file-len/do_test.py @@ -10,15 +10,15 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): max_len = 511 if (platform.system() == 'Windows'): max_len = 32 @@ -27,11 +27,11 @@ def migrate_test(): for num in range(0, max_len): long_path = os.path.join(long_path, "test_path") os.path.join(long_path, "name") - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " --output-file=" +long_path) - return is_sub_string("should be less than", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " --output-file=" +long_path, single_case_text) + return is_sub_string("should be less than", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-output-not-empty/do_test.py b/behavior_tests/src/ngt-output-not-empty/do_test.py index 347d97f36..779211806 100644 --- a/behavior_tests/src/ngt-output-not-empty/do_test.py +++ b/behavior_tests/src/ngt-output-not-empty/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): os.mkdir("dpct_output") with open(os.path.join("dpct_output", "test"), 'w') as f: f.write("2") - call_subprocess(test_config.CT_TOOL + " vector_add.cu --cuda-include-path=" + test_config.include_path) - return is_sub_string("directory is not empty.", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " vector_add.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("directory is not empty.", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-output-verbosity/do_test.py b/behavior_tests/src/ngt-output-verbosity/do_test.py index cec497281..219b7a490 100644 --- a/behavior_tests/src/ngt-output-verbosity/do_test.py +++ b/behavior_tests/src/ngt-output-verbosity/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --output-verbosity=abc") - return is_sub_string("--output-verbosity option: Cannot find option named", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --output-verbosity=abc", single_case_text) + return is_sub_string("--output-verbosity option: Cannot find option named", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-report-file-len/do_test.py b/behavior_tests/src/ngt-report-file-len/do_test.py index 62f0e51e0..659e7d006 100644 --- a/behavior_tests/src/ngt-report-file-len/do_test.py +++ b/behavior_tests/src/ngt-report-file-len/do_test.py @@ -10,15 +10,15 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): max_len = 511 if (platform.system() == 'Windows'): max_len = 32 @@ -27,11 +27,11 @@ def migrate_test(): for num in range(0, max_len): long_path = os.path.join(long_path, "test_path") os.path.join(long_path, "name") - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " --report-file-prefix=" +long_path) - return is_sub_string("should be less than 128", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " --report-file-prefix=" +long_path, single_case_text) + return is_sub_string("should be less than 128", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-report-file-prefix/do_test.py b/behavior_tests/src/ngt-report-file-prefix/do_test.py index 5f90dbc82..474f25f26 100644 --- a/behavior_tests/src/ngt-report-file-prefix/do_test.py +++ b/behavior_tests/src/ngt-report-file-prefix/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --report-file-prefix=abc:") - return is_sub_string("contains special character ':'", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --report-file-prefix=abc:", single_case_text) + return is_sub_string("contains special character ':'", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-report-file-prefix2/do_test.py b/behavior_tests/src/ngt-report-file-prefix2/do_test.py index 4a2389807..4e1bca92f 100644 --- a/behavior_tests/src/ngt-report-file-prefix2/do_test.py +++ b/behavior_tests/src/ngt-report-file-prefix2/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --report-file-prefix=\"/abc\"") - return is_sub_string("contains special character", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --report-file-prefix=\"/abc\"", single_case_text) + return is_sub_string("contains special character", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-report-format1/do_test.py b/behavior_tests/src/ngt-report-format1/do_test.py index fe925ff5d..d34773813 100644 --- a/behavior_tests/src/ngt-report-format1/do_test.py +++ b/behavior_tests/src/ngt-report-format1/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --report-format=abc") - return is_sub_string("--report-format option: Cannot find option named", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --report-format=abc", single_case_text) + return is_sub_string("--report-format option: Cannot find option named", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-report-format2/do_test.py b/behavior_tests/src/ngt-report-format2/do_test.py index ab6a019b0..3216be2a8 100644 --- a/behavior_tests/src/ngt-report-format2/do_test.py +++ b/behavior_tests/src/ngt-report-format2/do_test.py @@ -10,21 +10,21 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --report-format=xx vector_add.cu") - return is_sub_string("--report-format option: Cannot find option named 'xx'!", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --report-format=xx vector_add.cu", single_case_text) + return is_sub_string("--report-format option: Cannot find option named 'xx'!", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-report-type-diags/do_test.py b/behavior_tests/src/ngt-report-type-diags/do_test.py index 8c6d33831..7d8d0f017 100644 --- a/behavior_tests/src/ngt-report-type-diags/do_test.py +++ b/behavior_tests/src/ngt-report-type-diags/do_test.py @@ -10,21 +10,21 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --report-type=xxx --report-diags-content=transformation vector_add.cu") - return is_sub_string("--report-type option: Cannot find option named 'xxx'!", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --report-type=xxx --report-diags-content=transformation vector_add.cu", single_case_text) + return is_sub_string("--report-type option: Cannot find option named 'xxx'!", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-report-type/do_test.py b/behavior_tests/src/ngt-report-type/do_test.py index eade7e3fe..ca6e31b62 100644 --- a/behavior_tests/src/ngt-report-type/do_test.py +++ b/behavior_tests/src/ngt-report-type/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --report-type=abc") - return is_sub_string("--report-type option: Cannot find option named", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --report-type=abc", single_case_text) + return is_sub_string("--report-type option: Cannot find option named", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-rpt-prefix-too-long/do_test.py b/behavior_tests/src/ngt-rpt-prefix-too-long/do_test.py index c8a488843..253c16c1b 100644 --- a/behavior_tests/src/ngt-rpt-prefix-too-long/do_test.py +++ b/behavior_tests/src/ngt-rpt-prefix-too-long/do_test.py @@ -13,17 +13,17 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " simple_foo.cu -report-format=csv -report-file-prefix=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ - --cuda-include-path=" + test_config.include_path ) - return is_sub_string("Prefix is too long", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " simple_foo.cu -report-format=csv -report-file-prefix=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ + --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Prefix is too long", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-save-out-fail-lin/do_test.py b/behavior_tests/src/ngt-save-out-fail-lin/do_test.py index 4107aefc3..18701b463 100644 --- a/behavior_tests/src/ngt-save-out-fail-lin/do_test.py +++ b/behavior_tests/src/ngt-save-out-fail-lin/do_test.py @@ -13,19 +13,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess("mkdir ./read_only_folder") - call_subprocess("chmod 0444 ./read_only_folder") - call_subprocess(test_config.CT_TOOL + " simple_foo.cu --out-root=./read_only_folder --cuda-include-path=" + test_config.include_path) - return is_sub_string("Unable to save the output to the specified directory", test_config.command_output) -def build_test(): - call_subprocess("rm -rf ./read_only_folder") - call_subprocess("chmod 0777 ./read_only_folder") +def migrate_test(single_case_text): + call_subprocess("mkdir ./read_only_folder", single_case_text) + call_subprocess("chmod 0444 ./read_only_folder", single_case_text) + call_subprocess(single_case_text.CT_TOOL + " simple_foo.cu --out-root=./read_only_folder --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Unable to save the output to the specified directory", single_case_text.print_text) +def build_test(single_case_text): + call_subprocess("rm -rf ./read_only_folder", single_case_text) + call_subprocess("chmod 0777 ./read_only_folder", single_case_text) return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-show-help/do_test.py b/behavior_tests/src/ngt-show-help/do_test.py index d6b4fafc1..796e72771 100644 --- a/behavior_tests/src/ngt-show-help/do_test.py +++ b/behavior_tests/src/ngt-show-help/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL) - return is_sub_string("To get help on the tool usage", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL, single_case_text) + return is_sub_string("To get help on the tool usage", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-skip-for-missing-cmd/do_test.py b/behavior_tests/src/ngt-skip-for-missing-cmd/do_test.py index 35c2fa19b..7da739be7 100644 --- a/behavior_tests/src/ngt-skip-for-missing-cmd/do_test.py +++ b/behavior_tests/src/ngt-skip-for-missing-cmd/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " simple_foo.cu --process-all --cuda-include-path=" + test_config.include_path ) - return is_sub_string("Error: The option --process-all requires that the", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " simple_foo.cu --process-all --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Error: The option --process-all requires that the", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-stop-on-parse-err/do_test.py b/behavior_tests/src/ngt-stop-on-parse-err/do_test.py index b89fda679..bcbca1521 100644 --- a/behavior_tests/src/ngt-stop-on-parse-err/do_test.py +++ b/behavior_tests/src/ngt-stop-on-parse-err/do_test.py @@ -13,18 +13,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --stop-on-parse-err vector_add.cu") - return is_sub_string("Cannot parse input", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --stop-on-parse-err vector_add.cu", single_case_text) + return is_sub_string("Cannot parse input", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-suppress-warnings1/do_test.py b/behavior_tests/src/ngt-suppress-warnings1/do_test.py index acd2c2b94..e9a9aa679 100644 --- a/behavior_tests/src/ngt-suppress-warnings1/do_test.py +++ b/behavior_tests/src/ngt-suppress-warnings1/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --suppress-warnings=100e") - return is_sub_string("Invalid warning ID or range:", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --suppress-warnings=100e", single_case_text) + return is_sub_string("Invalid warning ID or range:", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-suppress-warnings10/do_test.py b/behavior_tests/src/ngt-suppress-warnings10/do_test.py index 8f5b1f7be..784786916 100644 --- a/behavior_tests/src/ngt-suppress-warnings10/do_test.py +++ b/behavior_tests/src/ngt-suppress-warnings10/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --suppress-warnings=1000-1900") - return is_sub_string("Invalid warning ID or range:", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --suppress-warnings=1000-1900", single_case_text) + return is_sub_string("Invalid warning ID or range:", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-suppress-warnings11/do_test.py b/behavior_tests/src/ngt-suppress-warnings11/do_test.py index 2b5a25d21..e48050bf7 100644 --- a/behavior_tests/src/ngt-suppress-warnings11/do_test.py +++ b/behavior_tests/src/ngt-suppress-warnings11/do_test.py @@ -13,17 +13,17 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --suppress-warnings=1010-1020-1023") - return is_sub_string("Invalid warning ID or range:", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --suppress-warnings=1010-1020-1023", single_case_text) + return is_sub_string("Invalid warning ID or range:", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-suppress-warnings2/do_test.py b/behavior_tests/src/ngt-suppress-warnings2/do_test.py index faccc31a6..51e02c51e 100644 --- a/behavior_tests/src/ngt-suppress-warnings2/do_test.py +++ b/behavior_tests/src/ngt-suppress-warnings2/do_test.py @@ -13,17 +13,17 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess( test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + \ - " --suppress-warnings=999") - return is_sub_string("Invalid warning ID or range:", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess( single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + \ + " --suppress-warnings=999", single_case_text) + return is_sub_string("Invalid warning ID or range:", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-suppress-warnings3/do_test.py b/behavior_tests/src/ngt-suppress-warnings3/do_test.py index b27ab0f00..ec0b4532a 100644 --- a/behavior_tests/src/ngt-suppress-warnings3/do_test.py +++ b/behavior_tests/src/ngt-suppress-warnings3/do_test.py @@ -13,18 +13,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --suppress-warnings=1900") - return is_sub_string("Invalid warning ID or range:", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --suppress-warnings=1900", single_case_text) + return is_sub_string("Invalid warning ID or range:", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngt-suppress-warnings4/do_test.py b/behavior_tests/src/ngt-suppress-warnings4/do_test.py index f4cc1d178..e7c3e7771 100644 --- a/behavior_tests/src/ngt-suppress-warnings4/do_test.py +++ b/behavior_tests/src/ngt-suppress-warnings4/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --suppress-warnings=-1000") - return is_sub_string("Invalid warning ID or range:", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --suppress-warnings=-1000", single_case_text) + return is_sub_string("Invalid warning ID or range:", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-suppress-warnings5/do_test.py b/behavior_tests/src/ngt-suppress-warnings5/do_test.py index 4382f43d4..76a085896 100644 --- a/behavior_tests/src/ngt-suppress-warnings5/do_test.py +++ b/behavior_tests/src/ngt-suppress-warnings5/do_test.py @@ -14,19 +14,19 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --suppress-warnings=1000-") - return is_sub_string("Invalid warning ID or range:", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --suppress-warnings=1000-", single_case_text) + return is_sub_string("Invalid warning ID or range:", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-suppress-warnings6/do_test.py b/behavior_tests/src/ngt-suppress-warnings6/do_test.py index 98ada803a..2af671b9e 100644 --- a/behavior_tests/src/ngt-suppress-warnings6/do_test.py +++ b/behavior_tests/src/ngt-suppress-warnings6/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --suppress-warnings=999-1023") - return is_sub_string("Invalid warning ID or range:", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --suppress-warnings=999-1023", single_case_text) + return is_sub_string("Invalid warning ID or range:", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-suppress-warnings7/do_test.py b/behavior_tests/src/ngt-suppress-warnings7/do_test.py index bdabdf19d..9fd137908 100644 --- a/behavior_tests/src/ngt-suppress-warnings7/do_test.py +++ b/behavior_tests/src/ngt-suppress-warnings7/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --suppress-warnings=100e-1023") - return is_sub_string("Invalid warning ID or range:", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --suppress-warnings=100e-1023", single_case_text) + return is_sub_string("Invalid warning ID or range:", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-suppress-warnings8/do_test.py b/behavior_tests/src/ngt-suppress-warnings8/do_test.py index bdabdf19d..9fd137908 100644 --- a/behavior_tests/src/ngt-suppress-warnings8/do_test.py +++ b/behavior_tests/src/ngt-suppress-warnings8/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --suppress-warnings=100e-1023") - return is_sub_string("Invalid warning ID or range:", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --suppress-warnings=100e-1023", single_case_text) + return is_sub_string("Invalid warning ID or range:", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-suppress-warnings9/do_test.py b/behavior_tests/src/ngt-suppress-warnings9/do_test.py index 8198ffc04..9e27d9302 100644 --- a/behavior_tests/src/ngt-suppress-warnings9/do_test.py +++ b/behavior_tests/src/ngt-suppress-warnings9/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --suppress-warnings=1010-1020-1023") - return is_sub_string("Invalid warning ID or range:", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --suppress-warnings=1010-1020-1023", single_case_text) + return is_sub_string("Invalid warning ID or range:", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-use-dpcpp-extensions/do_test.py b/behavior_tests/src/ngt-use-dpcpp-extensions/do_test.py index 4b8ea2d96..cb48e1063 100644 --- a/behavior_tests/src/ngt-use-dpcpp-extensions/do_test.py +++ b/behavior_tests/src/ngt-use-dpcpp-extensions/do_test.py @@ -9,22 +9,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --use-dpcpp-extensions=abc") - return is_sub_string("Cannot find option named 'abc'", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --use-dpcpp-extensions=abc", single_case_text) + return is_sub_string("Cannot find option named 'abc'", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-usm-leve/do_test.py b/behavior_tests/src/ngt-usm-leve/do_test.py index 86ebb2d2e..1817aab94 100644 --- a/behavior_tests/src/ngt-usm-leve/do_test.py +++ b/behavior_tests/src/ngt-usm-leve/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " --usm-leve=abc") - return is_sub_string("Unknown command line argument '--usm-leve=abc'", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " --usm-leve=abc", single_case_text) + return is_sub_string("Unknown command line argument '--usm-leve=abc'", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-usm-level/do_test.py b/behavior_tests/src/ngt-usm-level/do_test.py index ac878950f..e7abb120f 100644 --- a/behavior_tests/src/ngt-usm-level/do_test.py +++ b/behavior_tests/src/ngt-usm-level/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + \ - " --usm-level=abc") - return is_sub_string("--usm-level option: Cannot find option named 'abc'", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + \ + " --usm-level=abc", single_case_text) + return is_sub_string("--usm-level option: Cannot find option named 'abc'", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-vcxproj-does-not-exist/do_test.py b/behavior_tests/src/ngt-vcxproj-does-not-exist/do_test.py index d768ed26a..b26fe76c4 100644 --- a/behavior_tests/src/ngt-vcxproj-does-not-exist/do_test.py +++ b/behavior_tests/src/ngt-vcxproj-does-not-exist/do_test.py @@ -10,21 +10,21 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --vcxprojfile=aaa.vcxproj --cuda-include-path=" + test_config.include_path) - return is_sub_string("Cannot Open VcxprojFile", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --vcxprojfile=aaa.vcxproj --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("Cannot Open VcxprojFile", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-vcxproj-to-db-fail/do_test.py b/behavior_tests/src/ngt-vcxproj-to-db-fail/do_test.py index 50e7f9dcb..6610e371d 100644 --- a/behavior_tests/src/ngt-vcxproj-to-db-fail/do_test.py +++ b/behavior_tests/src/ngt-vcxproj-to-db-fail/do_test.py @@ -13,22 +13,22 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess("icacls ./source /deny Everyone\:\(WD\)") + call_subprocess("icacls ./source /deny Everyone\:\(WD\)", single_case_text) vcxproj_path = os.path.join(os.getcwd(), "source", "aaa.vcxproj") source_path = os.path.join(os.getcwd(), "source", "simple_foo.cu") - call_subprocess(test_config.CT_TOOL + " " + source_path + " --vcxprojfile=\"" + vcxproj_path + "\" --cuda-include-path=" + test_config.include_path) - call_subprocess("icacls ./source /grant Everyone\:\(WD\)") - return is_sub_string("Cannot create CompilationDatabase", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " " + source_path + " --vcxprojfile=\"" + vcxproj_path + "\" --cuda-include-path=" + single_case_text.include_path, single_case_text) + call_subprocess("icacls ./source /grant Everyone\:\(WD\)", single_case_text) + return is_sub_string("Cannot create CompilationDatabase", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngt-win-invalid-yaml-for-header4/do_test.py b/behavior_tests/src/ngt-win-invalid-yaml-for-header4/do_test.py index 931e51d46..91c463f1b 100644 --- a/behavior_tests/src/ngt-win-invalid-yaml-for-header4/do_test.py +++ b/behavior_tests/src/ngt-win-invalid-yaml-for-header4/do_test.py @@ -13,13 +13,13 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " hello.h --out-root=out --cuda-include-path=" + \ - os.environ["CUDA_INCLUDE_PATH"]) +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " hello.h --out-root=out --cuda-include-path=" + \ + os.environ["CUDA_INCLUDE_PATH"], single_case_text) migrated_yaml = os.path.join("out", "hello.h.yaml") with open(migrated_yaml, "r") as f: file_data = f.read() @@ -28,16 +28,16 @@ def migrate_test(): with open(migrated_yaml, "w") as f: f.write(file_data) - call_subprocess(test_config.CT_TOOL + " hello.h --out-root=out --cuda-include-path=" + \ - os.environ["CUDA_INCLUDE_PATH"]) - if "differnt path" in test_config.command_output: + call_subprocess(single_case_text.CT_TOOL + " hello.h --out-root=out --cuda-include-path=" + \ + os.environ["CUDA_INCLUDE_PATH"], single_case_text) + if "differnt path" in single_case_text.print_text: return True print("not catch the error: unkown key constantFla") return False -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/ngti-cdb-path-len/do_test.py b/behavior_tests/src/ngti-cdb-path-len/do_test.py index ebb534b77..46c5ee069 100644 --- a/behavior_tests/src/ngti-cdb-path-len/do_test.py +++ b/behavior_tests/src/ngti-cdb-path-len/do_test.py @@ -13,11 +13,11 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): max_len = 511 if (platform.system() == 'Windows'): max_len = 32 @@ -27,11 +27,11 @@ def migrate_test(): long_path = os.path.join(long_path, "test_path") os.path.join(long_path, "name") call_subprocess("intercept-build --cdb " + - long_path) - return is_sub_string("File name", test_config.command_output) + long_path, single_case_text) + return is_sub_string("File name", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngti-empty-make/do_test.py b/behavior_tests/src/ngti-empty-make/do_test.py index 291ae9c42..82bfeffbc 100644 --- a/behavior_tests/src/ngti-empty-make/do_test.py +++ b/behavior_tests/src/ngti-empty-make/do_test.py @@ -13,16 +13,16 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess("intercept-build make") - return is_sub_string("No targets", test_config.command_output) +def migrate_test(single_case_text): + call_subprocess("intercept-build make", single_case_text) + return is_sub_string("No targets", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/ngtn-database-fail/do_test.py b/behavior_tests/src/ngtn-database-fail/do_test.py index 4a225f5a1..04d31a3cb 100644 --- a/behavior_tests/src/ngtn-database-fail/do_test.py +++ b/behavior_tests/src/ngtn-database-fail/do_test.py @@ -10,22 +10,22 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + - " -p=. -in-root=./ -out-root=out") - return is_sub_string("Cannot parse compilation database", test_config.command_output) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + + " -p=. -in-root=./ -out-root=out", single_case_text) + return is_sub_string("Cannot parse compilation database", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/nominmax_bd/do_test.py b/behavior_tests/src/nominmax_bd/do_test.py index 8b6208ec8..64950708e 100644 --- a/behavior_tests/src/nominmax_bd/do_test.py +++ b/behavior_tests/src/nominmax_bd/do_test.py @@ -13,17 +13,17 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): return True -def build_test(): +def build_test(single_case_text): srcs = [] srcs.append(os.path.join("sycl", "hello.cpp")) - return compile_and_link(srcs) + return compile_and_link(srcs, single_case_text) -def run_test(): - os.environ["ONEAPI_DEVICE_SELECTOR"] = test_config.device_filter - return run_binary_with_args() \ No newline at end of file +def run_test(single_case_text): + os.environ["ONEAPI_DEVICE_SELECTOR"] = single_case_text.device_filter + return run_binary_with_args(single_case_text) \ No newline at end of file diff --git a/behavior_tests/src/open-source-mkl-compile/do_test.py b/behavior_tests/src/open-source-mkl-compile/do_test.py index cdfd75e7a..f549865c5 100644 --- a/behavior_tests/src/open-source-mkl-compile/do_test.py +++ b/behavior_tests/src/open-source-mkl-compile/do_test.py @@ -11,26 +11,26 @@ from test_utils import * -def setup_test(): +def setup_test(single_case_text): print("ONEMKLROOT =", end = " ") print(os.environ["ONEMKLROOT"]) if not os.path.exists(os.environ["ONEMKLROOT"] + "/include"): print("The path '${ONEMKLROOT}/include' is not exist!") return False - change_dir(test_config.current_test) + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): return True -def build_test(): +def build_test(single_case_text): cmp_opts = ["-I${ONEMKLROOT}/include"] ret = False - ret = compile_files(["main.dp.cpp"], cmp_opts) + ret = compile_files(["main.dp.cpp"], single_case_text, cmp_opts) return ret -def run_test(): +def run_test(single_case_text): return True diff --git a/behavior_tests/src/path_validation_0/do_test.py b/behavior_tests/src/path_validation_0/do_test.py index 76b74c92c..134139097 100644 --- a/behavior_tests/src/path_validation_0/do_test.py +++ b/behavior_tests/src/path_validation_0/do_test.py @@ -13,20 +13,20 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - change_dir("helloworld") - call_subprocess("intercept-build /usr/bin/make") - change_dir("..") - call_subprocess("mv helloworld helloworld_tst") - call_subprocess(test_config.CT_TOOL + " -in-root=helloworld_tst/src/rootdir helloworld_tst/src/test.cu --cuda-include-path=" + test_config.include_path) - return is_sub_string("is not under the specified input root directory", test_config.command_output) +def migrate_test(single_case_text): + change_dir("helloworld", single_case_text) + call_subprocess("intercept-build /usr/bin/make", single_case_text) + change_dir("..", single_case_text) + call_subprocess("mv helloworld helloworld_tst", single_case_text) + call_subprocess(single_case_text.CT_TOOL + " -in-root=helloworld_tst/src/rootdir helloworld_tst/src/test.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("is not under the specified input root directory", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/path_validation_1/do_test.py b/behavior_tests/src/path_validation_1/do_test.py index a46706c6f..12e52ed02 100644 --- a/behavior_tests/src/path_validation_1/do_test.py +++ b/behavior_tests/src/path_validation_1/do_test.py @@ -13,20 +13,20 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - change_dir("helloworld") - call_subprocess("intercept-build /usr/bin/make") - change_dir("..") - call_subprocess("mv helloworld helloworld_tst") - call_subprocess(test_config.CT_TOOL + " -in-root=helloworld_tst/src/rootdir helloworld_tst/src/rootdir/../test.cu --cuda-include-path=" + test_config.include_path) - return is_sub_string("is not under the specified input root directory", test_config.command_output) +def migrate_test(single_case_text): + change_dir("helloworld", single_case_text) + call_subprocess("intercept-build /usr/bin/make", single_case_text) + change_dir("..", single_case_text) + call_subprocess("mv helloworld helloworld_tst", single_case_text) + call_subprocess(single_case_text.CT_TOOL + " -in-root=helloworld_tst/src/rootdir helloworld_tst/src/rootdir/../test.cu --cuda-include-path=" + single_case_text.include_path, single_case_text) + return is_sub_string("is not under the specified input root directory", single_case_text.print_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/relative_path_test/do_test.py b/behavior_tests/src/relative_path_test/do_test.py index 81c7dabfd..c4b384024 100644 --- a/behavior_tests/src/relative_path_test/do_test.py +++ b/behavior_tests/src/relative_path_test/do_test.py @@ -13,18 +13,18 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - change_dir("build") - call_subprocess(test_config.CT_TOOL + " -in-root ../src -out-root ../sycl -p ./ --cuda-include-path=" + test_config.include_path) - change_dir("..") +def migrate_test(single_case_text): + change_dir("build", single_case_text) + call_subprocess(single_case_text.CT_TOOL + " -in-root ../src -out-root ../sycl -p ./ --cuda-include-path=" + single_case_text.include_path, single_case_text) + change_dir("..", single_case_text) return os.path.exists(os.path.join("sycl", "kernel.dp.cpp")) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/sh-ct-1306/do_test.py b/behavior_tests/src/sh-ct-1306/do_test.py index 5364b2822..2b0777d4b 100644 --- a/behavior_tests/src/sh-ct-1306/do_test.py +++ b/behavior_tests/src/sh-ct-1306/do_test.py @@ -13,15 +13,15 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - os.environ["CUDA_INCLUDE_PATH"] = test_config.include_path - return call_subprocess("/bin/bash sh-ct-1306.sh") +def migrate_test(single_case_text): + os.environ["CUDA_INCLUDE_PATH"] = single_case_text.include_path + return call_subprocess("/bin/bash sh-ct-1306.sh", single_case_text) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/src/test_soft_link_folder/do_test.py b/behavior_tests/src/test_soft_link_folder/do_test.py index 7de2a15a1..d1680fe56 100644 --- a/behavior_tests/src/test_soft_link_folder/do_test.py +++ b/behavior_tests/src/test_soft_link_folder/do_test.py @@ -13,8 +13,8 @@ from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) prepare_soft_link_folder() return True @@ -22,15 +22,15 @@ def setup_test(): def prepare_soft_link_folder(): os.symlink("cuda_", "cuda") -def migrate_test(): +def migrate_test(single_case_text): src = [os.path.join("cuda", "test_soft_link_folder.cu")] in_root = "" extra_args = "" - return do_migrate(src, in_root, test_config.out_root, extra_args) + return do_migrate(src, in_root, single_case_text.out_root, single_case_text, extra_args) -def build_test(): +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/behavior_tests/test_behavior.py b/behavior_tests/test_behavior.py index ba7e02205..4ed21a657 100644 --- a/behavior_tests/test_behavior.py +++ b/behavior_tests/test_behavior.py @@ -15,36 +15,36 @@ from test_utils import * -def setup_test(): +def setup_test(single_case_text): return True -def migrate_test(): +def migrate_test(single_case_text): src = [] extra_args = [] - in_root = os.path.join(os.getcwd(), test_config.current_test) - test_config.out_root = os.path.join(in_root, 'out_root') + in_root = os.path.join(os.getcwd(), single_case_text.name) + single_case_text.out_root = os.path.join(in_root, 'out_root') for dirpath, dirnames, filenames in os.walk(in_root): for filename in [f for f in filenames if re.match('.*(cu|cpp|c)$', f)]: src.append(os.path.abspath(os.path.join(dirpath, filename))) - return do_migrate(src, in_root, test_config.out_root, extra_args) + return do_migrate(src, in_root, single_case_text.out_root, single_case_text, extra_args) -def build_test(): - if (os.path.exists(test_config.current_test)): - os.chdir(test_config.current_test) +def build_test(single_case_text): + if (os.path.exists(single_case_text.name)): + os.chdir(single_case_text.name) srcs = [] cmp_opts = '' link_opts = '' objects = '' - for dirpath, dirnames, filenames in os.walk(test_config.out_root): + for dirpath, dirnames, filenames in os.walk(single_case_text.out_root): for filename in [f for f in filenames if re.match('.*(cpp|c)$', f)]: srcs.append(os.path.abspath(os.path.join(dirpath, filename))) ret = False - ret = compile_files(srcs, cmp_opts) + ret = compile_files(srcs, single_case_text, cmp_opts) return ret -def run_test(): +def run_test(single_case_text): return True diff --git a/features/feature_case/backprop/do_test.py b/features/feature_case/backprop/do_test.py index 52693f2af..deff15757 100644 --- a/features/feature_case/backprop/do_test.py +++ b/features/feature_case/backprop/do_test.py @@ -10,18 +10,18 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): - call_subprocess(test_config.CT_TOOL + " -out-root=./ backprop.c --cuda-include-path=" + test_config.include_path + " --") - return is_sub_string("Migration not necessary; no CUDA code detected", test_config.command_output) -def build_test(): +def migrate_test(single_case_text): + call_subprocess(single_case_text.CT_TOOL + " -out-root=./ backprop.c --cuda-include-path=" + single_case_text.include_path + " --", single_case_text) + return is_sub_string("Migration not necessary; no CUDA code detected", single_case_text.print_text) +def build_test(single_case_text): return True -def run_test(): +def run_test(single_case_text): return True \ No newline at end of file diff --git a/features/feature_case/cudnn_multiple_files/do_test.py b/features/feature_case/cudnn_multiple_files/do_test.py index d63cf2167..ad04b8cd1 100644 --- a/features/feature_case/cudnn_multiple_files/do_test.py +++ b/features/feature_case/cudnn_multiple_files/do_test.py @@ -10,25 +10,25 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): # clean previous migration output if (os.path.exists("dpct_output")): shutil.rmtree("dpct_output") - call_subprocess("sed 's/main/scale_main/' cudnn-scale.cu --in-place") - call_subprocess("sed 's/main/sum_main/' cudnn-sum.cu --in-place") - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " multiple_main.cpp cudnn-scale.cu cudnn-sum.cu") + call_subprocess("sed 's/main/scale_main/' cudnn-scale.cu --in-place", single_case_text) + call_subprocess("sed 's/main/sum_main/' cudnn-sum.cu --in-place", single_case_text) + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " multiple_main.cpp cudnn-scale.cu cudnn-sum.cu", single_case_text) return os.path.exists(os.path.join("dpct_output", "cudnn-scale.dp.cpp")) -def build_test(): +def build_test(single_case_text): srcs = [] objects = [] cmp_options = [] @@ -36,16 +36,16 @@ def build_test(): cmp_options.append("-DMKL_ILP64") if platform.system() == 'Linux': - linkopt = test_config.mkl_link_opt_lin + linkopt = single_case_text.mkl_link_opt_lin linkopt.append(" -ldnnl") else: - linkopt = test_config.mkl_link_opt_win + linkopt = single_case_text.mkl_link_opt_win linkopt.append(" dnnl.lib") srcs.append(os.path.join("dpct_output", "multiple_main.cpp")) srcs.append(os.path.join("dpct_output", "cudnn-scale.dp.cpp")) srcs.append(os.path.join("dpct_output", "cudnn-sum.dp.cpp")) - return compile_and_link(srcs, cmp_options, objects, linkopt) + return compile_and_link(srcs, single_case_text, cmp_options, objects, linkopt) -def run_test(): - return call_subprocess(os.path.join(os.path.curdir, test_config.current_test + '.run ')) +def run_test(single_case_text): + return call_subprocess(os.path.join(os.path.curdir, single_case_text.name + '.run '), single_case_text) diff --git a/features/feature_case/kernel_library/do_test.py b/features/feature_case/kernel_library/do_test.py index 36b5f0f57..3f7c0abd7 100644 --- a/features/feature_case/kernel_library/do_test.py +++ b/features/feature_case/kernel_library/do_test.py @@ -10,32 +10,32 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): # clean previous migration output if (os.path.exists("dpct_output")): shutil.rmtree("dpct_output") - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " kernel_library.cpp jit.cu --extra-arg=--ptx") + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " kernel_library.cpp jit.cu --extra-arg=--ptx", single_case_text) return os.path.exists(os.path.join("dpct_output", "kernel_library.cpp.dp.cpp")) -def build_test(): +def build_test(single_case_text): # make shared library if (platform.system() == 'Windows'): - ret = call_subprocess("icpx -fsycl dpct_output/jit.dp.cpp -shared -o premade.ptx") + ret = call_subprocess("icpx -fsycl dpct_output/jit.dp.cpp -shared -o premade.ptx", single_case_text) else: - ret = call_subprocess(test_config.DPCXX_COM + " dpct_output/jit.dp.cpp -fPIC -shared -o premade.ptx") + ret = call_subprocess(single_case_text.DPCXX_COM + " dpct_output/jit.dp.cpp -fPIC -shared -o premade.ptx", single_case_text) if not ret: print("Could not make premade.ptx shared library.") return False srcs = [] srcs.append(os.path.join("dpct_output", "kernel_library.cpp.dp.cpp")) - return compile_and_link(srcs, linkopt=["-lstdc++fs"]) -def run_test(): - return call_subprocess(os.path.join(os.path.curdir, test_config.current_test + '.run ')) + return compile_and_link(srcs, single_case_text, linkopt=["-lstdc++fs"]) +def run_test(single_case_text): + return call_subprocess(os.path.join(os.path.curdir, single_case_text.name + '.run '), single_case_text) diff --git a/features/feature_case/module/do_test.py b/features/feature_case/module/do_test.py index efe66ae5a..e06fccfd2 100644 --- a/features/feature_case/module/do_test.py +++ b/features/feature_case/module/do_test.py @@ -10,26 +10,26 @@ import platform import os import sys -from test_config import CT_TOOL + from test_utils import * -def setup_test(): - change_dir(test_config.current_test) +def setup_test(single_case_text): + change_dir(single_case_text.name, single_case_text) return True -def migrate_test(): +def migrate_test(single_case_text): # clean previous migration output if (os.path.exists("dpct_output")): shutil.rmtree("dpct_output") - call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " module-helper.cpp module-main.cu module-kernel.cu --extra-arg=--ptx") + call_subprocess(single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + " module-helper.cpp module-main.cu module-kernel.cu --extra-arg=--ptx", single_case_text) return os.path.exists(os.path.join("dpct_output", "module-kernel.dp.cpp")) -def build_test(): +def build_test(single_case_text): # make shared library if (platform.system() == 'Windows'): - ret = call_subprocess("icpx -fsycl dpct_output/module-kernel.dp.cpp -shared -o module-kernel.dll") + ret = call_subprocess("icpx -fsycl dpct_output/module-kernel.dp.cpp -shared -o module-kernel.dll", single_case_text) else: - ret = call_subprocess(test_config.DPCXX_COM + " dpct_output/module-kernel.dp.cpp -fPIC -shared -o module-kernel.so") + ret = call_subprocess(single_case_text.DPCXX_COM + " dpct_output/module-kernel.dp.cpp -fPIC -shared -o module-kernel.so", single_case_text) if not ret: print("Could not make module-kernel.* shared library.") return False @@ -37,6 +37,6 @@ def build_test(): srcs = [] srcs.append(os.path.join("dpct_output", "module-helper.cpp")) srcs.append(os.path.join("dpct_output", "module-main.dp.cpp")) - return compile_and_link(srcs) -def run_test(): - return call_subprocess(os.path.join(os.path.curdir, test_config.current_test + '.run ')) + return compile_and_link(srcs, single_case_text) +def run_test(single_case_text): + return call_subprocess(os.path.join(os.path.curdir, single_case_text.name + '.run '), single_case_text) diff --git a/features/test_feature.py b/features/test_feature.py index 710f22059..ea2f8e31b 100644 --- a/features/test_feature.py +++ b/features/test_feature.py @@ -54,17 +54,17 @@ occupancy_calculation_exper = ['occupancy_calculation'] -def setup_test(): +def setup_test(single_case_text): return True -def migrate_test(): +def migrate_test(single_case_text): src = [] extra_args = [] - in_root = os.path.join(os.getcwd(), test_config.current_test) - test_config.out_root = os.path.join(in_root, 'out_root') + in_root = os.path.join(os.getcwd(), single_case_text.name) + single_case_text.out_root = os.path.join(in_root, 'out_root') - if test_config.current_test == 'cufft_test': - return do_migrate([os.path.join(in_root, 'cufft_test.cu')], in_root, test_config.out_root, extra_args) + if single_case_text.name == 'cufft_test': + return do_migrate([os.path.join(in_root, 'cufft_test.cu')], in_root, single_case_text.out_root, single_case_text, extra_args) for dirpath, dirnames, filenames in os.walk(in_root): for filename in [f for f in filenames if re.match('.*(cu|cpp|c)$', f)]: @@ -75,23 +75,23 @@ def migrate_test(): math_extension_tests = ['math-ext-double', 'math-ext-float', 'math-ext-half', 'math-ext-half2', 'math-ext-simd'] - if test_config.current_test in nd_range_bar_exper: + if single_case_text.name in nd_range_bar_exper: src.append(' --use-experimental-features=nd_range_barrier ') - if test_config.current_test == "user_defined_rules": + if single_case_text.name == "user_defined_rules": src.append(' --rule-file=./user_defined_rules/rules.yaml') - if test_config.current_test in logical_group_exper: + if single_case_text.name in logical_group_exper: src.append(' --use-experimental-features=logical-group ') - if test_config.current_test == 'math_intel_specific': + if single_case_text.name == 'math_intel_specific': src.append(' --rule-file=./math_intel_specific/intel_specific_math.yaml') - if test_config.current_test in math_extension_tests: + if single_case_text.name in math_extension_tests: src.append(' --use-dpcpp-extensions=intel_device_math') - if test_config.current_test in occupancy_calculation_exper: + if single_case_text.name in occupancy_calculation_exper: src.append(' --use-experimental-features=occupancy-calculation ') - if test_config.current_test == 'feature_profiling': + if single_case_text.name == 'feature_profiling': src.append(' --enable-profiling ') - if test_config.current_test == 'sync_warp_p2': + if single_case_text.name == 'sync_warp_p2': src.append(' --use-experimental-features=masked-sub-group-operation ') - return do_migrate(src, in_root, test_config.out_root, extra_args) + return do_migrate(src, in_root, single_case_text.out_root, single_case_text, extra_args) def manual_fix_for_cufft_external_workspace(migrated_file): lines = [] @@ -120,9 +120,9 @@ def manual_fix_for_occupancy_calculation(migrated_file): for line in lines: out_f.write(line) -def build_test(): - if (os.path.exists(test_config.current_test)): - os.chdir(test_config.current_test) +def build_test(single_case_text): + if (os.path.exists(single_case_text.name)): + os.chdir(single_case_text.name) srcs = [] cmp_options = [] link_opts = [] @@ -139,53 +139,53 @@ def build_test(): 'cudnn-types', 'cudnn-version', 'cudnn-dropout' ] - if test_config.current_test in oneDPL_related: - cmp_options.append(prepare_oneDPL_specific_macro()) + if single_case_text.name in oneDPL_related: + cmp_options.append(prepare_oneDPL_specific_macro(single_case_text)) - if re.match('^cu.*', test_config.current_test): + if re.match('^cu.*', single_case_text.name): if platform.system() == 'Linux': - link_opts = test_config.mkl_link_opt_lin + link_opts = single_case_text.mkl_link_opt_lin else: - link_opts = test_config.mkl_link_opt_win + link_opts = single_case_text.mkl_link_opt_win cmp_options.append("-DMKL_ILP64") - if test_config.current_test.startswith('ccl-test'): + if single_case_text.name.startswith('ccl-test'): link_opts.append('-lccl -lmpi') - for dirpath, dirnames, filenames in os.walk(test_config.out_root): + for dirpath, dirnames, filenames in os.walk(single_case_text.out_root): for filename in [f for f in filenames if re.match('.*(cpp|c)$', f)]: srcs.append(os.path.abspath(os.path.join(dirpath, filename))) if platform.system() == 'Linux': link_opts.append(' -lpthread ') - if test_config.current_test in oneDNN_related: + if single_case_text.name in oneDNN_related: if platform.system() == 'Linux': link_opts.append(' -ldnnl') else: link_opts.append(' dnnl.lib') ret = False - if (test_config.current_test == 'cufft-external-workspace'): + if (single_case_text.name == 'cufft-external-workspace'): manual_fix_for_cufft_external_workspace(srcs[0]) - if (test_config.current_test in occupancy_calculation_exper): + if (single_case_text.name in occupancy_calculation_exper): manual_fix_for_occupancy_calculation(srcs[0]) - if test_config.current_test == 'cufft_test': - ret = compile_and_link([os.path.join(test_config.out_root, 'cufft_test.dp.cpp')], cmp_options, objects, link_opts) - elif test_config.current_test in exec_tests: - ret = compile_and_link(srcs, cmp_options, objects, link_opts) - elif re.match('^cufft.*', test_config.current_test) and platform.system() == 'Linux': - ret = compile_and_link(srcs, cmp_options, objects, link_opts) + if single_case_text.name == 'cufft_test': + ret = compile_and_link([os.path.join(single_case_text.out_root, 'cufft_test.dp.cpp')], single_case_text, cmp_options, objects, link_opts) + elif single_case_text.name in exec_tests: + ret = compile_and_link(srcs, single_case_text, cmp_options, objects, link_opts) + elif re.match('^cufft.*', single_case_text.name) and platform.system() == 'Linux': + ret = compile_and_link(srcs, single_case_text, cmp_options, objects, link_opts) else: - ret = compile_files(srcs, cmp_options) + ret = compile_files(srcs, single_case_text, cmp_options) return ret -def run_test(): - if test_config.current_test not in exec_tests: +def run_test(single_case_text): + if single_case_text.name not in exec_tests: return True - os.environ['ONEAPI_DEVICE_SELECTOR'] = test_config.device_filter + os.environ['ONEAPI_DEVICE_SELECTOR'] = single_case_text.device_filter os.environ['CL_CONFIG_CPU_EXPERIMENTAL_FP16']="1" - if test_config.current_test.startswith('ccl-test'): - return call_subprocess('mpirun -n 2 ' + os.path.join(os.path.curdir, test_config.current_test + '.run ')) - return run_binary_with_args() + if single_case_text.name.startswith('ccl-test'): + return call_subprocess('mpirun -n 2 ' + os.path.join(os.path.curdir, single_case_text.name + '.run '),single_case_text) + return run_binary_with_args(single_case_text) diff --git a/help_function/test_help.py b/help_function/test_help.py index 1ccb5db39..c1f0c83a9 100644 --- a/help_function/test_help.py +++ b/help_function/test_help.py @@ -15,16 +15,16 @@ from test_utils import * -def setup_test(): +def setup_test(single_case_text): return True -def migrate_test(): +def migrate_test(single_case_text): return True -def build_test(): - if (os.path.exists(test_config.current_test)): - os.chdir(test_config.current_test) - test_config.out_root = os.getcwd() +def build_test(single_case_text): + if (os.path.exists(single_case_text.name)): + os.chdir(single_case_text.name) + single_case_text.out_root = os.getcwd() lpthread_link_cases = ["devicemgr_multi_thread_aware", "memory_async_dpct_free", "blas_extension_api_usm", "blas_extension_api_buffer", "fft_utils_engine_buffer", "fft_utils_engine_usm", @@ -56,61 +56,61 @@ def build_test(): link_opts = [] objects = [] - if test_config.current_test in oneDPL_related: - cmp_opts.append(prepare_oneDPL_specific_macro()) - if test_config.current_test in lpthread_link_cases and platform.system() == "Linux": + if single_case_text.name in oneDPL_related: + cmp_opts.append(prepare_oneDPL_specific_macro(single_case_text)) + if single_case_text.name in lpthread_link_cases and platform.system() == "Linux": link_opts.append("-lpthread") - for dirpath, dirnames, filenames in os.walk(test_config.out_root): - srcs.append(os.path.abspath(os.path.join(dirpath, test_config.current_test + ".cpp"))) + for dirpath, dirnames, filenames in os.walk(single_case_text.out_root): + srcs.append(os.path.abspath(os.path.join(dirpath, single_case_text.name + ".cpp"))) ret = False - if test_config.current_test == "test_default_queue_2": + if single_case_text.name == "test_default_queue_2": srcs.append("test_default_queue_1.cpp") - if test_config.current_test == "kernel_function_lin": - ret = call_subprocess(test_config.DPCXX_COM + " -shared -fPIC -o module.so kernel_module_lin.cpp") + if single_case_text.name == "kernel_function_lin": + ret = call_subprocess(single_case_text.DPCXX_COM + " -shared -fPIC -o module.so kernel_module_lin.cpp", single_case_text) if not ret: print("kernel_function_lin created the shared lib failed.") return False - if test_config.current_test == "kernel_function_win": - ret = call_subprocess("icx-cl -fsycl /EHsc /LD kernel_module_win.cpp /link /OUT:module.dll") + if single_case_text.name == "kernel_function_win": + ret = call_subprocess("icx-cl -fsycl /EHsc /LD kernel_module_win.cpp /link /OUT:module.dll", single_case_text) if not ret: print("kernel_function_win created the shared lib failed.") return False - if test_config.current_test in oneDNN_related: + if single_case_text.name in oneDNN_related: if platform.system() == 'Linux': link_opts.append(' -ldnnl') else: link_opts.append(' dnnl.lib') - if (test_config.current_test in blas_cases) or (test_config.current_test in fft_cases) or ( - test_config.current_test in lapack_cases) or (test_config.current_test in rng_cases) or ( - test_config.current_test in oneDNN_related) or (test_config.current_test in sparse_cases): + if (single_case_text.name in blas_cases) or (single_case_text.name in fft_cases) or ( + single_case_text.name in lapack_cases) or (single_case_text.name in rng_cases) or ( + single_case_text.name in oneDNN_related) or (single_case_text.name in sparse_cases): mkl_opts = [] if platform.system() == "Linux": - mkl_opts = test_config.mkl_link_opt_lin + mkl_opts = single_case_text.mkl_link_opt_lin else: - mkl_opts = test_config.mkl_link_opt_win + mkl_opts = single_case_text.mkl_link_opt_win link_opts += mkl_opts cmp_opts.append("-DMKL_ILP64") - if test_config.current_test == 'fft_utils_engine_buffer' or test_config.current_test == 'fft_utils_engine_usm': - ret = compile_and_link([os.path.join(test_config.out_root, 'cufft_test.dp.cpp')], cmp_opts, objects, link_opts) + if single_case_text.name == 'fft_utils_engine_buffer' or single_case_text.name == 'fft_utils_engine_usm': + ret = compile_and_link([os.path.join(single_case_text.out_root, 'cufft_test.dp.cpp')], single_case_text, cmp_opts, objects, link_opts) else: - ret = compile_and_link(srcs, cmp_opts, objects, link_opts) + ret = compile_and_link(srcs, single_case_text, cmp_opts, objects, link_opts) return ret -def run_test(): - os.environ["ONEAPI_DEVICE_SELECTOR"] = test_config.device_filter +def run_test(single_case_text): + os.environ["ONEAPI_DEVICE_SELECTOR"] = single_case_text.device_filter args = [] - if test_config.current_test == "kernel_function_lin": + if single_case_text.name == "kernel_function_lin": args.append("./module.so") - if test_config.current_test == "kernel_function_win": + if single_case_text.name == "kernel_function_win": args.append("./module.dll") os.environ['CL_CONFIG_CPU_EXPERIMENTAL_FP16']="1" - ret = run_binary_with_args(args) - if test_config.current_test == "async_exception" and "Caught asynchronous SYCL exception" in test_config.command_output and "test_dpct_async_handler" in test_config.command_output: + ret = run_binary_with_args(single_case_text, args) + if single_case_text.name == "async_exception" and "Caught asynchronous SYCL exception" in single_case_text.print_text and "test_dpct_async_handler" in single_case_text.print_text: return True return ret diff --git a/regressions/test_regression.py b/regressions/test_regression.py index 39e5dcee1..5ad8b4194 100644 --- a/regressions/test_regression.py +++ b/regressions/test_regression.py @@ -17,56 +17,56 @@ from test_utils import * -def setup_test(): +def setup_test(single_case_text): return True -def migrate_test(): - if test_config.current_test in ["test-1399", "test-1247"]: - os.chdir(test_config.current_test) - return call_subprocess("sh ./run.sh") +def migrate_test(single_case_text): + if single_case_text.name in ["test-1399", "test-1247"]: + os.chdir(single_case_text.name) + return call_subprocess("sh ./run.sh", single_case_text) src = [] extra_args = [] - in_root = os.path.join(os.getcwd(), test_config.current_test) + in_root = os.path.join(os.getcwd(), single_case_text.name) - test_config.out_root = os.path.join(in_root, 'out_root') + single_case_text.out_root = os.path.join(in_root, 'out_root') for dirpath, dirnames, filenames in os.walk(in_root): for filename in [f for f in filenames if re.match('.*(cu|cpp|c)$', f)]: src.append(os.path.abspath(os.path.join(dirpath, filename))) - return do_migrate(src, in_root, test_config.out_root, extra_args) + return do_migrate(src, in_root, single_case_text.out_root, single_case_text, extra_args) -def build_test(): - if test_config.current_test in ["test-1399", "test-1247"]: +def build_test(single_case_text): + if single_case_text.name in ["test-1399", "test-1247"]: return True - if (os.path.exists(test_config.current_test)): - os.chdir(test_config.current_test) + if (os.path.exists(single_case_text.name)): + os.chdir(single_case_text.name) srcs = [] cmp_opts = [] link_opts = [] objects = [] - for dirpath, dirnames, filenames in os.walk(test_config.out_root): + for dirpath, dirnames, filenames in os.walk(single_case_text.out_root): for filename in [f for f in filenames if re.match('.*(cpp|c)$', f)]: srcs.append(os.path.abspath(os.path.join(dirpath, filename))) mkl_related_cases = ["test-1585", "test-1554", "test-1765", "test-1766a", "test-1766b", \ "test-850a", "test-850b", "test-850c"] - if test_config.current_test in mkl_related_cases: + if single_case_text.name in mkl_related_cases: if platform.system() == 'Linux': - link_opts = test_config.mkl_link_opt_lin + link_opts = single_case_text.mkl_link_opt_lin else: - link_opts = test_config.mkl_link_opt_win + link_opts = single_case_text.mkl_link_opt_win ret = False - ret = compile_and_link(srcs, cmp_opts, objects, link_opts) + ret = compile_and_link(srcs, single_case_text, cmp_opts, objects, link_opts) return ret -def run_test(): +def run_test(single_case_text): args = [] - if test_config.current_test in ["test-1399", "test-1247", "test-1662"]: + if single_case_text.name in ["test-1399", "test-1247", "test-1662"]: return True - if test_config.current_test == "test-1601": + if single_case_text.name == "test-1601": args.append("12 12 12") - os.environ['ONEAPI_DEVICE_SELECTOR'] = test_config.device_filter - return run_binary_with_args(args) + os.environ['ONEAPI_DEVICE_SELECTOR'] = single_case_text.device_filter + return run_binary_with_args(single_case_text, args) diff --git a/run_test.py b/run_test.py index 6e8d1ee9e..e1ba9fe73 100644 --- a/run_test.py +++ b/run_test.py @@ -24,6 +24,7 @@ from test_utils import * +import multiprocessing class suite_config: def __init__(self, suite_name, test_config_map, suite_deps_files): @@ -62,6 +63,48 @@ def __init__(self, case_name, test_dep_files, option_rule_list, platform_rule_li self.platform_rule_list = platform_rule_list self.split_group = split_group +class case_text: + def __init__(self, single_run_config, case_name, command_file = "", command_text = "", log_file = "", log_text = "", + result_file = "", result_text = "", print_text = ""): + self.name = case_name + self.command_file = command_file + self.command_text = command_text + self.log_file = log_file + self.log_text = log_text + self.result_file = result_file + self.result_text = result_text + self.print_text = print_text + self.test_status = "SKIPPED" + self.out_root = "" + self.run_flag = False + self.case_workspace = "" + self.mkl_link_opt_lin = ["-lmkl_intel_ilp64", "-lmkl_sequential", "-lmkl_core", + "-lOpenCL", "-lmkl_sycl", "-lpthread", "-ldl"] + self.mkl_link_opt_win = ["mkl_sycl_dll.lib", "mkl_intel_ilp64_dll.lib", + "mkl_sequential_dll.lib", "mkl_core_dll.lib", "OpenCL.lib"] + self.DPCXX_COM = single_run_config.DPCXX_COM + self.CT_TOOL = single_run_config.CT_TOOL + self.include_path = single_run_config.include_path + self.migrate_option = single_run_config.migrate_option + self.timeout = single_run_config.timeout + self.device_filter = single_run_config.device_filter + self.cuda_ver = single_run_config.cuda_ver + self.test_option = single_run_config.test_option + self.device = single_run_config.device + +class case_run_config: + def __init__(self, DPCXX_COM, CT_TOOL, include_path, migrate_option, timeout, device_filter, cuda_ver, test_option, backend_device): + self.DPCXX_COM = DPCXX_COM + self.CT_TOOL = CT_TOOL + self.include_path = include_path + self.migrate_option = migrate_option + self.timeout = timeout + self.device_filter = device_filter + self.cuda_ver = cuda_ver + self.test_option = test_option + self.device = backend_device + + def parse_suite_cfg(suite_name, root_path): xml_file = os.path.join(os.path.abspath(root_path), suite_name + ".xml") root = parse_xml_cfg_file(xml_file) @@ -156,40 +199,40 @@ def pop_module(workspace): sys.path.pop() return "" -def test_setup(test_driver_module, specific_module): +def test_setup(test_driver_module, specific_module, single_case_text): if not specific_module: - return test_driver_module.setup_test() + return test_driver_module.setup_test(single_case_text) elif hasattr(specific_module, "setup_test"): - return specific_module.setup_test() + return specific_module.setup_test(single_case_text) return True -def test_migrate(test_driver_module, specific_module): +def test_migrate(test_driver_module, specific_module, single_case_text): if not specific_module: - return test_driver_module.migrate_test() + return test_driver_module.migrate_test(single_case_text) elif hasattr(specific_module, "migrate_test"): - return specific_module.migrate_test() + return specific_module.migrate_test(single_case_text) return True -def test_build(test_driver_module, specific_module): +def test_build(test_driver_module, specific_module, single_case_text): if not specific_module: - return test_driver_module.build_test() + return test_driver_module.build_test(single_case_text) elif hasattr(specific_module, "build_test"): - return specific_module.build_test() + return specific_module.build_test(single_case_text) return True -def run_migrated_binary_test(test_driver_module, specific_module): +def run_migrated_binary_test(test_driver_module, specific_module, single_case_text): if not specific_module: - return test_driver_module.run_test() + return test_driver_module.run_test(single_case_text) elif hasattr(specific_module, "run_test"): - return specific_module.run_test() + return specific_module.run_test(single_case_text) return True # Execute the test driver to do the validation. -def run_test_driver(module): - with open(test_config.command_file, "a+") as f: - f.write("================= " + test_config.current_test + " ==================\n") - case_workspace = os.path.join(os.path.dirname(test_config.result_text), test_config.current_test) - test_config.test_status = "" +def run_test_driver(module, single_case_text): + single_case_text.command_text += "================= " + single_case_text.name + " ==================\n" + + case_workspace = single_case_text.case_workspace + single_case_text.test_status = "" ret_val = True specific_module = "" @@ -199,37 +242,37 @@ def run_test_driver(module): built = False run = False - ret_val = test_setup(module, specific_module) + ret_val = test_setup(module, specific_module, single_case_text) if ret_val: - ret_val = test_migrate(module, specific_module) + ret_val = test_migrate(module, specific_module, single_case_text) migrated = True else: - test_config.test_status = "BADTEST" + single_case_text.test_status = "BADTEST" if ret_val: - ret_val = test_build(module, specific_module) + ret_val = test_build(module, specific_module, single_case_text) built = True elif migrated: - test_config.test_status = "MIGFAIL" + single_case_text.test_status = "MIGFAIL" if ret_val: - ret_val = run_migrated_binary_test(module, specific_module) + ret_val = run_migrated_binary_test(module, specific_module, single_case_text) run = True elif migrated and built: - test_config.test_status = "COMPFAIL" + single_case_text.test_status = "COMPFAIL" if migrated and built and run and ret_val: - test_config.test_status = "PASS" + single_case_text.test_status = "PASS" elif migrated and built and run: - test_config.test_status = "RUNFAIL" + single_case_text.test_status = "RUNFAIL" if is_registered_module(case_workspace): pop_module(case_workspace) - append_msg_to_file(test_config.result_text, test_config.current_test + " " + test_config.test_status + "\n") - append_msg_to_file(test_config.log_file, "------------------------------------------------------------------------\n\n" + \ - "=================== "+ test_config.current_test + " is " + test_config.test_status + " ======================\n ") - print_result(test_config.current_test, test_config.test_status, test_config.command_output) + single_case_text.result_text += single_case_text.name + " " + single_case_text.test_status + "\n" + single_case_text.log_text += "------------------------------------------------------------------------\n\n" + \ + "=================== "+ single_case_text.name + " is " + single_case_text.test_status + " ======================\n " + print_result(single_case_text, single_case_text.print_text) return ret_val # To do: if the API was enabled in CUDA 9.2 version but deprecated in the CUDA 11.4 version, @@ -239,64 +282,68 @@ def run_test_driver(module): # Rule1:skip < CUDA 9.2 # Rule2:skip > CUDA 11.4 # Not supported -def is_platform_supported(platform_rule_list): +def is_platform_supported(platform_rule_list, single_case_text): for platform_rule in platform_rule_list: if platform_rule.os_family != platform.system(): continue if platform_rule.cuda_version: version = int(float(re.findall("\d+\.?\d*", platform_rule.cuda_version)[0])) * 1000 print_debug_log("CUDA version is ", version) - print_debug_log("default CUDA version is ", test_config.cuda_ver) + print_debug_log("default CUDA version is ", single_case_text.cuda_ver) print_debug_log("default CUDA range is ", platform_rule.cuda_range) - if platform_rule.cuda_range == "LATER_OR_EQUAL" and test_config.cuda_ver >= version and platform_rule.run_on_this_platform.upper() == "FALSE": + if platform_rule.cuda_range == "LATER_OR_EQUAL" and single_case_text.cuda_ver >= version and platform_rule.run_on_this_platform.upper() == "FALSE": return False - elif platform_rule.cuda_range == "OLDER" and test_config.cuda_ver < version and platform_rule.run_on_this_platform.upper() == "FALSE": + elif platform_rule.cuda_range == "OLDER" and single_case_text.cuda_ver < version and platform_rule.run_on_this_platform.upper() == "FALSE": return False - elif platform_rule.cuda_range == "LATER" and test_config.cuda_ver > version and platform_rule.run_on_this_platform.upper() == "FALSE": + elif platform_rule.cuda_range == "LATER" and single_case_text.cuda_ver > version and platform_rule.run_on_this_platform.upper() == "FALSE": return False - elif platform_rule.cuda_range == "OLDER_OR_EQUAL" and test_config.cuda_ver <= version and platform_rule.run_on_this_platform.upper() == "FALSE": + elif platform_rule.cuda_range == "OLDER_OR_EQUAL" and single_case_text.cuda_ver <= version and platform_rule.run_on_this_platform.upper() == "FALSE": return False - elif platform_rule.cuda_range == "EQUAL" and test_config.cuda_ver == version and platform_rule.run_on_this_platform.upper() == "FALSE": + elif platform_rule.cuda_range == "EQUAL" and single_case_text.cuda_ver == version and platform_rule.run_on_this_platform.upper() == "FALSE": return False else: return platform_rule.run_on_this_platform.upper() == "TRUE" return True -def is_option_supported(option_rule_list): +def is_option_supported(option_rule_list, single_case_text): for option_rule in option_rule_list: - if option_rule.exclude_option != "" and option_rule.exclude_option in test_config.test_option and not option_rule.not_double_type_feature: + if option_rule.exclude_option != "" and option_rule.exclude_option in single_case_text.test_option and not option_rule.not_double_type_feature: return False - elif option_rule.only_option not in test_config.test_option: + elif option_rule.only_option not in single_case_text.test_option: return False - elif option_rule.exclude_option in test_config.test_option and option_rule.not_double_type_feature == "NOT double": - if test_config.backend_device not in test_config.support_double_gpu: + elif option_rule.exclude_option in single_case_text.test_option and option_rule.not_double_type_feature == "NOT double": + if single_case_text.device not in test_config.support_double_gpu: return False return True -def test_single_case(current_test, single_case_config, workspace, module, suite_root_path): - test_config.current_test = current_test - if single_case_config.platform_rule_list and not is_platform_supported(single_case_config.platform_rule_list): - append_msg_to_file(test_config.result_text, current_test + " Skip " + "\n") - return True +def test_single_case(current_test, single_case_config, workspace, suite_root_path, single_run_config): + single_case_text = case_text(single_run_config, current_test, os.path.join(workspace, "command.tst"),"", + os.path.join(workspace, current_test + ".lf"), "", + os.path.join(workspace, "result.md"), "", "") + module = import_test_driver(suite_root_path) + if single_case_config.platform_rule_list and not is_platform_supported(single_case_config.platform_rule_list, single_case_text): + single_case_text.result_text += current_test + " Skip " + "\n" + single_case_text.run_flag = True + return single_case_text - if single_case_config.option_rule_list and not is_option_supported(single_case_config.option_rule_list): - append_msg_to_file(test_config.result_text, current_test + " Skip " + "\n") - return True + if single_case_config.option_rule_list and not is_option_supported(single_case_config.option_rule_list, single_case_text): + single_case_text.result_text += current_test + " Skip " + "\n" + single_case_text.run_flag = True + return single_case_text case_workspace = os.path.join(workspace, current_test) + single_case_text.case_workspace = case_workspace if not os.path.exists(case_workspace): os.makedirs(case_workspace) os.chdir(workspace) - test_config.log_file = os.path.join(workspace, current_test + ".lf") + # test_config.log_file = os.path.join(workspace, current_test + ".lf") copy_source_to_ws(single_case_config.test_dep_files, case_workspace, suite_root_path) - return run_test_driver(module) + single_case_text.run_flag = run_test_driver(module, single_case_text) + return single_case_text def prepare_test_workspace(root_path, suite_name, opt, case = ""): suite_workspace = os.path.join(os.path.abspath(root_path), suite_name, opt) - case_workspace = os.path.join(suite_workspace, case) - test_config.command_file = os.path.join(suite_workspace, "command.tst") - test_config.result_text = os.path.join(suite_workspace, "result.md") if os.path.isdir(suite_workspace) and not case: shutil.rmtree(suite_workspace) @@ -318,20 +365,46 @@ def get_gpu_split_test_suite(suite_cfg): elif test_config.backend_device not in test_config.support_double_gpu and not case_config.split_group: new_test_config_map[current_test] = case_config return new_test_config_map + +def record_msg_case(single_case_text): + append_msg_to_file(single_case_text.result_file, single_case_text.result_text) + if single_case_text.test_status == "BADTEST" or single_case_text.test_status == "SKIPPED": + return + append_msg_to_file(single_case_text.command_file, single_case_text.command_text) + append_msg_to_file(single_case_text.log_file, single_case_text.log_text) + return + def test_suite(suite_root_path, suite_name, opt): test_ws_root = os.path.join(os.path.dirname(suite_root_path), "test_workspace") - # module means the test driver for a test suite. - module = import_test_driver(suite_root_path) - test_config.suite_cfg = parse_suite_cfg(suite_name, suite_root_path) + cfg_suite = parse_suite_cfg(suite_name, suite_root_path) test_workspace = prepare_test_workspace(test_ws_root, suite_name, opt) suite_result = True failed_cases = [] - test_config.suite_cfg.test_config_map = get_gpu_split_test_suite(test_config.suite_cfg) - for current_test, single_case_config in test_config.suite_cfg.test_config_map.items(): - ret = test_single_case(current_test, single_case_config, test_workspace, module, suite_root_path) - if not ret: - failed_cases.append(current_test + " " + test_config.test_status) - suite_result = ret & suite_result + command_data = "" + cfg_suite.test_config_map = get_gpu_split_test_suite(cfg_suite) + # Enable multi process + with multiprocessing.Pool(processes= int(multiprocessing.cpu_count() * 0.8)) as pool: + results = [] + + for current_test, single_case_config in cfg_suite.test_config_map.items(): + single_run_config = case_run_config(test_config.DPCXX_COM, test_config.CT_TOOL, test_config.include_path, + test_config.migrate_option, test_config.timeout, test_config.device_filter, + test_config.cuda_ver, test_config.test_option, test_config.backend_device) + result = pool.apply_async(test_single_case, (current_test, single_case_config, test_workspace, + suite_root_path, single_run_config,)) + # store all msg + results.append([result, current_test, single_case_config, test_workspace, suite_root_path, single_run_config]) + + for result_iter in results: + ret = result_iter[0].get() + record_msg_case(ret) + if not ret.run_flag: + # TODO we can add auto rerun + failed_cases.append(ret.name + " " + ret.test_status) + suite_result = ret.run_flag & suite_result + pool.close() + pool.join() + if failed_cases: print("===============Failed case(s) ==========================") for case in failed_cases: @@ -341,15 +414,20 @@ def test_suite(suite_root_path, suite_name, opt): def test_single_case_in_suite(suite_root_path, suite_name, case, option): test_ws_root = os.path.join(os.path.dirname(suite_root_path), "test_workspace") - module = import_test_driver(suite_root_path) - test_config.suite_cfg = parse_suite_cfg(suite_name, suite_root_path) + suite_cfg = parse_suite_cfg(suite_name, suite_root_path) test_workspace = prepare_test_workspace(test_ws_root, suite_name, option, case) config_running_device(option) - if case not in test_config.suite_cfg.test_config_map.keys(): + if case not in suite_cfg.test_config_map.keys(): exit("The test case " + case + " is not in the " + suite_name + " test suite! Please double check.") - single_case_config = test_config.suite_cfg.test_config_map[case] - return test_single_case(case, single_case_config, test_workspace, module, suite_root_path) + single_case_config = suite_cfg.test_config_map[case] + single_run_config = case_run_config(test_config.DPCXX_COM, test_config.CT_TOOL, test_config.include_path, + test_config.migrate_option, test_config.timeout, test_config.device_filter, + test_config.cuda_ver, test_config.test_option, test_config.backend_device) + single_case_text = test_single_case(case, single_case_config, test_workspace, suite_root_path, single_run_config) + record_msg_case(single_case_text) + return single_case_text.run_flag + # Before run the test: # 1. Please specify the CUDA header files with CUDA_INCLUDE_PATH environment variable. @@ -382,16 +460,6 @@ def import_test_driver(suite_folder): test_config.test_driver = str(test_driver.get("driverID")) return importlib.import_module(test_config.test_driver) -def clean_global_setting(): - test_config.current_test = "" - test_config.command_file = "" # Used to store the executed command. - test_config.log_file = "" # Used to store the executed log for each case. - test_config.result_text = "" # Used to store the executed status for each case. - test_config.out_root = "" - test_config.subprocess_stdout_log = "" - test_config.test_status = "" # Default: "SKIPPED" - test_config.test_driver = "" - # Parse the test suite configuration file and get the supported suite list. def get_suite_list(): xml_file = test_config.suite_list_file @@ -429,7 +497,6 @@ def test_suite_with_opts(suite_root_path, suite_name, opts): def test_full_suite_list(suite_list): ret = True for suite_name in suite_list: - clean_global_setting() os.chdir(test_config.root_path) suite_root_path = suite_list[suite_name][0] if os.path.exists(suite_root_path): diff --git a/samples/test_samples.py b/samples/test_samples.py index 3d8f0e6e0..b1c1c02cf 100644 --- a/samples/test_samples.py +++ b/samples/test_samples.py @@ -15,37 +15,37 @@ sys.path.append(parent) from test_utils import * -def setup_test(): +def setup_test(single_case_text): return True -def migrate_test(): +def migrate_test(single_case_text): src = [] extra_args = [] - in_root = os.path.join(os.getcwd(), test_config.current_test) - test_config.out_root = os.path.join(in_root, 'out_root') + in_root = os.path.join(os.getcwd(), single_case_text.name) + single_case_text.out_root = os.path.join(in_root, 'out_root') for dirpath, dirnames, filenames in os.walk(in_root): for filename in [f for f in filenames if re.match('.*(cu|cpp|c)$', f)]: src.append(os.path.abspath(os.path.join(dirpath, filename))) - return do_migrate(src, in_root, test_config.out_root, extra_args) + return do_migrate(src, in_root, single_case_text.out_root, single_case_text, extra_args) -def build_test(): - if (os.path.exists(test_config.current_test)): - os.chdir(test_config.current_test) +def build_test(single_case_text): + if (os.path.exists(single_case_text.name)): + os.chdir(single_case_text.name) srcs = [] cmp_opts = [] link_opts = '' objects = '' - for dirpath, dirnames, filenames in os.walk(test_config.out_root): + for dirpath, dirnames, filenames in os.walk(single_case_text.out_root): for filename in [f for f in filenames if re.match('.*(cpp|c)$', f)]: srcs.append(os.path.abspath(os.path.join(dirpath, filename))) ret = False - ret = compile_and_link(srcs, cmp_opts) + ret = compile_and_link(srcs, single_case_text, cmp_opts) return ret -def run_test(): - os.environ['ONEAPI_DEVICE_SELECTOR'] = test_config.device_filter - return run_binary_with_args() +def run_test(single_case_text): + os.environ['ONEAPI_DEVICE_SELECTOR'] = single_case_text.device_filter + return run_binary_with_args(single_case_text) diff --git a/test_config.py b/test_config.py index 394b19dec..1a6df9c3b 100644 --- a/test_config.py +++ b/test_config.py @@ -7,46 +7,25 @@ # # ===----------------------------------------------------------------------===# +#Only high level config, global variable and static variable are reserved in test_config # The arguments DPCXX_COM = "" # Default compiler will set by set_default_compiler API call. CT_TOOL = "dpct" # The migration tool binary name PYTHON_COM = "python3 " suite_list_file = "test_suite_list.xml" # The configuration file lists all the suite to run and corresponding options. - VERBOSE_LEVEL = 0 # Debug verbose level: 0: silent all the debug information. None 0: turn on all the debug information. - -current_test = "" # The name of current test. The test driver will automatically set a name for current test, if the current test is empty. -command_file = "" # Used to store the execution command. -log_file = "" # Default: /[test name].lf -result_text = "" # Default: /result.md include_path = "" # Specify the CUDA header file path. - -out_root = "" -command_output = "" cuda_ver = 0 # CUDA header file version. -test_status = "" # the test case execution status: MIGFAIL, COMPFAIL, RUNFAIL, SKIPPED or PASS. test_option = "" # Ref the option_mapping.json file table. -failed_message = "" -test_driver = "" -suite_cfg = "" # Parsed from .xml. migrate_option = "" -workspace = "" option_map = "" # Option mapping table. Ref: option_mapping.json root_path = "" # The root path of test repo. timeout = 1200 # The time limit for each test case. -back_end_device = "" # The default device for the test. Device can be "opencl:cpu", "opencl:gpu" and "level_zero:gpu". # For all the devices: https://intel.github.io/llvm-docs/EnvironmentVariables.html#sycl_device_filter device_filter = "level_zero:gpu" -# Depended libraries -mkl_link_opt_lin = ["-lmkl_intel_ilp64", "-lmkl_sequential", "-lmkl_core", - "-lOpenCL", "-lmkl_sycl", "-lpthread", "-ldl"] - -mkl_link_opt_win = ["mkl_sycl_dll.lib", "mkl_intel_ilp64_dll.lib", "mkl_sequential_dll.lib", "mkl_core_dll.lib", "OpenCL.lib"] - -mkl_comp_opt = ["-DMKL_ILP64"] gpu_device = ["Gen9", "Gen12"] diff --git a/test_utils.py b/test_utils.py index e043e1e3e..b7e02e6f3 100644 --- a/test_utils.py +++ b/test_utils.py @@ -25,31 +25,28 @@ # Call subprocess to run migration, build and test binary. Store the command and execution result to # command.tst and result.md. -def call_subprocess(cmd): - with open(test_config.command_file, 'a+') as f: - f.write(cmd + "\n") - with open(test_config.log_file, 'a+') as f: +def call_subprocess(cmd, single_case_text): + single_case_text.command_text += cmd + "\n" + with open(single_case_text.log_file, 'a+') as f: try: run_on_shell = False if (platform.system() == 'Linux'): run_on_shell = True complete_process = subprocess.run(cmd, shell=run_on_shell, check=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, - encoding="utf-8", timeout=test_config.timeout) - test_config.command_output = complete_process.stdout + encoding="utf-8", timeout=single_case_text.timeout) + single_case_text.print_text = complete_process.stdout f.write(complete_process.stdout) except subprocess.TimeoutExpired: - f.write("========= Execution time out(" + str(test_config.timeout) + "s) Please check. ======") + f.write("========= Execution time out(" + str(single_case_text.timeout) + "s) Please check. ======") return False if complete_process.returncode != 0: return False return True -def change_dir(dir): +def change_dir(dir, single_case_text): cmd = "cd " + dir - - with open(test_config.command_file, 'a+') as f: - f.write(cmd + "\n") + single_case_text.command_text += cmd + "\n" if os.path.exists(dir): os.chdir(dir) return True @@ -70,14 +67,14 @@ def print_debug_log(desc, *args): print(arg) print('\n') -def compile_files(srcs, cmpopts = []): +def compile_files(srcs, single_case_text,cmpopts = []): ret = True - base_cmd = test_config.DPCXX_COM + " -c " + base_cmd = single_case_text.DPCXX_COM + " -c " if (platform.system() == 'Windows'): base_cmd += " /EHsc -DNOMINMAX " for src in srcs: cmd = base_cmd + src + ' ' + ' '.join(cmpopts) - ret = call_subprocess(cmd) and ret + ret = call_subprocess(cmd, single_case_text) and ret return ret def prepare_obj_name(src): @@ -88,22 +85,22 @@ def prepare_obj_name(src): obj_name[-1] = suffix return '.'.join(obj_name) -def compile_and_link(srcs, cmpopts = [], objects = [], linkopt = []): - if not compile_files(srcs, cmpopts): +def compile_and_link(srcs, single_case_text,cmpopts = [], objects = [], linkopt = []): + if not compile_files(srcs, single_case_text, cmpopts): return False obj_files = [] for src in srcs: new_obj = prepare_obj_name(src) if new_obj not in obj_files: obj_files.append(new_obj) - cmd = test_config.DPCXX_COM + ' ' + ' '.join(obj_files) + ' ' + \ - ' '.join(linkopt) + ' ' + ' '.join(objects) + ' -o ' + test_config.current_test + '.run' - return call_subprocess(cmd) + cmd = single_case_text.DPCXX_COM + ' ' + ' '.join(obj_files) + ' ' + \ + ' '.join(linkopt) + ' ' + ' '.join(objects) + ' -o ' + single_case_text.name + '.run' + return call_subprocess(cmd, single_case_text) -def run_binary_with_args(args = []): - cmd = os.path.join(os.path.curdir, test_config.current_test + '.run ') + ' '.join(args) - return call_subprocess(cmd) +def run_binary_with_args(single_case_text, args = []): + cmd = os.path.join(os.path.curdir, single_case_text.name+ '.run ') + ' '.join(args) + return call_subprocess(cmd, single_case_text) # Replace the ${testName} with the specific test name. @@ -117,7 +114,7 @@ def copy_source_to_ws(source_files, test_ws_path, suite_root_path): for file in source_files: print_debug_log("The file copied: ", file) if "${testName}" in file: - file.replace("${testName}", test_config.current_test) + file.replace("${testName}", single_case_text.name) file = os.path.join(suite_root_path, file) if os.path.isdir(file): distutils.dir_util.copy_tree(file, test_ws_path) @@ -125,13 +122,13 @@ def copy_source_to_ws(source_files, test_ws_path, suite_root_path): shutil.copy(file, test_ws_path) return -def prepare_oneDPL_specific_macro(): +def prepare_oneDPL_specific_macro(single_case_text): if (platform.system() == 'Windows'): return '' - call_subprocess('gcc -dumpversion') - if ('9' in test_config.command_output): + call_subprocess('gcc -dumpversion', single_case_text) + if ('9' in single_case_text.print_text): return "-DPSTL_USE_PARALLEL_POLICIES=0" - elif ('10' in test_config.command_output): + elif ('10' in single_case_text.print_text): return "-D_GLIBCXX_USE_TBB_PAR_BACKEND=0" return "" @@ -150,8 +147,8 @@ def append_msg_to_file(file_path, msg): f.write(msg) -def do_migrate(src, in_root, out_root, extra_args = []): - cmd = test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + \ +def do_migrate(src, in_root, out_root, single_case_text, extra_args = []): + cmd = single_case_text.CT_TOOL + " --cuda-include-path=" + single_case_text.include_path + \ ' ' + ' '.join(src) if in_root: cmd += ' --in-root ' + os.path.abspath(in_root) @@ -160,12 +157,12 @@ def do_migrate(src, in_root, out_root, extra_args = []): if extra_args: for arg in extra_args: cmd += ' --extra-arg=\" ' + arg + '\"' - if test_config.migrate_option: - cmd += ' ' + test_config.migrate_option - return call_subprocess(cmd) + if single_case_text.migrate_option: + cmd += ' ' + single_case_text.migrate_option + return call_subprocess(cmd, single_case_text) -def check_migration_result(msg): - with open(test_config.log_file, 'a+') as f: +def check_migration_result(msg, single_case_text): + with open(single_case_text.log_file, 'a+') as f: if msg in f.read(): return True return False @@ -180,13 +177,15 @@ def is_registered_module(test_case_workspace): return False # Print the failed test result and details in the screen. -def print_result(case, status, details_log): - print("============= " + case + ": " + status + " ==================\n") - call_subprocess("sycl-ls") +def print_result(single_case_text, detail_log): + print("============= " + single_case_text.name + ": " + + single_case_text.test_status + " ==================\n") + call_subprocess("sycl-ls", single_case_text) print("========== Device Runtime Info: ===============") - print(test_config.command_output) + print(single_case_text.print_text) print("=============================================\n") - print("----------------------------\n" + details_log + "\n----------------------\n") + print("----------------------------\n" + detail_log + + "\n----------------------\n") def is_sub_string(substr, fullstr): if substr in fullstr: diff --git a/user_guide_samples/test_guide.py b/user_guide_samples/test_guide.py index 360816835..5ba97ad4f 100644 --- a/user_guide_samples/test_guide.py +++ b/user_guide_samples/test_guide.py @@ -15,21 +15,21 @@ from test_utils import * -def setup_test(): +def setup_test(single_case_text): return True -def migrate_test(): +def migrate_test(single_case_text): return True -def build_test(): +def build_test(single_case_text): return True -def run_test(): - change_dir(test_config.current_test) - test_driver = test_config.current_test + ".py" +def run_test(single_case_text): + change_dir(single_case_text.name, single_case_text) + test_driver = single_case_text.name + ".py" options = " \" \"" - os.environ['ONEAPI_DEVICE_SELECTOR'] = test_config.device_filter - call_subprocess("python " + test_driver + options) - if "case pass" in test_config.command_output: + os.environ['ONEAPI_DEVICE_SELECTOR'] = single_case_text.device_filter + call_subprocess("python " + test_driver + options, single_case_text) + if "case pass" in single_case_text.print_text: return True return False