From 09652475bd17d084cfceb133c23f0ace16564757 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 10 Feb 2022 10:00:32 -0500 Subject: [PATCH] Set the YATH_JOB_COUNt to NIX_BUILD_CORES if no parallelism variables are set --- t/test.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/t/test.pl b/t/test.pl index fc5b215a..7f17f107 100644 --- a/t/test.pl +++ b/t/test.pl @@ -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{"T2_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 = $?;