Skip to content

Commit 12b6ab4

Browse files
authored
[CI] Enhance pytest xml files collection (#2380)
1. fix the xml files collection issue 2. modify xml file name 3. remove run_test_with_only.py which is duplicated with run_test_with_skip.py after test_decomp enabled
1 parent 256dc00 commit 12b6ab4

File tree

5 files changed

+23
-46
lines changed

5 files changed

+23
-46
lines changed

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

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -74,34 +74,7 @@ runs:
7474
python run_test_with_skip.py \
7575
2> ${{ github.workspace }}/ut_log/op_ut/op_ut_with_skip_test_error.log | \
7676
tee ${{ github.workspace }}/ut_log/op_ut/op_ut_with_skip_test.log
77-
ls -al
78-
cp *.xml ${{ github.workspace }}/ut_log
79-
find op_ut_with_skip.nn op_ut_with_skip.quantization/core op_ut_with_all.functorch -type f -exec sh -c '
80-
dir_path=$(dirname "$1");
81-
case "$dir_path" in
82-
*"op_ut_with_skip.quantization/core"*)
83-
dir_name="op_ut_with_skip.quantization.core";;
84-
*"op_ut_with_all.functorch"*)
85-
dir_name="op_ut_with_all.functorch";;
86-
*)
87-
dir_name="op_ut_with_skip.nn";;
88-
esac;
89-
mv "$1" "$dir_path/${dir_name}.$(basename "$1")"
90-
' _ {} \;
91-
ls -al op_ut_with_skip.nn op_ut_with_skip.quantization/core op_ut_with_all.functorch
92-
cp op_ut_with_skip.nn/*.xml ${{ github.workspace }}/ut_log
93-
cp op_ut_with_skip.quantization/core/*.xml ${{ github.workspace }}/ut_log
94-
cp op_ut_with_all.functorch/*.xml ${{ github.workspace }}/ut_log
95-
# Cases run with a on-demand white list, since some suites are too
96-
# slow to go through all operators on CPU. So add cases on-demand
97-
# when XPU implementatoin is done.
98-
# test_foreach, test_decomp
99-
# Run with only
100-
python run_test_with_only.py \
101-
2> ${{ github.workspace }}/ut_log/op_ut/op_ut_with_only_test_error.log | \
102-
tee ${{ github.workspace }}/ut_log/op_ut/op_ut_with_only_test.log
103-
ls -al
104-
cp *.xml ${{ github.workspace }}/ut_log
77+
find . -type f -name "op_ut_with_*.xml" -exec mv {} ${{ github.workspace }}/ut_log/ \; || true
10578
echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/xpu" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_ut.log
10679
echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce_op_ut.log
10780
- name: skipped_ut
@@ -114,9 +87,9 @@ runs:
11487
python run_test_with_skip.py --test-cases skipped \
11588
2> ${{ github.workspace }}/ut_log/skipped_ut/skipped_ut_with_skip_test_error.log | \
11689
tee ${{ github.workspace }}/ut_log/skipped_ut/skipped_ut_with_skip_test.log
90+
find . -type f -name "op_ut_with_*.xml" -exec mv {} ${{ github.workspace }}/ut_log/ \; || true
11791
echo -e "File Path: cd pytorch/third_party/torch-xpu-ops/test/xpu" | tee -a ${{ github.workspace }}/ut_log/reproduce_skipped_ut.log
11892
echo -e "Reproduce Command: pytest -sv failed_case" | tee -a ${{ github.workspace }}/ut_log/reproduce_skipped_ut.log
119-
cp *.xml ${{ github.workspace }}/ut_log
12093
- name: torch_xpu
12194
shell: timeout 3600 bash -xe {0}
12295
if: ${{ inputs.ut_name == 'torch_xpu' }}

.github/scripts/e2e_summary.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ process_model() {
213213
done
214214

215215
local row
216-
row=$(generate_html_row "$suite" "$model" "${results[@]}")
216+
row=$(generate_html_row "$suite" "$model")
217217

218218
if [[ "$row" =~ ${RED}|${GREEN}|${YELLOW} ]]; then
219219
echo "$row" | tee -a accuracy.details.html >> accuracy.regression.html
@@ -258,15 +258,20 @@ determine_color() {
258258

259259
generate_html_row() {
260260
local suite="$1" model="$2"
261-
shift 2
262-
local results=("$@")
263-
264261
cat << EOF
265262
<tr>
266263
<td>$suite</td>
267264
<td>$model</td>
268-
<td>${results[0]}</td><td>${results[1]}</td><td>${results[2]}</td><td>${results[3]}</td><td>${results[4]}</td>
269-
<td>${results[5]}</td><td>${results[6]}</td><td>${results[7]}</td><td>${results[8]}</td><td>${results[9]}</td>
265+
<td>${results["training_float32"]}</td>
266+
<td>${results["training_bfloat16"]}</td>
267+
<td>${results["training_float16"]}</td>
268+
<td>${results["training_amp_bf16"]}</td>
269+
<td>${results["training_amp_fp16"]}</td>
270+
<td>${results["inference_float32"]}</td>
271+
<td>${results["inference_bfloat16"]}</td>
272+
<td>${results["inference_float16"]}</td>
273+
<td>${results["inference_amp_bf16"]}</td>
274+
<td>${results["inference_amp_fp16"]}</td>
270275
</tr>
271276
EOF
272277
}

.github/scripts/get_issue.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import re
99
import json
1010
import argparse
11-
from github import Github
11+
from github import Github, Auth
1212

1313

1414
def get_github_issues(repo_owner, repo_name, labels, state='open'):
@@ -91,8 +91,9 @@ def main():
9191

9292
# Quick token check
9393
token = os.getenv('GH_TOKEN')
94+
auth = Auth.Token(token)
9495
global g
95-
g = Github(token) # Increase page size for fewer API calls
96+
g = Github(auth=auth)
9697

9798
print(f"Fetching known issues from {args.repo_owner}/{args.repo_name}...")
9899

.github/scripts/ut_result_check.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ readonly REPO="intel/torch-xpu-ops"
1111
# Used to detect significant test case reductions (>5%)
1212
declare -A EXPECTED_CASES=(
1313
["op_extended"]=5349
14-
["op_regression"]=244
14+
["op_regression"]=268
1515
["op_regression_dev1"]=1
16-
["op_transformers"]=237
17-
["op_ut"]=120408
16+
["op_transformers"]=262
17+
["op_ut"]=178548
1818
["test_xpu"]=69
1919
)
2020

test/xpu/xpu_test_utils.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,15 +1092,15 @@ def copy_tests(
10921092

10931093
def launch_test(test_case, skip_list=None, exe_list=None):
10941094
os.environ["PYTORCH_TEST_WITH_SLOW"] = "1"
1095+
module_name = test_case.replace(".py", "").replace("/", ".").replace("\\", ".")
10951096
if skip_list is not None:
10961097
skip_options = ' -k "not ' + skip_list[0]
10971098
for skip_case in skip_list[1:]:
10981099
skip_option = " and not " + skip_case
10991100
skip_options += skip_option
11001101
skip_options += '"'
11011102
test_command = (
1102-
f"pytest --junit-xml=./op_ut_with_skip.{test_case}.xml --max-worker-restart=1000 "
1103-
+ test_case
1103+
f"pytest --junit-xml=./op_ut_with_skip.{module_name}.xml " + test_case
11041104
)
11051105
test_command += skip_options
11061106
elif exe_list is not None:
@@ -1110,13 +1110,11 @@ def launch_test(test_case, skip_list=None, exe_list=None):
11101110
exe_options += exe_option
11111111
exe_options += '"'
11121112
test_command = (
1113-
f"pytest --junit-xml=./op_ut_with_exe.{test_case}.xml --max-worker-restart=1000 "
1114-
+ test_case
1113+
f"pytest --junit-xml=./op_ut_with_exe.{module_name}.xml " + test_case
11151114
)
11161115
test_command += exe_options
11171116
else:
11181117
test_command = (
1119-
f"pytest --junit-xml=./op_ut_with_all.{test_case}.xml --max-worker-restart=1000 "
1120-
+ test_case
1118+
f"pytest --junit-xml=./op_ut_with_all.{module_name}.xml " + test_case
11211119
)
11221120
return os.system(test_command)

0 commit comments

Comments
 (0)