blob: 5b9f8fbc00572ed9edce5271c9c7d4e3ca795ac9 [file] [log] [blame]
Manuel Pégourié-Gonnard64985402013-09-20 16:22:42 +02001#!/usr/bin/perl
2
3# test standard configurations:
4# - build
5# - run test suite
6# - run compat.sh
7
8use warnings;
9use strict;
10
11my %configs = (
12 'config-psk-rc4-tls1_0.h' => "-m tls1 -f 'PSK.*RC4'",
13 'config-mini-tls1_1.h'
14 => "-m tls1_1 -f '^DES-CBC3-SHA\$\|^TLS_RSA_WITH_3DES_EDE_CBC_SHA\$'",
15 'config-suite-b.h' => "-m tls1_2 -f 'ECDSA.*GCM'",
16);
17
18-d 'library' && -d 'include' && -d 'tests' or die "Must be run from root\n";
19
20my $test = system( "grep -i cmake Makefile >/dev/null" ) ? 'check' : 'test';
21
22my $config_h = 'include/polarssl/config.h';
23
24system( "cp $config_h $config_h.bak" ) and die;
25sub abort {
26 system( "mv $config_h.bak $config_h" ) and warn "$config_h not restored\n";
27 die $_[0];
28}
29
30while( my ($conf, $args) = each %configs ) {
31 system( "cp $config_h.bak $config_h" ) and die;
32 system( "make clean" ) and die;
33
34 print "\n******************************************\n";
35 print "* Testing configuration: $conf\n";
36 print "******************************************\n";
37
38 system( "cd scripts && ./activate-config.pl data_files/$conf" )
39 and abort "Failed to activate $conf\n";
40
41 system( "make" ) and abort "Failed to build: $conf\n";
42 system( "make $test" ) and abort "Failed test suite: $conf\n";
43 system( "cd tests && ./compat.sh $args" )
44 and abort "Failed compat.sh: $conf\n";
45}
46
47system( "mv $config_h.bak $config_h" ) and warn "$config_h not restored\n";
48system( "make clean" );
49exit 0;