846
846
@testset " OS/ABI: $platform " for platform in [Platform (" x86_64" , " freebsd" ),
847
847
Platform (" aarch64" , " freebsd" )]
848
848
mktempdir () do build_path
849
- build_output_meta = @test_logs (:warn , r" libwrong.so has an ELF header OS/ABI value that is not set to FreeBSD " ) match_mode= :any begin
849
+ build_output_meta = @test_logs (:warn , r" Skipping binary analysis of lib/lib(nonote|badosabi) \. so \( incorrect platform \) " ) match_mode= :any begin
850
850
autobuild (
851
851
build_path,
852
852
" OSABI" ,
@@ -858,16 +858,20 @@ end
858
858
apk update
859
859
apk add binutils
860
860
mkdir -p "${libdir}"
861
- echo 'int wrong() { return 0; }' | cc -shared -fPIC -o "${libdir}/libwrong.${dlext}" -x c -
862
- echo 'int right() { return 0; }' | cc -shared -fPIC -o "${libdir}/libright.${dlext}" -x c -
861
+ cd "${libdir}"
862
+ echo 'int wrong() { return 0; }' | cc -shared -fPIC -o "libwrong.${dlext}" -x c -
863
+ echo 'int right() { return 0; }' | cc -shared -fPIC -o "libright.${dlext}" -x c -
864
+ cp "libwrong.${dlext}" "libnonote.${dlext}"
865
+ strip --remove-section=.note.tag "libnonote.${dlext}"
866
+ mv "libwrong.${dlext}" "libbadosabi.${dlext}"
863
867
# NetBSD runs anywhere, which implies that anything that runs is for NetBSD, right?
864
- elfedit --output-osabi=NetBSD "${libdir}/libwrong.${dlext}"
865
- strip --remove-section=.note.tag "${libdir}/libwrong.${dlext}"
868
+ elfedit --output-osabi=NetBSD "libbadosabi.${dlext}"
866
869
""" ,
867
870
[platform],
868
871
# Ensure our library product is built
869
872
[
870
- LibraryProduct (" libwrong" , :libwrong ),
873
+ LibraryProduct (" libbadosabi" , :libbadosabi ),
874
+ LibraryProduct (" libnonote" , :libnonote ),
871
875
LibraryProduct (" libright" , :libright ),
872
876
],
873
877
# No dependencies
@@ -891,13 +895,24 @@ end
891
895
@test is_for_platform (oh, platform)
892
896
@test check_os_abi (oh, platform)
893
897
end
894
- readmeta (joinpath (testdir, " lib" , " libwrong.so" )) do ohs
898
+ readmeta (joinpath (testdir, " lib" , " libnonote.so" )) do ohs
899
+ oh = only (ohs)
900
+ @test ! is_for_platform (oh, platform)
901
+ @test ! check_os_abi (oh, platform)
902
+ @test_logs ((:warn , r" libnonote.so does not have a FreeBSD-branded ELF note" ),
903
+ match_mode= :any , check_os_abi (oh, platform; verbose= true ))
904
+ end
905
+ readmeta (joinpath (testdir, " lib" , " libbadosabi.so" )) do ohs
895
906
oh = only (ohs)
896
907
@test ! is_for_platform (oh, platform)
897
908
@test ! check_os_abi (oh, platform)
909
+ @test_logs ((:warn , r" libbadosabi.so has an ELF header OS/ABI value that is not set to FreeBSD" ),
910
+ match_mode= :any , check_os_abi (oh, platform; verbose= true ))
898
911
end
899
912
# Only audit the library we didn't mess with in the recipe
900
- rm (joinpath (testdir, " lib" , " libwrong.so" ))
913
+ for bad in (" nonote" , " badosabi" )
914
+ rm (joinpath (testdir, " lib" , " lib$bad .so" ))
915
+ end
901
916
@test Auditor. audit (Prefix (testdir); platform= platform, require_license= false )
902
917
end
903
918
end
0 commit comments