Merge pull request #1152 from DeterminateSystems/parallel-tests

Parallel tests, fix a hydra-queue-runner race condition
This commit is contained in:
Graham Christensen
2022-02-10 12:11:20 -05:00
committed by GitHub
7 changed files with 40 additions and 8 deletions

View File

@ -60,6 +60,16 @@ if (!defined($pid = fork())) {
kill('INT', $pid);
}
# We expect $ctx{jobsdir}/server.py to create the file at $filename, but the time it
# takes to do so is non-deterministic. We need to give it _some_ time to hopefully
# settle -- but not too much that it drastically slows things down.
for my $i (1..10) {
if (! -f $filename) {
diag("$filename does not yet exist");
sleep(1);
}
}
open(my $fh, "<", $filename) or die ("Can't open(): $!\n");
my $i = 0;
my $uri = <$fh>;

View File

@ -39,7 +39,7 @@ subtest "Building, caching, and then garbage collecting the underlying job" => s
ok(unlink(Hydra::Helper::Nix::gcRootFor($path)), "Unlinking the GC root for underlying Dependency succeeds");
(my $ret, my $stdout, my $stderr) = captureStdoutStderr(1, "nix-store", "--delete", $path);
(my $ret, my $stdout, my $stderr) = captureStdoutStderr(5, "nix-store", "--delete", $path);
is($ret, 0, "Deleting the underlying dependency should succeed");
};

View File

@ -11,6 +11,15 @@ BEGIN {
$App::Yath::Script::SCRIPT = which 'yath';
}
use App::Yath::Util qw/find_yath/;
use List::SomeUtils qw(none);
if (defined($ENV{"NIX_BUILD_CORES"})
and not defined($ENV{"YATH_JOB_COUNT"})
and not defined($ENV{"T2_HARNESS_JOB_COUNT"})
and not defined($ENV{"HARNESS_JOB_COUNT"})) {
$ENV{"YATH_JOB_COUNT"} = $ENV{"NIX_BUILD_CORES"};
print STDERR "test.pl: Defaulting \$YATH_JOB_COUNT to \$NIX_BUILD_CORES (${\$ENV{'NIX_BUILD_CORES'}})\n";
}
system($^X, find_yath(), '-D', 'test', '--default-search' => './', @ARGV);
my $exit = $?;