From 3eca6f2738379a5e68b1d134232184bc41ac05eb Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 12 Apr 2012 01:08:44 +0200 Subject: [PATCH] Add --ignore-arch option. --- bin/blhc | 18 ++++++++++++++++++ t/tests.t | 18 +++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/bin/blhc b/bin/blhc index 98d82c2..e3b83d9 100755 --- a/bin/blhc +++ b/bin/blhc @@ -428,6 +428,7 @@ my $option_help = 0; my $option_version = 0; my $option_pie = 0; my $option_bindnow = 0; +my @option_ignore_arch = (); my @option_ignore_flag = (); my @option_ignore_line = (); my $option_all = 0; @@ -442,6 +443,7 @@ if (not Getopt::Long::GetOptions( 'bindnow' => \$option_bindnow, 'all' => \$option_all, # Ignore. + 'ignore-arch=s' => \@option_ignore_arch, 'ignore-flag=s' => \@option_ignore_flag, 'ignore-line=s' => \@option_ignore_line, # Misc. @@ -689,6 +691,16 @@ foreach my $file (@ARGV) { close $fh; + # Ignore arch if requested. + if (scalar @option_ignore_arch > 0 and $arch) { + foreach my $ignore (@option_ignore_arch) { + if ($arch eq $ignore) { + print "ignoring architecture '$arch'\n"; + next FILE; + } + } + } + if (scalar @input == 0) { if (not $option_buildd) { print "No compiler commands!\n"; @@ -1020,6 +1032,12 @@ Don't require Term::ANSIColor. Use colored (ANSI) output for warning messages. +=item B<--ignore-arch> I + +Ignore build logs from architectures matching I. I is a string. + +Used to prevent false positives. This option can be specified multiple times. + =item B<--ignore-flag> I Don't print an error when the specific flag is missing in a compiler line. diff --git a/t/tests.t b/t/tests.t index 62fef67..1f83fa0 100644 --- a/t/tests.t +++ b/t/tests.t @@ -19,7 +19,7 @@ use strict; use warnings; -use Test::More tests => 132; +use Test::More tests => 134; sub is_blhc { @@ -633,6 +633,22 @@ 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" + ; + + # debian is_blhc 'debian', '', 8, -- 2.45.2