diff options
Diffstat (limited to 'check.py')
-rwxr-xr-x | check.py | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -496,6 +496,29 @@ for dot_s_dir in ['dot_s', 'llvm_autogenerated']: cmd = [os.path.join('bin', 'binaryen-shell'), expected_file] run_command(cmd) +print '\n[ running linker tests... ]\n' +# The {main,foo,bar,baz}.s files were created by running clang over the respective +# c files. The foobar.bar archive was created by running: +# llvm-ar -format=gnu rc foobar.a foo.s bar.s baz.s +s2wasm = os.path.join('bin', 's2wasm') +cmd = [s2wasm, os.path.join('test', 'linker', 'main.s'), '-l', os.path.join('test', 'linker', 'archive', 'foobar.a')] +output = run_command(cmd) +# foo should come from main.s and return 42 +fail_if_not_contained(output, '(func $foo') +fail_if_not_contained(output, '(i32.const 42)') +# bar should be linked in from bar.s +fail_if_not_contained(output, '(func $bar') +# baz should not be linked in at all +if 'baz' in output: + raise Exception('output should not contain "baz": ' + output) + +# Test an archive using a string table +cmd = [s2wasm, os.path.join('test', 'linker', 'main.s'), '-l', os.path.join('test', 'linker', 'archive', 'barlong.a')] +output = run_command(cmd) +# bar should be linked from the archive +fail_if_not_contained(output, '(func $bar') + + if torture: print '\n[ checking torture testcases... ]\n' |