diff options
author | David Gibson <dwg@au1.ibm.com> | 2006-11-12 11:20:13 +1100 |
---|---|---|
committer | Nishanth Aravamudan <nacc@us.ibm.com> | 2006-11-13 12:12:05 -0800 |
commit | 54d5a78b3017f7867a40765371fe01ba4c292e02 (patch) | |
tree | 9a5f613be24662e302691f8e9e38234f731ae0ed /tests/testutils.c | |
parent | f3eac2e60661eee1444f6bc0f73bea695cdd81fe (diff) | |
download | libhugetlbfs-54d5a78b3017f7867a40765371fe01ba4c292e02.tar.gz |
Small tweaks to make debugging failing testcases easier
Two things to make debugging easier:
- Use an fflush() after each verbose_printf(), so that line
buffering won't mean messages get re-ordered w.r.t. the operations
they're describing (this can be particularly confusing when straceing
a testcase).
- When quiet mode isn't on, print the testname and pid at the
beginning of each test from test_init(). This saves a few steps
finding the pid when attaching gdb, or strace, or examining
/proc/XX/maps.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Diffstat (limited to 'tests/testutils.c')
-rw-r--r-- | tests/testutils.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/testutils.c b/tests/testutils.c index 11f7502..11316b6 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -54,7 +54,8 @@ static void segv_handler(int signum, siginfo_t *si, void *uc) static void sigint_handler(int signum, siginfo_t *si, void *uc) { cleanup(); - fprintf(stderr, "%s (pid=%d)\n", strsignal(signum), getpid()); + fprintf(stderr, "%s: %s (pid=%d)\n", test_name, + strsignal(signum), getpid()); exit(RC_BUG); } @@ -73,6 +74,9 @@ void test_init(int argc, char *argv[]) if (getenv("QUIET_TEST")) verbose_test = 0; + + verbose_printf("Starting testcase \"%s\", pid %d\n", + test_name, getpid()); } #define MAPS_BUF_SZ 4096 |