Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor changes to support testing on windows #790

Merged
merged 10 commits into from
Aug 31, 2024
Merged
13 changes: 7 additions & 6 deletions test/xpu/extended/run_test_with_skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,16 @@
)


skip_options = " -k 'not " + skip_list[0]
skip_options = " -k \"not " + skip_list[0]
for skip_case in skip_list[1:]:
skip_option = " and not " + skip_case
skip_options += skip_option
skip_options += "'"
skip_options += "\""

test_command = "PYTORCH_TEST_WITH_SLOW=1 pytest -v test_ops_xpu.py"
test_command += skip_options
os.environ["PYTORCH_ENABLE_XPU_FALLBACK"]="1"
min-jean-cho marked this conversation as resolved.
Show resolved Hide resolved
os.environ["PYTORCH_TEST_WITH_SLOW"]="1"

test_command = "pytest -v test_ops_xpu.py"
test_command += skip_options
res = os.system(test_command)
exit_code = os.WEXITSTATUS(res)
sys.exit(exit_code)
sys.exit(res)
37 changes: 15 additions & 22 deletions test/xpu/run_test_with_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,27 @@


def launch_test(test_case, skip_list=None, exe_list=None):
os.environ["PYTORCH_ENABLE_XPU_FALLBACK"]="1"
os.environ["PYTORCH_TEST_WITH_SLOW"]="1"
if skip_list != None:
skip_options = " -k 'not " + skip_list[0]
skip_options = " -k \"not " + skip_list[0]
for skip_case in skip_list[1:]:
skip_option = " and not " + skip_case
skip_options += skip_option
skip_options += "'"
test_command = (
"PYTORCH_ENABLE_XPU_FALLBACK=1 PYTORCH_TEST_WITH_SLOW=1 pytest -v "
+ test_case
)
test_command += skip_options
skip_options += "\""
test_command = "pytest -v " + test_case + skip_options
return os.system(test_command)
elif exe_list != None:
exe_options = " -k '" + exe_list[0]
exe_options = " -k \"" + exe_list[0]
for exe_case in exe_list[1:]:
exe_option = " or " + exe_case
exe_options += exe_option
exe_options += "'"
test_command = (
"PYTORCH_ENABLE_XPU_FALLBACK=1 PYTORCH_TEST_WITH_SLOW=1 pytest -v "
+ test_case
)
test_command += exe_options
exe_options += "\""
test_command = "pytest -v " + test_case + exe_options
return os.system(test_command)
else:
test_command = (
"PYTORCH_ENABLE_XPU_FALLBACK=1 PYTORCH_TEST_WITH_SLOW=1 pytest -v "
+ test_case
)
return os.system(test_command)

test_command = "pytest -v " + test_case
return os.system(test_command)

res = 0

Expand All @@ -51,5 +41,8 @@ def launch_test(test_case, skip_list=None, exe_list=None):
)
res += launch_test("test_decomp_xpu.py", exe_list=execute_list)

exit_code = os.WEXITSTATUS(res)
sys.exit(exit_code)
if os.name == "nt":
sys.exit(res)
else:
exit_code = os.WEXITSTATUS(res)
sys.exit(exit_code)
8 changes: 6 additions & 2 deletions test/xpu/run_test_with_skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
skip_list = skip_dict[key]
res += launch_test(key, skip_list)

exit_code = os.WEXITSTATUS(res)
sys.exit(exit_code)

if os.name == "nt":
sys.exit(res)
else:
exit_code = os.WEXITSTATUS(res)
sys.exit(exit_code)
7 changes: 5 additions & 2 deletions test/xpu/run_test_with_skip_arc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
skip_list = skip_dict[key] if key not in skip_dict_specifical else skip_dict[key] + skip_dict_specifical[key]
res += launch_test(key, skip_list)

exit_code = os.WEXITSTATUS(res)
sys.exit(exit_code)
if os.name == "nt":
sys.exit(res)
else:
exit_code = os.WEXITSTATUS(res)
sys.exit(exit_code)
7 changes: 5 additions & 2 deletions test/xpu/run_test_with_skip_mtl.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
skip_list = skip_dict[key] if key not in skip_dict_specifical else skip_dict[key] + skip_dict_specifical[key]
res += launch_test(key, skip_list)

exit_code = os.WEXITSTATUS(res)
sys.exit(exit_code)
if os.name == "nt":
sys.exit(res)
else:
exit_code = os.WEXITSTATUS(res)
sys.exit(exit_code)
20 changes: 10 additions & 10 deletions test/xpu/xpu_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,33 +742,33 @@ def copy_tests(


def launch_test(test_case, skip_list=None, exe_list=None):
os.environ["PYTORCH_ENABLE_XPU_FALLBACK"]="1"
os.environ["PYTORCH_TEST_WITH_SLOW"]="1"
if skip_list != None:
skip_options = " -k 'not " + skip_list[0]
skip_options = " -k \"not " + skip_list[0]
for skip_case in skip_list[1:]:
skip_option = " and not " + skip_case
skip_options += skip_option
skip_options += "'"
skip_options += "\""
test_command = (
"PYTORCH_ENABLE_XPU_FALLBACK=1 PYTORCH_TEST_WITH_SLOW=1 pytest -v "
"pytest -v "
+ test_case
)
test_command += skip_options
return os.system(test_command)
elif exe_list != None:
exe_options = " -k '" + exe_list[0]
exe_options = " -k \"" + exe_list[0]
for exe_case in exe_list[1:]:
exe_option = " or " + exe_case
exe_options += exe_option
exe_options += "'"
exe_options += "\""
test_command = (
"PYTORCH_ENABLE_XPU_FALLBACK=1 PYTORCH_TEST_WITH_SLOW=1 pytest -v "
"pytest -v "
+ test_case
)
test_command += exe_options
return os.system(test_command)
else:
test_command = (
"PYTORCH_ENABLE_XPU_FALLBACK=1 PYTORCH_TEST_WITH_SLOW=1 pytest -v "
"pytest -v "
+ test_case
)
return os.system(test_command)
return os.system(test_command)