Skip to content

Commit 7afaea0

Browse files
committed
Just try to unlink, don't create a race
1 parent 6085e09 commit 7afaea0

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

S10-packages/precompilation.t

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ my @precomp-paths;
99
for <C A B> {
1010
my $path = "t/spec/packages/Example/{$_}.pm";
1111
my $precomp-path = $path ~ '.' ~ $*VM.precomp-ext;
12-
unlink $precomp-path if $precomp-path.IO.e;
12+
unlink $precomp-path; # don't care if failed
13+
1314
ok CompUnit.new($path).precomp, "precomp Example::$_";
1415
ok $precomp-path.IO.e, "created $precomp-path";
1516
@precomp-paths.push: $precomp-path;
@@ -38,15 +39,16 @@ unlink $_ for @precomp-paths;
3839

3940
my ($cu) = $cur.candidates('RT76456');
4041
ok $cu.precomp(:force), 'precompiled a parameterized role';
41-
unlink $cu.precomp-path if $cu.precomp-path.IO.e;
42+
unlink $cu.precomp-path; # don't care if failed
4243
}
4344

4445
#RT #122447
4546
{
4647
# also a test of precompilation from the command line
4748
my $module-name = 'RT122447';
4849
my $output-path = "t/spec/packages/" ~ $module-name ~ '.pm.' ~ $*VM.precomp-ext;
49-
unlink $output-path if $output-path.IO.e;
50+
unlink $output-path; # don't care if failed
51+
5052
is_run 'sub foo($bar) { Proxy.new( FETCH => sub (|) { }, STORE => sub (|) { } ) }', { err => '', out => '', status => 0 }, :compiler-args['--target', $*VM.precomp-target, '--output', $output-path ], 'precompile sub with params returning a proxy';
5153

5254
is_run '0', { err => '', out => '', status => 0 }, :compiler-args['-I', 't/spec/packages', '-M', $module-name], 'precompile load - from the command line';
@@ -57,11 +59,13 @@ unlink $_ for @precomp-paths;
5759
{
5860
my $module-name = 'RT115240';
5961
my $output-path = "t/spec/packages/" ~ $module-name ~ '.pm.' ~ $*VM.precomp-ext;
60-
unlink $output-path if $output-path.IO.e;
62+
unlink $output-path; # don't care if failed
63+
6164
is_run 'role Foo [ ] { }; role Bar does Foo[] { }', { err => '', out => '', status => 0 }, :compiler-args['--target', $*VM.precomp-target, '--output', $output-path ], "precomp curried role compose";
6265

6366
is_run "use $module-name; class C does Bar { };", { err => '', out => '', status => 0 }, :compiler-args['-I', 't/spec/packages', '-M', $module-name], 'precompile load - from the command line';
64-
unlink $output-path if $output-path.IO.e;
67+
68+
unlink $output-path; # don't care if failed
6569
}
6670

6771
#RT #123276
@@ -72,7 +76,8 @@ unlink $_ for @precomp-paths;
7276
my $module-dir = join '/', split('::', $module-name);
7377
my $path = "t/spec/packages/{$module-dir}.pm";
7478
my $precomp-path = $path ~ '.' ~ $*VM.precomp-ext;
75-
unlink $precomp-path if $precomp-path.IO.e;
79+
unlink $precomp-path; # don't care if failed
80+
7681
ok CompUnit.new($path).precomp(), "precomp Example::$_";
7782
@precomp-paths.push: $precomp-path;
7883
}
@@ -88,35 +93,38 @@ unlink $_ for @precomp-paths;
8893
#?rakudo.moar todo 'RT #123276'
8994
is_deeply @keys, [<foo>], 'RT123276';
9095

91-
unlink $_ for @precomp-paths;
96+
unlink $_ for @precomp-paths; # don't care if failed
9297
}
9398

9499
#RT #124162
95100
{
96101
my $module-name = 'RT124162';
97102
my $output-path = "t/spec/packages/" ~ $module-name ~ '.pm.' ~ $*VM.precomp-ext;
98-
unlink $output-path if $output-path.IO.e;
103+
unlink $output-path; # don't care if failed
104+
99105
is_run 'my @f = $(array[uint32].new(0,1)), $(array[uint32].new(3,4));',
100106
{ err => '', out => '', status => 0 }, :compiler-args['--target', $*VM.precomp-target, '--output', $output-path ],
101107
"precomp of native array parameterization";
102108

103109
is_run "use $module-name;",
104110
{ err => '', out => '', status => 0 }, :compiler-args['-I', 't/spec/packages', '-M', $module-name],
105111
'precompile load - from the command line';
106-
unlink $output-path if $output-path.IO.e;
112+
113+
unlink $output-path; # don't care if failed
107114
}
108115

109116
{
110117
my $module-name-a = 'InternArrayA';
111118
my $output-path-a = "t/spec/packages/" ~ $module-name-a ~ '.pm.' ~ $*VM.precomp-ext;
112-
unlink $output-path-a if $output-path-a.IO.e;
119+
unlink $output-path-a; # don't care if failed
113120
is_run 'my constant VALUE = array[uint32].new; sub a() is export { VALUE }',
114121
{ err => '', out => '', status => 0 }, :compiler-args['--target', $*VM.precomp-target, '--output', $output-path-a ],
115122
"precomp of native array parameterization intern test (a)";
116123

117124
my $module-name-b = 'InternArrayB';
118125
my $output-path-b = "t/spec/packages/" ~ $module-name-b ~ '.pm.' ~ $*VM.precomp-ext;
119-
unlink $output-path-b if $output-path-b.IO.e;
126+
127+
unlink $output-path-b; # don't care if failed
120128
is_run 'my constant VALUE = array[uint32].new; sub b() is export { VALUE }',
121129
{ err => '', out => '', status => 0 }, :compiler-args['--target', $*VM.precomp-target, '--output', $output-path-b ],
122130
"precomp of native array parameterization intern test (b)";
@@ -126,5 +134,6 @@ unlink $_ for @precomp-paths;
126134
is_run "use $module-name-a; use $module-name-b; print a().WHAT =:= b().WHAT",
127135
{ err => '', out => "True", status => 0 }, :compiler-args['-I', 't/spec/packages'],
128136
'precompile load of both and identity check passed';
129-
unlink $_ if $_.IO.e for $output-path-a, $output-path-b;
137+
138+
unlink $_ for $output-path-a, $output-path-b; # don't care if failed
130139
}

0 commit comments

Comments
 (0)