Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Metal-produced universal binaries #38

Merged
merged 13 commits into from
Apr 7, 2023
Prev Previous commit
Next Next commit
Add Metal tests.
maleadt committed Apr 7, 2023
commit 2d4bdbcc163b31b35e35be12d1b836b7a6fda80e
Binary file added test/macmetal/dummy
Binary file not shown.
14 changes: 14 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -169,13 +169,27 @@ function test_fat_libfoo(file)
@test n64 == 1
end

function test_metal(file)
oh = readmeta(open(file, "r"))
@test isa(oh, FatMachOHandle)
@test length(oh) == 2

arch = oh[1]
@test arch.header isa MachO.MachOHeader64
@test findfirst(Sections(arch), "__TEXT,__compute") !== nothing

arch = oh[2]
@test arch.header isa MachO.MetallibHeader
end

# Run ELF tests
test_libfoo_and_fooifier("./linux32/fooifier", "./linux32/libfoo.so")
test_libfoo_and_fooifier("./linux64/fooifier", "./linux64/libfoo.so")

# Run MachO tests
test_libfoo_and_fooifier("./mac64/fooifier", "./mac64/libfoo.dylib")
test_fat_libfoo("./mac64/libfoo_fat.dylib")
test_metal("./macmetal/dummy")

# Run COFF tests
test_libfoo_and_fooifier("./win32/fooifier.exe", "./win32/libfoo.dll")