X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=blobdiff_plain;f=t%2Ftests.t;h=cfe2f9dbb082724ddf068ca4f48f3b4564feaf81;hp=3b9c332292db849b0a7b9e88b0e7cd2e2305b22b;hb=f0ae7b1580cd26bcf44dc5b780f1c2e081314479;hpb=f939b4685a7cb1e1003fbd81a4f136c254b554a4 diff --git a/t/tests.t b/t/tests.t index 3b9c332..cfe2f9d 100644 --- a/t/tests.t +++ b/t/tests.t @@ -19,13 +19,20 @@ use strict; use warnings; -use Test::More tests => 90; +use Test::More tests => 136; sub is_blhc { my ($file, $options, $exit, $expected) = @_; - my $output = `./bin/blhc $options ./t/logs/$file 2>&1`; + # Multiple files as array references. + if (ref $file eq 'ARRAY') { + local $" = ' ./t/logs/'; + $file = "@{$file}"; + } + + $file = "./t/logs/$file" if $file; + my $output = `./bin/blhc $options $file 2>&1`; if ($options) { $options = ' '. $options; @@ -35,29 +42,55 @@ sub is_blhc { } -# Usage. +# Usage, invalid arguments. -is_blhc 'empty', '--invalid', 2, - 'Unknown option: invalid -Usage: - blhc [options] - - --all force +all (+pie, +bindnow) check - --arch set architecture (autodetected) - --bindnow force +bindbow check - --buildd parser mode for buildds - --color use colored output - --pie force +pie check - --help available options - --version version number and license +my $usage = + 'Usage: + blhc [*options*] *..* '; +is_blhc '', '--invalid', 2, + "Unknown option: invalid\n" + . $usage; + +is_blhc '', '', 2, + $usage; # No compiler commands found. +my $empty = "No compiler commands!\n"; is_blhc 'empty', '', 1, - "No compiler commands!\n"; + $empty; + + +# ANSI colored output. + +is_blhc 'arch-avr32', '--color', 8, + "\033[31mCFLAGS missing\033[0m (--param=ssp-buffer-size=4)\033[33m:\033[0m gcc -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -Wall -c test.c +"; + + +# 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. @@ -106,11 +139,23 @@ CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -g -O2 -fstack-protector --param=ss LDFLAGS missing (-Wl,-z,relro): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp LDFLAGS missing (-Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.a LDFLAGS missing (-Wl,-z,relro): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ../src/test/objs/test.o -o ../src/test/bin/test -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.s +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.S CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -E test.c +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -S test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -S test.c CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc test.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c LDFLAGS missing (-Wl,-z,relro): gcc test.c +CXXFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MD -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MD -c test.c +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MT -MD -MF test.d -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MD -MF test.d -c test.c +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MMD -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MMD -c test.c +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MT -MMD -MF test.d -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MMD -MF test.d -c test.c '; is_blhc 'bad', '--pie', 8, 'CFLAGS missing (-fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -O2 -c test-a.c @@ -127,17 +172,30 @@ CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-b.c CFLAGS missing (-fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-c.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-c.c LDFLAGS missing (-fPIE -pie -Wl,-z,relro): x86_64-linux-gnu-gcc -o test test-a.o test-b.o test-c.o -ltest -CFLAGS missing (-fPIE): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp +CXXFLAGS missing (-fPIE): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp LDFLAGS missing (-fPIE -pie -Wl,-z,relro): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp LDFLAGS missing (-fPIE -pie): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -Wl,-z,relro -o ../src/test/bin/test ../src/test/objs/test.o LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.a LDFLAGS missing (-fPIE -pie -Wl,-z,relro): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ../src/test/objs/test.o -o ../src/test/bin/test -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.s +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.S CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -E test.c +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -S test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -S test.c CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc test.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc test.c +CXXFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o +LDFLAGS missing (-fPIE -pie): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MD -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MD -c test.c +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MT -MD -MF test.d -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MD -MF test.d -c test.c +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MMD -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MMD -c test.c +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MT -MMD -MF test.d -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MMD -MF test.d -c test.c '; is_blhc 'bad', '--bindnow', 8, 'CFLAGS missing (-fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -O2 -c test-a.c @@ -159,13 +217,26 @@ LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): g++ -g -O2 -fstack-protector --param LDFLAGS missing (-Wl,-z,now): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -Wl,-z,relro -o ../src/test/bin/test ../src/test/objs/test.o LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test-b.o test-c.a LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ../src/test/objs/test.o -o ../src/test/bin/test -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.s +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.S CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -E test.c +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -S test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -S test.c CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc test.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc test.c -'; -is_blhc 'bad', '--pie --bindnow', 8, +CXXFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o +LDFLAGS missing (-Wl,-z,now): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MD -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MD -c test.c +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MT -MD -MF test.d -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MD -MF test.d -c test.c +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MMD -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MMD -c test.c +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MT -MMD -MF test.d -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MMD -MF test.d -c test.c +'; +my $bad_pie_bindnow = 'CFLAGS missing (-fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -O2 -c test-a.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-a.c CFLAGS missing (-fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -O2 -c test-b.c @@ -180,45 +251,35 @@ CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-b.c CFLAGS missing (-fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-c.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-c.c LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): x86_64-linux-gnu-gcc -o test test-a.o test-b.o test-c.o -ltest -CFLAGS missing (-fPIE): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp +CXXFLAGS missing (-fPIE): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp LDFLAGS missing (-fPIE -pie -Wl,-z,now): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -Wl,-z,relro -o ../src/test/bin/test ../src/test/objs/test.o LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test-b.o test-c.a LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ../src/test/objs/test.o -o ../src/test/bin/test -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.s +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.S CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -E test.c +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -S test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -S test.c CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc test.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc test.c +CXXFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o +LDFLAGS missing (-fPIE -pie -Wl,-z,now): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MD -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MD -c test.c +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MT -MD -MF test.d -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MD -MF test.d -c test.c +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MMD -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MMD -c test.c +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -MT -MMD -MF test.d -c test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MMD -MF test.d -c test.c '; +is_blhc 'bad', '--pie --bindnow', 8, + $bad_pie_bindnow; is_blhc 'bad', '--all', 8, - 'CFLAGS missing (-fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -O2 -c test-a.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-a.c -CFLAGS missing (-fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -O2 -c test-b.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-b.c -CFLAGS missing (-fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -O2 -c test-c.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -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 -CFLAGS missing (-fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-a.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-a.c -CFLAGS missing (-fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-b.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-b.c -CFLAGS missing (-fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-c.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-c.c -LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): x86_64-linux-gnu-gcc -o test test-a.o test-b.o test-c.o -ltest -CFLAGS missing (-fPIE): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp -LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp -LDFLAGS missing (-fPIE -pie -Wl,-z,now): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -pthread -Wl,-z,relro -o ../src/test/bin/test ../src/test/objs/test.o -LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test-b.o test-c.a -LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ../src/test/objs/test.o -o ../src/test/bin/test -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.s -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -E test.c -CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc test.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c -LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc test.c -'; + $bad_pie_bindnow; is_blhc 'bad-cflags', '', 8, 'CFLAGS missing (-Wformat): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c @@ -232,6 +293,8 @@ CFLAGS missing (-Wformat): gcc -fPIC -g -O2 -fstack-protector --param=ssp-buffer CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc test.c -o test.output CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c -o test.output LDFLAGS missing (-Wl,-z,relro): gcc test.c -o test.output +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): (gcc -Wl,-z,relro -o test.output test.c) +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): (gcc -Wl,-z,relro -o test.output test.c) '; is_blhc 'bad-cflags', '--pie', 8, 'CFLAGS missing (-fPIE -Wformat): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c @@ -247,6 +310,9 @@ CFLAGS missing (-Wformat): gcc -fPIC -g -O2 -fstack-protector --param=ssp-buffer CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc test.c -o test.output CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c -o test.output LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc test.c -o test.output +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): (gcc -Wl,-z,relro -o test.output test.c) +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): (gcc -Wl,-z,relro -o test.output test.c) +LDFLAGS missing (-fPIE -pie): (gcc -Wl,-z,relro -o test.output test.c) '; is_blhc 'bad-cflags', '--bindnow', 8, 'CFLAGS missing (-Wformat): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c @@ -263,6 +329,9 @@ CFLAGS missing (-Wformat): gcc -fPIC -g -O2 -fstack-protector --param=ssp-buffer CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc test.c -o test.output CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c -o test.output LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc test.c -o test.output +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): (gcc -Wl,-z,relro -o test.output test.c) +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): (gcc -Wl,-z,relro -o test.output test.c) +LDFLAGS missing (-Wl,-z,now): (gcc -Wl,-z,relro -o test.output test.c) '; is_blhc 'bad-cflags', '--pie --bindnow', 8, 'CFLAGS missing (-fPIE -Wformat): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c @@ -279,6 +348,9 @@ CFLAGS missing (-Wformat): gcc -fPIC -g -O2 -fstack-protector --param=ssp-buffer CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc test.c -o test.output CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c -o test.output LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc test.c -o test.output +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): (gcc -Wl,-z,relro -o test.output test.c) +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): (gcc -Wl,-z,relro -o test.output test.c) +LDFLAGS missing (-fPIE -pie -Wl,-z,now): (gcc -Wl,-z,relro -o test.output test.c) '; is_blhc 'bad-cppflags', '', 8, @@ -289,9 +361,11 @@ CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -fPIC -g -O2 -fstack-protector --par CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -o test -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security test-a.cxx test-b.o test-c.o -Wl,-z,relro '; -is_blhc 'bad-ldflags', '', 8, +my $bad_ldflags = 'LDFLAGS missing (-Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.o -ltest '; +is_blhc 'bad-ldflags', '', 8, + $bad_ldflags; 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-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 @@ -313,10 +387,10 @@ is_blhc 'bad-multiline', '', 8, CFLAGS missing (--param=ssp-buffer-size=4): gcc -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security\ -D_FORTIFY_SOURCE=2\ -c test-b.c CFLAGS missing (-Werror=format-security): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c LDFLAGS missing (-Wl,-z,relro): gcc -o\ test test-c.o test-a.o test-b.o\ -ltest -LDFLAGS missing (-Wl,-z,relro): gcc -o \ test test-c.o test-b.o test-a.o\ -CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -o \ test test-b.o test-a.o test-c.c\ -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -o \ test test-b.o test-a.o test-c.c\ -LDFLAGS missing (-Wl,-z,relro): gcc -o \ test test-b.o test-a.o test-c.c\ +LDFLAGS missing (-Wl,-z,relro): gcc -o \ test test-c.o test-b.o test-a.o\ +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -o \ test test-b.o test-a.o test-c.c\ +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -o \ test test-b.o test-a.o test-c.c\ +LDFLAGS missing (-Wl,-z,relro): gcc -o \ test test-b.o test-a.o test-c.c\ CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -c test-a.c CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -D_FORTIFY_SOURCE=2 -c test-b.c CFLAGS missing (-Wformat-security -Werror=format-security): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -D_FORTIFY_SOURCE=2 -c test-a.c @@ -340,7 +414,7 @@ LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -D_FORTIFY_SOURCE=2 -g -O2 --para LDFLAGS missing (-Wl,-z,now): gcc -shared -fPIC -DPIC libtest.o -lpthread -O2 -Wl,relro -Wl,--as-needed -o libtest.so LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -shared -fPIC -DPIC libtest.o -lpthread -O2 -Wl,--as-needed -o libtest.so LDFLAGS missing (-Wl,-z,now): gcc -shared -fPIC test.o -Wl,-z -Wl,relro -o .libs/libtest.so.1.0.0 -LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -shared -o libtest.so.0d ./test-a.o test/./test-b.o -Wl,-z,now -lpthread -ldl +LDFLAGS missing (-Wl,-z,relro): gcc -shared -o libtest.so.0d ./test-a.o test/./test-b.o -Wl,-z,now -lpthread -ldl LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): /usr/bin/g++ -shared -fpic -o libtest-6.1.so.0 test.o -ltiff -lz LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -Wl,--as-needed -fPIE -pie -o test.cgi test.o -lgcrypt CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security test.c -o lib`basename test/test`.so @@ -378,20 +452,24 @@ NONVERBOSE BUILD: [CC] src/test-b.o NONVERBOSE BUILD: [CC] src/test_c.o NONVERBOSE BUILD: [LD] src/test.o NONVERBOSE BUILD: CC modules/server/test.c +NONVERBOSE BUILD: C++ test/test.o +NONVERBOSE BUILD: C++ test.cpp +NONVERBOSE BUILD: Building program ../build/bin/test +NONVERBOSE BUILD: Compiling test/test.cc to ../build/test/test.o NONVERBOSE BUILD: Compiling test/test.cc to ../build/test/test.o NONVERBOSE BUILD: Building shared library ../build/test/libtest.so.1.2.3 NONVERBOSE BUILD: Compiling test.cc to ../build/test/test.o NONVERBOSE BUILD: Building program ../build/bin/test CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -c -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -o ../build/test/test.o test/test.cc LDFLAGS missing (-Wl,-z,relro): g++ -fPIC -DPIC \ -o ../build/test/libtest.so.1.2.3 -shared \ ../build/obj/test/test-a.o ../build/obj/test/test-b.o ../build/obj/test/test-c.o -CFLAGS missing (-Wformat): g++ -c -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -o ../build/test/test.o test.cc +CXXFLAGS missing (-Wformat): g++ -c -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -o ../build/test/test.o test.cc CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -c -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -o ../build/test/test.o test.cc LDFLAGS missing (-Wl,-z,relro): g++ ../build/obj/test/test.o -o /../build/bin/test NONVERBOSE BUILD: Compiling test_file.cxx... -CFLAGS missing (-fstack-protector): g++ -g -O2 -fPIC --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test_file.cxx +CXXFLAGS missing (-fstack-protector): g++ -g -O2 -fPIC --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test_file.cxx NONVERBOSE BUILD: [ 22%] Building CXX object src/CMakeFiles/test/test.cpp.o NONVERBOSE BUILD: [ 82%] Building C object src/CMakeFiles/test/test.c.o -CFLAGS missing (-Wformat): cd /tmp/test/src && /usr/bin/c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -o CMakeFiles/test-verbose.dir/verbose.cpp.o -c -D_FORTIFY_SOURCE=2 /tmp/test/src/test-verbose/verbose.cpp +CXXFLAGS missing (-Wformat): cd /tmp/test/src && /usr/bin/c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -o CMakeFiles/test-verbose.dir/verbose.cpp.o -c -D_FORTIFY_SOURCE=2 /tmp/test/src/test-verbose/verbose.cpp CFLAGS missing (-Werror=format-security): cd /tmp/test/src && /usr/bin/gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -o CMakeFiles/test-verbose-c.dir/verbose-c.c.o -c -D_FORTIFY_SOURCE=2 /tmp/test/src/test-verbose-c/verbose-c.c '; @@ -399,26 +477,27 @@ 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; # cc is_blhc 'cc', '--pie --bindnow', 8, - 'CFLAGS missing (-fPIE -Wformat): cc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cc + 'CXXFLAGS missing (-fPIE -Wformat): cc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cc CFLAGS missing (-fPIE -Wformat): cc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c CFLAGS missing (-fPIE --param=ssp-buffer-size=4): cc -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c CFLAGS missing (-fPIE -Werror=format-security): cc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): cc -Wl,-z,defs -o test test-a.o test-b.o test-c.o -ltest -CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): cc\ test.cc +CXXFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): cc\ test.cc CPPFLAGS missing (-D_FORTIFY_SOURCE=2): cc\ test.cc LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): cc\ test.cc +CXXFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): cc\ test.cc +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): cc\ test.cc +LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): cc\ test.cc LDFLAGS missing (-fPIE -pie -Wl,-z,now): cc -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o '; @@ -426,7 +505,7 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,now): cc -Wl,-z,defs test-a.o test-b.o test-c # gcc is_blhc 'gcc', '--pie --bindnow', 8, - 'CFLAGS missing (-fPIE -Wformat): gcc-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cc + 'CXXFLAGS missing (-fPIE -Wformat): gcc-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cc CFLAGS missing (-fPIE -Wformat): gcc-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c CFLAGS missing (-fPIE --param=ssp-buffer-size=4): gcc-4.6 -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c CFLAGS missing (-fPIE -Werror=format-security): gcc-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c @@ -434,6 +513,9 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc-4.6 -Wl,-z,defs -o tes CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc\ test.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc\ test.c LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc\ test.c +CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc\ test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc\ test.c +LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc\ test.c LDFLAGS missing (-fPIE -pie -Wl,-z,now): gcc-4.6 -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o '; @@ -441,22 +523,25 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,now): gcc-4.6 -Wl,-z,defs test-a.o test-b.o t # c++ is_blhc 'c++', '--pie --bindnow', 8, - 'CFLAGS missing (-fPIE -Wformat): c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp -CFLAGS missing (-fPIE --param=ssp-buffer-size=4): c++ -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp -CFLAGS missing (-fPIE -Werror=format-security): c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp -CFLAGS missing (-fPIE): c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc + 'CXXFLAGS missing (-fPIE -Wformat): c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp +CXXFLAGS missing (-fPIE --param=ssp-buffer-size=4): c++ -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp +CXXFLAGS missing (-fPIE -Werror=format-security): c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp +CXXFLAGS missing (-fPIE): c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): c++ -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest LDFLAGS missing (-fPIE -pie -Wl,-z,now): c++ -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): c++\ test.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): c++\ test.c LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): c++\ test.c -CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): c++\ test.c++ +CXXFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): c++\ test.c++ CPPFLAGS missing (-D_FORTIFY_SOURCE=2): c++\ test.c++ LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): c++\ test.c++ -CFLAGS missing (-fPIE -Wformat): c++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp -CFLAGS missing (-fPIE --param=ssp-buffer-size=4): c++-4.6 -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp -CFLAGS missing (-fPIE -Werror=format-security): c++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp -CFLAGS missing (-fPIE): c++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc +CXXFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): c++\ test.c++ +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): c++\ test.c++ +LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): c++\ test.c++ +CXXFLAGS missing (-fPIE -Wformat): c++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp +CXXFLAGS missing (-fPIE --param=ssp-buffer-size=4): c++-4.6 -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp +CXXFLAGS missing (-fPIE -Werror=format-security): c++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp +CXXFLAGS missing (-fPIE): c++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): c++-4.6 -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest '; @@ -464,24 +549,24 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): c++-4.6 -Wl,-z,defs -o tes # g++ is_blhc 'g++', '--pie --bindnow', 8, - 'CFLAGS missing (-fPIE -Wformat): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp -CFLAGS missing (-fPIE --param=ssp-buffer-size=4): g++ -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp -CFLAGS missing (-fPIE -Werror=format-security): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp -CFLAGS missing (-fPIE): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc + 'CXXFLAGS missing (-fPIE -Wformat): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp +CXXFLAGS missing (-fPIE --param=ssp-buffer-size=4): g++ -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp +CXXFLAGS missing (-fPIE -Werror=format-security): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp +CXXFLAGS missing (-fPIE): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++ -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest -CFLAGS missing (-fPIE -Wformat): x86_64-linux-gnu-g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp -CFLAGS missing (-fPIE --param=ssp-buffer-size=4): x86_64-linux-gnu-g++ -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp -CFLAGS missing (-fPIE -Werror=format-security): x86_64-linux-gnu-g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp -CFLAGS missing (-fPIE): x86_64-linux-gnu-g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc +CXXFLAGS missing (-fPIE -Wformat): x86_64-linux-gnu-g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp +CXXFLAGS missing (-fPIE --param=ssp-buffer-size=4): x86_64-linux-gnu-g++ -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp +CXXFLAGS missing (-fPIE -Werror=format-security): x86_64-linux-gnu-g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp +CXXFLAGS missing (-fPIE): x86_64-linux-gnu-g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): x86_64-linux-gnu-g++ -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest LDFLAGS missing (-fPIE -pie -Wl,-z,now): g++ -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o CFLAGS missing (-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): g++\ test.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++\ test.c LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++\ test.c -CFLAGS missing (-fPIE -Wformat): g++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp -CFLAGS missing (-fPIE --param=ssp-buffer-size=4): g++-4.6 -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp -CFLAGS missing (-fPIE -Werror=format-security): g++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp -CFLAGS missing (-fPIE): g++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc +CXXFLAGS missing (-fPIE -Wformat): g++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp +CXXFLAGS missing (-fPIE --param=ssp-buffer-size=4): g++-4.6 -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp +CXXFLAGS missing (-fPIE -Werror=format-security): g++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp +CXXFLAGS missing (-fPIE): g++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++-4.6 -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest '; @@ -490,11 +575,10 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++-4.6 -Wl,-z,defs -o tes is_blhc 'libtool', '--bindnow', 8, 'CFLAGS missing (-fPIE -Wformat): /bin/bash ../../libtool --tag=CC --mode=compile x86_64-linux-gnu-gcc -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -c test.c -CFLAGS missing (-fPIE -Wformat): /bin/bash ../../libtool --tag=CC --mode=compile x86_64-linux-gnu-g++ -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -c test.cpp +CXXFLAGS missing (-fPIE -Wformat): /bin/bash ../../libtool --tag=CC --mode=compile x86_64-linux-gnu-g++ -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -c test.cpp CFLAGS missing (-fPIE -Wformat): /bin/bash ../../libtool --tag=CC --mode=compile gcc-4.6 -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -c test.c CFLAGS missing (-fPIE -Wformat): /bin/bash ../../libtool --tag=CXX --mode=compile g++-4.6 -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -c test.c -LDFLAGS missing (-fPIE): libtool: link: g++ -shared test-a.o test-b.o test-b.o test-c.o -O2 -pie -Wl,relro -Wl,now -o test.so -LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: g++ -shared test-a.o test-b.o test-b.o test-c.o -O2 -Wl,relro -o test.so +LDFLAGS missing (-Wl,-z,now): libtool: link: g++ -shared test-a.o test-b.o test-b.o test-c.o -O2 -Wl,relro -o test.so LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: gcc -Wl,-z -Wl,relro -o test test.o LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/bash ../../../libtool --mode=link cc -Wl,-z,relro -o test.so test.o LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/bash ../../../libtool --mode=link gcc-4.6 -Wl,-z,relro -o test.so test.o @@ -516,25 +600,57 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/bash ../libtool --tag=CC --mode= # different architectures -is_blhc 'arch-avr32', '', 8, +my $arch_avr32 = 'CFLAGS missing (--param=ssp-buffer-size=4): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -Wall -c test.c '; +is_blhc 'arch-avr32', '', 8, + $arch_avr32; -is_blhc 'arch-i386', '', 8, +my $arch_i386 = 'CFLAGS missing (-fstack-protector): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall -c test.c LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o '; +is_blhc 'arch-i386', '', 8, + $arch_i386; -is_blhc 'arch-ia64', '', 8, +my $arch_ia64 = 'CFLAGS missing (-fPIE): gcc -D_FORTIFY_SOURCE=2 -g -O2 -Wformat -Wformat-security -Werror=format-security -Wall -c test.c LDFLAGS missing (-pie): gcc -fPIE -o test test.o '; +is_blhc 'arch-ia64', '', 8, + $arch_ia64; is_blhc 'arch-mipsel', '', 8, 'CFLAGS missing (-Werror=format-security): gcc -D_FORTIFY_SOURCE=2 -g -O2 -Wformat -Wformat-security -Wall -c test.c LDFLAGS missing (-Wl,-z,relro): gcc -Wl,-z,now -o test test.o '; +is_blhc 'arch-ia64', '--arch i386', 8, + 'CFLAGS missing (-fstack-protector --param=ssp-buffer-size=4): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c +LDFLAGS missing (-Wl,-z,relro): gcc -fPIE -pie -o test test.o +CFLAGS missing (-fPIE -fstack-protector --param=ssp-buffer-size=4): gcc -D_FORTIFY_SOURCE=2 -g -O2 -Wformat -Wformat-security -Werror=format-security -Wall -c test.c +LDFLAGS missing (-pie -Wl,-z,relro): gcc -fPIE -o test test.o +'; + + +# ignore architecture + +is_blhc ['arch-avr32', 'arch-i386', 'empty', 'arch-mipsel'], + '--ignore-arch avr32 --ignore-arch mipsel', + 9, + "checking './t/logs/arch-avr32'...\n" + . "ignoring architecture 'avr32'\n" + . "checking './t/logs/arch-i386'...\n" + . $arch_i386 + . "checking './t/logs/empty'...\n" + . $empty + . "checking './t/logs/arch-mipsel'...\n" + . "ignoring architecture 'mipsel'\n" + ; + +is_blhc 'buildd-dpkg-dev', '--ignore-arch i386', 0, + "ignoring architecture 'i386'\n"; + # debian @@ -547,35 +663,95 @@ CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c `dpkg-buildflags --get LDFLAGS` t LDFLAGS missing (-Wl,-z,relro): gcc -o test test.o `dpkg-buildflags --get CFLAGS` '; -is_blhc 'debian-hardening-wrapper', '', 16, +is_blhc 'debian-cmake', '', 32, + 'INVALID CMAKE: 2.8.7-1 +'; +is_blhc 'debian-cmake-2', '', 32, + 'INVALID CMAKE: 2.8.7-2 +'; +is_blhc 'debian-cmake-ok', '', 0, + ''; + +my $debian_hardening_wrapper = 'HARDENING WRAPPER: no checks possible, aborting '; +is_blhc 'debian-hardening-wrapper', '', 16, + $debian_hardening_wrapper; + + +# false positives + +is_blhc 'false-positives', '', 1, + $empty; # buildd support +is_blhc 'empty', '--buildd', 1, + 'W-no-compiler-commands +'; + is_blhc 'buildd-package-details', '--buildd', 0, ''; is_blhc 'buildd-dpkg-dev', '--buildd', 8, - 'CFLAGS missing (-fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -O2 -c test-a.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-a.c -CFLAGS missing (-fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -O2 -c test-b.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-b.c -CFLAGS missing (-fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -O2 -c test-c.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-c.c -LDFLAGS missing (-Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.o -ltest -CFLAGS missing (-O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -c test-a.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -c test-a.c -CFLAGS missing (-O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -c test-b.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -c test-b.c -CFLAGS missing (-O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -c test-c.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -c test-c.c -LDFLAGS missing (-Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.o -ltest + 'W-dpkg-buildflags-missing CPPFLAGS 7 (of 7), CFLAGS 6 (of 6), CXXFLAGS 1 (of 1), LDFLAGS 2 (of 2) missing '; is_blhc 'buildd-dpkg-dev-old', '--buildd', 8, - 'CFLAGS missing (-O2): gcc -g -c test-a.c -CFLAGS missing (-O2): gcc -g -c test-b.c -CFLAGS missing (-O2): gcc -g -c test-c.c + 'W-dpkg-buildflags-missing CFLAGS 3 (of 6), CXXFLAGS 1 (of 1) missing +'; + +is_blhc 'buildd-dpkg-dev-missing', '--buildd', 8, + 'W-dpkg-buildflags-missing CFLAGS 3 (of 6), CXXFLAGS 1 (of 1) missing +'; + +is_blhc 'debian-hardening-wrapper', '--buildd', 16, + 'I-hardening-wrapper-used +'; + +is_blhc 'buildd-verbose-build', '--buildd', 4, + 'W-compiler-flags-hidden 1 (of 5) hidden +'; + +is_blhc 'make', '--buildd', 1, + 'W-no-compiler-commands +'; + +is_blhc 'debian-cmake', '--buildd', 32, + 'W-invalid-cmake-used 2.8.7-1 '; + + +# multiple files + +is_blhc ['good', 'good-pie', 'good-bindnow', 'good-all', 'good-multiline', 'good-library'], '', 0, + "checking './t/logs/good'... +checking './t/logs/good-pie'... +checking './t/logs/good-bindnow'... +checking './t/logs/good-all'... +checking './t/logs/good-multiline'... +checking './t/logs/good-library'... +"; +is_blhc ['good-all', 'good-library'], '--all', 0, + "checking './t/logs/good-all'... +checking './t/logs/good-library'... +"; + +is_blhc ['arch-i386', 'arch-ia64'], '', 8, + "checking './t/logs/arch-i386'...\n" + . $arch_i386 + . "checking './t/logs/arch-ia64'...\n" + . $arch_ia64; + +# No exit when multiple files are specified. +is_blhc ['bad-ldflags', 'empty', 'arch-avr32', 'debian-hardening-wrapper'], '', 25, + "checking './t/logs/bad-ldflags'...\n" + . $bad_ldflags + . "checking './t/logs/empty'...\n" + . $empty + . "checking './t/logs/arch-avr32'...\n" + . $arch_avr32 + . "checking './t/logs/debian-hardening-wrapper'...\n" + . $debian_hardening_wrapper + ;