diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-20 12:45:55 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-20 12:45:55 +0100 |
commit | 2a37b1d78e8afedcd796dbb0b91d1bee6822d133 (patch) | |
tree | e81ac455ed495881241cd8c3203d6e1ba0eb6d8f /lib/drmtest.c | |
parent | 398be7d573fc20c42c737fdac3e3e979835c47fa (diff) |
lib: Make igt_assert() abort under gdb
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/drmtest.c')
-rw-r--r-- | lib/drmtest.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index 62b3f829..ae64f226 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -894,12 +894,23 @@ void igt_fail(int exitcode) } } +static bool run_under_gdb(void) +{ + char buf[1024]; + + sprintf(buf, "/proc/%d/exe", getppid()); + return (readlink (buf, buf, sizeof (buf)) != -1 && + strncmp (basename (buf), "gdb", 3) == 0); +} + void __igt_fail_assert(int exitcode, const char *file, const int line, const char *func, const char *assertion) { printf("Test assertion failure function %s, file %s:%i:\n" "Failed assertion: %s\n", func, file, line, assertion); + if (run_under_gdb()) + abort(); igt_fail(exitcode); } |