X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=blobdiff_plain;f=t%2Ftests.t;h=c6906e2a59aaaa5a304f68264e5341d07d90a2a9;hp=d9c15c311f23ee4dfb0c61682e9385293eced2e9;hb=d6333e474554290abc21a27bbd1de7e0be1a4e10;hpb=fd2822367ae3c4bcc451d2f82e4b1cee87a741d6 diff --git a/t/tests.t b/t/tests.t index d9c15c3..c6906e2 100644 --- 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,