|
43 | 43 | import tools.line_endings
|
44 | 44 | import tools.js_optimizer
|
45 | 45 | import tools.tempfiles
|
46 |
| -import tools.duplicate_function_eliminator |
47 | 46 |
|
48 | 47 | scons_path = shared.which('scons')
|
49 | 48 | emmake = shared.bat_suffix(path_from_root('emmake'))
|
@@ -6999,130 +6998,6 @@ def test_warn_unexported_main(self):
|
6999 | 6998 | proc = self.run_process([EMCC, path_from_root('tests', 'hello_world.c'), '-s', 'EXPORTED_FUNCTIONS=[]'], stderr=PIPE)
|
7000 | 6999 | self.assertContained(WARNING, proc.stderr)
|
7001 | 7000 |
|
7002 |
| - ############################################################ |
7003 |
| - # Function eliminator tests |
7004 |
| - ############################################################ |
7005 |
| - def normalize_line_endings(self, input): |
7006 |
| - return input.replace('\r\n', '\n').replace('\n\n', '\n').replace('\n\n', '\n') |
7007 |
| - |
7008 |
| - def get_file_contents(self, file): |
7009 |
| - file_contents = "" |
7010 |
| - with open(file) as fout: |
7011 |
| - file_contents = "".join(fout.readlines()) |
7012 |
| - |
7013 |
| - file_contents = self.normalize_line_endings(file_contents) |
7014 |
| - |
7015 |
| - return file_contents |
7016 |
| - |
7017 |
| - def function_eliminator_test_helper(self, input_file, expected_output_file, use_hash_info=False): |
7018 |
| - input_file = path_from_root('tests', 'optimizer', input_file) |
7019 |
| - expected_output_file = path_from_root('tests', 'optimizer', expected_output_file) |
7020 |
| - command = [path_from_root('tools', 'eliminate-duplicate-functions.js'), input_file, '--no-minimize-whitespace', '--use-asm-ast'] |
7021 |
| - |
7022 |
| - if use_hash_info: |
7023 |
| - command.append('--use-hash-info') |
7024 |
| - |
7025 |
| - proc = self.run_process(NODE_JS + command, stdin=PIPE, stderr=PIPE, stdout=PIPE) |
7026 |
| - assert proc.stderr == '', proc.stderr |
7027 |
| - expected_output = self.get_file_contents(expected_output_file) |
7028 |
| - output = self.normalize_line_endings(proc.stdout) |
7029 |
| - |
7030 |
| - self.assertIdentical(expected_output, output) |
7031 |
| - |
7032 |
| - def test_function_eliminator_simple(self): |
7033 |
| - self.function_eliminator_test_helper('test-function-eliminator-simple.js', |
7034 |
| - 'test-function-eliminator-simple-output.js') |
7035 |
| - |
7036 |
| - def test_function_eliminator_replace_function_call(self): |
7037 |
| - self.function_eliminator_test_helper('test-function-eliminator-replace-function-call.js', |
7038 |
| - 'test-function-eliminator-replace-function-call-output.js') |
7039 |
| - |
7040 |
| - def test_function_eliminator_replace_function_call_two_passes(self): |
7041 |
| - self.function_eliminator_test_helper('test-function-eliminator-replace-function-call-output.js', |
7042 |
| - 'test-function-eliminator-replace-function-call-two-passes-output.js') |
7043 |
| - |
7044 |
| - def test_function_eliminator_replace_array_value(self): |
7045 |
| - output_file = 'output.js' |
7046 |
| - |
7047 |
| - try: |
7048 |
| - shared.safe_copy(path_from_root('tests', 'optimizer', 'test-function-eliminator-replace-array-value.js'), output_file) |
7049 |
| - |
7050 |
| - tools.duplicate_function_eliminator.run(output_file) |
7051 |
| - |
7052 |
| - output_file_contents = self.get_file_contents(output_file) |
7053 |
| - |
7054 |
| - expected_file_contents = self.get_file_contents(path_from_root('tests', 'optimizer', 'test-function-eliminator-replace-array-value-output.js')) |
7055 |
| - |
7056 |
| - self.assertIdentical(expected_file_contents, output_file_contents) |
7057 |
| - finally: |
7058 |
| - tools.tempfiles.try_delete(output_file) |
7059 |
| - |
7060 |
| - def test_function_eliminator_replace_object_value_assignment(self): |
7061 |
| - self.function_eliminator_test_helper('test-function-eliminator-replace-object-value-assignment.js', |
7062 |
| - 'test-function-eliminator-replace-object-value-assignment-output.js') |
7063 |
| - |
7064 |
| - def test_function_eliminator_variable_clash(self): |
7065 |
| - self.function_eliminator_test_helper('test-function-eliminator-variable-clash.js', |
7066 |
| - 'test-function-eliminator-variable-clash-output.js') |
7067 |
| - |
7068 |
| - def test_function_eliminator_replace_variable_value(self): |
7069 |
| - self.function_eliminator_test_helper('test-function-eliminator-replace-variable-value.js', |
7070 |
| - 'test-function-eliminator-replace-variable-value-output.js') |
7071 |
| - |
7072 |
| - @no_wasm_backend('tests native asm.js optimizer, which is never build for wasm backend') |
7073 |
| - def test_function_eliminator_double_parsed_correctly(self): |
7074 |
| - # This is a test that makes sure that when we perform final optimization on |
7075 |
| - # the JS file, doubles are preserved (and not converted to ints). |
7076 |
| - output_file = 'output.js' |
7077 |
| - |
7078 |
| - try: |
7079 |
| - shared.safe_copy(path_from_root('tests', 'optimizer', 'test-function-eliminator-double-parsed-correctly.js'), output_file) |
7080 |
| - |
7081 |
| - # Run duplicate function elimination |
7082 |
| - tools.duplicate_function_eliminator.run(output_file) |
7083 |
| - |
7084 |
| - # Run last opts |
7085 |
| - shutil.move(tools.js_optimizer.run(output_file, ['last', 'asm']), output_file) |
7086 |
| - output_file_contents = self.get_file_contents(output_file) |
7087 |
| - |
7088 |
| - # Compare |
7089 |
| - expected_file_contents = self.get_file_contents(path_from_root('tests', 'optimizer', 'test-function-eliminator-double-parsed-correctly-output.js')) |
7090 |
| - self.assertIdentical(expected_file_contents, output_file_contents) |
7091 |
| - finally: |
7092 |
| - tools.tempfiles.try_delete(output_file) |
7093 |
| - |
7094 |
| - # Now do the same, but using a pre-generated equivalent function hash info that |
7095 |
| - # comes in handy for parallel processing |
7096 |
| - def test_function_eliminator_simple_with_hash_info(self): |
7097 |
| - self.function_eliminator_test_helper('test-function-eliminator-simple-with-hash-info.js', |
7098 |
| - 'test-function-eliminator-simple-output.js', |
7099 |
| - use_hash_info=True) |
7100 |
| - |
7101 |
| - def test_function_eliminator_replace_function_call_with_hash_info(self): |
7102 |
| - self.function_eliminator_test_helper('test-function-eliminator-replace-function-call-with-hash-info.js', |
7103 |
| - 'test-function-eliminator-replace-function-call-output.js', |
7104 |
| - use_hash_info=True) |
7105 |
| - |
7106 |
| - def test_function_eliminator_replace_function_call_two_passes_with_hash_info(self): |
7107 |
| - self.function_eliminator_test_helper('test-function-eliminator-replace-function-call-output-with-hash-info.js', |
7108 |
| - 'test-function-eliminator-replace-function-call-two-passes-output.js', |
7109 |
| - use_hash_info=True) |
7110 |
| - |
7111 |
| - def test_function_eliminator_replace_object_value_assignment_with_hash_info(self): |
7112 |
| - self.function_eliminator_test_helper('test-function-eliminator-replace-object-value-assignment-with-hash-info.js', |
7113 |
| - 'test-function-eliminator-replace-object-value-assignment-output.js', |
7114 |
| - use_hash_info=True) |
7115 |
| - |
7116 |
| - def test_function_eliminator_variable_clash_with_hash_info(self): |
7117 |
| - self.function_eliminator_test_helper('test-function-eliminator-variable-clash-with-hash-info.js', |
7118 |
| - 'test-function-eliminator-variable-clash-output.js', |
7119 |
| - use_hash_info=True) |
7120 |
| - |
7121 |
| - def test_function_eliminator_replace_variable_value_with_hash_info(self): |
7122 |
| - self.function_eliminator_test_helper('test-function-eliminator-replace-variable-value-with-hash-info.js', |
7123 |
| - 'test-function-eliminator-replace-variable-value-output.js', |
7124 |
| - use_hash_info=True) |
7125 |
| - |
7126 | 7001 | def test_source_file_with_fixed_language_mode(self):
|
7127 | 7002 | create_test_file('src_tmp_fixed_lang', '''
|
7128 | 7003 | #include <string>
|
@@ -9035,7 +8910,7 @@ def test_minimal_runtime_code_size(self):
|
9035 | 8910 | '-DNDEBUG',
|
9036 | 8911 | '-ffast-math']
|
9037 | 8912 |
|
9038 |
| - asmjs = ['-s', 'WASM=0', '--separate-asm', '-s', 'ELIMINATE_DUPLICATE_FUNCTIONS=1', '--memory-init-file', '1'] |
| 8913 | + asmjs = ['-s', 'WASM=0', '--separate-asm', '-s', '--memory-init-file', '1'] |
9039 | 8914 | wasm2js = ['-s', 'WASM=0', '--memory-init-file', '1']
|
9040 | 8915 |
|
9041 | 8916 | hello_world_sources = [path_from_root('tests', 'small_hello_world.c'),
|
|
0 commit comments