]> ruderich.org/simon Gitweb - blhc/blhc.git/blobdiff - t/tests.t
Don't recognize options which contain compiler names as compiler lines.
[blhc/blhc.git] / t / tests.t
index d9c15c311f23ee4dfb0c61682e9385293eced2e9..c6906e2a59aaaa5a304f68264e5341d07d90a2a9 100644 (file)
--- a/t/tests.t
+++ b/t/tests.t
@@ -19,7 +19,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 122;
+use Test::More tests => 132;
 
 
 sub is_blhc {
@@ -71,6 +71,28 @@ is_blhc 'arch-avr32', '--color', 8,
 ";
 
 
+# Ignore missing compiler flags.
+
+is_blhc 'ignore-flag', '--ignore-flag -g', 8,
+        'CFLAGS missing (-O2): gcc -g     -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c
+';
+
+is_blhc 'ignore-flag', '--ignore-flag -g --ignore-flag -O2', 0,
+        '';
+
+
+# Ignore certain lines.
+
+is_blhc 'ignore-line', '--ignore-line "\./prepare-script gcc test-[a-z]\.c"', 8,
+        'CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security):     ./prepare-script gcc test-a.c test-b.c test-c.c
+CPPFLAGS missing (-D_FORTIFY_SOURCE=2):     ./prepare-script gcc test-a.c test-b.c test-c.c
+LDFLAGS missing (-Wl,-z,relro):     ./prepare-script gcc test-a.c test-b.c test-c.c
+';
+
+is_blhc 'ignore-line', '--ignore-line "\./prepare-script gcc test-[a-z]\.c" --ignore-line "\s*\./prepare-script gcc test-[a-z]\.c .+"', 0,
+        '';
+
+
 # Correct build logs.
 
 is_blhc 'good', '', 0,
@@ -453,12 +475,10 @@ CFLAGS missing (-Werror=format-security): cd /tmp/test/src && /usr/bin/gcc -g -O
 # configure/make
 
 is_blhc 'configure', '', 1,
-        'No compiler commands!
-';
+        $empty;
 
 is_blhc 'make', '', 1,
-        'No compiler commands!
-';
+        $empty;
 
 
 
@@ -638,6 +658,12 @@ is_blhc 'debian-hardening-wrapper', '', 16,
         $debian_hardening_wrapper;
 
 
+# false positives
+
+is_blhc 'false-positives', '', 1,
+        $empty;
+
+
 # buildd support
 
 is_blhc 'empty', '--buildd', 1,