Skip to content

Commit d8c27ee

Browse files
abueideclaude
andcommitted
fix(tests): skip ios-app-resolution on non-Darwin platforms
Add uname Darwin guard to skip the entire test suite on Linux CI, matching the pattern used by ios test-cache.sh. Reverts the cross-platform XML plist workaround in favor of using native PlistBuddy as intended. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7bc692c commit d8c27ee

1 file changed

Lines changed: 19 additions & 27 deletions

File tree

plugins/tests/ios/test-app-resolution.sh

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
33
#
44
# Tests for the ios_find_app() precedence chain in deploy.sh.
55
# These tests use temporary directories with fixture .app bundles.
6-
# Does NOT require Xcode (xcodebuild tests are skipped).
6+
# Requires macOS (uses PlistBuddy for plist creation/reading).
77

88
set -euo pipefail
99

1010
script_dir="$(cd "$(dirname "$0")" && pwd)"
1111
. "$script_dir/../test-framework.sh"
1212
setup_logging
1313

14+
# Only run on macOS
15+
if [ "$(uname -s)" != "Darwin" ]; then
16+
echo "Skipping iOS app resolution tests (not on macOS)"
17+
exit 0
18+
fi
19+
1420
# ============================================================================
1521
# Setup
1622
# ============================================================================
@@ -38,16 +44,7 @@ create_fake_app() {
3844
app_dir="$1"
3945
bundle_id="${2:-com.test.app}"
4046
mkdir -p "$app_dir"
41-
cat > "$app_dir/Info.plist" <<PLIST
42-
<?xml version="1.0" encoding="UTF-8"?>
43-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
44-
<plist version="1.0">
45-
<dict>
46-
<key>CFBundleIdentifier</key>
47-
<string>${bundle_id}</string>
48-
</dict>
49-
</plist>
50-
PLIST
47+
/usr/libexec/PlistBuddy -c "Add :CFBundleIdentifier string $bundle_id" "$app_dir/Info.plist" 2>/dev/null || true
5148
}
5249

5350
echo "========================================"
@@ -180,24 +177,19 @@ assert_contains "$error_output" "No .app bundle found" "Error should mention no
180177
assert_contains "$error_output" "IOS_APP_ARTIFACT" "Error should mention env var"
181178

182179
# ============================================================================
183-
# Tests: ios_extract_bundle_id (macOS only - uses PlistBuddy)
180+
# Tests: ios_extract_bundle_id
184181
# ============================================================================
185182

186-
if [ -x /usr/libexec/PlistBuddy ]; then
187-
start_test "ios_extract_bundle_id - extracts from Info.plist"
188-
test_root="$TMPDIR_BASE/test_bundle"
189-
create_fake_app "$test_root/MyApp.app" "com.example.myapp"
190-
result=$(ios_extract_bundle_id "$test_root/MyApp.app" 2>/dev/null)
191-
assert_equal "com.example.myapp" "$result" "Should extract correct bundle ID"
192-
193-
start_test "ios_extract_bundle_id - fails on missing Info.plist"
194-
test_root="$TMPDIR_BASE/test_bundle_missing"
195-
mkdir -p "$test_root/NoInfo.app"
196-
assert_failure "ios_extract_bundle_id '$test_root/NoInfo.app'" "Should fail without Info.plist"
197-
else
198-
echo ""
199-
echo "SKIP: ios_extract_bundle_id tests (PlistBuddy not available on this platform)"
200-
fi
183+
start_test "ios_extract_bundle_id - extracts from Info.plist"
184+
test_root="$TMPDIR_BASE/test_bundle"
185+
create_fake_app "$test_root/MyApp.app" "com.example.myapp"
186+
result=$(ios_extract_bundle_id "$test_root/MyApp.app" 2>/dev/null)
187+
assert_equal "com.example.myapp" "$result" "Should extract correct bundle ID"
188+
189+
start_test "ios_extract_bundle_id - fails on missing Info.plist"
190+
test_root="$TMPDIR_BASE/test_bundle_missing"
191+
mkdir -p "$test_root/NoInfo.app"
192+
assert_failure "ios_extract_bundle_id '$test_root/NoInfo.app'" "Should fail without Info.plist"
201193

202194
# ============================================================================
203195
# Tests: ios_resolve_app_glob

0 commit comments

Comments
 (0)