[test suite] run fko-wrapper without valgrind, closes #113
authorMichael Rash <mbr@cipherdyne.org>
Mon, 30 Dec 2013 00:59:16 +0000 (19:59 -0500)
committerMichael Rash <mbr@cipherdyne.org>
Mon, 30 Dec 2013 00:59:16 +0000 (19:59 -0500)
test/fko-wrapper/run_no_valgrind.sh [new file with mode: 0755]
test/test-fwknop.pl
test/tests/rijndael_fuzzing.pl

diff --git a/test/fko-wrapper/run_no_valgrind.sh b/test/fko-wrapper/run_no_valgrind.sh
new file mode 100755 (executable)
index 0000000..72e14b9
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh -x
+
+LD_LIBRARY_PATH=../../lib/.libs ./fko_wrapper
index 4700563..488113f 100755 (executable)
@@ -5966,6 +5966,69 @@ sub compile_execute_fko_wrapper() {
     return $rv;
 }
 
+sub compile_execute_fko_wrapper_no_valgrind() {
+    my $rv = 1;
+
+    unless (-d $fko_wrapper_dir) {
+        &write_test_file("[-] fko wrapper directory " .
+            "$fko_wrapper_dir does not exist.\n", $curr_test_file);
+        return 0;
+    }
+
+    chdir $fko_wrapper_dir or die $!;
+
+    ### 'make clean' as root
+    unless (&run_cmd('make clean', "../$cmd_out_tmp",
+            "../$curr_test_file")) {
+        chdir '..' or die $!;
+        return 0;
+    }
+
+    if ($sudo_path) {
+        my $username = getpwuid((stat("../$test_suite_path"))[4]);
+        die "[*] Could not determine ../$test_suite_path owner"
+            unless $username;
+
+        unless (&run_cmd("$sudo_path -u $username make",
+                "../$cmd_out_tmp", "../$curr_test_file")) {
+            unless (&run_cmd('make', "../$cmd_out_tmp",
+                    "../$curr_test_file")) {
+                chdir '..' or die $!;
+                return 0;
+            }
+        }
+
+    } else {
+
+        unless (&run_cmd('make', "../$cmd_out_tmp",
+                "../$curr_test_file")) {
+            chdir '..' or die $!;
+            return 0;
+        }
+    }
+
+    unless (-e 'fko_wrapper' and -e 'run_no_valgrind.sh') {
+        &write_test_file("[-] fko_wrapper or run_valgrind.sh does not exist.\n",
+            "../$curr_test_file");
+        chdir '..' or die $!;
+        return 0;
+    }
+
+    &run_cmd('./run_no_valgrind.sh',
+        "../$cmd_out_tmp", "../$curr_test_file");
+
+    chdir '..' or die $!;
+
+    if (&file_find_regex([qr/segmentation\sfault/i, qr/core\sdumped/i],
+            $MATCH_ANY, $NO_APPEND_RESULTS, $curr_test_file)) {
+        &write_test_file("[-] crash message found in: $curr_test_file\n",
+            $curr_test_file);
+        $rv = 0;
+    }
+
+    return $rv;
+}
+
 sub parse_valgrind_flagged_functions() {
 
     my $rv = 1;
index e3037d7..d57550e 100644 (file)
         'cmdline'  => $default_client_args,
         'fwknopd_cmdline' => "$fwknopdCmd $default_server_conf_args $intf_str",
     },
+    {
+        'category' => 'Rijndael',
+        'subcategory' => 'fko-wrapper',
+        'detail'   => 'multiple libfko calls',
+        'function' => \&compile_execute_fko_wrapper_no_valgrind
+    },
 );