[test suite] added files to Makefile.am and added a test to verify this
authorMichael Rash <mbr@cipherdyne.org>
Wed, 13 Mar 2013 02:50:37 +0000 (22:50 -0400)
committerMichael Rash <mbr@cipherdyne.org>
Wed, 13 Mar 2013 02:50:37 +0000 (22:50 -0400)
Makefile.am
test/test-fwknop.pl

index fdd040c..769dad3 100644 (file)
@@ -148,10 +148,43 @@ EXTRA_DIST = \
     test/conf/hmac_dual_key_usage_access.conf \
     test/conf/hmac_invalid_type_access.conf \
     test/conf/hmac_md5_access.conf \
+    test/conf/hmac_md5_short_key_access.conf \
+    test/conf/hmac_md5_long_key_access.conf \
     test/conf/hmac_sha1_access.conf \
+    test/conf/hmac_sha1_short_key_access.conf \
+    test/conf/hmac_sha1_long_key_access.conf \
+    test/conf/hmac_sha256_access.conf \
+    test/conf/hmac_sha256_short_key_access.conf \
+    test/conf/hmac_sha256_long_key_access.conf \
     test/conf/hmac_sha384_access.conf \
+    test/conf/hmac_sha384_short_key_access.conf \
+    test/conf/hmac_sha384_long_key_access.conf \
     test/conf/hmac_sha512_access.conf \
+    test/conf/hmac_sha512_short_key_access.conf \
+    test/conf/hmac_sha512_long_key_access.conf \
     test/conf/hmac_simple_keys_access.conf \
+    test/conf/fwknoprc_default_hmac_base64_key \
+    test/conf/fwknoprc_hmac_invalid_type \
+    test/conf/fwknoprc_hmac_md5_key \
+    test/conf/fwknoprc_hmac_md5_long_key \
+    test/conf/fwknoprc_hmac_md5_short_key \
+    test/conf/fwknoprc_hmac_sha1_key \
+    test/conf/fwknoprc_hmac_sha1_long_key \
+    test/conf/fwknoprc_hmac_sha1_short_key \
+    test/conf/fwknoprc_hmac_sha256_key \
+    test/conf/fwknoprc_hmac_sha256_long_key \
+    test/conf/fwknoprc_hmac_sha256_short_key \
+    test/conf/fwknoprc_hmac_sha384_key \
+    test/conf/fwknoprc_hmac_sha384_long_key \
+    test/conf/fwknoprc_hmac_sha384_short_key \
+    test/conf/fwknoprc_hmac_sha512_key \
+    test/conf/fwknoprc_hmac_sha512_short_key \
+    test/conf/fwknoprc_hmac_simple_keys \
+    test/conf/fwknoprc_invalid_base64_key \
+    test/conf/fwknoprc_named_key \
+    test/conf/fwknoprc_with_default_base64_key \
+    test/conf/fwknoprc_with_default_key \
+    test/conf/fwknoprc_with_named_key \
     test/conf/icmp_pcap_filter_fwknopd.conf \
     test/conf/invalid_expire_access.conf \
     test/conf/invalid_source_access.conf \
index edc17ef..09c9e35 100755 (executable)
@@ -408,6 +408,12 @@ my @tests = (
         'function' => \&make_distcheck,
         'fatal'    => $NO
     },
+    {
+        'category' => 'Makefile.am',
+        'detail'   => 'test suite conf/ files included',
+        'function' => \&test_suite_conf_files,
+        'fatal'    => $NO
+    },
 
     @build_security_client,
     @build_security_server,
@@ -852,6 +858,43 @@ sub profile_coverage() {
     return 1;
 }
 
+sub test_suite_conf_files() {
+    my $make_file = '../Makefile.am';
+    my $rv = 1;
+
+    my %makefile_am_files = ();
+
+    unless (-e $make_file) {
+        &write_test_file("[-] $make_file does not exist.\n",
+            $curr_test_file);
+        return 0;
+    }
+
+    open F, "< $make_file" or die $!;
+    while (<F>) {
+        if (m|test/conf/(\S+)|) {
+            $makefile_am_files{$1} = '';
+        }
+    }
+    close F;
+
+    for my $f (glob("$conf_dir/*")) {
+        next if -d $f;
+        next unless $f =~ /\.conf/ or $f =~ /fwknop/;
+        if ($f =~ m|$conf_dir/(\S+)|) {
+            if (defined $makefile_am_files{$1}) {
+                &write_test_file("[+] test suite conf file $1 is in $make_file.\n",
+                    $curr_test_file);
+            } else {
+                &write_test_file("[-] test suite conf file $1 not in $make_file.\n",
+                    $curr_test_file);
+                $rv = 0;
+            }
+        }
+    }
+    return $rv;
+}
+
 sub make_distcheck() {
 
     ### 'make clean' as root