summaryrefslogtreecommitdiff
path: root/lib/drmtest.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-09-12 16:17:33 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-09-17 00:13:47 +0200
commitd1b9bc0dc17dbc49d707abf861d31020fbcb5ff6 (patch)
tree76a1028fb0df37e38b2fc3b3c8daaed7f6c0b44d /lib/drmtest.c
parent7b3634364a1f5cf1797a55a1d0d042ec8d9f510c (diff)
lib/drmtest: check that igt_exit is called for subtest tests
I get this wrong for almost every conversion to subtests ... v2: Don't install the check when just listing subtest names. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/drmtest.c')
-rw-r--r--lib/drmtest.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index a3ff0d6f..3d89047a 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -675,6 +675,14 @@ void __igt_fixture_end(void)
longjmp(igt_subtest_jmpbuf, 1);
}
+bool igt_exit_called;
+static void check_igt_exit(int sig)
+{
+ /* When not killed by a signal check that igt_exit() has been properly
+ * called. */
+ assert(sig != 0 || igt_exit_called);
+}
+
static void print_usage(const char *command_str, const char *help_str,
bool output_on_stderr)
{
@@ -738,6 +746,8 @@ int igt_subtest_init_parse_opts(int argc, char **argv,
case 'l':
if (!run_single_subtest)
list_subtests = true;
+ else
+ igt_install_exit_handler(check_igt_exit);
break;
case 'r':
if (!list_subtests)
@@ -937,6 +947,7 @@ void igt_exit(void)
/* Calling this without calling one of the above is a failure */
assert(skipped_one || succeeded_one || failed_one);
+ igt_exit_called = true;
if (failed_one)
exit(igt_exitcode);