Skip to content

XNU as a loadable kernel module inside Linux (macOS personality for arm64 Linux)

C

Headless xcodebuild test: testmanagerd's per-user agent as a Background-session agent bootstrapped into root's user domain at boot (vm-sysdisk-launchd.sh); run xcodebuild test under 'launchctl asuser 0'. Alamofire: xcodebuild test passes 79 tests (sanitizers off: ThreadSanitizer needs a 47-bit user address space, the hosted pmaps give 39)

Heyang Zhouf878ae9cadfd
diff --git a/scripts/vm-sysdisk-launchd.sh b/scripts/vm-sysdisk-launchd.sh
index 765fed7..0bac18d 100755
--- a/scripts/vm-sysdisk-launchd.sh
+++ b/scripts/vm-sysdisk-launchd.sh
@@ -86,6 +86,29 @@ GP
</dict>
</plist>
PL
+ # xcodebuild test needs the per-user agent com.apple.testmanagerd, which macOS limits to Aqua/LoginWindow sessions;
+ # the headless system has none: a copy limited to Background sessions, bootstrapped into root's user domain at boot.
+ if [ -e /mnt/sys/System/Library/LaunchAgents/com.apple.testmanagerd.plist ]; then
+ sudo mkdir -p /mnt/sys/Library/LaunchAgents
+ sudo python3 - <<'PY'
+import plistlib
+s = "/mnt/sys/System/Library/LaunchAgents/com.apple.testmanagerd.plist"
+d = plistlib.load(open(s, "rb")); d["LimitLoadToSessionType"] = "Background"
+plistlib.dump(d, open("/mnt/sys/Library/LaunchAgents/com.apple.testmanagerd.plist", "wb"))
+PY
+ sudo tee /mnt/sys/System/Library/LaunchDaemons/xnulinux.userdomain.plist >/dev/null <<'PL'
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key><string>xnulinux.userdomain</string>
+ <key>ProgramArguments</key>
+ <array><string>/bin/launchctl</string><string>bootstrap</string><string>user/0</string><string>/Library/LaunchAgents/com.apple.testmanagerd.plist</string></array>
+ <key>RunAtLoad</key><true/>
+</dict>
+</plist>
+PL
+ fi
sudo tee /mnt/sys/System/Library/LaunchDaemons/xnulinux.shell.plist >/dev/null <<'PL'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">