Skip to content

Commit

Permalink
Fix occasional test failures caused by overly clever reproducible-bui…
Browse files Browse the repository at this point in the history
…lds.t

reproducible-builds.t assumed that a whole precomp store is locked for writing
and therefore it would suffice to lock for an arbitrary precomp id. This
assumption is no longer true and the trick it played actually violates a
different assumption: that we only lock one precomp file at a time.

Better to stop playing tricks and just copy the test files to a private
repository where other tests cannot interfere (which is what locking the
store for the duration of the test tried to fix).
  • Loading branch information
niner committed Sep 6, 2020
1 parent 961a653 commit 8642533
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions t/02-rakudo/reproducible-builds.t
@@ -1,17 +1,26 @@
use lib 'lib';
BEGIN my $compiler-id = CompUnit::PrecompilationId.new-without-check($*PERL.compiler.id);
BEGIN my $id = CompUnit::PrecompilationId.new('1F3B9959EF798485A266FE735E772328311AD787');
BEGIN my $dest = $*REPO.precomp-store.destination($compiler-id, $id); # not really used
END { $*REPO.precomp-store.unlock }
my constant $lib = $*TMPDIR.child("rakudo-lib" ~ (^2**128).pick.base(36));
BEGIN {
$lib.child('NativeCall').mkdir;
$lib.child('NativeCall').child('Compiler').mkdir;
'lib'.IO.child('NativeCall.rakumod').copy: $lib.child('NativeCall.rakumod');
'lib'.IO.child('NativeCall').child('Types.rakumod').copy: $lib.child('NativeCall').child('Types.rakumod');
'lib'.IO.child('NativeCall').child('Compiler').child('GNU.rakumod').copy: $lib.child('NativeCall').child('Compiler').child('GNU.rakumod');
'lib'.IO.child('NativeCall').child('Compiler').child('MSVC.rakumod').copy: $lib.child('NativeCall').child('Compiler').child('MSVC.rakumod');
}
use lib $lib;

use Test;
use NativeCall; # precompile dependencies


my $store = CompUnit::PrecompilationStore::File.new(
:prefix($*TMPDIR.child("rakudo-precomp" ~ (^2**128).pick.base(36)))
);
my $precompilation-repository = CompUnit::PrecompilationRepository::Default.new(:$store);
my @checksums;
my @units;
my $compiler-id = CompUnit::PrecompilationId.new-without-check($*PERL.compiler.id);
my constant $id = CompUnit::PrecompilationId.new-without-check('6B7A1AECF02807F30DDAD99C02C34440CA036AF6');
for ^2 -> $run {
$precompilation-repository.precompile(
'lib/NativeCall.rakumod'.IO,
Expand Down

0 comments on commit 8642533

Please sign in to comment.