11
11
12
12
assert 'EM_CONFIG' in os .environ , "emsdk should be activated before running this script"
13
13
14
+ LIBC = os .environ ['EM_CACHE' ] + '/wasm/libc.a'
15
+
16
+ # Remove the EM_CACHE environment variable. It interferes with testing since
17
+ # it would otherwise be fixed for the duration of the script and we expect
18
+ # "emsdk activate" to be able switch between SDKs during the running of this
19
+ # script.
20
+ del os .environ ['EM_CACHE' ]
21
+
14
22
emconfig = os .environ ['EM_CONFIG' ]
15
23
upstream_emcc = os .path .join ('upstream' , 'emscripten' , 'emcc' )
16
24
fastcomp_emcc = os .path .join ('fastcomp' , 'emscripten' , 'emcc' )
@@ -80,8 +88,6 @@ def hack_emsdk(marker, replacement):
80
88
81
89
TAGS = json .loads (open ('emscripten-releases-tags.txt' ).read ())
82
90
83
- LIBC = os .environ ['EM_CACHE' ] + '/wasm/libc.a'
84
-
85
91
# Tests
86
92
87
93
print ('test .emscripten contents (latest was installed/activated in test.sh)' )
@@ -95,31 +101,27 @@ def hack_emsdk(marker, replacement):
95
101
96
102
97
103
def test_lib_building (emcc , use_asmjs_optimizer ):
98
- def test_build (args , expected = None , unexpected = None ):
104
+ cache_building_messages = ['generating system library: ' ]
105
+
106
+ def test_build (args , expected ):
107
+ if expected :
108
+ expected = cache_building_messages
109
+ unexpected = []
110
+ else :
111
+ expected = []
112
+ unexpected = cache_building_messages
99
113
checked_call_with_output (emcc + ' hello_world.c' + args ,
100
114
expected = expected ,
101
115
unexpected = unexpected ,
102
116
stderr = subprocess .STDOUT )
103
117
104
- # by default we ship libc, struct_info, and the asm.js optimizer, as they
105
- # are important for various reasons (libc takes a long time to build;
106
- # struct_info is a bootstrap product so if the user's setup is broken it's
107
- # confusing; the asm.js optimizer is a native application so it needs a
108
- # working native local build environment). otherwise we don't ship every
109
- # single lib, so some building is expected on first run.
110
-
111
- unexpected_system_libs = ['generating system library: libc.' ,
112
- 'generating system asset: optimizer' ]
113
- if use_asmjs_optimizer :
114
- unexpected_system_libs += ['generating system asset: generated_struct_info.json' ]
115
-
116
- first_time_system_libs = ['generating system library: libdlmalloc.' ]
117
-
118
- test_build ('' , expected = first_time_system_libs ,
119
- unexpected = unexpected_system_libs )
120
- test_build (' -O2' , unexpected = unexpected_system_libs + first_time_system_libs )
121
- test_build (' -s WASM=0' , unexpected = unexpected_system_libs + first_time_system_libs )
122
- test_build (' -O2 -s WASM=0' , unexpected = unexpected_system_libs + first_time_system_libs )
118
+ # The emsdk ships all system libraries so we don't expect to see any
119
+ # cache population unless we explicly --clear-cache.
120
+ test_build ('' , expected = False )
121
+ check_call (emcc + ' --clear-cache' )
122
+ test_build (' -O2' , expected = True )
123
+ test_build (' -s WASM=0' , expected = False )
124
+ test_build (' -O2 -s WASM=0' , expected = False )
123
125
124
126
125
127
def run_emsdk (cmd ):
0 commit comments