|
1 | 1 | #!/usr/bin/perl |
2 | 2 |
|
3 | | -# Author: Per Östlund |
| 3 | +# Author: Per Östlund, Adrian Pop |
4 | 4 | # |
5 | 5 | # This script parses the makefiles in the testsuite and extracts (almost) all |
6 | 6 | # testcases. It then runs each test with the runtest.pl script, which creates a |
|
31 | 31 | use List::Util 'shuffle'; |
32 | 32 | use Cwd; |
33 | 33 | use File::Path qw(rmtree); |
34 | | -use Time::HiRes qw( usleep ualarm gettimeofday tv_interval clock stat ); |
| 34 | +use Time::HiRes qw( usleep gettimeofday tv_interval stat ); |
35 | 35 |
|
36 | 36 | use Fcntl; |
37 | 37 |
|
|
65 | 65 | my $withtxt = 0; |
66 | 66 | my $have_dwdiff = ""; |
67 | 67 | my $rebase_test = ""; |
| 68 | +my $osname = $^O; |
68 | 69 |
|
69 | 70 | { |
70 | 71 | eval { require File::Which; 1; }; |
|
190 | 191 | my $tests_failed :shared = 0; |
191 | 192 | my @failed_tests :shared; |
192 | 193 | my $testscript = cwd() . "/runtest.pl"; |
| 194 | +if ( $osname eq 'MSWin32' ) { |
| 195 | + $testscript = "perl " . $testscript; |
| 196 | +} |
193 | 197 | my $testsuite_root = cwd() . "/../"; |
194 | 198 | my %test_map :shared; |
195 | 199 |
|
@@ -277,6 +281,7 @@ sub run_tests { |
277 | 281 |
|
278 | 282 | my $t0 = [gettimeofday]; |
279 | 283 | my $cmd = "$testscript $test_full $have_dwdiff $nocolour $withxmlcmd $with_omc $rebase_test"; |
| 284 | + # print ("CMD: ", $cmd, "\n"); |
280 | 285 | my $x = system("$cmd") >> 8; |
281 | 286 | my $elapsed = tv_interval ( $t0, [gettimeofday]); |
282 | 287 |
|
@@ -378,17 +383,22 @@ sub run_tests { |
378 | 383 | while(<$in>) { |
379 | 384 | $thread_count++ if /processor/; |
380 | 385 | } |
381 | | - } else { # On OSX, try syscyl |
382 | | - my @contents = `sysctl -n hw.ncpu`; |
383 | | - if (int($contents[0]) > 0) { |
384 | | - $thread_count = int($contents[0]); |
| 386 | + } else { |
| 387 | + if ( $osname eq 'MSWin32' ) { # Windows |
| 388 | + $thread_count = int($ENV{"NUMBER_OF_PROCESSORS"}); |
| 389 | + } else { # On OSX, try syscyl |
| 390 | + my @contents = `sysctl -n hw.ncpu`; |
| 391 | + if (int($contents[0]) > 0) { |
| 392 | + $thread_count = int($contents[0]); |
| 393 | + } |
385 | 394 | } |
386 | 395 | } |
387 | 396 | } |
388 | 397 | # Make sure that omc-diff is generated before trying to run any tests. |
389 | 398 | system("make --quiet -j$thread_count omc-diff ReferenceFiles > /dev/null 2>&1"); |
390 | 399 |
|
391 | | -symlink('../Compiler', 'Compiler'); |
| 400 | +# I really don't think this is needed anymore! |
| 401 | +# symlink('../Compiler', 'Compiler'); |
392 | 402 |
|
393 | 403 | print "$thread_count threads\n"; |
394 | 404 |
|
@@ -480,7 +490,8 @@ sub run_tests { |
480 | 490 | print $XMLOUT "</testsuite>\n"; |
481 | 491 | } |
482 | 492 |
|
483 | | -unlink("Compiler"); |
| 493 | +# should not be needed anymore! |
| 494 | +# unlink("Compiler"); |
484 | 495 | # Clean up the temporary rtest directory, so it doesn't get overrun. |
485 | 496 | my $username = getpwuid($<); |
486 | 497 | my @dirs = glob "/tmp/omc-rtest-$username*"; |
|
0 commit comments