Skip to contentSkip to conversation

lib/tests/igt_segfault.c Add unit test to test segfault handling

PATCH Superseded Derek Morton 2 participants 4 messages May 26, 2015 – May 27, 2015

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/tests/igt_segfault.c Add unit test to test segfault handling

Unit test to check a segfaulting subtest is handled correctly.

---
 lib/tests/Makefile.sources |  2 ++
 lib/tests/igt_segfault.c   | 57 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 lib/tests/igt_segfault.c
lib/tests/Makefile.sources +2 -0
index 10e0617..04ce4e6 100644
@@ -8,6 +8,7 @@ check_PROGRAMS = \
 	igt_simple_test_subtests \
 	igt_timeout \
 	igt_invalid_subtest_name \
+	igt_segfault \
 	$(NULL)
 
 check_SCRIPTS = \
@@ -29,4 +30,5 @@ XFAIL_TESTS = \
 	igt_simple_test_subtests \
 	igt_timeout \
 	igt_invalid_subtest_name \
+	igt_segfault \
 	$(NULL)
lib/tests/igt_segfault.c new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#1 lore raw
Quoted 3 lines · Derek Morton

+ * The test consists of three subtests. The first and third should pass
+ * while the second should cause a segfault.
+ * The overall result should be a failure with two subtests passing.

You need to split this up into separate binaries and mark the expected failure with XFAIL_TESTS. Or write a short wrapper for it that checks that we get the right kind of failure ...

Yeah, autoconf library tests aren't awesome I know. -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Tuesday, May 26, 2015 4:27 PM
To: Morton, Derek J
Cc: intel-gfx; Wood, Thomas
Subject: Re: [Intel-gfx] [PATCH i-g-t] lib/tests/igt_segfault.c Add unit test to test segfault handling

Quoted 7 lines · Derek Morton
Quoted 4 lines

+ * The test consists of three subtests. The first and third should
+ pass
+ * while the second should cause a segfault.
+ * The overall result should be a failure with two subtests passing.

You need to split this up into separate binaries and mark the expected failure with XFAIL_TESTS. Or write a short wrapper for it that checks that we get the right kind of failure ...

The aim of the test was to ensure the overall test returns an failure code if a subtest segfaults. I put a passing subtest before and after the one that crashes to test that the crashing subtest does not affect the other subtests. I guess I could write a script to check the individual subtest results.

Quoted 6 lines

Yeah, autoconf library tests aren't awesome I know. -Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 13 lines · Derek J

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Tuesday, May 26, 2015 4:27 PM
To: Morton, Derek J
Cc: intel-gfx; Wood, Thomas
Subject: Re: [Intel-gfx] [PATCH i-g-t] lib/tests/igt_segfault.c Add unit test to test segfault handling

Quoted 5 lines · Derek Morton
Quoted 4 lines

+ * The test consists of three subtests. The first and third should
+ pass
+ * while the second should cause a segfault.
+ * The overall result should be a failure with two subtests passing.

Quoted 7 lines
Quoted 1 line

You need to split this up into separate binaries and mark the expected failure with XFAIL_TESTS. Or write a short wrapper for it that checks that we get the right kind of failure ...

The aim of the test was to ensure the overall test returns an failure code if a subtest segfaults. I put a passing subtest before and after the one that crashes to test that the crashing subtest does not affect the other subtests. I guess I could write a script to check the individual subtest results.

Adding a scrip to parse subtest results means when we ever change the convention (or just the output printed, which isn't part of the stable testrunner interface) then this testcase fails.

Imo just copypaste the testcase and specialize all the different variants you want to test.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx