123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- use warnings;
- use strict;
- -d 'library' && -d 'include' && -d 'tests' or die "Must be run from root\n";
- my $config_h = 'include/mbedtls/config.h';
- my $ssl_sed_cmd = 's/^#define \(MBEDTLS_SSL.*\)/\1/p';
- my @ssl = split( /\s+/, `sed -n -e '$ssl_sed_cmd' $config_h` );
- my $mdx_sed_cmd = 's/^#define \(MBEDTLS_MD..*_C\)/\1/p';
- my $sha_sed_cmd = 's/^#define \(MBEDTLS_SHA.*_C\)/\1/p';
- my @hash_modules = split( /\s+/,
- `sed -n -e '$mdx_sed_cmd' -e '$sha_sed_cmd' $config_h` );
- my $sha_trunc_sed_cmd = 's/^\/\/#define \(MBEDTLS_SHA..._NO_.*\)/\1/p';
- my @hash_negatives = split( /\s+/,
- `sed -n -e '$sha_trunc_sed_cmd' $config_h` );
- my @hashes = ((map { "unset $_" } @hash_modules),
- (map { "set $_" } @hash_negatives));
- 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";
-
- warn $_[0];
- exit 1;
- }
- for my $hash (@hashes) {
- system( "cp $config_h.bak $config_h" ) and die "$config_h not restored\n";
- system( "make clean" ) and die;
- print "\n******************************************\n";
- print "* Testing hash option: $hash\n";
- print "******************************************\n";
- $ENV{MBEDTLS_TEST_CONFIGURATION} = "-$hash";
- system( "scripts/config.py $hash" )
- and abort "Failed to $hash\n";
- for my $opt (@ssl) {
- system( "scripts/config.py unset $opt" )
- and abort "Failed to disable $opt\n";
- }
- system( "CFLAGS='-Werror -Wall -Wextra' make lib" )
- and abort "Failed to build lib: $hash\n";
- system( "cd tests && make" ) and abort "Failed to build tests: $hash\n";
- system( "make test" ) and abort "Failed test suite: $hash\n";
- }
- system( "mv $config_h.bak $config_h" ) and die "$config_h not restored\n";
- system( "make clean" ) and die;
- exit 0;
|