on master help sign in
Reenable parallel testing
1ca661aNiklas Larsson
test/Makefile+6−2
@@ -1,11 +1,15 @@
1.PHONY: test test_js time update diff distclean $(TESTS)
1.PHONY: test test_js time update diff distclean $(TESTS)
2
2
3+TESTS = $(sort $(patsubst %/,%.test,$(wildcard */)))
3
4
4−test:
5+test: $(TESTS)
6+
7+
8+info:
5 /usr/bin/env perl ./runtest.pl all
9 /usr/bin/env perl ./runtest.pl all
6
10
7%.test:
11%.test:
8− @perl ./runtest.pl $(patsubst %.test,%,$@)
12+ @perl ./runtest.pl $(patsubst %.test,%,$@) -q
9
13
10test_js:
14test_js:
11 @perl ./runtest.pl without sugar004 reg029 reg052 io001 dsl002 io003 effects001 effects002 basic007 basic011 ffi006 --codegen node
15 @perl ./runtest.pl without sugar004 reg029 reg052 io001 dsl002 io003 effects001 effects002 basic007 basic011 ffi006 --codegen node
test/runtest.pl+19−16
@@ -7,6 +7,7 @@ use Env;
7
7
8my $exitstatus = 0;
8my $exitstatus = 0;
9my @idrOpts = ();
9my @idrOpts = ();
10+my $quiet = 0;
10
11
11
12
12# Sets the PATH if there's a sandbox or stack present
13# Sets the PATH if there's a sandbox or stack present
@@ -26,15 +27,15 @@ sub set_path {
26
27
27 if ( -d $sandbox ) {
28 if ( -d $sandbox ) {
28 my $sandbox_abs = abs_path($sandbox);
29 my $sandbox_abs = abs_path($sandbox);
29− print "Using Cabal Sandbox\n";
30+ print "Using Cabal Sandbox\n" unless $quiet;
30− printf("Sandbox located at: %s\n", $sandbox_abs);
31+ printf("Sandbox located at: %s\n", $sandbox_abs) unless $quiet;
31 $ENV{PATH} = $sandbox_abs . ":" . $path;
32 $ENV{PATH} = $sandbox_abs . ":" . $path;
32
33
33 } elsif ( -d $stack_work_dir ) {
34 } elsif ( -d $stack_work_dir ) {
34
35
35 my $stack_work_abs = abs_path($stack_work_dir);
36 my $stack_work_abs = abs_path($stack_work_dir);
36− print "Using Stack Work\n";
37+ print "Using Stack Work\n" unless $quiet;
37− printf("Stack work located at: %s\n", $stack_work_abs);
38+ printf("Stack work located at: %s\n", $stack_work_abs) unless $quiet;
38 $ENV{PATH} = $stack_work_abs . ":" . $path;
39 $ENV{PATH} = $stack_work_abs . ":" . $path;
39
40
40 }
41 }
@@ -49,7 +50,6 @@ sub runtest {
49 chdir($test);
50 chdir($test);
50
51
51 my $startTime = time();
52 my $startTime = time();
52− print "Running $test...";
53 my $got = `./run @idrOpts`;
53 my $got = `./run @idrOpts`;
54 my $exp = `cat expected`;
54 my $exp = `cat expected`;
55
55
@@ -87,19 +87,19 @@ sub runtest {
87 }
87 }
88
88
89 if ($got eq $exp) {
89 if ($got eq $exp) {
90− print "success\n";
90+ print "$test finished...success\n";
91 $statsref->{'succeeded'}++;
91 $statsref->{'succeeded'}++;
92 }
92 }
93 else {
93 else {
94 if ($update == 0) {
94 if ($update == 0) {
95 $exitstatus = 1;
95 $exitstatus = 1;
96− print "FAILURE\n";
96+ print "$test finished...FAILURE\n";
97 system "diff output expected";
97 system "diff output expected";
98 push @$failedref, $test;
98 push @$failedref, $test;
99 $statsref->{'failed'}++;
99 $statsref->{'failed'}++;
100 } else {
100 } else {
101 system("cp output expected");
101 system("cp output expected");
102− print "UPDATED\n";
102+ print "$test finished...UPDATED\n";
103 $statsref->{'updated'}++;
103 $statsref->{'updated'}++;
104 }
104 }
105 }
105 }
@@ -179,6 +179,7 @@ while (my $opt = shift @opts) {
179 elsif ($opt eq "-d") { $diff = 1; }
179 elsif ($opt eq "-d") { $diff = 1; }
180 elsif ($opt eq "-s") { $show = 1; }
180 elsif ($opt eq "-s") { $show = 1; }
181 elsif ($opt eq "-t") { $showTime = 1; }
181 elsif ($opt eq "-t") { $showTime = 1; }
182+ elsif ($opt eq "-q") { $quiet = 1; }
182 else { push(@idrOpts, $opt); }
183 else { push(@idrOpts, $opt); }
183}
184}
184
185
@@ -186,7 +187,7 @@ my $idris = $ENV{IDRIS};
186
187
187if (defined $ENV{IDRIS} && -e $idris ) {
188if (defined $ENV{IDRIS} && -e $idris ) {
188 $ENV{IDRIS} = abs_path($idris);
189 $ENV{IDRIS} = abs_path($idris);
189− print "Using $idris\n";
190+ print "Using $idris\n" unless $quiet;
190} else {
191} else {
191 delete $ENV{IDRIS};
192 delete $ENV{IDRIS};
192 set_path();
193 set_path();
@@ -220,14 +221,16 @@ my $endTime = time();
220my $elapsedTime = $endTime - $startTime;
221my $elapsedTime = $endTime - $startTime;
221
222
222
223
224+if(!$quiet) {
223−print "----\n";
225+ print "----\n";
224−printf("%d tests run: %d succeeded, %d failed, %d updated.\n\n",
226+ printf("%d tests run: %d succeeded, %d failed, %d updated.\n\n",
225− $stats{'total'}, $stats{'succeeded'}, $stats{'failed'}, $stats{'updated'} );
227+ $stats{'total'}, $stats{'succeeded'}, $stats{'failed'}, $stats{'updated'} );
226
228
227−if (@failed) {
229+ if (@failed) {
228− print "Failed tests:\n";
230+ print "Failed tests:\n";
229− foreach my $failure (@failed) {
231+ foreach my $failure (@failed) {
230− print "$failure\n";
232+ print "$failure\n";
233+ }
231 }
234 }
232}
235}
233
236