X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=blobdiff_plain;f=t%2Ftests.t;h=d9c15c311f23ee4dfb0c61682e9385293eced2e9;hp=c9a8649a1658b4fd7d8368466006f808abc5cc95;hb=fd2822367ae3c4bcc451d2f82e4b1cee87a741d6;hpb=cb6df05acfa32fe06b4f980422fd4b38c3239c0e diff --git a/t/tests.t b/t/tests.t index c9a8649..d9c15c3 100644 --- a/t/tests.t +++ b/t/tests.t @@ -19,7 +19,7 @@ use strict; use warnings; -use Test::More tests => 112; +use Test::More tests => 122; sub is_blhc { @@ -42,7 +42,7 @@ sub is_blhc { } -# Usage. +# Usage, invalid arguments. my $usage = 'Usage: @@ -56,6 +56,7 @@ is_blhc '', '--invalid', 2, is_blhc '', '', 2, $usage; + # No compiler commands found. my $empty = "No compiler commands!\n"; @@ -63,6 +64,13 @@ is_blhc 'empty', '', 1, $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 +"; + + # Correct build logs. is_blhc 'good', '', 0, @@ -111,6 +119,8 @@ 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 -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 @@ -148,6 +158,8 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -o test test-a.o test-b.o test-c. 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 -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 @@ -185,6 +197,8 @@ LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test-b.o test-c. 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 -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 @@ -223,6 +237,8 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test- 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 -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 @@ -607,8 +623,13 @@ LDFLAGS missing (-Wl,-z,relro): gcc -o test test.o `dpkg-buildflags --get CFLAGS '; 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 @@ -634,6 +655,14 @@ is_blhc 'buildd-dpkg-dev-old', '--buildd', 8, '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 '; @@ -643,7 +672,7 @@ is_blhc 'make', '--buildd', 1, '; is_blhc 'debian-cmake', '--buildd', 32, - 'W-invalid-cmake-used 2.8.7-2 + 'W-invalid-cmake-used 2.8.7-1 ';