@@ -9,6 +9,10 @@ compare_and_filter_logs() {
9
9
local file_known_issue=" $2 "
10
10
local output_file=" ${3:- ${file_UT% .* } _filtered.log} "
11
11
local filtered_content=" ${file_UT% .* } _removed.log"
12
+ local temp_file=" temp_parts.log"
13
+ local temp_file_labeled=" temp_parts_labeled.log"
14
+ local temp_output=" ${3:- ${file_UT% .* } _filtered_temp.log} "
15
+ local temp_final=" ${file_UT% .* } _final_temp.log"
12
16
13
17
if [[ $# -lt 2 ]]; then
14
18
echo " [ERROR] Need 2 files to compare"
@@ -21,7 +25,6 @@ compare_and_filter_logs() {
21
25
echo " $file_UT contains $file_known_issue "
22
26
else
23
27
echo " $file_UT does not contain $file_known_issue "
24
- return 1
25
28
fi
26
29
27
30
# Filter the same content from file_UT as file_known_issue
@@ -31,34 +34,73 @@ compare_and_filter_logs() {
31
34
# Keep the filtered UT cases
32
35
grep -noFf " $file_known_issue " " $file_UT " > " $filtered_content "
33
36
echo " Filtered cases file: $filtered_content "
37
+ true > " $temp_file "
38
+ true > " $temp_file_labeled "
39
+ true > " $temp_output "
40
+ true > " $temp_final "
41
+ grep -E ' \.py$|,' " $output_file " > " $temp_output "
42
+ while IFS= read -r line; do
43
+ IFS=' ,' read -ra parts <<< " $line"
44
+ for part in " ${parts[@]} " ; do
45
+ part_trimmed=$( echo " $part " | xargs)
46
+ if [[ -n " $part_trimmed " ]] && ! grep -qF " $part_trimmed " " $file_known_issue " ; then
47
+ echo " $part_trimmed " >> " $temp_file "
48
+ echo -e " \n\033[1;33m[Check the failed cases in summary line]\033[0m"
49
+ echo -e " \033[1;33mCase not found in ${file_known_issue} : '${part_trimmed} ' (from line: '${line} ')\033[0m"
50
+ else
51
+ echo -e " \n\033[1;33m[Check the failed cases in summary line]\033[0m"
52
+ echo -e " \n\033[1;32m${part_trimmed} found in ${file_known_issue} (from line: '${line} ')\033[0m"
53
+ fi
54
+ done
55
+ done < " $temp_output "
56
+
57
+ awk ' {print $0 " [in summary line]"}' " $temp_file " > " $temp_file_labeled "
58
+ grep -vE ' \.py$|,' " $output_file " > " $temp_final "
59
+ cat " $temp_file_labeled " >> " $temp_final "
60
+ mv " $temp_final " " $output_file "
61
+
62
+ echo -e " \n\033[1;31m[New failed cases Summary]\033[0m"
63
+ if [[ -z " $( tr -d ' \t\n\r\f' < " $output_file " 2> /dev/null) " ]]; then
64
+ echo -e " \033[1;32mNo new failed cases found\033[0m"
65
+ else
66
+ echo -e " \n\033[1;31mNew failed cases, not in known issues\033[0m"
67
+ cat " $output_file "
68
+ fi
69
+
34
70
if [[ -s " $filtered_content " ]]; then
35
- echo -e " \n\033[1;31m[Filtered Cases ]\033[0m"
71
+ echo -e " \n\033[1;31m[These failed cases are in skip list, will filter ]\033[0m"
36
72
awk -F' :' ' {
37
73
line_number = $1
38
74
$1 = ""
39
75
gsub(/^ /, "", $0)
40
76
printf "\033[33m%3d\033[0m: %s\n", line_number, $0
41
77
}' " $filtered_content "
42
78
else
43
- echo -e " \n\033[1;32mNo Filtered Cases\033[0m"
79
+ echo -e " \n\033[1;32mNo Skipped Cases\033[0m"
44
80
fi
81
+
82
+ rm -f ${temp_output} ${temp_file} ${temp_final}
45
83
}
46
84
47
85
if [[ " ${ut_suite} " == ' op_regression' || " ${ut_suite} " == ' op_regression_dev1' || " ${ut_suite} " == ' op_extended' || " ${ut_suite} " == ' op_transformers' ]]; then
48
86
grep -E " FAILED" " ${ut_suite} " _test.log | awk ' {print $1}' | grep -v " FAILED" > ./" ${ut_suite} " _failed.log
49
87
grep -E " have failures" " ${ut_suite} " _test.log | awk ' {print $1}' >> ./" ${ut_suite} " _failed.log
88
+ grep -E " Timeout" " ${ut_suite} " _test.log | grep " test" >> ./" ${ut_suite} " _failed.log
50
89
grep " PASSED" " ${ut_suite} " _test.log | awk ' {print $1}' > ./" ${ut_suite} " _passed.log
90
+ echo -e " ========================================================================="
91
+ echo -e " Show Failed cases in ${ut_suite} "
92
+ echo -e " ========================================================================="
93
+ cat " ./${ut_suite} _failed.log"
94
+ echo -e " ========================================================================="
95
+ echo -e " Checking Failed cases in ${ut_suite} "
96
+ echo -e " ========================================================================="
51
97
compare_and_filter_logs " ${ut_suite} " _failed.log Known_issue.log
52
98
if [[ -f " ${ut_suite} _failed_filtered.log" ]]; then
53
99
num_failed=$( wc -l < " ./${ut_suite} _failed_filtered.log" )
54
100
else
55
101
num_failed=$( wc -l < " ./${ut_suite} _failed.log" )
56
102
fi
57
103
num_passed=$( wc -l < " ./${ut_suite} _passed.log" )
58
- echo -e " ========================================================================="
59
- echo -e " Show Failed cases in ${ut_suite} "
60
- echo -e " ========================================================================="
61
- cat " ./${ut_suite} _failed.log"
62
104
if [[ $num_failed -gt 0 ]] || [[ $num_passed -le 0 ]]; then
63
105
echo -e " [ERROR] UT ${ut_suite} test Fail"
64
106
exit 1
69
111
if [[ " ${ut_suite} " == ' op_ut' ]]; then
70
112
grep -E " FAILED" op_ut_with_skip_test.log | awk ' {print $1}' | grep -v " FAILED" > ./" ${ut_suite} " _with_skip_test_failed.log
71
113
grep -E " have failures" op_ut_with_skip_test.log | awk ' {print $1}' >> ./" ${ut_suite} " _with_skip_test_failed.log
114
+ grep -E " Timeout" op_ut_with_skip_test.log | grep " test" >> ./" ${ut_suite} " _with_skip_test_failed.log
72
115
grep -E " FAILED" op_ut_with_only_test.log | awk ' {print $1}' | grep -v " FAILED" > ./" ${ut_suite} " _with_only_test_failed.log
73
116
grep -E " have failures" op_ut_with_only_test.log | awk ' {print $1}' >> ./" ${ut_suite} " _with_only_test_failed.log
117
+ grep -E " Timeout" op_ut_with_only_test.log | grep " test" >> ./" ${ut_suite} " _with_only_test_failed.log
118
+ echo -e " ========================================================================="
119
+ echo -e " Show Failed cases in ${ut_suite} with skip"
120
+ echo -e " ========================================================================="
121
+ cat " ./${ut_suite} _with_skip_test_failed.log"
122
+ echo -e " ========================================================================="
123
+ echo -e " Checking Failed cases in ${ut_suite} with skip"
124
+ echo -e " ========================================================================="
74
125
compare_and_filter_logs " ${ut_suite} " _with_skip_test_failed.log Known_issue.log
75
126
if [[ -f " ${ut_suite} _with_skip_test_failed_filtered.log" ]]; then
76
127
num_failed_with_skip=$( wc -l < " ./${ut_suite} _with_skip_test_failed_filtered.log" )
77
128
else
78
129
num_failed_with_skip=$( wc -l < " ./${ut_suite} _with_skip_test_failed.log" )
79
130
fi
131
+ echo -e " ========================================================================="
132
+ echo -e " Show Failed cases in ${ut_suite} with only"
133
+ echo -e " ========================================================================="
134
+ cat " ./${ut_suite} _with_only_test_failed.log"
135
+ echo -e " ========================================================================="
136
+ echo -e " Checking Failed cases in ${ut_suite} with only"
137
+ echo -e " ========================================================================="
80
138
compare_and_filter_logs " ${ut_suite} " _with_only_test_failed.log Known_issue.log
81
139
if [[ -f " ${ut_suite} _with_only_test_failed_filtered.log" ]]; then
82
140
num_failed_with_only=$( wc -l < " ./${ut_suite} _with_only_test_failed_filtered.log" )
83
141
else
84
142
num_failed_with_only=$( wc -l < " ./${ut_suite} _with_only_test_failed.log" )
85
143
fi
86
- echo -e " ========================================================================="
87
- echo -e " Show Failed cases in ${ut_suite} with skip"
88
- echo -e " ========================================================================="
89
- cat " ./${ut_suite} _with_skip_test_failed.log"
90
- echo -e " ========================================================================="
91
- echo -e " Show Failed cases in ${ut_suite} with only"
92
- echo -e " ========================================================================="
93
- cat " ./${ut_suite} _with_only_test_failed.log"
94
144
(( num_failed= num_failed_with_skip+ num_failed_with_only))
95
145
grep " PASSED" op_ut_with_skip_test.log | awk ' {print $1}' > ./" ${ut_suite} " _with_skip_test_passed.log
96
146
grep " PASSED" op_ut_with_only_test.log | awk ' {print $1}' > ./" ${ut_suite} " _with_only_test_passed.log
136
186
if [[ " ${ut_suite} " == ' xpu_distributed' ]]; then
137
187
grep -E " ^FAILED" xpu_distributed_test.log | awk ' {print $2}' > ./" ${ut_suite} " _xpu_distributed_test_failed.log
138
188
grep -E " have failures" xpu_distributed_test.log | awk ' {print $1}' >> ./" ${ut_suite} " _xpu_distributed_test_failed.log
189
+ echo -e " ========================================================================="
190
+ echo -e " Show Failed cases in ${ut_suite} xpu distributed"
191
+ echo -e " ========================================================================="
192
+ cat " ./${ut_suite} _xpu_distributed_test_failed.log"
193
+ echo -e " ========================================================================="
194
+ echo -e " Checking Failed cases in ${ut_suite} xpu distributed"
195
+ echo -e " ========================================================================="
139
196
compare_and_filter_logs " ${ut_suite} " _xpu_distributed_test_failed.log Known_issue.log
140
197
if [[ -f " ${ut_suite} _xpu_distributed_test_failed_filtered.log" ]]; then
141
198
num_failed_xpu_distributed=$( wc -l < " ./${ut_suite} _xpu_distributed_test_failed_filtered.log" )
142
199
else
143
200
num_failed_xpu_distributed=$( wc -l < " ./${ut_suite} _xpu_distributed_test_failed.log" )
144
201
fi
145
- echo -e " ========================================================================="
146
- echo -e " Show Failed cases in ${ut_suite} xpu distributed"
147
- echo -e " ========================================================================="
148
- cat " ./${ut_suite} _xpu_distributed_test_failed.log"
149
202
(( num_failed= num_failed_xpu_distributed))
150
203
if [[ $num_failed -gt 0 ]]; then
151
204
echo -e " [ERROR] UT ${ut_suite} test Fail"
0 commit comments