File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1
1
# This file is a part of Julia. License is MIT: https://julialang.org/license
2
2
3
+ using Base. Test
4
+
3
5
script = """
4
6
# Issue #11948
5
7
f(x) = x+1
@@ -24,3 +26,35 @@ mutable struct Foo end
24
26
@assert Tuple{Type{LastMain.Foo}} !== Tuple{Type{Main.Foo}}
25
27
"""
26
28
run (` $exename --startup-file=no -e $script2 ` )
29
+
30
+ # Issue #22101
31
+ mktempdir () do dir
32
+ withenv (" JULIA_DEBUG_LOADING" => nothing ) do
33
+ # We need to ensure that the module does a nontrivial amount of work during precompilation
34
+ write (joinpath (dir, " Test22101.jl" ), """
35
+ __precompile__()
36
+ module Test22101
37
+ export f22101
38
+ f22101() = collect(1:10)
39
+ f22101()
40
+ end
41
+ """ )
42
+ write (joinpath (dir, " testdriver.jl" ), """
43
+ insert!(LOAD_PATH, 1, $(repr (dir)) )
44
+ insert!(Base.LOAD_CACHE_PATH, 1, $(repr (dir)) )
45
+ try
46
+ using Test22101
47
+ f22101()
48
+ workspace()
49
+ using Test22101
50
+ finally
51
+ splice!(LOAD_PATH, 1)
52
+ splice!(Base.LOAD_CACHE_PATH, 1)
53
+ end
54
+ exit(isdefined(Main, :f22101) ? 0 : 1)
55
+ """ )
56
+ # Ensure that STDIO doesn't get swallowed (helps with debugging)
57
+ cmd = ` $(Base. julia_cmd ()) --startup-file=no --precompile=yes $(joinpath (dir, " testdriver.jl" )) `
58
+ @test success (pipeline (cmd, stdout = STDOUT, stderr = STDERR))
59
+ end
60
+ end
You can’t perform that action at this time.
0 commit comments