summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorBen Laurie <ben@links.org>2013-05-05 15:06:33 +0100
committerBen Laurie <ben@links.org>2013-05-05 15:06:33 +0100
commit342ec250c34ba854eb2a9803c5401972fcecc13d (patch)
treed478d68c7e62bc2ec41bcf1fcee7b319c018d487 /util
parentc6d8adb8a45186617e0a8e2c09469bd164b92b31 (diff)
Ugly hack to avoid recompiling the same thing multiple times in parallel.
Diffstat (limited to 'util')
-rw-r--r--util/pl/unix.pl40
1 files changed, 36 insertions, 4 deletions
diff --git a/util/pl/unix.pl b/util/pl/unix.pl
index 72d3b441e1..b76981dc55 100644
--- a/util/pl/unix.pl
+++ b/util/pl/unix.pl
@@ -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";
}