Use an actual hello world program to test in test.py (#456)

This commit is contained in:
Sam Clegg
2020-03-20 14:23:26 -04:00
committed by GitHub
parent 7e689a5061
commit 044f25f66e

15
test.py
View File

@@ -52,7 +52,14 @@ def hack_emsdk(marker, replacement):
# Set up
open('hello_world.cpp', 'w').write('int main() {}')
open('hello_world.c', 'w').write('''\
#include <stdio.h>
int main() {
printf("Hello, world!\\n");
return 0;
}
''')
TAGS = json.loads(open('emscripten-releases-tags.txt').read())
@@ -69,7 +76,7 @@ print('building proper system libraries')
def test_lib_building(emcc, use_asmjs_optimizer):
def test_build(args, expected=None, unexpected=None):
checked_call_with_output(emcc + ' hello_world.cpp' + args,
checked_call_with_output(emcc + ' hello_world.c' + args,
expected=expected,
unexpected=unexpected,
stderr=subprocess.STDOUT)
@@ -149,12 +156,12 @@ run_emsdk('activate tot-upstream')
assert old_config == open(os.path.expanduser('~/.emscripten.old')).read()
# TODO; test on latest as well
assert os.path.exists(LIBC), 'activation supplies prebuilt libc'
check_call(upstream_emcc + ' hello_world.cpp')
check_call(upstream_emcc + ' hello_world.c')
print('test tot-fastcomp')
run_emsdk('install tot-fastcomp')
run_emsdk('activate tot-fastcomp')
check_call(fastcomp_emcc + ' hello_world.cpp')
check_call(fastcomp_emcc + ' hello_world.c')
print('test specific release (old)')
run_emsdk('install sdk-fastcomp-1.38.31-64bit')