Improve interactive output on GHA (#15)

Before this commit the output of the test262 step was only visible in
the web interface at the end of the test run. Now it prints a status
update every few seconds.
This commit is contained in:
Ben Noordhuis 2023-11-05 13:48:44 +01:00 committed by GitHub
parent 18eb603e0d
commit a59faac8c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1889,21 +1889,23 @@ void show_progress(int force) {
if (compact) { if (compact) {
static int last_test_skipped; static int last_test_skipped;
static int last_test_failed; static int last_test_failed;
static int dots;
char c = '.'; char c = '.';
if (test_skipped > last_test_skipped) c = '-'; if (test_skipped > last_test_skipped) c = '-';
if (test_failed > last_test_failed) c = '!'; if (test_failed > last_test_failed) c = '!';
last_test_skipped = test_skipped; last_test_skipped = test_skipped;
last_test_failed = test_failed; last_test_failed = test_failed;
fputc(c, stderr); fputc(c, stderr);
if (force) if (force || ++dots % 60 == 0) {
fputc('\n', stderr); fprintf(stderr, " %d/%d/%d\n",
fflush(stderr); test_failed, test_count, test_skipped);
}
} else { } else {
/* output progress indicator: erase end of line and return to col 0 */ /* output progress indicator: erase end of line and return to col 0 */
fprintf(stderr, "%d/%d/%d\033[K\r", fprintf(stderr, "%d/%d/%d\033[K\r",
test_failed, test_count, test_skipped); test_failed, test_count, test_skipped);
fflush(stderr);
} }
fflush(stderr);
} }
} }