Refactor testlib's funcname handling.

This commit is contained in:
Nigel Tao committed 2017-06-10 15:34:13 +10:00
1 parent 8d6694a752
commit 88e2d4cf59
3 files changed
+32 -31

No files matched your search

+3 -1
View File
@@ -16,6 +16,7 @@ typedef void (*test)();
test tests[];
const char* test_filename;
const char* test_funcname = "";
int main(int argc, char** argv) {
// The order matters here. Clang also defines "__GNUC__".
@@ -32,7 +33,8 @@ int main(int argc, char** argv) {
for (test* t = tests; *t; t++) {
(*t)();
if (fail_msg[0]) {
printf("%-16s%-8sFAIL %s\n", test_filename, cc, fail_msg);
printf("%-16s%-8sFAIL %s: %s\n", test_filename, cc, test_funcname,
fail_msg);
return 1;
}
tests_run++;