summaryrefslogtreecommitdiff
path: root/src/user/app/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app/tests')
-rw-r--r--src/user/app/tests/tests.c7
-rw-r--r--src/user/app/tests/tests.h5
2 files changed, 11 insertions, 1 deletions
diff --git a/src/user/app/tests/tests.c b/src/user/app/tests/tests.c
index 14225ac..e4b4d37 100644
--- a/src/user/app/tests/tests.c
+++ b/src/user/app/tests/tests.c
@@ -2,6 +2,9 @@
#include <camellia/syscalls.h>
#include <unistd.h>
+__attribute__((visibility("hidden")))
+extern char _image_base[];
+
FILE *fail_trig;
void run_test(void (*fn)()) {
@@ -10,7 +13,9 @@ void run_test(void (*fn)()) {
exit(0);
} else {
/* successful tests must return 0 */
- if (_syscall_await() != 0) test_fail();
+ if (_syscall_await() != 0) {
+ test_failf("0x%x, base 0x%x", (void*)fn - (void*)_image_base, _image_base);
+ }
}
}
diff --git a/src/user/app/tests/tests.h b/src/user/app/tests/tests.h
index e9b06e5..e93653e 100644
--- a/src/user/app/tests/tests.h
+++ b/src/user/app/tests/tests.h
@@ -29,4 +29,9 @@ int forkpipe(FILE **f, handle_t *h);
fflush(fail_trig); \
exit(0); \
} while (0)
+#define test_failf(fmt, ...) do { \
+ fprintf(fail_trig, "%s():%u " fmt, __func__, __LINE__, __VA_ARGS__); \
+ fflush(fail_trig); \
+ exit(0); \
+} while (0)
#define test(cond) if (!(cond)) test_fail();