# 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
use strict;
use warnings;
-use Test::More tests => 194;
+use Test::More tests => 204;
sub is_blhc {
$usage;
is_blhc '', '--version', 0,
- 'blhc 0.03 Copyright (C) 2012 Simon Ruderich
+ 'blhc 0.04 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
';
+# 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,
';
+# architecture in older buildd logs
+
+is_blhc 'buildd-architecture-old', '', 0,
+ '';
+
+
# ignore architecture
is_blhc ['arch-avr32', 'arch-i386', 'empty', 'arch-mipsel'],
';
is_blhc 'debian-hardening-wrapper', '', 16,
$debian_hardening_wrapper;
+is_blhc 'debian-hardening-wrapper-pbuilder', '', 16,
+ $debian_hardening_wrapper;
# false positives
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|