Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_runner: print expected exit code for tests #486

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion misc/test_runner/test_runner.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define _GNU_SOURCE

/* Define this macro to make the pointers in struct fake_criterion_test function pointers */
#define IA2_TEST_RUNNER_SOURCE
#include "include/ia2_test_runner.h"
Expand Down Expand Up @@ -83,7 +85,18 @@ int main() {
*/
sigaction(SIGSEGV, &act, NULL);
for (struct fake_criterion_test *test_info = fake_criterion_tests; test_info; test_info = test_info->next) {
fprintf(stderr, "running suite '%s' test '%s'...\n", test_info->suite, test_info->name);
const int exit_code = test_info->exit_code;
fprintf(stderr, "running suite '%s' test '%s', expecting exit code %d",
test_info->suite, test_info->name, exit_code);
if (exit_code == EXIT_SUCCESS) {
fprintf(stderr, " (%s)", STRINGIFY(EXIT_SUCCESS));
} else if (exit_code == EXIT_FAILURE) {
fprintf(stderr, " (%s)", STRINGIFY(EXIT_FAILURE));
} else if (exit_code > 128) {
fprintf(stderr, " (SIG%s)", sigabbrev_np(exit_code - 128));
}
fprintf(stderr, "...\n");

pid_t pid = fork();
bool in_child = pid == 0;
if (in_child) {
Expand Down
Loading