コード例 #1
0
def main():
    run_help_tests()
    run_wasm_opt_tests()
    asm2wasm.test_asm2wasm()
    asm2wasm.test_asm2wasm_binary()
    run_wasm_dis_tests()
    run_wasm_merge_tests()
    run_crash_tests()
    run_ctor_eval_tests()
    run_wasm_metadce_tests()
    if has_shell_timeout():
        run_wasm_reduce_tests()

    run_spec_tests()
    run_binaryen_js_tests()
    s2wasm.test_s2wasm()
    s2wasm.test_linker()
    lld.test_wasm_link_metadata()
    lld.test_wasm_emscripten_finalize()
    wasm2asm.test_wasm2asm()
    run_validator_tests()
    if options.torture and options.test_waterfall:
        run_torture_tests()
    if has_vanilla_emcc and has_vanilla_llvm and 0:
        run_vanilla_tests()
    print '\n[ checking example testcases... ]\n'
    if options.run_gcc_tests:
        run_gcc_torture_tests()
    if EMCC:
        run_emscripten_tests()

    # Check/display the results
    if num_failures == 0:
        print '\n[ success! ]'

    if warnings:
        print '\n' + '\n'.join(warnings)

    if num_failures > 0:
        print '\n[ ' + str(num_failures) + ' failures! ]'

    sys.exit(num_failures)
コード例 #2
0
ファイル: check.py プロジェクト: liuhaibinGit/C-Compiler
        if not s.endswith('.js'): continue
        print s
        f = open('a.js', 'w')
        f.write(open(os.path.join(options.binaryen_bin, 'binaryen.js')).read())
        f.write(
            open(os.path.join(options.binaryen_test, 'binaryen.js', s)).read())
        f.close()
        cmd = [MOZJS, 'a.js']
        out = run_command(cmd, stderr=subprocess.STDOUT)
        expected = open(
            os.path.join(options.binaryen_test, 'binaryen.js',
                         s + '.txt')).read()
        if expected not in out:
            fail(out, expected)

s2wasm.test_s2wasm()
s2wasm.test_linker()

print '\n[ running validation tests... ]\n'
# Ensure the tests validate by default
cmd = WASM_AS + [
    os.path.join(options.binaryen_test, 'validator', 'invalid_export.wast')
]
run_command(cmd)
cmd = WASM_AS + [
    os.path.join(options.binaryen_test, 'validator', 'invalid_import.wast')
]
run_command(cmd)
cmd = WASM_AS + [
    '--validate=web',
    os.path.join(options.binaryen_test, 'validator', 'invalid_export.wast')
コード例 #3
0
ファイル: check.py プロジェクト: WebAssembly/binaryen
  print '\n[ checking binaryen.js testcases... ]\n'

  for s in sorted(os.listdir(os.path.join(options.binaryen_test, 'binaryen.js'))):
    if not s.endswith('.js'): continue
    print s
    f = open('a.js', 'w')
    f.write(open(os.path.join(options.binaryen_bin, 'binaryen.js')).read())
    f.write(open(os.path.join(options.binaryen_test, 'binaryen.js', s)).read())
    f.close()
    cmd = [NODEJS, 'a.js']
    out = run_command(cmd)
    expected = open(os.path.join(options.binaryen_test, 'binaryen.js', s + '.txt')).read()
    if expected not in out:
      fail(out, expected)

s2wasm.test_s2wasm()
s2wasm.test_linker()

print '\n[ running validation tests... ]\n'
# Ensure the tests validate by default
cmd = WASM_AS + [os.path.join(options.binaryen_test, 'validator', 'invalid_export.wast')]
run_command(cmd)
cmd = WASM_AS + [os.path.join(options.binaryen_test, 'validator', 'invalid_import.wast')]
run_command(cmd)
cmd = WASM_AS + ['--validate=web', os.path.join(options.binaryen_test, 'validator', 'invalid_export.wast')]
run_command(cmd, expected_status=1)
cmd = WASM_AS + ['--validate=web', os.path.join(options.binaryen_test, 'validator', 'invalid_import.wast')]
run_command(cmd, expected_status=1)
cmd = WASM_AS + ['--validate=none', os.path.join(options.binaryen_test, 'validator', 'invalid_return.wast')]
run_command(cmd)