@@ -15,11 +15,6 @@ const dirname = typeof __dirname === "string" ? __dirname : path.dirname(fileURL
15
15
jest . setTimeout ( 400000 )
16
16
17
17
describe ( "setup-llvm" , ( ) => {
18
- let directory : string
19
- beforeAll ( async ( ) => {
20
- directory = await setupTmpDir ( "llvm" )
21
- } )
22
-
23
18
it ( "Finds URL for ubuntu version" , async ( ) => {
24
19
expect (
25
20
await getLLVMAssetURL ( "linux" , "x86_64" , "13.0.0" ) ,
@@ -65,22 +60,46 @@ describe("setup-llvm", () => {
65
60
)
66
61
} )
67
62
68
- it ( "should setup LLVM" , async ( ) => {
69
- const osVersion = await ubuntuVersion ( )
70
- const { binDir } = await setupLLVM ( getVersion ( "llvm" , "true" , osVersion ) , directory , process . arch )
71
- await testBin ( "clang++" , [ "--version" ] , binDir )
63
+ let directory : string
64
+ beforeEach ( async ( ) => {
65
+ directory = await setupTmpDir ( "llvm" )
66
+ } )
72
67
73
- expect ( process . env . CC ?. includes ( "clang" ) ) . toBeTruthy ( )
74
- expect ( process . env . CXX ?. includes ( "clang++" ) ) . toBeTruthy ( )
68
+ afterEach ( async ( ) => {
69
+ await io . rmRF ( directory )
70
+ } , 100000 )
71
+
72
+ describe ( "should setup latest LLVM" , ( ) => {
73
+ it ( "should download LLVM" , async ( ) => {
74
+ const osVersion = await ubuntuVersion ( )
75
+ const { binDir } = await setupLLVM ( getVersion ( "llvm" , "true" , osVersion ) , directory , process . arch )
76
+ await testBin ( "clang++" , [ "--version" ] , binDir )
75
77
76
- // test compilation
77
- const file = join ( dirname , "main.cpp" )
78
- const main_exe = join ( dirname , addExeExt ( "main" ) )
79
- execaSync ( "clang++" , [ file , "-o" , main_exe ] , { cwd : dirname } )
80
- if ( process . platform !== "win32" ) {
81
- await chmod ( main_exe , "755" )
82
- }
83
- execaSync ( main_exe , { cwd : dirname , stdio : "inherit" } )
78
+ expect ( process . env . CC ?. includes ( "clang" ) ) . toBeTruthy ( )
79
+ expect ( process . env . CXX ?. includes ( "clang++" ) ) . toBeTruthy ( )
80
+
81
+ // test compilation
82
+ const file = join ( dirname , "main.cpp" )
83
+ const main_exe = join ( dirname , addExeExt ( "main" ) )
84
+ execaSync ( "clang++" , [ file , "-o" , main_exe ] , { cwd : dirname } )
85
+ if ( process . platform !== "win32" ) {
86
+ await chmod ( main_exe , "755" )
87
+ }
88
+ execaSync ( main_exe , { cwd : dirname , stdio : "inherit" } )
89
+ } )
90
+
91
+ it ( "should setup clang-format" , async ( ) => {
92
+ const osVersion = await ubuntuVersion ( )
93
+ const { binDir } = await setupClangFormat ( getVersion ( "llvm" , "true" , osVersion ) , directory , process . arch )
94
+ await testBin ( "clang-format" , [ "--version" ] , binDir )
95
+ } )
96
+
97
+ it ( "should setup clang tools" , async ( ) => {
98
+ const osVersion = await ubuntuVersion ( )
99
+ const { binDir } = await setupClangTools ( getVersion ( "llvm" , "true" , osVersion ) , directory , process . arch )
100
+ await testBin ( "clang-tidy" , [ "--version" ] , binDir )
101
+ await testBin ( "clang-format" , [ "--version" ] , binDir )
102
+ } )
84
103
} )
85
104
86
105
it ( "should setup LLVM 5 from llvm.org" , async ( ) => {
@@ -99,21 +118,4 @@ describe("setup-llvm", () => {
99
118
}
100
119
execaSync ( main_exe , { cwd : dirname , stdio : "inherit" } )
101
120
} )
102
-
103
- it ( "should setup clang-format" , async ( ) => {
104
- const osVersion = await ubuntuVersion ( )
105
- const { binDir } = await setupClangFormat ( getVersion ( "llvm" , "true" , osVersion ) , directory , process . arch )
106
- await testBin ( "clang-format" , [ "--version" ] , binDir )
107
- } )
108
-
109
- it ( "should setup clang tools" , async ( ) => {
110
- const osVersion = await ubuntuVersion ( )
111
- const { binDir } = await setupClangTools ( getVersion ( "llvm" , "true" , osVersion ) , directory , process . arch )
112
- await testBin ( "clang-tidy" , [ "--version" ] , binDir )
113
- await testBin ( "clang-format" , [ "--version" ] , binDir )
114
- } )
115
-
116
- afterAll ( async ( ) => {
117
- await io . rmRF ( directory )
118
- } , 100000 )
119
121
} )
0 commit comments