|
4 | 4 | from skip_list_common import skip_dict |
5 | 5 | from skip_list_win import skip_dict as skip_dict_win |
6 | 6 | from skip_list_win_lnl import skip_dict as skip_dict_win_lnl |
7 | | -from xpu_test_utils import launch_test |
8 | 7 |
|
9 | 8 | res = 0 |
10 | 9 | IS_WINDOWS = sys.platform == "win32" |
11 | 10 |
|
| 11 | +def launch_test(test_case, skip_list=None, exe_list=None): |
| 12 | + os.environ["PYTORCH_TEST_WITH_SLOW"] = "1" |
| 13 | + module_name = test_case.replace(".py", "").replace("/", ".").replace("\\", ".") |
| 14 | + if skip_list is not None: |
| 15 | + if skip_list: |
| 16 | + skip_options = ' -k "not ' + skip_list[0] |
| 17 | + for skip_case in skip_list[1:]: |
| 18 | + skip_option = " and not " + skip_case |
| 19 | + skip_options += skip_option |
| 20 | + skip_options += '"' |
| 21 | + test_command = ( |
| 22 | + f"pytest --junit-xml=./op_ut_with_skip.{module_name}.xml " + test_case |
| 23 | + ) |
| 24 | + test_command += skip_options |
| 25 | + else: |
| 26 | + test_command = ( |
| 27 | + f"pytest --junit-xml=./op_ut_with_all.{module_name}.xml " + test_case |
| 28 | + ) |
| 29 | + elif exe_list is not None: |
| 30 | + if exe_list: |
| 31 | + exe_options = ' -k "' + exe_list[0] |
| 32 | + for exe_case in exe_list[1:]: |
| 33 | + exe_option = " or " + exe_case |
| 34 | + exe_options += exe_option |
| 35 | + exe_options += '"' |
| 36 | + test_command = ( |
| 37 | + f"pytest --junit-xml=./op_ut_with_exe.{module_name}.xml " + test_case |
| 38 | + ) |
| 39 | + test_command += exe_options |
| 40 | + else: |
| 41 | + test_command = ( |
| 42 | + f"pytest --junit-xml=./op_ut_with_all.{module_name}.xml " + test_case |
| 43 | + ) |
| 44 | + else: |
| 45 | + test_command = ( |
| 46 | + f"pytest --junit-xml=./op_ut_with_all.{module_name}.xml " + test_case |
| 47 | + ) |
| 48 | + return os.system(test_command) |
| 49 | + |
| 50 | + |
12 | 51 | skip_files_list = [ |
13 | 52 | "test_autocast_xpu.py", |
14 | 53 | "test_autograd_fallback_xpu.py", |
|
0 commit comments