Skip to content

Commit 5efac58

Browse files
authored
Do not paint red for asan (#9704)
1 parent d59377c commit 5efac58

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

.github/actions/test_ya/action.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ runs:
8686
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
8787
-d '{"state":"pending","description":"The check has been started","context":"build_${{inputs.build_preset}}"}'
8888
89-
if [[ "${{inputs.run_tests}}" == "true" ]];then
89+
if [[ "${{inputs.run_tests}}" == "true" ]]; then
9090
curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \
9191
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
9292
-d '{"state":"pending","description":"The check has been started","context":"test_${{inputs.build_preset}}"}'
@@ -187,6 +187,7 @@ runs:
187187
)
188188
189189
TEST_RETRY_COUNT=${{ inputs.test_retry_count }}
190+
IS_TEST_RESULT_IGNORED=0
190191
191192
case "$BUILD_PRESET" in
192193
debug)
@@ -212,6 +213,7 @@ runs:
212213
if [ $TEST_RETRY_COUNT -z ]; then
213214
TEST_RETRY_COUNT=1
214215
fi
216+
IS_TEST_RESULT_IGNORED=1
215217
;;
216218
release-tsan)
217219
params+=(
@@ -221,6 +223,7 @@ runs:
221223
if [ $TEST_RETRY_COUNT -z ]; then
222224
TEST_RETRY_COUNT=1
223225
fi
226+
IS_TEST_RESULT_IGNORED=1
224227
;;
225228
release-msan)
226229
params+=(
@@ -230,12 +233,15 @@ runs:
230233
if [ $TEST_RETRY_COUNT -z ]; then
231234
TEST_RETRY_COUNT=1
232235
fi
236+
IS_TEST_RESULT_IGNORED=1
233237
;;
234238
*)
235239
echo "Invalid preset: $BUILD_PRESET"
236240
exit 1
237241
;;
238242
esac
243+
244+
echo "IS_TEST_RESULT_IGNORED=$IS_TEST_RESULT_IGNORED" >> $GITHUB_ENV
239245
240246
if [ $TEST_RETRY_COUNT -z ]; then
241247
# default is 3 for ordinary build and 1 for sanitizer builds
@@ -434,6 +440,7 @@ runs:
434440
--status_report_file statusrep.txt \
435441
--is_retry $IS_RETRY \
436442
--is_last_retry $IS_LAST_RETRY \
443+
--is_test_result_ignored $IS_TEST_RESULT_IGNORED \
437444
--comment_color_file summary_color.txt \
438445
--comment_text_file summary_text.txt \
439446
"Tests" $CURRENT_PUBLIC_DIR/ya-test.html "$CURRENT_JUNIT_XML_PATH"
@@ -513,7 +520,7 @@ runs:
513520
set -x
514521
if [ true = ${{ inputs.run_tests }} ]; then
515522
teststatus=$(cat statusrep.txt)
516-
if [[ $teststatus == "success" ]];then
523+
if [[ $teststatus == "success" ]]; then
517524
testmessage="The check has been completed successfully"
518525
else
519526
testmessage="The check has been failed"
@@ -522,7 +529,7 @@ runs:
522529
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
523530
-d '{"state":"'$teststatus'","description":"'"$testmessage"'","context":"test_${{inputs.build_preset}}"}'
524531
525-
if [[ $teststatus != "success" ]];then
532+
if [[ $teststatus != "success" ]]; then
526533
echo "status=failed" >> $GITHUB_OUTPUT
527534
fi
528535
fi
@@ -531,7 +538,9 @@ runs:
531538
if: inputs.run_tests
532539
shell: bash
533540
run: |
534-
.github/scripts/tests/fail-checker.py "$LAST_JUNIT_REPORT_XML"
541+
if [ $IS_TEST_RESULT_IGNORED == 0 ]; then
542+
.github/scripts/tests/fail-checker.py "$LAST_JUNIT_REPORT_XML"
543+
fi
535544
536545
- name: show diff mute_ya.txt
537546
if: inputs.build_preset == 'relwithdebinfo' && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target')
@@ -623,7 +632,7 @@ runs:
623632
read -ra comment_arr <<< "$comment_raw"
624633
625634
printf "$comment"
626-
if [[ ${comment_raw} != "Error"* ]];then
635+
if [[ ${comment_raw} != "Error"* ]]; then
627636
color=${comment_arr[0]}
628637
replace=$color";;;"
629638
comment=${comment_raw/$replace/""}

.github/scripts/tests/generate-summary.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,15 @@ def gen_summary(public_dir, public_dir_url, paths, is_retry: bool, build_preset)
346346
return summary
347347

348348

349-
def get_comment_text(summary: TestSummary, summary_links: str, is_last_retry: bool)->tuple[str, list[str]]:
349+
def get_comment_text(summary: TestSummary, summary_links: str, is_last_retry: bool, is_test_result_ignored: bool)->tuple[str, list[str]]:
350350
color = "red"
351351
if summary.is_failed:
352-
color = "red" if is_last_retry else "yellow"
353-
result = f"Some tests failed, follow the links below."
352+
if is_test_result_ignored:
353+
color = "yellow"
354+
result = f"Some tests failed, follow the links below. This fail is not in blocking policy yet"
355+
else:
356+
color = "red" if is_last_retry else "yellow"
357+
result = f"Some tests failed, follow the links below."
354358
if not is_last_retry:
355359
result += " Going to retry failed tests..."
356360
else:
@@ -397,6 +401,7 @@ def main():
397401
parser.add_argument('--status_report_file', required=False)
398402
parser.add_argument('--is_retry', required=True, type=int)
399403
parser.add_argument('--is_last_retry', required=True, type=int)
404+
parser.add_argument('--is_test_result_ignored', required=True, type=int)
400405
parser.add_argument('--comment_color_file', required=True)
401406
parser.add_argument('--comment_text_file', required=True)
402407
parser.add_argument("args", nargs="+", metavar="TITLE html_out path")
@@ -412,12 +417,12 @@ def main():
412417
summary = gen_summary(args.public_dir, args.public_dir_url, title_path, is_retry=bool(args.is_retry),build_preset=args.build_preset)
413418
write_summary(summary)
414419

415-
if summary.is_failed:
420+
if summary.is_failed and not args.is_test_result_ignored:
416421
overall_status = "failure"
417422
else:
418423
overall_status = "success"
419424

420-
color, text = get_comment_text(summary, args.summary_links, is_last_retry=bool(args.is_last_retry))
425+
color, text = get_comment_text(summary, args.summary_links, is_last_retry=bool(args.is_last_retry), is_test_result_ignored=args.is_test_result_ignored)
421426

422427
with open(args.comment_color_file, "w") as f:
423428
f.write(color)

0 commit comments

Comments
 (0)