Skip to content

Commit 55773ef

Browse files
authored
update parallel runtest to run on ucrt64 perl (#11967)
1 parent ea459d0 commit 55773ef

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

testsuite/partest/runtest.pl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
my $rtest_extra_args = "";
1919
my $test_baseline = 0;
2020
my $isWSL = (defined $ENV{'WSLENV'} && rindex(Cwd::abs_path(),"/mnt/",0)==0);
21+
my $osname = $^O;
2122

2223
for(@ARGV){
2324
if(/--no-colour/) {
@@ -71,7 +72,7 @@ sub symlink_if_exists {
7172
my $dst = shift;
7273

7374
if (-e $src) {
74-
if ($isWSL) {
75+
if ($isWSL or ($osname eq 'MSWin32')) {
7576
link($src, $dst);
7677
} else {
7778
symlink($src, $dst);
@@ -230,9 +231,13 @@ sub needs_sandbox {
230231
my $test_suit_path_rel = "../" x $n;
231232

232233
my $rtest = $test_suit_path_rel . "rtest $rtest_extra_args -v -nolib ";
234+
if ( $osname eq 'MSWin32' ) {
235+
$rtest = "perl " . $rtest;
236+
}
233237

234238
# Run the testscript and redirect output to a logfile.
235239
my $cmd = "$rtest $test > $test.test_log 2>&1";
240+
# print ("CMD: ", $cmd, "\n");
236241
system("$cmd");
237242

238243
# Read the logfile and see if the test succeeded or failed.
@@ -302,6 +307,8 @@ sub needs_sandbox {
302307
print color 'reset';
303308
}
304309

310+
close( $test_log );
311+
305312
if ($withxml) {
306313
my $XMLOUT;
307314
open $XMLOUT, '>', $xml_log or die "Couldn't open result.xml: $!";

testsuite/partest/runtests.pl

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/perl
22

3-
# Author: Per Östlund
3+
# Author: Per Östlund, Adrian Pop
44
#
55
# This script parses the makefiles in the testsuite and extracts (almost) all
66
# testcases. It then runs each test with the runtest.pl script, which creates a
@@ -31,7 +31,7 @@
3131
use List::Util 'shuffle';
3232
use Cwd;
3333
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 );
3535

3636
use Fcntl;
3737

@@ -65,6 +65,7 @@
6565
my $withtxt = 0;
6666
my $have_dwdiff = "";
6767
my $rebase_test = "";
68+
my $osname = $^O;
6869

6970
{
7071
eval { require File::Which; 1; };
@@ -190,6 +191,9 @@
190191
my $tests_failed :shared = 0;
191192
my @failed_tests :shared;
192193
my $testscript = cwd() . "/runtest.pl";
194+
if ( $osname eq 'MSWin32' ) {
195+
$testscript = "perl " . $testscript;
196+
}
193197
my $testsuite_root = cwd() . "/../";
194198
my %test_map :shared;
195199

@@ -277,6 +281,7 @@ sub run_tests {
277281

278282
my $t0 = [gettimeofday];
279283
my $cmd = "$testscript $test_full $have_dwdiff $nocolour $withxmlcmd $with_omc $rebase_test";
284+
# print ("CMD: ", $cmd, "\n");
280285
my $x = system("$cmd") >> 8;
281286
my $elapsed = tv_interval ( $t0, [gettimeofday]);
282287

@@ -378,17 +383,22 @@ sub run_tests {
378383
while(<$in>) {
379384
$thread_count++ if /processor/;
380385
}
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+
}
385394
}
386395
}
387396
}
388397
# Make sure that omc-diff is generated before trying to run any tests.
389398
system("make --quiet -j$thread_count omc-diff ReferenceFiles > /dev/null 2>&1");
390399

391-
symlink('../Compiler', 'Compiler');
400+
# I really don't think this is needed anymore!
401+
# symlink('../Compiler', 'Compiler');
392402

393403
print "$thread_count threads\n";
394404

@@ -480,7 +490,8 @@ sub run_tests {
480490
print $XMLOUT "</testsuite>\n";
481491
}
482492

483-
unlink("Compiler");
493+
# should not be needed anymore!
494+
# unlink("Compiler");
484495
# Clean up the temporary rtest directory, so it doesn't get overrun.
485496
my $username = getpwuid($<);
486497
my @dirs = glob "/tmp/omc-rtest-$username*";

0 commit comments

Comments
 (0)