test: skip buserror test when SIGBUS is not defined in perl POSIX module 86/12186/3
authorMichael Meffie <mmeffie@sinenomine.net>
Mon, 8 Feb 2016 15:10:32 +0000 (10:10 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 11 Feb 2016 04:47:52 +0000 (23:47 -0500)
Older versions of the perl POSIX module do not define the SIGBUS symbol, which
causes the opr/softsig-t perl test to fail to compile.  Instead of trying to
defined SIGBUS, which may be platform dependent, skip the buserror unit test on
these older platforms.

Change-Id: Ib8cfd77215ea43566e9d47b501d4989556b83734
Reviewed-on: http://gerrit.openafs.org/12186
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

tests/opr/softsig-t

index a2e6fc9..89e66e5 100755 (executable)
@@ -77,11 +77,17 @@ close(HELPER);
 is($? & 0x7f, SIGSEGV, "Helper exited on SEGV signal.");
 
 # Check that an internal bus error kills the process.
-
-my ($fh, $path) = mkstemp("/tmp/softsig-t_XXXXXX");
-$pid = open(HELPER, "$softsig_helper -buserror $path |")
-    or die "Couldn't start test helper.";
-close(HELPER);
-is($? & 0x7f, SIGBUS, "Helper exited on BUS signal.");
-$fh->close;
-unlink $path;
+# Skip this test when running on ancient versions of Perl
+# which do not have SIGBUS defined.
+SKIP: {
+    my $sigbus = eval "SIGBUS";
+    skip("Skipping buserror test; SIGBUS constant is not defined.", 1) unless $sigbus;
+
+    my ($fh, $path) = mkstemp("/tmp/softsig-t_XXXXXX");
+    $pid = open(HELPER, "$softsig_helper -buserror $path |")
+        or die "Couldn't start test helper.";
+    close(HELPER);
+    is($? & 0x7f, $sigbus, "Helper exited on BUS signal.");
+    $fh->close;
+    unlink $path;
+}