Skip to content

Commit ebd04c2

Browse files
authored
[CI] Enable test with skipped cases in skip list (#2189)
disable_build disable_e2e disable_distributed disable_windows
1 parent c9bd7a1 commit ebd04c2

File tree

10 files changed

+71
-342
lines changed

10 files changed

+71
-342
lines changed

.github/actions/linux-testenv/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,5 +193,5 @@ runs:
193193
TORCH_CHECK_ID=$(python -c 'import torch; print(torch.version.git_version)')
194194
if [ "${TORCH_CHECK_ID}" != "${TORCH_COMMIT_ID}" ];then
195195
echo "Torch is re-installed when installing deps, please check"
196-
exit
196+
exit 1
197197
fi

.github/actions/linux-uttest/action.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,20 @@ runs:
102102
cp *.xml ${{ github.workspace }}/ut_log
103103
echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/xpu" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_ut.log
104104
echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_ut.log
105+
- name: skipped_ut
106+
shell: timeout 18000 bash -xe {0}
107+
if: ${{ inputs.ut_name == 'skipped_ut' }}
108+
run: |
109+
export PYTORCH_TEST_WITH_SLOW=1
110+
export PYTORCH_ENABLE_XPU_FALLBACK=1
111+
mkdir -p ut_log/skipped_ut
112+
cd pytorch/third_party/torch-xpu-ops/test/xpu
113+
python run_test_with_skip.py --test-cases skipped \
114+
2> ${{ github.workspace }}/ut_log/skipped_ut/skipped_ut_with_skip_test_error.log | \
115+
tee ${{ github.workspace }}/ut_log/skipped_ut/skipped_ut_with_skip_test.log
116+
echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/xpu" | tee -a ${{ github.workspace }}/ut_log/reproduce_skipped_ut.log
117+
echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce_skipped_ut.log
118+
cp *.xml ${{ github.workspace }}/ut_log
105119
- name: torch_xpu
106120
shell: timeout 3600 bash -xe {0}
107121
if: ${{ inputs.ut_name == 'torch_xpu' }}
@@ -179,7 +193,7 @@ runs:
179193
shell: timeout 180 bash -xe {0}
180194
run: |
181195
pip install junitparser
182-
python ./.github/scripts/check-ut.py ${{ github.workspace }}/ut_log/*.xml >> $GITHUB_STEP_SUMMARY || true
196+
python ./.github/scripts/check-ut.py -n ${{ inputs.ut_name }} -i ${{ github.workspace }}/ut_log/*.xml >> $GITHUB_STEP_SUMMARY || true
183197
# Check the failure logs
184198
if ls ${{ github.workspace }}/failures*.log 1> /dev/null 2>&1; then
185199
echo -e "Exist Failure logs"

.github/scripts/check-ut.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from collections import defaultdict
77

88
parser = argparse.ArgumentParser(description='Test results analyzer')
9-
parser.add_argument('input_files', nargs='+', help='JUnit XML files or log files')
9+
parser.add_argument('-n', '--ut-name', type=str, default='', help='UT name')
10+
parser.add_argument('-i', '--input-files', nargs='+', help='JUnit XML files or log files')
1011
args = parser.parse_args()
1112

1213
failures = []
@@ -370,9 +371,9 @@ def main():
370371
process_xml_file(input_file)
371372
else:
372373
print(f"Skipping unknown file type: {input_file}", file=sys.stderr)
373-
374-
with open("ut_failure_list.csv", "w") as failure_list:
375-
print_failures(failure_list=failure_list)
374+
if args.ut_name != "skipped_ut":
375+
with open("ut_failure_list.csv", "w") as failure_list:
376+
print_failures(failure_list=failure_list)
376377

377378
generate_failures_log()
378379
generate_passed_log()

.github/scripts/ut_result_check.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,24 @@ if [[ "${ut_suite}" == 'xpu_distributed' ]]; then
244244
echo -e "[PASS] UT ${ut_suite} test Pass"
245245
fi
246246
fi
247+
248+
if [[ "${ut_suite}" == 'skipped_ut' ]]; then
249+
random_cases=(
250+
"test_parity__foreach_div_fastpath_inplace_xpu_complex128"
251+
"test_parity__foreach_div_fastpath_outplace_xpu_complex128"
252+
"test_parity__foreach_addcdiv_fastpath_inplace_xpu_complex128"
253+
"test_parity__foreach_addcdiv_fastpath_outplace_xpu_complex128"
254+
"test_python_ref__refs_log2_xpu_complex128"
255+
"_jiterator_"
256+
)
257+
grep "PASSED" skipped_ut_with_skip_test.log | grep -vFf <(printf '%s\n' "${random_cases[@]}") > ./skipped_ut_with_skip_test_passed.log
258+
num_passed=$(wc -l < "./skipped_ut_with_skip_test_passed.log")
259+
if [ ${num_passed} -gt 0 ];then
260+
echo -e "========================================================================="
261+
echo -e "Checking New passed cases in Skip list for ${ut_suite}"
262+
echo -e "========================================================================="
263+
cat ./skipped_ut_with_skip_test_passed.log
264+
echo -e "[Warning] Has ${num_passed} new pass in ${ut_suite}"
265+
exit 1
266+
fi
267+
fi

.github/workflows/_linux_ut.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
ut:
2323
required: true
2424
type: string
25-
description: UT scope. one of `op_regression,op_transformers,op_extended,op_ut,torch_xpu,op_regression_dev1`
25+
description: UT scope. one of `op_regression,op_transformers,op_extended,op_ut,skipped_ut,torch_xpu,op_regression_dev1`
2626

2727
permissions: read-all
2828

.github/workflows/_windows_ut.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ jobs:
190190
pip install junitparser
191191
echo "GITHUB_WORKSPACE: %GITHUB_WORKSPACE%"
192192
for %%i in ("%GITHUB_WORKSPACE%\ut_log\*.xml") do (
193-
python .\.github\scripts\check-ut.py "%%i" >> "%GITHUB_STEP_SUMMARY%"
193+
python .\.github\scripts\check-ut.py -n windows -i "%%i" >> "%GITHUB_STEP_SUMMARY%"
194194
)
195195
@echo off
196196

.github/workflows/nightly_ondemand.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
ut:
3030
type: string
3131
default: ''
32-
description: UT scope. 'op_regression,op_transformers,op_extended,op_ut,xpu_profiling,torch_xpu,op_regression_dev1,xpu_distributed,microbench,windows'. Delimiter is comma
32+
description: UT scope. 'op_regression,op_transformers,op_extended,op_ut,skipped_ut,xpu_profiling,torch_xpu,op_regression_dev1,xpu_distributed,microbench,windows'. Delimiter is comma
3333
suite:
3434
type: string
3535
default: ''
@@ -95,7 +95,7 @@ jobs:
9595
echo "No such scheduler: ${{ github.event.schedule }}"
9696
exit 1
9797
fi
98-
ut='["basic","op_ut","xpu_profiling","xpu_distributed"]'
98+
ut='["basic","op_ut","skipped_ut","xpu_profiling","xpu_distributed"]'
9999
suite='["huggingface","timm_models","torchbench","pt2e"]'
100100
triton=''
101101
python='3.10'

test/xpu/run_test_with_skip.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,35 @@
1+
import argparse
12
import os
23
import sys
34

45
from skip_list_common import skip_dict
56
from xpu_test_utils import launch_test
67

8+
parser = argparse.ArgumentParser(description="Run specific unit tests")
9+
# By default, run the cases without the skipped cases
10+
parser.add_argument(
11+
"--test-cases",
12+
choices=["selected", "skipped", "all"],
13+
default="selected",
14+
help="Test cases scope",
15+
)
16+
args = parser.parse_args()
17+
18+
719
res = 0
820
fail_test = []
921

1022
for key in skip_dict:
1123
skip_list = skip_dict[key]
12-
fail = launch_test(key, skip_list)
24+
exe_list = None
25+
if args.test_cases == "skipped":
26+
exe_list = skip_list
27+
skip_list = None
28+
if exe_list is None:
29+
continue
30+
elif args.test_cases == "all":
31+
skip_list = None
32+
fail = launch_test(key, skip_list=skip_list, exe_list=exe_list)
1333
res += fail
1434
if fail:
1535
fail_test.append(key)

0 commit comments

Comments
 (0)