@@ -52,14 +52,14 @@ def checked_call_with_output(cmd, expected=None, unexpected=None, stderr=None, e
52
52
53
53
if expected :
54
54
for x in listify (expected ):
55
- assert x in stdout , 'call had the right output: ' + stdout + '\n [[[' + x + ']]]'
55
+ assert x in stdout , 'expected output missing : ' + stdout + '\n [[[' + x + ']]]'
56
56
if unexpected :
57
57
for x in listify (unexpected ):
58
- assert x not in stdout , 'call had the wrong output: ' + stdout + '\n [[[' + x + ']]]'
58
+ assert x not in stdout , 'unexpected output present : ' + stdout + '\n [[[' + x + ']]]'
59
59
60
60
61
- def failing_call_with_output (cmd , expected ):
62
- proc = subprocess .Popen (cmd .split (' ' ), stdout = subprocess .PIPE , stderr = subprocess .PIPE , universal_newlines = True )
61
+ def failing_call_with_output (cmd , expected , env = None ):
62
+ proc = subprocess .Popen (cmd .split (' ' ), stdout = subprocess .PIPE , stderr = subprocess .PIPE , universal_newlines = True , env = env )
63
63
stdout , stderr = proc .communicate ()
64
64
if WINDOWS :
65
65
print ('warning: skipping part of failing_call_with_output() due to error codes not being propagated (see #592)' )
@@ -137,6 +137,20 @@ def setUp(self):
137
137
run_emsdk ('install latest' )
138
138
run_emsdk ('activate latest' )
139
139
140
+ def test_unknown_arch (self ):
141
+ env = os .environ .copy ()
142
+ env ['EMSDK_ARCH' ] = 'mips'
143
+ failing_call_with_output (emsdk + ' install latest' ,
144
+ expected = 'unknown machine architecture: mips' ,
145
+ env = env )
146
+
147
+ def test_wrong_bitness (self ):
148
+ env = os .environ .copy ()
149
+ env ['EMSDK_ARCH' ] = 'x86'
150
+ failing_call_with_output (emsdk + ' install sdk-latest-64bit' ,
151
+ expected = 'is only provided for 64-bit OSe' ,
152
+ env = env )
153
+
140
154
def test_already_installed (self ):
141
155
# Test we don't re-download unnecessarily
142
156
checked_call_with_output (emsdk + ' install latest' , expected = 'already installed' , unexpected = 'Downloading:' )
@@ -251,11 +265,15 @@ def test_update_no_git(self):
251
265
if not filename .startswith ('.' ) and not os .path .isdir (filename ):
252
266
shutil .copy2 (filename , os .path .join (temp_dir , filename ))
253
267
254
- os .chdir (temp_dir )
255
- run_emsdk ('update' )
268
+ olddir = os .getcwd ()
269
+ try :
270
+ os .chdir (temp_dir )
271
+ run_emsdk ('update' )
256
272
257
- print ('second time' )
258
- run_emsdk ('update' )
273
+ print ('second time' )
274
+ run_emsdk ('update' )
275
+ finally :
276
+ os .chdir (olddir )
259
277
260
278
def test_install_arbitrary (self ):
261
279
# Test that its possible to install arbrary emscripten-releases SDKs
@@ -278,6 +296,7 @@ def test_keep_downloads(self):
278
296
# With EMSDK_KEEP_DOWNLOADS the downloading should happen on the first
279
297
# install of 2.0.28, and again when we install 2.0.29, but not on the
280
298
# second install of 2.0.28 because the zip should already be local.
299
+ shutil .rmtree ('zips' )
281
300
checked_call_with_output (emsdk + ' install 2.0.28' , expected = 'Downloading:' , env = env )
282
301
checked_call_with_output (emsdk + ' install 2.0.29' , expected = 'Downloading:' , env = env )
283
302
checked_call_with_output (emsdk + ' install 2.0.28' , expected = 'already downloaded, skipping' , unexpected = 'Downloading:' , env = env )
0 commit comments