@@ -81,7 +81,10 @@ def exit_test(self, build_dir = "build"):
81
81
# call premake in the test
82
82
def premake (self ):
83
83
if override_compiler :
84
- self .assertEqual (subprocess .call (["premake5" , "--scripts=../../.." , "--cc=" + override_compiler , "ninja" ]), 0 , "looks like premake failed" )
84
+ args = ["premake5" , "--scripts=../../.." , "--cc=" + override_compiler , "ninja" ]
85
+ if override_compiler == "emcc" :
86
+ args += ["--os=emscripten" ]
87
+ self .assertEqual (subprocess .call (args ), 0 , "looks like premake failed" )
85
88
else :
86
89
self .assertEqual (subprocess .call (["premake5" , "--scripts=../../.." , "ninja" ]), 0 , "looks like premake failed" )
87
90
@@ -106,7 +109,7 @@ def out_name(self, path, ext = None, prefix = None):
106
109
107
110
# check if executable exist
108
111
def out_exist (self , path ):
109
- print ("Looking for {} in {}" , path , os .listdir (os .path .dirname (path )))
112
+ print (f "Looking for { path } in { os .listdir (os .path .dirname (path ))} " )
110
113
sys .stdout .flush ()
111
114
self .assertTrue (
112
115
os .path .exists (path ) or
@@ -116,9 +119,10 @@ def out_exist(self, path):
116
119
os .path .exists (self .out_name (path , ".a" , "lib" )) or
117
120
os .path .exists (self .out_name (path , ".dll" )) or
118
121
os .path .exists (self .out_name (path , ".so" , "lib" )) or
119
- os .path .exists (self .out_name (path , ".dylib" , "lib" ))
122
+ os .path .exists (self .out_name (path , ".dylib" , "lib" )) or
123
+ os .path .exists (self .out_name (path , ".wasm" ))
120
124
)
121
- print ("Found {}" , path )
125
+ print (f "Found { path } " )
122
126
sys .stdout .flush ()
123
127
# check if executable doesn't exist
124
128
def out_not_exist (self , path ):
@@ -130,7 +134,8 @@ def out_not_exist(self, path):
130
134
os .path .exists (self .out_name (path , ".a" , "lib" )) or
131
135
os .path .exists (self .out_name (path , ".dll" )) or
132
136
os .path .exists (self .out_name (path , ".so" , "lib" )) or
133
- os .path .exists (self .out_name (path , ".dylib" , "lib" ))
137
+ os .path .exists (self .out_name (path , ".dylib" , "lib" )) or
138
+ os .path .exists (self .out_name (path , ".wasm" ))
134
139
)
135
140
136
141
# check if executable exist
@@ -179,8 +184,9 @@ def check_basics(self, out_debug, out_release, build_dir = "build"):
179
184
self .out_exist (out_release )
180
185
181
186
# run executables to check if they are valid
182
- self .exe (out_debug )
183
- self .exe (out_release )
187
+ if override_compiler != "emcc" :
188
+ self .exe (out_debug )
189
+ self .exe (out_release )
184
190
185
191
# ----------------------------------------------------- console app tests
186
192
class TestConsoleApp (Helper ):
@@ -218,12 +224,18 @@ def test_withapp(self):
218
224
class TestSharedLib (Helper ):
219
225
# test simple app
220
226
def test_simple (self ):
227
+ # Skip shared library tests on Emscripten since this is an advanced feature not supported by Premake yet.
228
+ if override_compiler == "emcc" :
229
+ return
221
230
self .enter_test ("shared_lib/simple" )
222
231
self .check_basics ("build/bin_debug/ninjatestprj" , "build/bin_release/ninjatestprj" )
223
232
self .exit_test ()
224
233
225
234
# test shared lib with app
226
235
def test_withapp (self ):
236
+ # Skip shared library tests on Emscripten since this is an advanced feature not supported by Premake yet.
237
+ if override_compiler == "emcc" :
238
+ return
227
239
self .enter_test ("shared_lib/withapp" )
228
240
self .check_basics ("build/bin_debug/ninjatestprj_app" , "build/bin_release/ninjatestprj_app" )
229
241
self .out_exist ("build/bin_debug/ninjatestprj_lib_test1" )
@@ -251,3 +263,8 @@ def test_simple(self):
251
263
print ("-------------------------- found gcc on windows" )
252
264
override_compiler = "gcc"
253
265
unittest .main ()
266
+
267
+ if which ("emcc" ):
268
+ print ("-------------------------- found emcc" )
269
+ override_compiler = "emcc"
270
+ unittest .main ()
0 commit comments