]> ruderich.org/simon Gitweb - blhc/blhc.git/blobdiff - t/tests.t
Update copyright year.
[blhc/blhc.git] / t / tests.t
index b2e3d6d46656951af124bccd94ec6c9dfb0b9fd6..3fbdb3efa1de73bba69fdd8f43bdf24e20f5179a 100644 (file)
--- a/t/tests.t
+++ b/t/tests.t
@@ -1,6 +1,6 @@
 # Tests for blhc.
 #
-# Copyright (C) 2012  Simon Ruderich
+# Copyright (C) 2012-2013  Simon Ruderich
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 194;
+use Test::More tests => 204;
 
 
 sub is_blhc {
@@ -61,7 +61,7 @@ is_blhc '', '', 2,
         $usage;
 
 is_blhc '', '--version', 0,
-        'blhc 0.03  Copyright (C) 2012  Simon Ruderich
+        'blhc 0.03  Copyright (C) 2012-2013  Simon Ruderich
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -85,7 +85,7 @@ Options:
 /s;
 
 is_blhc 'doesnt-exist', '', 2,
-        qr{^No such file or directory at \./bin/blhc line \d+\.$};
+        qr{^No such file: \./t/logs/doesnt-exist at \./bin/blhc line \d+\.$};
 
 
 # No compiler commands found.
@@ -527,6 +527,8 @@ is_blhc 'bad-cppflags', '--ignore-flag -D_FORTIFY_SOURCE=2', 0,
 
 my $bad_ldflags =
         'LDFLAGS missing (-Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.o -ltest
+LDFLAGS missing (-Wl,-z,relro): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o
+LDFLAGS missing (-Wl,-z,relro): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o test.h
 ';
 is_blhc 'bad-ldflags', '', 8,
         $bad_ldflags;
@@ -535,15 +537,21 @@ is_blhc 'bad-ldflags', '--pie', 8,
 CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
 CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c
 LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.o -ltest
+LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o
+LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o test.h
 ';
 is_blhc 'bad-ldflags', '--bindnow', 8,
         'LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test-b.o test-c.o -ltest
+LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o
+LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o test.h
 ';
 is_blhc 'bad-ldflags', '--pie --bindnow', 8,
         'CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c
 CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
 CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c
 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test-b.o test-c.o -ltest
+LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o
+LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o test.h
 ';
 
 is_blhc 'bad-multiline', '', 8,
@@ -740,6 +748,22 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++-4.6 -Wl,-z,defs -o tes
 ';
 
 
+# ada
+
+my $ada = 'CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc-4.6 -c -fPIC -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security test.c
+LDFLAGS missing (-Wl,-z,relro): /usr/bin/gcc-4.6 -shared -lgnat-4.6 -o libtest.so.2 test-a.o test-b.o test-c.o -Wl,--as-needed
+CFLAGS missing (-fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security): gcc -c -g -O2 test.c
+CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -g -O2 test.c
+CFLAGS missing (-fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security): gcc -g -O2 test.c
+CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 test.c
+LDFLAGS missing (-Wl,-z,relro): gcc -g -O2 test.c
+';
+is_blhc 'ada', '', 8,
+        $ada;
+is_blhc 'ada-pbuilder', '', 8,
+        $ada;
+
+
 # libtool
 
 is_blhc 'libtool', '--bindnow', 8,
@@ -764,6 +788,10 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,now): gcc -g -O2 -fstack-protector --param=ss
 CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security): /bin/bash ../libtool --tag=CC   --mode=link gcc -Wl,-z,relro -o test.so test.c
 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): /bin/bash ../libtool --tag=CC   --mode=link gcc -Wl,-z,relro -o test.so test.c
 LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/bash ../libtool --tag=CC   --mode=link gcc -Wl,-z,relro -o test.so test.c
+CPPFLAGS missing (-D_FORTIFY_SOURCE=2): /bin/sh ../libtool --mode=link gcc -Wl,-z,relro -o libtest.la test.h test-a.lo test-b.lo test-c.lo test-d.la
+LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/sh ../libtool --mode=link gcc -Wl,-z,relro -o libtest.la test.h test-a.lo test-b.lo test-c.lo test-d.la
+CPPFLAGS missing (-D_FORTIFY_SOURCE=2): /bin/sh ../libtool --mode=link gcc -o libtest.la test.h test-a.lo test-b.lo test-c.lo test-d.la
+LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): /bin/sh ../libtool --mode=link gcc -o libtest.la test.h test-a.lo test-b.lo test-c.lo test-d.la
 ';
 
 
@@ -802,6 +830,12 @@ LDFLAGS missing (-pie -Wl,-z,relro): gcc -fPIE -o test test.o
 ';
 
 
+# architecture in older buildd logs
+
+is_blhc 'buildd-architecture-old', '', 0,
+        '';
+
+
 # ignore architecture
 
 is_blhc ['arch-avr32', 'arch-i386', 'empty', 'arch-mipsel'],
@@ -846,6 +880,8 @@ my $debian_hardening_wrapper =
 ';
 is_blhc 'debian-hardening-wrapper', '', 16,
         $debian_hardening_wrapper;
+is_blhc 'debian-hardening-wrapper-pbuilder', '', 16,
+        $debian_hardening_wrapper;
 
 
 # false positives
@@ -878,6 +914,9 @@ is_blhc 'buildd-dpkg-dev-missing', '--buildd', 0,
 is_blhc 'debian-hardening-wrapper', '--buildd', 0,
         'I-hardening-wrapper-used||
 ';
+is_blhc 'debian-hardening-wrapper-pbuilder', '--buildd', 0,
+        'I-hardening-wrapper-used||
+';
 
 is_blhc 'buildd-verbose-build', '--buildd', 0,
         'W-compiler-flags-hidden|1 (of 5) hidden|