Ugly hack to avoid recompiling the same thing multiple times in parallel.
This commit is contained in:
parent
c6d8adb8a4
commit
342ec250c3
@ -189,13 +189,18 @@ sub fixtests
|
||||
|
||||
sub fixdeps
|
||||
{
|
||||
my ($str) = @_;
|
||||
my ($str, $fakes) = @_;
|
||||
|
||||
my @t = split(/\s+/, $str);
|
||||
$str = '';
|
||||
foreach my $t (@t)
|
||||
{
|
||||
$str .= ' ' if $str ne '';
|
||||
if (exists($fakes->{$t}))
|
||||
{
|
||||
$str .= $fakes->{$t};
|
||||
next;
|
||||
}
|
||||
if ($t =~ /^[^\/]+$/)
|
||||
{
|
||||
$str .= '$(TEST_D)/' . $t;
|
||||
@ -265,6 +270,7 @@ sub get_tests
|
||||
my %deps;
|
||||
my %tests;
|
||||
my %alltests;
|
||||
my %fakes;
|
||||
while (my $line = <M>)
|
||||
{
|
||||
chomp $line;
|
||||
@ -287,7 +293,22 @@ sub get_tests
|
||||
|| $line =~ /^(?<t>test_(ss|gen) .*):(?<d>.*)/)
|
||||
{
|
||||
my $t = $+{t};
|
||||
$deps{$t} = $+{d};
|
||||
my $d = $+{d};
|
||||
# If there are multiple targets stupid FreeBSD make runs the
|
||||
# rules once for each dependency that matches one of the
|
||||
# targets. Running the same rule twice concurrently causes
|
||||
# breakage, so replace with a fake target.
|
||||
if ($t =~ /\s/)
|
||||
{
|
||||
++$fake;
|
||||
my @targets = split /\s+/, $t;
|
||||
$t = "_fake$fake";
|
||||
foreach my $f (@targets)
|
||||
{
|
||||
$fakes{$f} = $t;
|
||||
}
|
||||
}
|
||||
$deps{$t} = $d;
|
||||
$deps{$t} =~ s/#.*$//;
|
||||
for (;;)
|
||||
{
|
||||
@ -326,7 +347,7 @@ sub get_tests
|
||||
$d =~ s/\.\.\/apps/\$(BIN_D)/g;
|
||||
$d =~ s/\.\.\/util/\$(TEST_D)/g;
|
||||
$d = fixtests($d, \%tests);
|
||||
$d = fixdeps($d);
|
||||
$d = fixdeps($d, \%fakes);
|
||||
|
||||
my $r = $targets{$t};
|
||||
$r =~ s/\.\.\/apps/..\/\$(BIN_D)/g;
|
||||
@ -392,7 +413,18 @@ sub get_tests
|
||||
$scripts .= "\nocsp:\n\tcp -R test/ocsp-tests \$(TEST_D)\n";
|
||||
$scripts .= "\smime:\n\tcp -R test/smime-certs \$(TEST_D)\n";
|
||||
|
||||
my $all = 'test: ' . join(' ', keys %alltests);
|
||||
my $all = 'test:';
|
||||
foreach my $t (keys %alltests)
|
||||
{
|
||||
if (exists($fakes{$t}))
|
||||
{
|
||||
$all .= " $fakes{$t}";
|
||||
}
|
||||
else
|
||||
{
|
||||
$all .= " $t";
|
||||
}
|
||||
}
|
||||
|
||||
return "$scripts\n$copies\n$tests\n$all\n\n$each";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user