Skip to content

Commit

Permalink
Modify archive index tests to handle llvm change. NFC (emscripten-cor…
Browse files Browse the repository at this point in the history
…e#21114)

After llvm/llvm-project#78658 wasm-ld now
accepts libraries without indexes.
  • Loading branch information
sbc100 authored Jan 20, 2024
1 parent ac445cb commit 88fe106
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ def test_symlink_has_bad_suffix(self):
create_file('foobar.c', 'int main(){ return 0; }')
os.symlink('foobar.c', 'foobar.xxx')
err = self.expect_fail([EMCC, 'foobar.xxx', '-o', 'foobar.js'])
self.assertContained('unknown file type: foobar.xxx', err)
self.assertContained(['unknown file type: foobar.xxx', "archive member 'native.o' is neither Wasm object file nor LLVM bitcode"], err)

def test_multiply_defined_libsymbols(self):
create_file('libA.c', 'int mult() { return 1; }')
Expand Down Expand Up @@ -1466,7 +1466,7 @@ def test_dot_a_all_contents_invalid(self):
clang_native.get_clang_native_args())
self.run_process([EMAR, 'crs', 'libfoo.a', 'native.o'])
stderr = self.expect_fail([EMCC, 'main.c', 'libfoo.a'])
self.assertContained('unknown file type', stderr)
self.assertContained(['unknown file type', "libfoo.a: archive member 'native.o' is neither Wasm object file nor LLVM bitcode"], stderr)

def test_export_all(self):
lib = r'''
Expand Down Expand Up @@ -9133,12 +9133,8 @@ def test_archive_no_index(self):
self.run_process([EMCC, '-c', test_file('hello_world.c')])
# The `S` flag means don't add an archive index
self.run_process([EMAR, 'crS', 'libfoo.a', 'foo.o'])
# The llvm backend (link GNU ld and lld) doesn't support linking archives with no index.
# However we have logic that will automatically add indexes (unless running with
# NO_AUTO_ARCHIVE_INDEXES).
stderr = self.expect_fail([EMCC, '-sNO_AUTO_ARCHIVE_INDEXES', 'libfoo.a', 'hello_world.o'])
self.assertContained('libfoo.a: archive has no index; run ranlib to add one', stderr)
# The default behavior is to add archive indexes automatically.
# wasm-ld supports archive files without an index (unlike GNU ld) as of
# https://github.com/llvm/llvm-project/pull/78821
self.run_process([EMCC, 'libfoo.a', 'hello_world.o'])

def test_archive_non_objects(self):
Expand Down

0 comments on commit 88fe106

Please sign in to comment.