[test suite] added checks to look for segfaults/crashes
authorMichael Rash <mbr@cipherdyne.org>
Fri, 2 Aug 2013 19:09:00 +0000 (15:09 -0400)
committerMichael Rash <mbr@cipherdyne.org>
Fri, 2 Aug 2013 19:09:00 +0000 (15:09 -0400)
test/test-fwknop.pl

index 1e81a6c..69e9638 100755 (executable)
@@ -525,10 +525,25 @@ my @tests = (
     @os_compatibility,
     @perl_FKO_module,
     @python_fko,
+
+    {
+        'category' => 'Look for crashes',
+        'detail'   => 'checking for segfaults (1)',
+        'function' => \&look_for_crashes,
+        'fatal'    => $NO
+    },
+
     @gpg_no_pw,
     @gpg_no_pw_hmac,
     @gpg,
     @gpg_hmac,
+
+    {
+        'category' => 'Look for crashes',
+        'detail'   => 'checking for segfaults (2)',
+        'function' => \&look_for_crashes,
+        'fatal'    => $NO
+    }
 );
 
 &validate_test_hashes();
@@ -1031,6 +1046,23 @@ sub test_suite_conf_files() {
     return $rv;
 }
 
+sub look_for_crashes() {
+    my $rv = 1;
+
+    for my $f (glob("$output_dir/*")) {
+
+        next if -d $f;
+        next unless $f =~ /\.test$/;
+
+        if (&file_find_regex([qr/segmentation\sfault/i, qr/core\sdumped/i],
+                $MATCH_ANY, $APPEND_RESULTS, $f)) {
+            $rv = 0;
+        }
+    }
+
+    return $rv;
+}
+
 sub make_distcheck() {
 
     ### 'make clean' as root