Skip to content

Commit 7211a3e

Browse files
committed
pass all test
Signed-off-by: Ni, Wenhui <[email protected]>
1 parent 4d6ff72 commit 7211a3e

File tree

10 files changed

+16
-14
lines changed

10 files changed

+16
-14
lines changed

behavior_tests/src/bt-autocomplete/do_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def migrate_test(single_case_text):
2727
reference = '-gen-build-script\n'
2828
res = res and (reference == single_case_text.print_text)
2929

30-
call_subprocess(test_config.CT_TOOL + " --autocomplete=foo")
30+
call_subprocess(test_config.CT_TOOL + " --autocomplete=foo", single_case_text)
3131
reference = '\n'
3232
res = res and (reference == single_case_text.print_text)
3333

behavior_tests/src/bt-cdb-default-out-folder/do_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def setup_test(single_case_text):
1919
return True
2020

2121
def migrate_test(single_case_text):
22-
call_subprocess("intercept-build /usr/bin/make")
22+
call_subprocess("intercept-build /usr/bin/make", single_case_text)
2323
in_root = ""
2424
extra_args = ""
2525
return call_subprocess(test_config.CT_TOOL + " --cuda-include-path=" + test_config.include_path + " " +

behavior_tests/src/bt-format-range/do_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def migrate_test(single_case_text):
2222
os.mkdir("out_migrated")
2323
os.mkdir("out_all")
2424
os.mkdir("out_none")
25-
call_subprocess(test_config.CT_TOOL + " --format-range=migrated --out-root=./out_migrated vector_add.cu --cuda-include-path=" + test_config.include_path)
25+
call_subprocess(test_config.CT_TOOL + " --format-range=migrated --out-root=./out_migrated vector_add.cu --cuda-include-path=" + test_config.include_path, single_case_text)
2626
call_subprocess(test_config.CT_TOOL + " --format-range=all --out-root=./out_all vector_add.cu --cuda-include-path=" + test_config.include_path, single_case_text)
2727
call_subprocess(test_config.CT_TOOL + " -format-range=none --out-root=./out_none vector_add.cu --cuda-include-path=" + test_config.include_path, single_case_text)
2828

behavior_tests/src/execute_from_cuda_path/do_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def migrate_test(single_case_text):
2727
src =os.path.join("include", "vector_types.h")
2828
in_root = ""
2929
extra_args = ""
30-
call_subprocess(test_config.CT_TOOL + " --cuda-include-path=./include " + src)
30+
call_subprocess(test_config.CT_TOOL + " --cuda-include-path=./include " + src, single_case_text)
3131
print("hello" + single_case_text.print_text, single_case_text)
3232
if ('option is in the CUDA_PATH folder' in single_case_text.print_text):
3333
return True

behavior_tests/src/ngt-invalid-json1/do_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ def setup_test(single_case_text):
2121
def migrate_test(single_case_text):
2222
data = []
2323
ret = []
24-
with open("compile_commands.json", 'r') as f:
24+
with open(os.path.join(single_case_text.case_workspace, "compile_commands.json"), 'r') as f:
2525
data = f.readlines()
2626
for line in data:
2727
line = line.replace("directory_placeholder", os.getcwd().replace("\\", "\\\\"))
2828
ret.append(line)
29-
with open("compile_commands.json", 'w') as f:
29+
with open(os.path.join(single_case_text.case_workspace, "compile_commands.json"), 'w') as f:
3030
f.writelines(ret[1:])
3131

3232
call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path, single_case_text)

behavior_tests/src/ngt-invalid-json6/do_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def setup_test(single_case_text):
2121
def migrate_test(single_case_text):
2222
data = []
2323
ret = []
24-
with open("compile_commands.json", 'r') as f:
24+
with open(os.path.join(single_case_text.case_workspace, "compile_commands.json"), 'r') as f:
2525
data = f.readlines()
2626
for line in data:
2727
line = line.replace("directory_placeholder", os.getcwd().replace("\\", "\\\\"))

behavior_tests/src/ngt-invalid-json8/do_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ def setup_test(single_case_text):
2121
def migrate_test(single_case_text):
2222
data = []
2323
ret = []
24-
with open("compile_commands.json", 'r') as f:
24+
with open(os.path.join(single_case_text.case_workspace, "compile_commands.json"), 'r') as f:
2525
data = f.readlines()
2626
for line in data:
2727
if "directory_placeholder" in line:
2828
ret.append(" \"arguments\": [\"nvcc hello_aaa.c\"],\n")
2929
line = line.replace("directory_placeholder", os.getcwd().replace("\\", "\\\\"))
3030
ret.append(line)
31-
with open("compile_commands.json", 'w') as f:
31+
with open(os.path.join(single_case_text.case_workspace, "compile_commands.json"), 'w') as f:
3232
f.writelines(ret)
3333

3434
call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path, single_case_text)

behavior_tests/src/ngt-output-create/do_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def setup_test(single_case_text):
1919

2020
def migrate_test(single_case_text):
2121
call_subprocess(test_config.CT_TOOL + " vector_add.cu --out-root=out --cuda-include-path=" + test_config.include_path, single_case_text)
22-
return is_sub_string("Unable to save the output to the specified directory", single_case_text.print_text, single_case_text)
22+
return is_sub_string("Unable to save the output to the specified directory", single_case_text.print_text)
2323

2424
def build_test(single_case_text):
2525
return True

run_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def __init__(self, case_name, command_file = "", command_text = "", log_file = "
7777
self.test_status = "SKIPPED"
7878
self.out_root = ""
7979
self.run_flag = False
80+
self.case_workspace = ""
8081

8182

8283
def parse_suite_cfg(suite_name, root_path):
@@ -206,7 +207,8 @@ def run_test_driver(module, single_case_text):
206207
# with open(test_config.command_file, "a+") as f:
207208
# f.write("================= " + single_case_text.name + " ==================\n")
208209
single_case_text.command_text += "================= " + single_case_text.name + " ==================\n"
209-
case_workspace = os.path.join(os.path.dirname(single_case_text.result_text), single_case_text.name)
210+
211+
case_workspace = single_case_text.case_workspace
210212
single_case_text.test_status = ""
211213
ret_val = True
212214
specific_module = ""
@@ -293,7 +295,7 @@ def is_option_supported(option_rule_list):
293295

294296
def test_single_case(current_test, single_case_config, workspace, suite_root_path):
295297
single_case_text = case_text(current_test, os.path.join(workspace, "command.tst"),"",
296-
os.path.join(workspace, current_test, current_test + ".lf"), "",
298+
os.path.join(workspace, current_test + ".lf"), "",
297299
os.path.join(workspace, "result.md"), "", "")
298300
module = import_test_driver(suite_root_path)
299301
if single_case_config.platform_rule_list and not is_platform_supported(single_case_config.platform_rule_list):
@@ -309,6 +311,7 @@ def test_single_case(current_test, single_case_config, workspace, suite_root_pa
309311
return single_case_text
310312

311313
case_workspace = os.path.join(workspace, current_test)
314+
single_case_text.case_workspace = case_workspace
312315
if not os.path.exists(case_workspace):
313316
os.makedirs(case_workspace)
314317
os.chdir(workspace)
@@ -320,7 +323,6 @@ def test_single_case(current_test, single_case_config, workspace, suite_root_pa
320323

321324
def prepare_test_workspace(root_path, suite_name, opt, case = ""):
322325
suite_workspace = os.path.join(os.path.abspath(root_path), suite_name, opt)
323-
case_workspace = os.path.join(suite_workspace, case)
324326

325327
if os.path.isdir(suite_workspace) and not case:
326328
shutil.rmtree(suite_workspace)

test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# command_output = ""
2727
cuda_ver = 0 # CUDA header file version.
2828
# test_status = "" # the test case execution status: MIGFAIL, COMPFAIL, RUNFAIL, SKIPPED or PASS.
29-
# test_option = "" # Ref the option_mapping.json file table.
29+
test_option = "" # Ref the option_mapping.json file table.
3030
# failed_message = ""
3131
# test_driver = ""
3232
# suite_cfg = "" # Parsed from <suite>.xml.

0 commit comments

Comments
 (0)