summaryrefslogtreecommitdiff
path: root/scripts/test/generate_lld_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/test/generate_lld_tests.py')
-rwxr-xr-xscripts/test/generate_lld_tests.py106
1 files changed, 53 insertions, 53 deletions
diff --git a/scripts/test/generate_lld_tests.py b/scripts/test/generate_lld_tests.py
index 9447fe973..b5cb6b140 100755
--- a/scripts/test/generate_lld_tests.py
+++ b/scripts/test/generate_lld_tests.py
@@ -23,69 +23,69 @@ import shared
def files_with_extensions(path, extensions):
- for file in sorted(os.listdir(path)):
- ext = os.path.splitext(file)[1]
- if ext in extensions:
- yield file, ext
+ for file in sorted(os.listdir(path)):
+ ext = os.path.splitext(file)[1]
+ if ext in extensions:
+ yield file, ext
def generate_wast_files(llvm_bin, emscripten_root):
- print('\n[ building wast files from C sources... ]\n')
+ print('\n[ building wast files from C sources... ]\n')
- lld_path = os.path.join(shared.options.binaryen_test, 'lld')
- for src_file, ext in files_with_extensions(lld_path, ['.c', '.cpp']):
- print('..', src_file)
- obj_file = src_file.replace(ext, '.o')
+ lld_path = os.path.join(shared.options.binaryen_test, 'lld')
+ for src_file, ext in files_with_extensions(lld_path, ['.c', '.cpp']):
+ print('..', src_file)
+ obj_file = src_file.replace(ext, '.o')
- src_path = os.path.join(lld_path, src_file)
- obj_path = os.path.join(lld_path, obj_file)
+ src_path = os.path.join(lld_path, src_file)
+ obj_path = os.path.join(lld_path, obj_file)
- wasm_file = src_file.replace(ext, '.wasm')
- wast_file = src_file.replace(ext, '.wast')
+ wasm_file = src_file.replace(ext, '.wasm')
+ wast_file = src_file.replace(ext, '.wast')
- obj_path = os.path.join(lld_path, obj_file)
- wasm_path = os.path.join(lld_path, wasm_file)
- wast_path = os.path.join(lld_path, wast_file)
- is_shared = 'shared' in src_file
+ obj_path = os.path.join(lld_path, obj_file)
+ wasm_path = os.path.join(lld_path, wasm_file)
+ wast_path = os.path.join(lld_path, wast_file)
+ is_shared = 'shared' in src_file
- compile_cmd = [
- os.path.join(llvm_bin, 'clang'), src_path, '-o', obj_path,
- '--target=wasm32-unknown-unknown-wasm',
- '-c',
- '-nostdinc',
- '-Xclang', '-nobuiltininc',
- '-Xclang', '-nostdsysteminc',
- '-Xclang', '-I%s/system/include' % emscripten_root,
- '-O1',
- ]
+ compile_cmd = [
+ os.path.join(llvm_bin, 'clang'), src_path, '-o', obj_path,
+ '--target=wasm32-unknown-unknown-wasm',
+ '-c',
+ '-nostdinc',
+ '-Xclang', '-nobuiltininc',
+ '-Xclang', '-nostdsysteminc',
+ '-Xclang', '-I%s/system/include' % emscripten_root,
+ '-O1',
+ ]
- link_cmd = [
- os.path.join(llvm_bin, 'wasm-ld'), '-flavor', 'wasm',
- '-z', '-stack-size=1048576',
- obj_path, '-o', wasm_path,
- '--allow-undefined',
- '--export', '__wasm_call_ctors',
- '--global-base=568',
- ]
- if is_shared:
- compile_cmd.append('-fPIC')
- compile_cmd.append('-fvisibility=default')
- link_cmd.append('-shared')
- else:
- link_cmd.append('--entry=main')
+ link_cmd = [
+ os.path.join(llvm_bin, 'wasm-ld'), '-flavor', 'wasm',
+ '-z', '-stack-size=1048576',
+ obj_path, '-o', wasm_path,
+ '--allow-undefined',
+ '--export', '__wasm_call_ctors',
+ '--global-base=568',
+ ]
+ if is_shared:
+ compile_cmd.append('-fPIC')
+ compile_cmd.append('-fvisibility=default')
+ link_cmd.append('-shared')
+ else:
+ link_cmd.append('--entry=main')
- try:
- run_command(compile_cmd)
- run_command(link_cmd)
- run_command(shared.WASM_DIS + [wasm_path, '-o', wast_path])
- finally:
- # Don't need the .o or .wasm files, don't leave them around
- shared.delete_from_orbit(obj_path)
- shared.delete_from_orbit(wasm_path)
+ try:
+ run_command(compile_cmd)
+ run_command(link_cmd)
+ run_command(shared.WASM_DIS + [wasm_path, '-o', wast_path])
+ finally:
+ # Don't need the .o or .wasm files, don't leave them around
+ shared.delete_from_orbit(obj_path)
+ shared.delete_from_orbit(wasm_path)
if __name__ == '__main__':
- if len(shared.options.positional_args) != 2:
- print('Usage: generate_lld_tests.py [llvm/bin/dir] [path/to/emscripten]')
- sys.exit(1)
- generate_wast_files(*shared.options.positional_args)
+ if len(shared.options.positional_args) != 2:
+ print('Usage: generate_lld_tests.py [llvm/bin/dir] [path/to/emscripten]')
+ sys.exit(1)
+ generate_wast_files(*shared.options.positional_args)