diff options
Diffstat (limited to '02-usart/test_harness/test_harness.c')
-rw-r--r-- | 02-usart/test_harness/test_harness.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/02-usart/test_harness/test_harness.c b/02-usart/test_harness/test_harness.c index 9f7dd79..3a6d10a 100644 --- a/02-usart/test_harness/test_harness.c +++ b/02-usart/test_harness/test_harness.c @@ -46,7 +46,6 @@ static int execute_test(test_t* test) int status; int ec; pid_t pid; - const char* note = ""; snprintf( fullname, sizeof(fullname), "%s::%s", iter->test_suite, iter->test_name); @@ -66,17 +65,21 @@ static int execute_test(test_t* test) return 1; } - ec = WEXITSTATUS(status); - switch (ec) { - case 0: - printf("%s " GREEN "[PASS]" RESET "\n", fullname); - return 0; - case 11: - note = " (SIGSEGV)"; - break; + if (WIFEXITED(status)) { + switch ((ec = WEXITSTATUS(status))) { + case 0: + printf("%s " GREEN "[PASS]" RESET "\n", fullname); + return 0; + default: + printf("%s " RED "[FAIL] %d" RESET "\n", fullname, ec); + return ec; + } + } else if (WIFSIGNALED(status)) { + int ec = WTERMSIG(status); + printf("%s " RED "[FAIL] signaled %d" RESET "\n", fullname, ec); + return ec; } - printf("%s " RED "[FAIL] %d%s" RESET "\n", fullname, ec, note); return ec; } } |