From: Simon Ruderich Date: Sat, 17 Mar 2012 14:59:08 +0000 (+0100) Subject: Ignore unimportant lines at the beginning of the log. X-Git-Tag: 0.01~105 X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;ds=inline;h=50b731db501c79ad33cb40845c16638703a4ea15;p=blhc%2Fblhc.git Ignore unimportant lines at the beginning of the log. --- diff --git a/bin/blhc b/bin/blhc index 585df64..880d24d 100755 --- a/bin/blhc +++ b/bin/blhc @@ -250,8 +250,14 @@ my $exit = 0; # Input lines, contain only the lines with compiler commands. my @input = (); +my $start = 0; my $continuation = 0; while (my $line = <>) { + # We skip over unimportant lines at the beginning to prevent false + # positives. + $start = 1 if $line =~ /^dpkg-buildpackage:/; + next if not $start; + # Ignore compiler warnings for now. next if $line =~ /$warning_regex/; diff --git a/t/logs/bad b/t/logs/bad index 9dbae59..49357a1 100644 --- a/t/logs/bad +++ b/t/logs/bad @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + configure: running /bin/bash ./configure ... 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security' 'LDFLAGS=-Wl,-z,relro -Wl,-z,defs -Wl,--as-needed' ... checking for gcc... gcc diff --git a/t/logs/bad-cflags b/t/logs/bad-cflags index 3f47182..3de1841 100644 --- a/t/logs/bad-cflags +++ b/t/logs/bad-cflags @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c gcc -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c diff --git a/t/logs/bad-cppflags b/t/logs/bad-cppflags index ff128e6..48e7f5a 100644 --- a/t/logs/bad-cppflags +++ b/t/logs/bad-cppflags @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -c test-a.c gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -c test-b.c gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -c test-c.c diff --git a/t/logs/bad-ldflags b/t/logs/bad-ldflags index 9296f4c..969ccfa 100644 --- a/t/logs/bad-ldflags +++ b/t/logs/bad-ldflags @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c diff --git a/t/logs/bad-library b/t/logs/bad-library index 811b711..831afd9 100644 --- a/t/logs/bad-library +++ b/t/logs/bad-library @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + gcc -D_FORTIFY_SOURCE=2 -g -O2 --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security test.c -fPIC -DPIC -o libtest.o gcc -shared -fPIC -DPIC libtest.o -lpthread -O2 -Wl,relro -Wl,--as-needed -o libtest.so gcc -shared -fPIC -DPIC libtest.o -lpthread -O2 -Wl,--as-needed -o libtest.so diff --git a/t/logs/bad-multiline b/t/logs/bad-multiline index 9ecf89b..91f63a6 100644 --- a/t/logs/bad-multiline +++ b/t/logs/bad-multiline @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + # Command over multiple lines. gcc \ -g -O2 -fstack-protector\ diff --git a/t/logs/c++ b/t/logs/c++ index e3828ce..34d7419 100644 --- a/t/logs/c++ +++ b/t/logs/c++ @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + checking for c++... c++ checking whether we are using the GNU C++ compiler... yes checking whether c++ accepts -g... yes diff --git a/t/logs/cc b/t/logs/cc index 9035202..38e7cab 100644 --- a/t/logs/cc +++ b/t/logs/cc @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + cc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cc cc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c cc -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c diff --git a/t/logs/configure b/t/logs/configure index ac181a3..ff54e1c 100644 --- a/t/logs/configure +++ b/t/logs/configure @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + # Output by configure or similar tools which should be ignored. Compiler: gcc diff --git a/t/logs/debian b/t/logs/debian index 9a03ba6..9665e8f 100644 --- a/t/logs/debian +++ b/t/logs/debian @@ -1 +1,7 @@ +Build-Depends: .., gcc (>= 4:4.4.3), g++ (>= 4:4.4.3), ... + +dpkg-buildpackage: source package test + dh_auto_configure -- CFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security" CPPFLAGS="-D_FORTIFY_SOURCE=2" CXXFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security" LDFLAGS="-Wl,-z,relro -Wl,-z,defs -Wl,--as-needed" ... + +gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall -c test.c diff --git a/t/logs/g++ b/t/logs/g++ index 4629197..7118ef1 100644 --- a/t/logs/g++ +++ b/t/logs/g++ @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes diff --git a/t/logs/gcc b/t/logs/gcc index 56eb38f..e90dba5 100644 --- a/t/logs/gcc +++ b/t/logs/gcc @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + checking for x86_64-linux-gnu-gcc... gcc-4.6 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 diff --git a/t/logs/good b/t/logs/good index 7233bc7..670766f 100644 --- a/t/logs/good +++ b/t/logs/good @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + configure: running /bin/bash ./configure ... 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security' 'LDFLAGS=-Wl,-z,relro -Wl,-z,defs -Wl,--as-needed' ... checking whether gcc accepts -g... yes diff --git a/t/logs/good-all b/t/logs/good-all index 84aca21..017fff6 100644 --- a/t/logs/good-all +++ b/t/logs/good-all @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + gcc -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c gcc -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c gcc -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c diff --git a/t/logs/good-bindnow b/t/logs/good-bindnow index eaa168d..556668b 100644 --- a/t/logs/good-bindnow +++ b/t/logs/good-bindnow @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c diff --git a/t/logs/good-library b/t/logs/good-library index 5447520..7d6a0ec 100644 --- a/t/logs/good-library +++ b/t/logs/good-library @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + # -fPIC and -fPIE conflict with each other and -fPIE is not necessary for # libraries. gcc -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security test.c -fPIC -DPIC -o libtest.o diff --git a/t/logs/good-multiline b/t/logs/good-multiline index e975958..39bba6b 100644 --- a/t/logs/good-multiline +++ b/t/logs/good-multiline @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + # Command over multiple lines. gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 \ \ diff --git a/t/logs/good-pie b/t/logs/good-pie index fb12870..e593530 100644 --- a/t/logs/good-pie +++ b/t/logs/good-pie @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + gcc -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c gcc -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c gcc -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c diff --git a/t/logs/libtool b/t/logs/libtool index 699d527..3849e6f 100644 --- a/t/logs/libtool +++ b/t/logs/libtool @@ -1,3 +1,5 @@ +dpkg-buildpackage: source package test + /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 /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 /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 diff --git a/t/logs/verbose-build b/t/logs/verbose-build index aba204b..c54e199 100644 --- a/t/logs/verbose-build +++ b/t/logs/verbose-build @@ -1,5 +1,7 @@ # We must ensure a verbose build is used. +dpkg-buildpackage: source package test + checking if you want to see long compiling messages... yes checking if you want to see long compiling messages... no diff --git a/t/tests.t b/t/tests.t index 35df835..5567979 100644 --- a/t/tests.t +++ b/t/tests.t @@ -357,8 +357,8 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,now): gcc-4.6 -Wl,-z,defs test-a.o test-b.o t # debian -is_blhc 'debian', '--all', 1, - 'No compiler commands! +is_blhc 'debian', '', 8, + 'CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall -c test.c ';