mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Use Perl to run tests suites with make
- works on Windows too! - we need Perl to generate/build the test suites anyway - easier & more flexible (eg, now count total number of tests run)
This commit is contained in:
35
tests/scripts/run-test-suites.pl
Normal file
35
tests/scripts/run-test-suites.pl
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use utf8;
|
||||
use open qw(:std utf8);
|
||||
|
||||
my @suites = grep { ! /\.c$/ } glob 'test_suite_*';
|
||||
die "$0: no test suite found\n" unless @suites;
|
||||
|
||||
# in case test suites are linked dynamically
|
||||
$ENV{'LD_LIBRARY_PATH'} = '../library';
|
||||
|
||||
my $prefix = $^O eq "MSWin32" ? '' : './';
|
||||
|
||||
my ($failed_suites, $total_tests_run);
|
||||
for my $suite (@suites)
|
||||
{
|
||||
print "$suite ", "." x ( 72 - length($suite) - 2 - 4 ), " ";
|
||||
my $result = `$prefix$suite`;
|
||||
if( $result =~ /PASSED/ ) {
|
||||
print "PASS\n";
|
||||
} else {
|
||||
$failed_suites++;
|
||||
print "FAIL\n";
|
||||
}
|
||||
my ($tests, $skipped) = $result =~ /([0-9]*) tests.*?([0-9]*) skipped/;
|
||||
$total_tests_run += $tests - $skipped;
|
||||
}
|
||||
|
||||
print "-" x 72, "\n";
|
||||
print $failed_suites ? "FAILED" : "PASSED";
|
||||
printf " (%d suites, %d tests run)\n", scalar @suites, $total_tests_run;
|
||||
exit( $failed_suites ? 1 : 0 );
|
Reference in New Issue
Block a user