forked from active911/fastcache
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.pl
More file actions
executable file
·46 lines (30 loc) · 824 Bytes
/
Copy pathrun_tests.pl
File metadata and controls
executable file
·46 lines (30 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl
use strict;
use warnings;
$|=1; # Autoflush
print("\nRUNNING TESTS\n");
print("---------------\n");
# Find the tests in this folder
opendir(DIR, "./test/") or die ("Unable to read tests from current directory");
my @tests;
while(my $filename=readdir(DIR)){
if($filename=~/^test_(\d)$/) {
push @tests, $1;
}
}
scalar @tests or die ("No tests found - perhaps you need to 'make tests' first?");
# Run each test
my $completed_tests=0;
for my $test (@tests) {
print ("-- Test $test\n");
print `./test/test_$test`;
if($? != 0) {
print ("************ FAIL\n\n");
die("Test $test returned nonzero\n");
}
$completed_tests++;
}
# Success
print("**************************\n");
print("* SUCCESS! $completed_tests/".scalar(@tests)." tests OK. *\n");
print("**************************\n");