X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=blobdiff_plain;f=t%2Ftests.t;h=052a1fda7f186c88bd05e4d08375d3bb701d82d7;hp=5662bd870621a7f563f4f957a008722ef804ade7;hb=47eb461331046250bbe1b2d39f73266a25bb5315;hpb=768e3101e9e4e22e0d775ca1191549d825b679d3 diff --git a/t/tests.t b/t/tests.t index 5662bd8..052a1fd 100644 --- a/t/tests.t +++ b/t/tests.t @@ -1,6 +1,6 @@ # Tests for blhc. # -# Copyright (C) 2012-2013 Simon Ruderich +# Copyright (C) 2012-2018 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 => 218; +use Test::More tests => 234; sub is_blhc { @@ -48,11 +48,17 @@ sub is_blhc { # Usage, invalid arguments. -my $usage = +use Pod::Usage; +my $usage = ( $Pod::Usage::VERSION < 1.65 ? 'Usage: blhc [*options*] *..* -'; +' + : + 'Usage: + blhc [options] .. + +'); is_blhc '', '--invalid', 2, "Unknown option: invalid\n" . $usage; @@ -61,7 +67,7 @@ is_blhc '', '', 2, $usage; is_blhc '', '--version', 0, - 'blhc 0.04 Copyright (C) 2012-2013 Simon Ruderich + 'blhc 0.08 Copyright (C) 2012-2018 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 @@ -79,7 +85,7 @@ along with this program. If not, see . is_blhc '', '--help', 1, qr/^Usage: - blhc \[\*options\*\] \*\.\.\* + blhc \[\*?options\*?\] \*?\.\.\*? Options: /s; @@ -118,23 +124,14 @@ is_blhc 'ignore-flag-ldflags', '--ignore-flag -fPIE', 0, # Invalid option. is_blhc 'ignore-flag', '--ignore-arch-flag -g', 2, - 'Value "-g" invalid for option ignore-arch-flag ("arch:flag" expected) -Usage: - blhc [*options*] *..* - -'; + 'Value "-g" invalid for option ignore-arch-flag ("arch:flag" expected)' + . "\n$usage"; is_blhc 'ignore-flag', '--ignore-arch-flag -g:', 2, - 'Value "-g:" invalid for option ignore-arch-flag ("arch:flag" expected) -Usage: - blhc [*options*] *..* - -'; + 'Value "-g:" invalid for option ignore-arch-flag ("arch:flag" expected)' + . "\n$usage"; is_blhc 'ignore-flag', '--ignore-arch-flag :amd64', 2, - 'Value ":amd64" invalid for option ignore-arch-flag ("arch:flag" expected) -Usage: - blhc [*options*] *..* - -'; + 'Value ":amd64" invalid for option ignore-arch-flag ("arch:flag" expected)' + . "\n$usage"; # Wrong architecture. is_blhc 'ignore-flag', '--ignore-arch-flag amd64:-g', 8, @@ -181,23 +178,14 @@ is_blhc 'ignore-line', '--ignore-line "\./prepare-script gcc test-[a-z]\.c" --ig # Invalid option. is_blhc 'ignore-line', '--ignore-arch-line .+', 2, - 'Value ".+" invalid for option ignore-arch-line ("arch:line" expected) -Usage: - blhc [*options*] *..* - -'; + 'Value ".+" invalid for option ignore-arch-line ("arch:line" expected)' + . "\n$usage"; is_blhc 'ignore-line', '--ignore-arch-line .+:', 2, - 'Value ".+:" invalid for option ignore-arch-line ("arch:line" expected) -Usage: - blhc [*options*] *..* - -'; + 'Value ".+:" invalid for option ignore-arch-line ("arch:line" expected)' + . "\n$usage"; is_blhc 'ignore-line', '--ignore-arch-line :amd64', 2, - 'Value ":amd64" invalid for option ignore-arch-line ("arch:line" expected) -Usage: - blhc [*options*] *..* - -'; + 'Value ":amd64" invalid for option ignore-arch-line ("arch:line" expected)' + . "\n$usage"; # Wrong architecture. is_blhc 'ignore-line', '--ignore-arch-line "amd64:.+"', 8, @@ -644,8 +632,11 @@ NONVERBOSE BUILD: [ 82%] Building C object src/CMakeFiles/test/test.c.o CXXFLAGS missing (-Wformat): cd /tmp/test/src && /usr/bin/c++ -g -O2 -fstack-protector-strong -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-strong -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 NONVERBOSE BUILD: Compiling test.c \ gcc test.c +NONVERBOSE BUILD: [ 3%] Building CXX object scribus/text/CMakeFiles/scribus_text_lib.dir/frect.cpp.o '; +is_blhc 'parallel', '', 0, ''; + # handle debug builds @@ -661,6 +652,10 @@ is_blhc 'configure-check', '', 4, 'NONVERBOSE BUILD: CC = gcc -std=gnu99 -std=gnu99 test.c '; +is_blhc 'configure-check', '--line-numbers', 4, + '5:NONVERBOSE BUILD: CC = gcc -std=gnu99 -std=gnu99 test.c +'; + is_blhc 'make', '', 1, $empty; @@ -762,11 +757,13 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++-4.6 -Wl,-z,defs -o tes my $ada = 'CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc-4.6 -c -fPIC -g -O2 -fstack-protector-strong -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-strong -Wformat -Werror=format-security): gcc -c -g -O2 test.c +CFLAGS missing (-fPIE -fstack-protector-strong -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-strong -Wformat -Werror=format-security): gcc -g -O2 test.c +CFLAGS missing (-fPIE -fstack-protector-strong -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 +LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -g -O2 test.c +CFLAGS missing (-fstack-protector-strong): gcc-6 -c -I./ -I../progs -g -O2 -fPIE -gnat2005 -gnato -gnatVa -fstack-check -gnatw.I -I- -o /«PKGBUILDDIR»/build/objects/arm_frm.o /«PKGBUILDDIR»/progs/arm_frm.adb +CFLAGS missing (-fstack-protector-strong): gcc-6 -c -I./ -I../progs -g -O2 -fPIE -gnat2005 -gnato -gnatVa -fstack-check -I- -x ada -o /«PKGBUILDDIR»/build/objects/arm_form.o /«PKGBUILDDIR»/progs/arm_form.ada '; is_blhc 'ada', '', 8, $ada; @@ -774,6 +771,19 @@ is_blhc 'ada-pbuilder', '', 8, $ada; +# fortran + +is_blhc 'fortran', '', 8, + 'CFLAGS missing (-fstack-protector-strong): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -Wl,-z,relro -o balls balls.f +CFLAGS missing (-fstack-protector-strong): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -c -o quadric.o quadric.f +CFLAGS missing (-fstack-protector-strong): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -c -o suv.o suv.f +CFLAGS missing (-fstack-protector-strong): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 \ rastep.f quadric.o suv.o -Wl,-z,relro \ -o rastep +CFLAGS missing (-fstack-protector-strong): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -c -o render.o render.f +LDFLAGS missing (-Wl,-z,relro): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -fstack-protector-strong -o balls-without-ldflags balls.f +CFLAGS missing (-fstack-protector-strong): mpifort -cpp -DDOUB -g -O2 -fdebug-prefix-map=/«PKGBUILDDIR»=. -c -o transform.o transform.f90 +'; + + # libtool is_blhc 'libtool', '--bindnow', 12, @@ -796,12 +806,8 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: relink: gcc -Wl,-z,relro -o t LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: relink: g++ -Wl,-z,relro -o test.la test.o LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: gcc -g -O2 -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -o test test.o LDFLAGS missing (-fPIE -pie -Wl,-z,now): gcc -g -O2 -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security -Wl,-z -Wl,relro -o .libs/test test.o -CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security): libtool: link: gcc -Wl,-z,relro -o test.so test.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): libtool: link: gcc -Wl,-z,relro -o test.so test.c -LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: gcc -Wl,-z,relro -o test.so test.c -CPPFLAGS missing (-D_FORTIFY_SOURCE=2): libtool: 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): libtool: link: g++ -include ./include/CppUTest/MemoryLeakDetectorNewMacros.h -Wall -Wextra -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -pedantic -Wsign-conversion -Woverloaded-virtual -Wno-disabled-macro-expansion -Wno-padded -Wno-global-constructors -Wno-exit-time-destructors -Wno-weak-vtables -Wno-old-style-cast -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z -Wl,relro -o CppUTestTests CppUTestTests-AllocationInCFile.o CppUTestTests-AllocationInCppFile.o CppUTestTests-AllocLetTestFree.o CppUTestTests-AllocLetTestFreeTest.o CppUTestTests-AllTests.o CppUTestTests-CheatSheetTest.o CppUTestTests-CommandLineArgumentsTest.o CppUTestTests-CommandLineTestRunnerTest.o CppUTestTests-JUnitOutputTest.o CppUTestTests-MemoryLeakDetectorTest.o CppUTestTests-MemoryLeakOperatorOverloadsTest.o CppUTestTests-MemoryLeakWarningTest.o CppUTestTests-PluginTest.o CppUTestTests-PreprocessorTest.o CppUTestTests-SetPluginTest.o CppUTest Tests-SimpleStringTest.o CppUTestTests-SimpleMutexTest.o CppUTestTests-TestFailureNaNTest.o CppUTestTests-TestFailureTest.o CppUTestTests-TestFilterTest.o CppUTestTests-TestHarness_cTest.o CppUTestTests-TestHarness_cTestCFile.o CppUTestTests-TestInstallerTest.o CppUTestTests-TestMemoryAllocatorTest.o CppUTestTests-TestOutputTest.o CppUTestTests-TestRegistryTest.o CppUTestTests-TestResultTest.o CppUTestTests-TestUTestMacro.o CppUTestTests-UtestTest.o CppUTestTests-UtestPlatformTest.o lib/libCppUTest.a -lpthread LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: 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): libtool: 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): libtool: link: gcc -o libtest.la test.h test-a.lo test-b.lo test-c.lo test-d.la NONVERBOSE BUILD: /usr/share/apr-1.0/build/libtool --silent --mode=compile x86_64-linux-gnu-gcc -std=gnu99 -I/usr/include/libxml2 -pthread -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security ... -prefer-pic -c mod_buffer.c NONVERBOSE BUILD: /usr/share/apr-1.0/build/libtool --silent --mode=link x86_64-linux-gnu-gcc -std=gnu99 -I/usr/include/libxml2 -pthread -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wl,--as-needed -Wl,-z,relro -o mod_buffer.la -rpath /usr/lib/apache2/modules -module -avoid-version mod_buffer.lo @@ -834,11 +840,6 @@ 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-strong): 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 @@ -889,6 +890,15 @@ 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', '--line-numbers', 8, + '9:CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security -Wall -c test.c +13:CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c `dpkg-buildflags --get CFLAGS` test.c +14:CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -c `dpkg-buildflags --get CXXFLAGS` test.cc +15:CFLAGS missing (-g -O2 -fstack-protector-strong -Wformat -Werror=format-security): gcc -c `dpkg-buildflags --get LDFLAGS` test.c +15:CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c `dpkg-buildflags --get LDFLAGS` test.c +19: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 '; @@ -911,8 +921,8 @@ is_blhc 'debian-hardening-wrapper-pbuilder', '', 16, # false positives -is_blhc 'false-positives', '', 1, - $empty; +is_blhc 'false-positives', '', 0, + ''; # buildd support @@ -936,6 +946,15 @@ is_blhc 'buildd-dpkg-dev-missing', '--buildd', 0, 'W-dpkg-buildflags-missing|CFLAGS 3 (of 6), CXXFLAGS 1 (of 1) missing| '; +is_blhc 'buildd-gcc-pie', '--buildd --all', 0, + 'W-dpkg-buildflags-missing|CFLAGS 1 (of 1), LDFLAGS 1 (of 1) missing| +'; +is_blhc 'buildd-gcc-pie-builtin-wrong-arch', '--buildd --all', 0, + 'W-dpkg-buildflags-missing|CFLAGS 1 (of 1), LDFLAGS 1 (of 1) missing| +'; +is_blhc 'buildd-gcc-pie-builtin', '--buildd', 0, ''; +is_blhc 'buildd-gcc-pie-builtin', '--buildd --all', 0, ''; + # Older dpkg versions use -fstack-protector instead of -strong. is_blhc 'buildd-dpkg-fstack-protector', '--buildd', 0, ''; @@ -963,6 +982,11 @@ is_blhc 'debian-cmake', '--buildd', 0, '; +# debian specific settings + +is_blhc 'debian-gcc-pie', '--debian', 0, ''; + + # multiple files is_blhc ['good', 'good-pie', 'good-bindnow', 'good-all', 'good-multiline', 'good-library'], '', 0,