def test_llvm(self): LLVM_WARNING = 'LLVM version appears incorrect' restore_and_set_up() # Clang should report the version number we expect, and emcc should not warn assert shared.check_llvm_version() output = self.check_working(EMCC) self.assertNotContained(LLVM_WARNING, output) # Fake a different llvm version restore_and_set_up() with open(config_file, 'a') as f: f.write('LLVM_ROOT = "' + self.in_dir('fake') + '"') real_version_x, real_version_y = (int(x) for x in EXPECTED_LLVM_VERSION.split('.')) make_fake_llc(self.in_dir('fake', 'llc'), 'wasm32 - WebAssembly 32-bit') make_fake_lld(self.in_dir('fake', 'wasm-ld')) with env_modify({'EM_IGNORE_SANITY': '1'}): for inc_x in range(-2, 3): for inc_y in range(-2, 3): expected_x = real_version_x + inc_x expected_y = real_version_y + inc_y if expected_x < 0 or expected_y < 0: continue # must be a valid llvm version print("mod LLVM version: %d %d -> %d %d" % (real_version_x, real_version_x, expected_x, expected_y)) make_fake_clang(self.in_dir('fake', 'clang'), '%s.%s' % (expected_x, expected_y)) did_modify = inc_x != 0 or inc_y != 0 if did_modify: output = self.check_working(EMCC, LLVM_WARNING) else: output = self.check_working(EMCC) self.assertNotContained(LLVM_WARNING, output)
def test_llvm(self): LLVM_WARNING = 'LLVM version appears incorrect' restore_and_set_up() # Clang should report the version number we expect, and emcc should not warn assert shared.check_llvm_version() output = self.check_working(EMCC) self.assertNotContained(LLVM_WARNING, output) # Fake a different llvm version restore_and_set_up() with open(CONFIG_FILE, 'a') as f: f.write('LLVM_ROOT = "' + path_from_root('tests', 'fake') + '"') real_version_x, real_version_y = ( int(x) for x in expected_llvm_version().split('.')) if shared.get_llvm_target() == shared.WASM_TARGET: make_fake_llc(path_from_root('tests', 'fake', 'llc'), 'wasm32 - WebAssembly 32-bit') make_fake_lld(path_from_root('tests', 'fake', 'wasm-ld')) else: make_fake_llc(path_from_root('tests', 'fake', 'llc'), 'js - JavaScript (asm.js, emscripten)') with env_modify({'EM_IGNORE_SANITY': '1'}): for inc_x in range(-2, 3): for inc_y in range(-2, 3): expected_x = real_version_x + inc_x expected_y = real_version_y + inc_y if expected_x < 0 or expected_y < 0: continue # must be a valid llvm version print("mod LLVM version: %d %d -> %d %d" % (real_version_x, real_version_x, expected_x, expected_y)) make_fake_clang(path_from_root('tests', 'fake', 'clang'), '%s.%s' % (expected_x, expected_y)) did_modify = inc_x != 0 or inc_y != 0 if did_modify: output = self.check_working(EMCC, LLVM_WARNING) else: output = self.check_working(EMCC) self.assertNotContained(LLVM_WARNING, output)