on master help sign in
Merge pull request #2853 from jfdm/time-tests

Gather timing data for tests.

commit9c991988fda4e52e316310bd75276d1e6379961e authorJan de Muijnck-Hughes <jfdm@users.noreply.github.com> dateThu 17 Dec 2015, 22:57 (11 years ago) parenta86558a33930f1
3 files changed+32−7
Makefile+3 test/Makefile+4−1 test/runtest.pl+25−6
Makefile+3
@@ -36,6 +36,9 @@ test_all:
3636 $(MAKE) test_llvm
3737 $(MAKE) test_java
3838
39+test_timed:
40+ $(MAKE) -C test IDRIS=../dist/build/idris time
41+
3942lib_clean:
4043 $(MAKE) -C libs IDRIS=../../dist/build/idris/idris RTS=../../dist/build/rts/libidris_rts clean
4144
test/Makefile+4−1
@@ -1,4 +1,4 @@
1−.PHONY: test test_java test_js update diff distclean $(TESTS)
1+.PHONY: test test_java test_js time update diff distclean $(TESTS)
22
33TESTS = $(sort $(patsubst %/,%.test,$(wildcard */)))
44
@@ -16,6 +16,9 @@ update:
1616diff:
1717 /usr/bin/env perl ./runtest.pl all -d
1818
19+time:
20+ /usr/bin/env perl ./runtest.pl all -t
21+
1922distclean:
2023 rm -f *~
2124 rm -f */output
test/runtest.pl+25−6
@@ -49,16 +49,24 @@ sub sandbox_path {
4949# output and report results.
5050#
5151sub runtest {
52− my ($test, $update) = @_;
52+ my ($test, $update, $showTime) = @_;
5353
5454 my $sandbox = sandbox_path($test);
5555
5656 chdir($test);
5757
58+ my $startTime = time();
5859 print "Running $test...\n";
5960 my $got = `$sandbox ./run @idrOpts`;
6061 my $exp = `cat expected`;
6162
63+ my $endTime = time();
64+ my $elapsedTime = $endTime - $startTime;
65+
66+ if ($showTime == 1 ){
67+ printf("Duration of $test was %d\n", $elapsedTime);
68+ }
69+
6270 # Allow for variant expected output for tests by overriding expected
6371 # when there is an expected.<os> file in the test.
6472 # This should be the exception but there are sometimes valid reasons
@@ -155,15 +163,17 @@ else {
155163
156164# Run the tests.
157165
158−my $update = 0;
159−my $diff = 0;
160−my $show = 0;
161−my $usejava = 0;
166+my $update = 0;
167+my $diff = 0;
168+my $show = 0;
169+my $usejava = 0;
170+my $showTime = 0;
162171
163172while (my $opt = shift @opts) {
164173 if ($opt eq "-u") { $update = 1; }
165174 elsif ($opt eq "-d") { $diff = 1; }
166175 elsif ($opt eq "-s") { $show = 1; }
176+ elsif ($opt eq "-t") { $showTime = 1; }
167177 else { push(@idrOpts, $opt); }
168178}
169179
@@ -171,9 +181,11 @@ my $idris = $ENV{IDRIS};
171181my $path = $ENV{PATH};
172182$ENV{PATH} = cwd() . "/" . $idris . ":" . $path;
173183
184+my $startTime = time();
185+
174186foreach my $test (@tests) {
175187 if ($diff == 0 && $show == 0) {
176− runtest($test,$update);
188+ runtest($test,$update,$showTime);
177189 }
178190 else {
179191 chdir $test;
@@ -192,4 +204,11 @@ foreach my $test (@tests) {
192204 }
193205}
194206
207+my $endTime = time();
208+my $elapsedTime = $endTime - $startTime;
209+
210+if ($showTime == 1) {
211+ printf("Duration of Entire Test Suite was %d\n", $elapsedTime);
212+}
213+
195214exit $exitstatus;