From bdf29239f1d66c2b6456f29c9ab7bbe44c0c2fb2 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 8 May 2022 15:13:56 +0200 Subject: [PATCH] [MIRROR] Annotates integration tests failures due to runtimes better [MDB IGNORE] (#13426) * Forgot about CI failure due to runtime (whoops) (#66762) * Annotates integration tests failures due to runtimes better Co-authored-by: Tastyfish --- code/modules/error_handler/error_handler.dm | 2 +- code/modules/unit_tests/unit_test.dm | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/code/modules/error_handler/error_handler.dm b/code/modules/error_handler/error_handler.dm index 8e209b889cb..60fe226fdef 100644 --- a/code/modules/error_handler/error_handler.dm +++ b/code/modules/error_handler/error_handler.dm @@ -129,7 +129,7 @@ GLOBAL_VAR_INIT(total_runtimes_skipped, 0) #ifdef UNIT_TESTS if(GLOB.current_test) //good day, sir - GLOB.current_test.Fail("[main_line]\n[desclines.Join("\n")]") + GLOB.current_test.Fail("[main_line]\n[desclines.Join("\n")]", file = E.file, line = E.line) #endif diff --git a/code/modules/unit_tests/unit_test.dm b/code/modules/unit_tests/unit_test.dm index d55673dce03..3a25d85ac72 100644 --- a/code/modules/unit_tests/unit_test.dm +++ b/code/modules/unit_tests/unit_test.dm @@ -104,8 +104,14 @@ GLOBAL_VAR(test_log) var/file = fail_reasons[reasonID][2] var/line = fail_reasons[reasonID][3] - /// Github action annotation. - log_world("::error file=[file],line=[line],title=[test_path]::[text]") + // Github action annotation. + // See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions + + // Need to escape the text to properly support newlines. + var/annotation_text = replacetext(text, "%", "%25") + annotation_text = replacetext(annotation_text, "\n", "%0A") + + log_world("::error file=[file],line=[line],title=[test_path]::[annotation_text]") // Normal log message log_entry += "\tREASON #[reasonID]: [text] at [file]:[line]"