Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion emscripten-releases-tags.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"latest": "1.39.15",
"latest": "1.39.16",
"releases": {
"1.39.16": "ae5001fac3849895a873e422a2a80afc90f3b798",
"1.39.15": "3880c744c068986d4ee781a61f7b2e820043e11f",
"1.39.14": "574ad04affb82cc36a32dd89b2a87bea4fb30eba",
"1.39.13": "7b3cd38017f7c582cfa3ac24a9f12aa6a8dca51f",
Expand Down
46 changes: 24 additions & 22 deletions scripts/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@

assert 'EM_CONFIG' in os.environ, "emsdk should be activated before running this script"

LIBC = os.environ['EM_CACHE'] + '/wasm/libc.a'

# Remove the EM_CACHE environment variable. It interferes with testing since
# it would otherwise be fixed for the duration of the script and we expect
# "emsdk activate" to be able switch between SDKs during the running of this
# script.
del os.environ['EM_CACHE']

emconfig = os.environ['EM_CONFIG']
upstream_emcc = os.path.join('upstream', 'emscripten', 'emcc')
fastcomp_emcc = os.path.join('fastcomp', 'emscripten', 'emcc')
Expand Down Expand Up @@ -80,8 +88,6 @@ def hack_emsdk(marker, replacement):

TAGS = json.loads(open('emscripten-releases-tags.txt').read())

LIBC = os.environ['EM_CACHE'] + '/wasm/libc.a'

# Tests

print('test .emscripten contents (latest was installed/activated in test.sh)')
Expand All @@ -95,31 +101,27 @@ def hack_emsdk(marker, replacement):


def test_lib_building(emcc, use_asmjs_optimizer):
def test_build(args, expected=None, unexpected=None):
cache_building_messages = ['generating system library: ']

def test_build(args, expected):
if expected:
expected = cache_building_messages
unexpected = []
else:
expected = []
unexpected = cache_building_messages
checked_call_with_output(emcc + ' hello_world.c' + args,
expected=expected,
unexpected=unexpected,
stderr=subprocess.STDOUT)

# by default we ship libc, struct_info, and the asm.js optimizer, as they
# are important for various reasons (libc takes a long time to build;
# struct_info is a bootstrap product so if the user's setup is broken it's
# confusing; the asm.js optimizer is a native application so it needs a
# working native local build environment). otherwise we don't ship every
# single lib, so some building is expected on first run.

unexpected_system_libs = ['generating system library: libc.',
'generating system asset: optimizer']
if use_asmjs_optimizer:
unexpected_system_libs += ['generating system asset: generated_struct_info.json']

first_time_system_libs = ['generating system library: libdlmalloc.']

test_build('', expected=first_time_system_libs,
unexpected=unexpected_system_libs)
test_build(' -O2', unexpected=unexpected_system_libs + first_time_system_libs)
test_build(' -s WASM=0', unexpected=unexpected_system_libs + first_time_system_libs)
test_build(' -O2 -s WASM=0', unexpected=unexpected_system_libs + first_time_system_libs)
# The emsdk ships all system libraries so we don't expect to see any
# cache population unless we explicly --clear-cache.
test_build('', expected=False)
check_call(emcc + ' --clear-cache')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is maybe excessive - CI here will wait on building all of libc. maybe just delete say libdlmalloc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that each version of SDK now has it own cache... so I'd need to figure out where each libc is. For the upstream SDK I know this because of EM_CACHE, but for fastcomp I'd need to derive the cache directory somehow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, how about removing fastcomp cache testing then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.. although building libc only takes less than a minute, no? Does it it matter on the emsdk CI?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big deal, yeah. But it's nice if emsdk CI is fast as we want to avoid anything landing on emscripten while we tag. lgtm either way though.

test_build(' -O2', expected=True)
test_build(' -s WASM=0', expected=False)
test_build(' -O2 -s WASM=0', expected=False)


def run_emsdk(cmd):
Expand Down