From b26b28a7e4dfe0a2db6737bc66855d26d79ad8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Wed, 12 Jul 2017 12:15:24 +0200 Subject: [PATCH] Make some perl scripts usable with git bisect run For that they need to return between 0 and 124 on error, while die returns 255, causing bisect-run to abort. --- tests/scripts/curves.pl | 6 ++++-- tests/scripts/depends-hashes.pl | 3 ++- tests/scripts/depends-pkalgs.pl | 3 ++- tests/scripts/key-exchanges.pl | 3 ++- tests/scripts/test-ref-configs.pl | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/scripts/curves.pl b/tests/scripts/curves.pl index f4942c624..b7cfdf674 100755 --- a/tests/scripts/curves.pl +++ b/tests/scripts/curves.pl @@ -36,14 +36,16 @@ my @curves = split( /\s+/, `sed -n -e '$sed_cmd' $config_h` ); system( "cp $config_h $config_h.bak" ) and die; sub abort { system( "mv $config_h.bak $config_h" ) and warn "$config_h not restored\n"; - die $_[0]; + warn $_[0]; + exit 1; } for my $curve (@curves) { system( "cp $config_h.bak $config_h" ) and die "$config_h not restored\n"; + system( "make clean" ) and die; + # depends on a specific curve. Also, ignore error if it wasn't enabled system( "scripts/config.pl unset MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED" ); - system( "make clean" ) and die; print "\n******************************************\n"; print "* Testing without curve: $curve\n"; diff --git a/tests/scripts/depends-hashes.pl b/tests/scripts/depends-hashes.pl index f27eb9e1b..96cc9020b 100755 --- a/tests/scripts/depends-hashes.pl +++ b/tests/scripts/depends-hashes.pl @@ -44,7 +44,8 @@ my @hashes = split( /\s+/, system( "cp $config_h $config_h.bak" ) and die; sub abort { system( "mv $config_h.bak $config_h" ) and warn "$config_h not restored\n"; - die $_[0]; + warn $_[0]; + exit 1; } for my $hash (@hashes) { diff --git a/tests/scripts/depends-pkalgs.pl b/tests/scripts/depends-pkalgs.pl index 703b41fa4..28f13787d 100755 --- a/tests/scripts/depends-pkalgs.pl +++ b/tests/scripts/depends-pkalgs.pl @@ -50,7 +50,8 @@ my %algs = ( system( "cp $config_h $config_h.bak" ) and die; sub abort { system( "mv $config_h.bak $config_h" ) and warn "$config_h not restored\n"; - die $_[0]; + warn $_[0]; + exit 1; } while( my ($alg, $extras) = each %algs ) { diff --git a/tests/scripts/key-exchanges.pl b/tests/scripts/key-exchanges.pl index 528812a00..5ce890046 100755 --- a/tests/scripts/key-exchanges.pl +++ b/tests/scripts/key-exchanges.pl @@ -33,7 +33,8 @@ my @kexes = split( /\s+/, `sed -n -e '$sed_cmd' $config_h` ); system( "cp $config_h $config_h.bak" ) and die; sub abort { system( "mv $config_h.bak $config_h" ) and warn "$config_h not restored\n"; - die $_[0]; + warn $_[0]; + exit 1; } for my $kex (@kexes) { diff --git a/tests/scripts/test-ref-configs.pl b/tests/scripts/test-ref-configs.pl index a9a89f1ce..fe6d154f9 100755 --- a/tests/scripts/test-ref-configs.pl +++ b/tests/scripts/test-ref-configs.pl @@ -55,7 +55,8 @@ my $config_h = 'include/mbedtls/config.h'; system( "cp $config_h $config_h.bak" ) and die; sub abort { system( "mv $config_h.bak $config_h" ) and warn "$config_h not restored\n"; - die $_[0]; + warn $_[0]; + exit 1; } while( my ($conf, $data) = each %configs ) {