From 54e388a3752e81d6c8137f740097dc68540f5fad Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 22 Feb 2023 00:30:12 -0300 Subject: [PATCH] More detailed hydra test results --- test/test_runner.c | 4 +++- tools/mgba-rom-test-hydra/main.c | 29 +++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/test/test_runner.c b/test/test_runner.c index 0be163431..c2d3f66d2 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -194,8 +194,10 @@ void CB2_TestRunner(void) default: result = "UNKNOWN"; break; } - if (gTestRunnerState.expectedResult == gTestRunnerState.result) + if (gTestRunnerState.result == TEST_RESULT_PASS) MgbaPrintf_(":P%s%s\e[0m", color, result); + else if (gTestRunnerState.expectedResult == gTestRunnerState.result) + MgbaPrintf_(":K%s%s\e[0m", color, result); else MgbaPrintf_(":F%s%s\e[0m", color, result); } diff --git a/tools/mgba-rom-test-hydra/main.c b/tools/mgba-rom-test-hydra/main.c index 4ce9b09bd..107ca339b 100644 --- a/tools/mgba-rom-test-hydra/main.c +++ b/tools/mgba-rom-test-hydra/main.c @@ -9,7 +9,11 @@ * COMMANDS * N: Sets the test name to the remainder of the line. * R: Sets the result to the remainder of the line, and flushes any - * output buffered since the previous R. */ + * output buffered since the previous R. + * + * //Missing P, F and K documentation, please tell me what to put here lol + * + */ #include #include #include @@ -39,6 +43,7 @@ struct Runner size_t output_buffer_capacity; char *output_buffer; int passes; + int knownFails; int results; }; @@ -76,8 +81,11 @@ static void handle_read(struct Runner *runner) case 'P': case 'F': + case 'K': if (soc[1] == 'P') runner->passes++; + else if (soc[1] == 'K') + runner->knownFails++; runner->results++; soc += 2; fprintf(stdout, "%s: ", runner->test_name); @@ -411,6 +419,7 @@ int main(int argc, char *argv[]) // Reap test runners and collate exit codes. int exit_code = 0; int passes = 0; + int knownFails = 0; int results = 0; for (int i = 0; i < nrunners; i++) { @@ -425,9 +434,25 @@ int main(int argc, char *argv[]) if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) > exit_code) exit_code = WEXITSTATUS(wstatus); passes += runners[i].passes; + knownFails += runners[i].knownFails; results += runners[i].results; } - fprintf(stdout, "%d/%d \e[32mPASS\e[0med\n", passes, results); + + if (results == 0) + { + fprintf(stdout, "\nNo tests found.\n"); + } + else + { + fprintf(stdout, "\n- Tests TOTAL: %d\n", results); + fprintf(stdout, "- Tests \e[32mPASSED: \e[0m %d\n", passes); + if (knownFails > 0) + fprintf(stdout, "- Tests \e[33mKNOWN_FAILING:\e[0m %d\n", knownFails); + if (passes + knownFails < results) + fprintf(stdout, "- Tests \e[31mFAILED: \e[0m %d\n", results - passes - knownFails); + } + fprintf(stdout, "\n"); + fflush(stdout); return exit_code; }