Skip to content

Commit 419578a

Browse files
committed
test(dist-apple): record the dependency's install name, and accept dyld's unnormalised rpath expansion
1 parent 9a87f5c commit 419578a

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tests/app-framework-consumer/check-apple-bundle.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ echo "== 1. the program's rpath =="
3737
rm -rf target
3838
"$MCPP" build > bundle-build.log 2>&1 || fail "mcpp build failed" bundle-build.log
3939
if find target -name '*.app' | grep -q .; then fail "a plain build produced a bundle"; fi
40-
programs=$(find target -type f -name "$EXE" ! -path '*/.build-mcpp/*')
40+
programs=$(find target -type f -name "$EXE" ! -path '*/.build-mcpp/*' ! -path '*.dSYM/*')
4141
[ "$(printf '%s\n' "$programs" | grep -c .)" = 1 ] \
4242
|| fail "expected one linked $EXE under target/, found: $(echo $programs)" bundle-build.log
4343
otool -l "$programs" > bundle-loadcommands.log
@@ -48,9 +48,11 @@ printf '%s\n' "$rpaths" | grep -qxF '@executable_path/../Frameworks' \
4848
if printf '%s\n' "$rpaths" | grep -q '.@executable_path'; then
4949
fail "an rpath carries @executable_path after a directory, anchored" bundle-loadcommands.log
5050
fi
51+
# The dependency's install name is the engine's choice and is recorded, not
52+
# asserted: criterion 3 is what shows the bundle loads the framework copy.
5153
otool -L "$programs" > bundle-needed.log
52-
grep -q "@rpath/$DYLIB" bundle-needed.log || fail "the program does not load @rpath/$DYLIB" bundle-needed.log
53-
echo "ok: LC_RPATH @executable_path/../Frameworks, as written, and the dependency is @rpath/$DYLIB"
54+
reading install-name "$(grep "$DYLIB" bundle-needed.log | sed 's/^[[:space:]]*//' | head -1)"
55+
echo "ok: LC_RPATH @executable_path/../Frameworks, as written"
5456

5557
# ── 2. the bundle ──────────────────────────────────────────────────────────
5658
echo "== 2. the bundle carries the framework and is signed ad hoc =="
@@ -91,7 +93,8 @@ reading bundle-run "exit=$rc $(cat bundle-run-out.log)"
9193
grep -qx 'framework-1-2-3 argc=1' bundle-run-out.log || fail "the bundled program's output is missing" bundle-run-out.log
9294
loaded=$(grep "$DYLIB" bundle-run-err.log | head -1)
9395
reading loaded "$loaded"
94-
case "$loaded" in *"/$NAME.app/Contents/Frameworks/$DYLIB") ;;
96+
# dyld may print the rpath expansion unnormalised (`Contents/MacOS/../Frameworks`).
97+
case "$loaded" in *"/$NAME.app/Contents/Frameworks/$DYLIB" | *"/$NAME.app/Contents/MacOS/../Frameworks/$DYLIB") ;;
9598
*) fail "the program did not load the framework copy" bundle-run-err.log ;; esac
9699
cp -R "$app" "$work/"
97100
rm "$work/$NAME.app/Contents/Frameworks/$DYLIB"

0 commit comments

Comments
 (0)