Skip to contentSkip to conversation

lib/igt_core.c: Flag the test as failing after a segfault

PATCH In review Derek Morton 2 participants 3 messages May 18, 2015 – May 19, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/igt_core.c: Flag the test as failing after a segfault

fatal_signal_handler() was trapping fatal errors but not flagging the test as failing or setting an exit code. The result was that the test would return Ok or Skipped depending on what the other subtests did even though one of the subtests had segfaulted.

---
 lib/igt_core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
lib/igt_core.c +8 -1
index 8a1a249..b29f7e3 100644
@@ -1433,8 +1433,15 @@ static void fatal_sig_handler(int sig)
 			igt_assert_eq(write(STDERR_FILENO, ".\n", 2), 2);
 		}
 
-		if (in_subtest && crash_signal(sig))
+		if (in_subtest && crash_signal(sig)) {
+			/* Linux standard to return exit code as 128 + signal */
+			if (!failed_one)
+				igt_exitcode = 128 + sig;
+
+			failed_one = true;
+
 			exit_subtest("CRASH");
+		}
 		break;
 	}
 
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 7 lines · Derek Morton

fatal_signal_handler() was trapping fatal errors but not flagging the test as failing or setting an exit code. The result was that the test would return Ok or Skipped depending on what the other subtests did even though one of the subtests had segfaulted.

This isn't the first trouble with our signal handler and test results. Can you perhaps write a library unit test for this bug?

They're in lib/tests and executed with make check.

Thanks, Daniel

Quoted 32 lines
---
 lib/igt_core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
lib/igt_core.c +8 -1
index 8a1a249..b29f7e3 100644
@@ -1433,8 +1433,15 @@ static void fatal_sig_handler(int sig)
 			igt_assert_eq(write(STDERR_FILENO, ".\n", 2), 2);
 		}
 
-		if (in_subtest && crash_signal(sig))
+		if (in_subtest && crash_signal(sig)) {
+			/* Linux standard to return exit code as 128 + signal */
+			if (!failed_one)
+				igt_exitcode = 128 + sig;
+
+			failed_one = true;
+
 			exit_subtest("CRASH");
+		}
 		break;
 	}
 
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
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
#2 lore raw

I will take a look and submit a test as a separate patch.

//Derek

-----Original Message-----
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Monday, May 18, 2015 4:14 PM
To: Morton, Derek J
Cc: [email protected]; Wood, Thomas
Subject: Re: [Intel-gfx] [PATCH i-g-t] lib/igt_core.c: Flag the test as failing after a segfault

Quoted 7 lines · Derek Morton

fatal_signal_handler() was trapping fatal errors but not flagging the test as failing or setting an exit code.
The result was that the test would return Ok or Skipped depending on what the other subtests did even though one of the subtests had segfaulted.

This isn't the first trouble with our signal handler and test results. Can you perhaps write a library unit test for this bug?

They're in lib/tests and executed with make check.

Thanks, Daniel

Quoted 28 lines
---
 lib/igt_core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
lib/igt_core.c index 8a1a249..b29f7e3 renamed from lib/igt_core.c +0 -0

100644

lib/igt_core.c +8 -2
@@ -1433,8 +1433,15 @@ static void fatal_sig_handler(int sig)
 			igt_assert_eq(write(STDERR_FILENO, ".\n", 2), 2);
 		}
 
-		if (in_subtest && crash_signal(sig))
+		if (in_subtest && crash_signal(sig)) {
+			/* Linux standard to return exit code as 128 + signal */
+			if (!failed_one)
+				igt_exitcode = 128 + sig;
+
+			failed_one = true;
+
 			exit_subtest("CRASH");
+		}
 		break;
 	}
 
--

1.9.1

Quoted 4 lines

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

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