XNU as a loadable kernel module inside Linux (macOS personality for arm64 Linux)
C
Remove the HFS+ route and one-off probes; README for the current system
Heyang Zhoube57c783f100
diff --git a/README.md b/README.mdindex bd0fbae..89cccbd 100644--- a/README.md+++ b/README.md@@ -10,26 +10,43 @@ The two sides are kept apart by license and only meet at the FKI (foreign kernel|---|---|---|| `linux/` | GPL-2.0 | In-tree FKI patch for Linux (`drivers/fki`, `include/linux/fki.h`) || `fki-ko/` | GPL-2.0 | The same FKI v0 as an out-of-tree module, for stock distro kernels |-| `xnu-ko/` | APSL-2.0 side | `xnu.ko`: loads the XNU Mach-O and calls into it; uses only FKI |-| `scripts/` | | Build and run scripts |+| `xnu-ko/` | APSL-2.0 side | `xnu.ko`: loads the XNU kernel collection and calls into it; uses only FKI |+| `xnu-patches/` | APSL-2.0 | The LINUX64 machine layer and hosted-kernel changes, applied to XNU's sources |+| `kexts/` | BSD-2-Clause | Our kexts in the kernel collection: disk, display, input, Ethernet, keystore stand-ins, Metal accelerator, DRM bridge |+| `gpu/` | per directory | Metal plugin (`xnu-cpu-metal`), the DRM bridge's user-space ends (`xnu-drm`), Mesa Venus patches (`venus`) |+| `scripts/`, `tools/` | | Build, disk, boot and test tools |`xnu.ko` must not include Linux headers beyond the module ABI, call Linux functions other than `fki_*`, or carry Linux code.--## Status--- **M1 (done, 2026-11-20).** A source-built XNU (`xnu-12377.121.6` plus the macOS-DroidVM patch series, arm64e) is loaded by `xnu.ko` into a stock Ubuntu 24.04 kernel (`7.0.0-43-generic`, 4K pages, PAC). It is slid and PAC-signed with XNU's own kernel keys, and XNU code runs inside Linux. XNU's `strlen` and `crc32` results match a reference computation.-- **M2a (done, 2026-11-20).** `arm_init` runs inside the module from `xnu.ko`'s boot args and ADT up to `arm_vm_init` (stage 199), with XNU's `kprintf` in dmesg. Next is M2b: a LINUX64 `arm_vm_init` and pmap on FKI.-- **M2b (done, 2026-11-20).** XNU runs at its own link address on physically contiguous memory with real PAs. `arm_vm_init` builds its kernel page tables, `xnu.ko` installs XNU's 48 kernel L1 entries into Linux's top-level L1 (the free `L1[384..495]` of `L0[511]`), and the hardware walks XNU's own tables. `pmap_bootstrap` runs, and XNU prints `kprintf initialized` to dmesg. Then (M2c, 2026-11-20) `machine_startup` → `kernel_bootstrap` runs to the end: zalloc/kalloc, scheduler, Mach IPC, tasks and threads; `load_context` switches to `kernel_bootstrap_thread`, which creates the idle thread, starts the scheduler, thread calls, clock service, kdp and sysctl, and reaches `PE_init_iokit`. Next: IOKit (`PE_init_iokit`), then timers/IPIs on FKI and real kthreads.-- **M2c (done, 2026-11-20).** The bare kernel runs `kernel_bootstrap_thread` through IOKit to `bsd_init` (VFS, mbufs, MAC, audit, aio), with a cooperative timer (XNU idles into the host, which delivers its timer), a virtual interrupt flag (hardware IRQs stay masked on XNU stacks), host-reported `assert`s and panics, and stand-ins for what the kexts would register.-- **M2e (done, 2026-11-20).** `xnu.ko` loads a fileset kernel collection: our kernel plus 53 of Apple's macOS 27.2 kexts (vma2 kernelcache, linked with macOS-DroidVM's `kc-build27.py`; Apple's binaries stay local). XNU applies the collection's chained fixups and signs it itself. Kernel page faults on XNU addresses are forwarded by FKI (`fki_fault_register`) to XNU's `vm_fault`; a fault nothing resolves ends the run cleanly instead of taking the host down. Apple's corecrypto (FIPS POST passes), AppleImage4, AMFI and Sandbox initialize; the ADT carries the `/chosen` a bootloader would pass (boot manifest hash, AP identity, NVRAM, SIP) and `/options`. `bsd_init` runs through networking and Skywalk to `IOFindBSDRoot`, waiting for a root device. Next: a root device (an FKI block endpoint or a RAM disk), NativeAES and AKS for AppleImage4 and AMFI, then `launchd` (M3).-- **M3 (in progress, 2026-11-20).** User space runs under the hosted XNU. EL0 entry and exit go through a LINUX64 path (`linux64_el0_run`, `linux64_el0_vectors`, `linux64_el0_exception` into XNU's own `sleh_synchronous`) that keeps Linux's x18 (shadow call stack), the user's NEON/FP state and XNU's ASIDs (TCR.A1 off in XNU's world); upcalls keep the user TLS registers Linux's scheduler would clobber, and unresolved faults inside copyin/copyout take XNU's copyio recovery. The root can be a host file (`hostdisk=`: FKI `fki_file_open/rw`, XNU `memdev` in host mode). Done so far: static test binaries (`tools/init`) through `open`/`write` on `/dev/console`, `fork`, `execve`, `wait4`, signals; then Apple's own `/bin/echo` from macOS, dynamically linked: dyld maps the 7 GB dyld shared cache system wide from an HFS+ image on the Linux host and echo prints through libSystem (Apple's binaries stay local, never in this repo). Then Apple's `/bin/sh` (bash: builtins, fork/exec of `uname` and `ls`), and macOS's own `launchd` as PID 1: libignition, the boot tasks, LaunchDaemons import and xpcproxy spawns. What launchd needs from hardware that is not there is stood in for inside the hosted XNU: AppleKeyStore's `AKSKernelServices` table (the three entries AMFI calls, PAC-signed with their type discriminators), the SEP `scrd` endpoint, an `IOAESAccelerator` whose AES entry copies (AppleImage4's nonce store). FKI moves Linux-running upcalls (idle, host file I/O) to a Linux-shaped stack and catches the foreign kernel's non-abort exceptions (die()), so XNU problems end the run instead of the host. EL0 tracing: boot-arg `linux64_trace=1` (system calls with the pid, paths of open/stat/exec/posix_spawn).- Later on 2026-11-20: launchd runs our job files (`xnulinux.hello`: sh, uname, ls, exit 0) and an interactive `bash -i` on `/dev/console`, whose input is typed from the host (`console_in=`, `scripts/xnu-console.sh`); the root mounts read-write (checked with `fsck.hfsplus` before each boot). Apple's core daemons run with it: notifyd (needs the sandbox profiles), logd (needs a writable root), syslogd, configd, opendirectoryd (needs a local node: a generated `dslocal` with root, daemon, wheel). Open: user lookups (`id`) wait on opendirectoryd, which keeps serving Mach messages; `sw_vers` needs `SystemVersion.plist`.--Debugging: the VM console is captured on the host (`scripts/serial-pty.py`), a monitor thread on another CPU prints XNU's counters every 2 s, and XNU dumps its threads with their saved frames after 20000 idle rounds.--## Running M1--The host is an arm64 Linux with PAC (for example an Apple Silicon VM under Virtualization.framework).--1. `scripts/vm-xnu-build.sh` builds the kernel with the macOS-DroidVM Linux toolchain, natively on arm64 and without Darling.-2. `scripts/vm-m1.sh` builds both modules against the running kernel, installs the image as firmware `xnu/kernel.macho`, and loads them.+Upstream code (Mesa, metal2vulkan, the Vulkan loader, Apple's open source) is fetched at pinned revisions and patched at+build time; it is never committed.++## Status (2026-11-22)++- A stock Ubuntu kernel (`7.0.0-43-generic`, 4K pages, PAC) loads `xnu.ko`, which boots a source-built XNU+ (`xnu-12377.121.6` with the LINUX64 machine layer) inside it, with a kernel collection of our kernel and Apple's macOS+ 27.2 kexts. XNU uses the host CPU and MMU directly; Linux gives it memory (CMA), timers, files, a network link and a+ message channel through FKI.+- The system disk is one Apple's own installer made (APFS, sealed system volume, Preboot, Data; `scripts/mk-macvm-disk.sh`)+ with a simulated SEP (AppleVPKeyStore over `kexts/XnuEAN`). macOS 27.2.1 boots to the desktop with auto-login: Dock,+ Finder, Safari and Chrome load web pages.+- Rendering: `gpu/xnu-cpu-metal` is a Metal device (metal2vulkan) over Mesa lavapipe on the CPU. The DRM bridge+ (`fki-ko/fki_hostcall.c`, `kexts/XnuDrm`, `gpu/xnu-drm`) gives hosted processes the Linux host's GPU through Mesa Venus:+ on an Apple Silicon host the Linux VM runs under krunkit (`scripts/krun-vm.sh`) and Vulkan in the hosted macOS runs on the+ host's GPU (`Virtio-GPU Venus (Apple M5 Max)`). Moving the Metal plugin onto it is in progress.+- From PoC to production: [`docs/production.md`](docs/production.md).++## Running++The host is an arm64 Linux VM with PAC on an Apple Silicon Mac (`scripts/krun-vm.sh`; tart works without the GPU), with+`cma=10G@0x100000000-0x600000000` on its kernel command line.++1. `scripts/vm-xnu-build.sh` (once) sets up the macOS-DroidVM Linux toolchain and builds XNU natively on arm64.+2. `scripts/vm-xnu-rebuild.sh` applies `xnu-patches/`, rebuilds the kernel, builds `kexts/` and links the kernel collection.+3. `scripts/mk-macvm-disk.sh` (on the Mac) makes the system disk with Apple's installer and puts it in the VM.+4. `scripts/vm-m2-kbisect.sh` builds `fki.ko` and `xnu.ko` and boots the hosted system; its console is+ `scripts/xnu-console.sh`, its screen `tools/hosted/fb2png.py`.+5. For the GPU: `gpu/xnu-drm/xnudrmd` runs as root once `/dev/xnu-hostcall` is there; `gpu/venus/build-darwin.sh` builds+ the hosted Vulkan driver.++Debugging: the VM console is captured on the host (`scripts/serial-pty.py`), a monitor thread on another CPU prints XNU's+counters every 2 s, and XNU dumps its threads with their saved frames after 20000 idle rounds.diff --git a/docs/production.md b/docs/production.mdindex f1e35a9..c251a8d 100644--- a/docs/production.md+++ b/docs/production.md@@ -33,8 +33,8 @@ What the PoC did to get each step running, and what replaces it. Ordered by what| Now | Replace with ||---|---|| ~30 scripts; the boot itself runs from `vm-m2-kbisect.sh` (`mode=3 stop=899 kmax=…`, a bisecting tool's knobs); several have session paths (`/Users/admin/...`), tty names, fixed `sleep`s | One driver (`xnulinux` CLI): `build`, `disk`, `boot`, `console`, `screenshot`, `test`; configuration in one file |-| HFS+ route scripts (`mk-fulldisk.sh`, `vm-sysdisk-*`, `vm-mk-sysdisk.sh`, `vm-m2-*`, `run-poc.sh`) | Removed (APFS route only) |-| `tools/hosted/tests/t*.sh`, `af*.sh`: one-off probes | A test suite with expected results: boot to desktop, Safari/Chrome page load (screenshot compare), `xcodebuild` of a pinned project, Metal unit tests |+| HFS+ route scripts (`mk-fulldisk.sh`, `vm-sysdisk-*`, `vm-mk-sysdisk.sh`, `vm-m2-*`, `run-poc.sh`) | Removed (done: APFS route only) |+| `tools/hosted/tests/t*.sh`, `af*.sh`: one-off probes (removed) | A test suite with expected results: boot to desktop, Safari/Chrome page load (screenshot compare), `xcodebuild` of a pinned project, Metal unit tests || No CI | CI: fki.ko/xnu.ko build against a pinned kernel, XNU + collection build (x86_64 Linux works with the DroidVM toolchain), GPU plugin host tests on macOS |## 5. GPUdiff --git a/gpu/xnu-cpu-metal/README.md b/gpu/xnu-cpu-metal/README.mdindex bad56c5..5ccea1c 100644--- a/gpu/xnu-cpu-metal/README.md+++ b/gpu/xnu-cpu-metal/README.md@@ -19,7 +19,7 @@ build-time renderers (`ictool`/Icon Composer, `actool`, CoreImage).scripts/build-m2v.sh && scripts/build-m2v-arm64e.shscripts/build-vkloader-arm64e.shscripts/build-bundle-universal.sh # -> dist/XnuCpuMetal.bundle-Install: `scripts/vm-gpu-prep.sh` (repo root) puts the bundle on the system disk; the hosted kernel needs the boot-arg `lp-sip0=2`.+Install: `scripts/mk-macvm-disk.sh` (repo root) puts the bundle on the system disk; the hosted kernel needs the boot-arg `lp-sip0=2`.## Hosted-system findings (what Metal requires of a plugin, beyond the host tests)- The accelerator service must not carry `Removable` / `SafeEjectRequested` at all (Metal skips a service on which either exists).diff --git a/kexts/XnuDisk/XnuDisk.cpp b/kexts/XnuDisk/XnuDisk.cppindex 6906239..9c437ef 100644--- a/kexts/XnuDisk/XnuDisk.cpp+++ b/kexts/XnuDisk/XnuDisk.cpp@@ -1,7 +1,7 @@// XnuDisk: the hosted macOS's internal disk, a block storage device whose blocks are a file on the Linux side.//// The file is a whole disk as macOS makes one: a GUID partition table and an APFS container (System and Data volumes),-// built on a macOS host with Apple's own tools (scripts/mk-apfs-disk.sh). IOStorageFamily's IOBlockStorageDriver takes+// built on a macOS host with Apple's own tools (scripts/mk-macvm-disk.sh). IOStorageFamily's IOBlockStorageDriver takes// this device, publishes its media, the GUID partition scheme finds the container partition and APFS mounts its volumes,// as on a Mac's internal SSD. I/O goes through the host: xnu.ko disk=, upcalls 820 (I/O) and 821 (size) in// bsd/net/if_linux64.c, done synchronously through a bounce buffer (the host reads and writes the file in Linux context).diff --git a/scripts/mk-apfs-disk.sh b/scripts/mk-apfs-disk.shdeleted file mode 100755index 88257c7..0000000--- a/scripts/mk-apfs-disk.sh+++ /dev/null@@ -1,36 +0,0 @@-#!/bin/bash-# On the macOS host (tokyo): the hosted system's APFS disk, /var/tmp/apfs.img in the xnupoc VM (xnu.ko disk=, kexts/XnuDisk).-# A whole disk as macOS makes one, made with Apple's own tools on this host: a GUID partition table and an APFS container-# with the system volume, filled with the golden full disk's tree (/var/tmp/full.img in the VM, HFS+, made by-# mk-fulldisk.sh, vm-gui-prep.sh and friends). Linux has no APFS writer; the hosted XNU's own apfs.kext mounts it.-# The image is sparse: built in a host file, then sent to the VM keeping its holes. Apple's files stay on this host and in-# that VM (never in the repo).-set -euo pipefail-cd "$(dirname "$0")/.."-V="bash scripts/vm.sh"-SIZE=${SIZE:-96g}; W=${W:-$PWD/../apfs-build}; IMG=$W/apfs.img; NAME=${VOLNAME:-xnulinux}-mkdir -p "$W"; rm -f "$IMG"; mkfile -n "$SIZE" "$IMG"-DEV=$(hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount "$IMG" | awk 'NR==1{print $1}')-cleanup() { sudo -n umount "$W/mnt" 2>/dev/null || true; hdiutil detach "$DEV" -force >/dev/null 2>&1 || true; }-trap cleanup EXIT-echo "image on $DEV"-diskutil partitionDisk "$DEV" GPT APFS "$NAME" 100% >/dev/null-diskutil list "$DEV"-VOL=$(diskutil list | awk -v n="$NAME" '$0 ~ "APFS Volume" && $0 ~ n {print $NF}' | tail -1)-CONTAINER=$(diskutil info "$VOL" | awk -F': *' '/APFS Container:/{print $2}')-echo "volume $VOL in container $CONTAINER"-diskutil unmount "$VOL" >/dev/null-mkdir -p "$W/mnt"; diskutil mount -mountPoint "$W/mnt" "$VOL" >/dev/null-sudo -n diskutil enableOwnership "$W/mnt" >/dev/null-t0=$(date +%s)-# the golden tree as the VM's Linux sees it (owners, modes, links; mk-fulldisk.sh wrote it without Mac metadata)-$V "set -e; sudo dmsetup remove xnusys 2>/dev/null || true; for l in \$(losetup -j /var/tmp/full.img -O NAME -n); do sudo losetup -d \$l; done- sudo mkdir -p /mnt/fullro; sudo mount -o loop,ro -t hfsplus /var/tmp/full.img /mnt/fullro- sudo tar -C /mnt/fullro --numeric-owner -cf - . ; sudo umount /mnt/fullro" \- | sudo -n tar -C "$W/mnt" --numeric-owner -xpf - 2> "$W/tar.err" || echo "tar ended nonzero ($(wc -l < "$W/tar.err") lines in $W/tar.err)"-echo "copied in $(( $(date +%s) - t0 ))s"; tail -3 "$W/tar.err" || true-df -h "$W/mnt" | tail -1; ls "$W/mnt" | tr '\n' ' '; echo-sudo -n umount "$W/mnt"; hdiutil detach "$DEV" >/dev/null; trap - EXIT-t0=$(date +%s)-tar -C "$W" -cSf - apfs.img | $V "rm -f /var/tmp/apfs.img; tar -C /var/tmp -xSf -; ls -ls /var/tmp/apfs.img"-echo "sent in $(( $(date +%s) - t0 ))s"diff --git a/scripts/mk-fulldisk.sh b/scripts/mk-fulldisk.shdeleted file mode 100644index 69c1561..0000000--- a/scripts/mk-fulldisk.sh+++ /dev/null@@ -1,45 +0,0 @@-#!/bin/bash-# On the macOS host (tokyo): build the full (non-GUI) userland system disk in the xnupoc VM, /var/tmp/full.img.-# The macOS system files and Xcode are streamed from this host straight into the VM's mounted HFS+ image; they stay-# on this host and that VM only (never in the repo). No host user data: no /Users, no /private/var (a pristine-# /private/var comes from Apple's data-volume template), no keychains, no host SSH keys, no host preferences.-set -euo pipefail-cd "$(dirname "$0")/.."-SIZE=${SIZE:-80G}-XCODE=${XCODE:-/Applications/Xcode_27.app}-V="bash scripts/vm.sh"--$V "set -e; sudo umount /mnt/full 2>/dev/null || true; rm -f /var/tmp/full.img; truncate -s $SIZE /var/tmp/full.img- mkfs.hfsplus -J -v xnulinux-full /var/tmp/full.img >/dev/null; sudo mkdir -p /mnt/full- sudo mount -o loop,rw,force -t hfsplus /var/tmp/full.img /mnt/full; df -h /mnt/full | tail -1"--# bsdtar --exclude patterns are not anchored ("Library/Preferences" also drops System/Library/Preferences), so the-# top-level choices are made by listing what goes in; the exclusions left are unique paths.-EXCL=(- --exclude 'System/Library/AssetsV2' --exclude 'System/Library/Desktop Pictures' --exclude 'System/Library/Caches/com.apple.*'- --exclude 'Library/Application Support/com.apple.TCC'- --exclude 'private/etc/ssh/ssh_host_*' --exclude 'private/etc/master.passwd' --exclude 'private/etc/kcpassword'- --exclude 'xcuserdata' --exclude '.Spotlight-V100' --exclude '.fseventsd'-)-pick() { # the entries of directory $1 except the names given after it- local d=$1; shift- for e in "/$d"/*; do- n=${e##*/}; skip=0- for x in "$@"; do [ "$n" = "$x" ] && skip=1; done- [ $skip = 1 ] || echo "$d/$n"- done-}-SRC=(System/Library bin sbin private/etc System/Volumes/Preboot/Cryptexes/OS "${XCODE#/}")-while IFS= read -r l; do SRC+=("$l"); done < <(- pick usr local- pick Library Caches Logs Keychains Preferences 'Managed Preferences' LaunchDaemons LaunchAgents PrivilegedHelperTools Developer Bluetooth Tailscale- pick Library/Developer CoreSimulator DeveloperDiskImages CommandLineTools)-t0=$(date +%s)-cd /-sudo -n tar -c -f - --no-mac-metadata --no-xattrs --no-acls "${EXCL[@]}" \- -s ",^${XCODE#/},Applications/Xcode.app," "${SRC[@]}" 2> /tmp/mk-fulldisk-tar.err \- | bash ~-/scripts/vm.sh "sudo tar -x -p -f - -C /mnt/full --warning=no-unknown-keyword 2>&1 | tail -5" \- || echo "host tar ended nonzero (SIP-protected entries such as Library/Bluetooth cannot be read; they are not needed)"-cd ~--echo "streamed in $(( $(date +%s) - t0 ))s; host tar warnings: $(wc -l < /tmp/mk-fulldisk-tar.err)"; tail -5 /tmp/mk-fulldisk-tar.err-$V "df -h /mnt/full | tail -1; ls /mnt/full /mnt/full/Applications; sudo umount /mnt/full"diff --git a/scripts/mk-gui-extras.sh b/scripts/mk-gui-extras.shdeleted file mode 100755index ca33ccf..0000000--- a/scripts/mk-gui-extras.sh+++ /dev/null@@ -1,30 +0,0 @@-#!/bin/bash-# On the macOS host (tokyo), with no hosted XNU running from the disk: add what a graphical session needs to the golden-# full disk (/var/tmp/full.img in the xnupoc VM) that scripts/mk-fulldisk.sh leaves out. Apple's files stream from this-# host into the VM's image and stay there (never in the repo).-# - the App cryptex (Safari and its helpers: /System/Volumes/Preboot/Cryptexes/App)-# - /System/Applications (Finder's and the Dock's apps: System Settings, Terminal, Preview, ...)-# - /System/Cryptexes/{OS,App}: the links a real Mac has to the cryptexes in Preboot. dyld finds the OS cryptex's own-# dylibs (/System/Cryptexes/OS/usr/lib, e.g. libLaunchServicesSupport.dylib, which loginwindow and the Dock link)-# only through this graft point; without it loginwindow stops at launch ("Library not loaded").-# - /Applications/Safari.app, the link into the App cryptex-set -euo pipefail-cd "$(dirname "$0")/.."-V="bash scripts/vm.sh"-IMG=/var/tmp/full.img-$V "set -e; sudo dmsetup remove xnusys 2>/dev/null || true; for l in \$(losetup -j $IMG -O NAME -n); do sudo losetup -d \$l; done- sudo fsck.hfsplus -fy $IMG 2>&1 | tail -1; sudo mkdir -p /mnt/full; sudo mount -o loop,rw,force -t hfsplus $IMG /mnt/full"-t0=$(date +%s)-cd /-sudo -n tar -c -f - --no-mac-metadata --no-xattrs --no-acls System/Volumes/Preboot/Cryptexes/App System/Applications 2> /tmp/mk-gui-extras.err \- | bash ~-/scripts/vm.sh "sudo tar -x -p -f - -C /mnt/full --warning=no-unknown-keyword 2>&1 | tail -5" \- || echo "host tar ended nonzero (see /tmp/mk-gui-extras.err)"-cd ~--echo "streamed in $(( $(date +%s) - t0 ))s; host tar warnings: $(wc -l < /tmp/mk-gui-extras.err)"-LINKS="OS App" # not Rosetta: the hosted system has no x86_64 support and presents itself as a Mac without Rosetta-$V "set -e; sudo mkdir -p /mnt/full/System/Cryptexes /mnt/full/Applications- for c in $LINKS; do [ -e /mnt/full/System/Cryptexes/\$c ] || sudo ln -s ../../System/Volumes/Preboot/Cryptexes/\$c /mnt/full/System/Cryptexes/\$c; done- [ -e /mnt/full/Applications/Safari.app ] || sudo ln -s ../System/Cryptexes/App/System/Applications/Safari.app /mnt/full/Applications/Safari.app- ls -la /mnt/full/System/Cryptexes | tail -n +2; ls /mnt/full/System/Cryptexes/OS/usr/lib | head -3; ls -d /mnt/full/Applications/Safari.app/Contents/MacOS/Safari- echo \"\$(ls /mnt/full/System/Applications | wc -l) apps in /System/Applications\"; df -h /mnt/full | tail -1- sudo umount /mnt/full; sudo fsck.hfsplus -fy $IMG 2>&1 | tail -1; sync"diff --git a/scripts/run-poc.sh b/scripts/run-poc.shdeleted file mode 100755index 45c4abb..0000000--- a/scripts/run-poc.sh+++ /dev/null@@ -1,27 +0,0 @@-#!/bin/bash-# Build xnu.ko against the host kernel, pack an initramfs (busybox + xnu.ko + the XNU image), boot it in QEMU TCG.-set -euo pipefail-P=$(cd "$(dirname "$0")/.." && pwd); W=${W:-/data/station/remote/sessions/bb931bdb925f109d18e36b92ae3422802e35c0a46561ce911a41789790c989b6/work}-O=$W/out/linux; R=$W/out/initrd; KIMG=${KIMG:-$W/dvm/out/k27/kernel-k27.macho}-make -s -C $W/src/linux ARCH=arm64 LLVM=-19 O=$O M=$P/xnu-ko modules-if [ ! -x $W/out/busybox ]; then- sudo dpkg --add-architecture arm64; sudo apt-get update -qq- (cd $W/out && apt-get download busybox-static:arm64 && dpkg-deb -x busybox-static_*_arm64.deb bb && cp bb/usr/bin/busybox busybox)-fi-rm -rf $R; mkdir -p $R/{bin,proc,sys,dev,lib/firmware/xnu,tmp}-cp $W/out/busybox $R/bin/busybox; for a in sh mount insmod rmmod dmesg cat poweroff sleep uname lsmod; do ln -s busybox $R/bin/$a; done-cp $P/xnu-ko/xnu.ko $R/xnu.ko-cp $KIMG $R/lib/firmware/xnu/kernel.macho-cat > $R/init <<'EOI'-#!/bin/sh-mount -t proc proc /proc; mount -t sysfs sys /sys; mount -t devtmpfs dev /dev-echo "=== host: $(uname -a)"; echo "=== page size: $(getconf PAGESIZE 2>/dev/null || echo ?)"-grep -m1 Features /proc/cpuinfo-echo "=== insmod xnu.ko"; insmod /xnu.ko; echo "insmod rc=$?"-lsmod-echo "=== done"; poweroff -f-EOI-chmod +x $R/init-(cd $R && find . | cpio -o -H newc 2>/dev/null | gzip -1) > $W/out/initrd.gz-timeout ${QTIMEOUT:-900} qemu-system-aarch64 -M virt -cpu max,pauth-impdef=on -smp 2 -m 4G -nographic -no-reboot \- -kernel $O/arch/arm64/boot/Image -initrd $W/out/initrd.gz -append "console=ttyAMA0 rdinit=/init panic=-1 cma=256M" | tee $W/out/poc-boot.logdiff --git a/scripts/vm-gpu-prep.sh b/scripts/vm-gpu-prep.shdeleted file mode 100644index 1ed45ce..0000000--- a/scripts/vm-gpu-prep.sh+++ /dev/null@@ -1,20 +0,0 @@-#!/bin/bash-# in the VM: Metal plugin bundle onto the golden system disk, kernel collection with XnuCpuMetal + IOGraphicsFamily-set -e -o pipefail-IMG=/var/tmp/full.img-sudo dmsetup remove xnusys 2>/dev/null || true; for l in $(losetup -j $IMG -O NAME -n); do sudo losetup -d $l; done-sudo fsck.hfsplus -fy $IMG 2>&1 | tail -1-sudo mkdir -p /mnt/sys; sudo mount -o loop,rw,force -t hfsplus $IMG /mnt/sys-sudo mkdir -p /mnt/sys/Library/GPUBundles-sudo rm -rf /mnt/sys/Library/GPUBundles/XnuCpuMetal.bundle-sudo tar -C /mnt/sys/Library/GPUBundles --no-same-owner -xzf /var/tmp/XnuCpuMetal.bundle.tgz-sudo chown -R 0:0 /mnt/sys/Library/GPUBundles-# lavapipe's ICD manifest where the Vulkan loader looks in every process: it ignores VK_ICD_FILENAMES (the plugin's own-# pointer to the bundle's manifest) in processes like WindowServer ("Found no drivers!"), and searches only system-# directories such as /usr/local/share/vulkan/icd.d-sudo mkdir -p /mnt/sys/usr/local/share/vulkan/icd.d-printf '{"file_format_version":"1.0.1","ICD":{"library_path":"/Library/GPUBundles/XnuCpuMetal.bundle/Contents/Frameworks/libvulkan_lvp.dylib","api_version":"1.4.363"}}\n' | sudo tee /mnt/sys/usr/local/share/vulkan/icd.d/xnu_lvp_icd.aarch64.json >/dev/null-sudo du -sh /mnt/sys/Library/GPUBundles/XnuCpuMetal.bundle-df -h /mnt/sys | tail -1-sudo umount /mnt/sys; sudo fsck.hfsplus -fy $IMG | tail -1-[ -n "${SKIP_REBUILD:-}" ] || bash ~/w/poc/scripts/vm-xnu-rebuild.sh 2>&1 | tail -25diff --git a/scripts/vm-gui-prep.sh b/scripts/vm-gui-prep.shdeleted file mode 100644index 441325f..0000000--- a/scripts/vm-gui-prep.sh+++ /dev/null@@ -1,22 +0,0 @@-#!/bin/bash-# In the VM: make the golden full disk boot into a graphical session.-# - loginwindow back in /System/Library/LaunchDaemons (earlier disks parked it). logind starts it when it opens the console-# session at boot; with loginwindow absent then, logind's SOStartSessionWithOptions dies (_xpc_api_misuse) and no-# later restart of logind or WindowServer opens the session again.-# - one local administrator made here (never copied from the host): name GUI_USER (xnu), password GUI_PASSWORD (xnulinux),-# uid 501, home from the system's own user template, member of admin and staff-# - automatic login as that user (loginwindow's autoLoginUser plus /etc/kcpassword), and Setup Assistant marked done-# for the system (.AppleSetupDone) and for the user, so the session goes straight to the desktop-set -e -o pipefail-cd "$(dirname "$0")/.."-IMG=${IMG:-/var/tmp/full.img}-USERNAME=${GUI_USER:-xnu}; PASSWORD=${GUI_PASSWORD:-xnulinux}; UID_=${GUI_UID:-501}-sudo dmsetup remove xnusys 2>/dev/null || true; for l in $(losetup -j $IMG -O NAME -n); do sudo losetup -d $l; done-sudo fsck.hfsplus -fy $IMG 2>&1 | tail -1-sudo mkdir -p /mnt/sys; sudo mount -o loop,rw,force -t hfsplus $IMG /mnt/sys-M=/mnt/sys-[ -e $M/private/var/xnulinux-parked/com.apple.loginwindow.plist ] && sudo mv $M/private/var/xnulinux-parked/com.apple.loginwindow.plist $M/System/Library/LaunchDaemons/-sudo python3 tools/hosted/gui-user.py $M "$M/System/Library/User Template" "$USERNAME" "$PASSWORD" "$UID_"-H=$M/Users/$USERNAME-echo "gui-prep: loginwindow $(ls $M/System/Library/LaunchDaemons/com.apple.loginwindow.plist 2>/dev/null | wc -l), user $USERNAME ($UID_), home $(sudo du -sh $H | cut -f1), autologin set"-sudo umount /mnt/sys; sudo fsck.hfsplus -fy $IMG 2>&1 | tail -1; syncdiff --git a/scripts/vm-m1.sh b/scripts/vm-m1.shdeleted file mode 100755index 279cce6..0000000--- a/scripts/vm-m1.sh+++ /dev/null@@ -1,14 +0,0 @@-#!/bin/bash-# Inside the VM: build fki.ko (GPL) and xnu.ko (non-GPL) against the stock Ubuntu kernel, load the source-built XNU.-set -x-cd ~/w/poc-make -s -C /lib/modules/$(uname -r)/build M=$PWD/fki-ko modules || exit 1-make -s -C /lib/modules/$(uname -r)/build M=$PWD/xnu-ko KBUILD_EXTRA_SYMBOLS=$PWD/fki-ko/Module.symvers modules || exit 1-modinfo -F license fki-ko/fki.ko xnu-ko/xnu.ko-sudo mkdir -p /lib/firmware/xnu && sudo cp ~/w/dvm/out/k27/kernel-k27.macho /lib/firmware/xnu/kernel.macho-grep -m1 Features /proc/cpuinfo | grep -o 'pac[ag]'-sudo dmesg -C-sudo rmmod xnu 2>/dev/null; sudo rmmod fki 2>/dev/null-sudo insmod fki-ko/fki.ko && sudo insmod xnu-ko/xnu.ko; echo "insmod rc=$?"-sudo dmesg | grep -v "^\[.*\] *\(x[0-9]\|Modules\)" | head -60-cat /proc/sys/kernel/tainteddiff --git a/scripts/vm-m2-bisect.sh b/scripts/vm-m2-bisect.shdeleted file mode 100755index e4c83a0..0000000--- a/scripts/vm-m2-bisect.sh+++ /dev/null@@ -1,14 +0,0 @@-#!/bin/bash-# Inside the VM: run M2a with stop=S for each S given; report the last stage that came back cleanly.-cd ~/w/poc-make -s -C /lib/modules/$(uname -r)/build M=$PWD/fki-ko modules >/dev/null 2>&1-make -s -C /lib/modules/$(uname -r)/build M=$PWD/xnu-ko clean >/dev/null 2>&1-make -s -C /lib/modules/$(uname -r)/build M=$PWD/xnu-ko KBUILD_EXTRA_SYMBOLS=$PWD/fki-ko/Module.symvers modules >/dev/null 2>&1-sudo rmmod xnu 2>/dev/null; sudo rmmod fki 2>/dev/null; sudo insmod fki-ko/fki.ko-for S in "$@"; do- sudo dmesg -C- echo ">>> stop=$S"; sync- sudo insmod xnu-ko/xnu.ko mode=${MODE:-2} stop=$S ram_mb=${RAM_MB:-128}- sudo dmesg | grep -a "XNU stage\|XNU sub-stage\|run ended\|panic\|returned" | tail -3- sudo rmmod xnu-donediff --git a/scripts/vm-m2-stream.sh b/scripts/vm-m2-stream.shdeleted file mode 100644index ea148dc..0000000--- a/scripts/vm-m2-stream.sh+++ /dev/null@@ -1,11 +0,0 @@-#!/bin/bash-# On the Mac host: stream the VM's kernel log over ssh while XNU runs, so the last lines survive a VM hang.-# Usage: KMAX=100000 IDLE_MAX=300 bash scripts/vm-m2-stream.sh OUT-OUT=${1:-../stream.out}-bash scripts/vm.sh 'sudo dmesg -C' >/dev/null 2>&1-bash scripts/vm.sh 'sudo dmesg -w' > "$OUT" 2>&1 &-SP=$!-sleep 2-timeout ${TMO:-150} bash scripts/vm.sh "IDLE_MAX=${IDLE_MAX:-300} SHOW=${SHOW:-1} bash ~/w/poc/scripts/vm-m2-kbisect.sh ${KMAX:-100000}" 2>&1 | tee "$OUT.run"-echo "run rc=$?"-sleep 3; kill $SP 2>/dev/nulldiff --git a/scripts/vm-m2.sh b/scripts/vm-m2.shdeleted file mode 100755index a843302..0000000--- a/scripts/vm-m2.sh+++ /dev/null@@ -1,12 +0,0 @@-#!/bin/bash-# Inside the VM: build fki.ko and xnu.ko, run M2a (XNU's arm_init in the XNU world, stages reported through FKI).-set -x-cd ~/w/poc-make -s -C /lib/modules/$(uname -r)/build M=$PWD/fki-ko modules 2>&1 | grep -v "compiler differs\|built by\|You are using\|pahole\|BTF\|built with" || true-make -s -C /lib/modules/$(uname -r)/build M=$PWD/xnu-ko clean >/dev/null 2>&1-make -s -C /lib/modules/$(uname -r)/build M=$PWD/xnu-ko KBUILD_EXTRA_SYMBOLS=$PWD/fki-ko/Module.symvers modules 2>&1 | grep -v "compiler differs\|built by\|You are using\|pahole\|BTF\|built with" || true-ls xnu-ko/xnu.ko fki-ko/fki.ko || exit 1-sudo dmesg -C-sudo rmmod xnu 2>/dev/null; sudo rmmod fki 2>/dev/null-sudo insmod fki-ko/fki.ko && sudo insmod xnu-ko/xnu.ko mode=2 stop=${STOP:-199}; echo "insmod rc=$?"-sudo dmesg | grep -v "^\[.*\] *\(x[0-9]\|Modules\)" | head -80diff --git a/scripts/vm-mk-sysdisk.sh b/scripts/vm-mk-sysdisk.shdeleted file mode 100755index bad6b62..0000000--- a/scripts/vm-mk-sysdisk.sh+++ /dev/null@@ -1,19 +0,0 @@-#!/bin/bash-# In the VM: an HFS+ system disk image for the host-disk root (/var/tmp/sys.img): Apple's dyld, the dyld shared cache,-# a few /bin tools (from /var/tmp/sys.tar, made on the macOS host; Apple binaries stay local, never in the repo) and the test init.-set -euo pipefail-IMG=${IMG:-/var/tmp/sys.img}-cd ~/w/poc/tools/init && bash vm-install.sh >/dev/null 2>&1 || true-sudo umount /mnt/sys 2>/dev/null || true-rm -f $IMG; truncate -s ${SIZE:-16G} $IMG-mkfs.hfsplus -v xnulinux-sys $IMG >/dev/null-sudo mkdir -p /mnt/sys; sudo mount -o loop -t hfsplus $IMG /mnt/sys-sudo tar xf /var/tmp/sys.tar -C /mnt/sys --warning=no-unknown-keyword-sudo mkdir -p /mnt/sys/sbin /mnt/sys/dev /mnt/sys/private/var/select /mnt/sys/private/tmp /mnt/sys/System/Library /mnt/sys/usr/lib-sudo ln -sf private/var /mnt/sys/var; sudo ln -sf private/tmp /mnt/sys/tmp-sudo ln -sf /bin/bash /mnt/sys/private/var/select/sh-[ -e /mnt/sys/System/Library/dyld ] || sudo ln -sf /System/Volumes/Preboot/Cryptexes/OS/System/Library/dyld /mnt/sys/System/Library/dyld-sudo cp ~/w/poc/tools/init/init /mnt/sys/sbin/launchd; sudo cp ~/w/poc/tools/init/hello /mnt/sys/sbin/hello-sudo chmod 755 /mnt/sys/sbin/launchd /mnt/sys/sbin/hello-sudo du -sh /mnt/sys; ls -la /mnt/sys /mnt/sys/bin-sudo umount /mnt/sysdiff --git a/scripts/vm-park.sh b/scripts/vm-park.shdeleted file mode 100755index be8c81e..0000000--- a/scripts/vm-park.sh+++ /dev/null@@ -1,26 +0,0 @@-#!/bin/bash-# In the VM: park (move aside) launchd jobs on the golden full disk that need hardware this hosted system does not-# have, or crash-loop and eat its one CPU; then mark the volume clean for XNU (fsck -fy). Names are plist basenames.-set -u-IMG=${IMG:-/var/tmp/full.img}-PARK="com.apple.audiomxd com.apple.audio.coreaudiod com.apple.audio.AudioComponentRegistrar.daemon com.apple.audio.micactivityd- com.apple.audio.systemsoundserverd com.apple.audioanalyticsd com.apple.historicalaudiod com.apple.usbaudiod- com.apple.PerfPowerServices com.apple.PerfPowerServicesExtended com.apple.perfpowermetricd- com.apple.bluetoothd com.apple.mobileactivationd com.apple.xprotectd com.apple.security.xprotectd com.apple.XProtect.daemon.scan com.apple.MRTd- com.apple.systemstats.daily com.apple.systemstats.analysis com.apple.systemstats.microstackshot_periodic- com.apple.endpointsecurity.endpointsecurityd com.apple.MobileSoftwareUpdate.CleanupPreparePathService- com.apple.oahd com.apple.oahd-root-helper ${PARK_MORE:-}"-# Rosetta (oahd): the hosted kernel runs no x86_64 code ("Bad CPU type in executable"), oahd exits at start and launchd-# keeps its Mach service, so PackageKit's Rosetta cache step after every install (PKUpdateCambriaCacheOperation) waits-# on it forever. With the daemon parked the installer fails instead ("Could not connect to AOT daemon", "Translation of-# Intel binaries failed", PKInstallErrorDomain 129); with the Rosetta runtime moved aside too the disk looks like a Mac-# without Rosetta installed, and the installer skips that step.-sudo mount -o loop,rw,force -t hfsplus "$IMG" /mnt/sys || exit 1-D=/mnt/sys/System/Library/LaunchDaemons; P=/mnt/sys/private/var/xnulinux-parked-sudo mkdir -p $P-n=0; for j in $PARK; do for d in $D /mnt/sys/Library/Apple/System/Library/LaunchDaemons; do- if [ -e $d/$j.plist ]; then sudo mv $d/$j.plist $P/ && n=$((n+1)); fi; done; done-if [ -d /mnt/sys/Library/Apple/usr/libexec/oah ]; then sudo mv /mnt/sys/Library/Apple/usr/libexec/oah $P/oah && n=$((n+1)); fi-echo "parked $n now; $(ls $P | wc -l) parked in all; $(ls $D | wc -l) jobs left"-sudo umount /mnt/sys-sudo fsck.hfsplus -fy "$IMG" 2>&1 | tail -1; syncdiff --git a/scripts/vm-snap.sh b/scripts/vm-snap.shdeleted file mode 100755index d6f620b..0000000--- a/scripts/vm-snap.sh+++ /dev/null@@ -1,13 +0,0 @@-#!/bin/bash-# In the VM: a fresh copy-on-write view of the golden system disk for one hosted run, /dev/mapper/xnusys.-# A hosted XNU that dies mid-write (or takes the host with it) leaves HFS+ corrupt; the golden image stays clean.-# NAME=xnuapfs IMG=/var/tmp/apfs.img COW=/var/tmp/apfs.cow: the same for the APFS disk (scripts/mk-apfs-disk.sh).-set -e-IMG=${IMG:-/var/tmp/full.img}; COW=${COW:-/var/tmp/full.cow}; NAME=${NAME:-xnusys}-sudo dmsetup remove $NAME 2>/dev/null || true-for l in $(losetup -j "$IMG" -O NAME -n) $(losetup -j "$COW" -O NAME -n 2>/dev/null); do sudo losetup -d "$l"; done-rm -f "$COW"; truncate -s ${COW_SIZE:-40G} "$COW"-B=$(sudo losetup -f -r --show "$IMG"); C=$(sudo losetup -f --show "$COW")-sudo dmsetup create $NAME --table "0 $(sudo blockdev --getsz "$B") snapshot $B $C N 16"-sudo chmod 666 /dev/mapper/$NAME 2>/dev/null || true-echo "$NAME over $B (cow $C): $(sudo blockdev --getsize64 /dev/mapper/$NAME) bytes"diff --git a/scripts/vm-sysdisk-init.sh b/scripts/vm-sysdisk-init.shdeleted file mode 100755index 882b935..0000000--- a/scripts/vm-sysdisk-init.sh+++ /dev/null@@ -1,13 +0,0 @@-#!/bin/bash-# In the VM: rebuild tools/init and put /sbin/launchd and /sbin/hello into the existing system disk image.-set -euo pipefail-IMG=${IMG:-/var/tmp/sys.img}-cd ~/w/poc/tools/init; TC=~/w/dvm/toolchains/linux/bin26-for f in start:init hello:hello; do- $TC/target-clang -target arm64-apple-macos14.0 -c ${f%%:*}.s -o ${f%%:*}.o- $TC/target-clang -target arm64-apple-macos14.0 -nostdlib -static -e _start -Wl,-adhoc_codesign ${f%%:*}.o -o ${f##*:} 2>&1 | grep -v "directory not found" || true-done-sudo fsck.hfsplus -fy $IMG 2>&1 | tail -1-sudo mkdir -p /mnt/sys; sudo mount -o loop,rw -t hfsplus $IMG /mnt/sys-sudo cp init /mnt/sys/sbin/launchd; sudo cp hello /mnt/sys/sbin/hello; sudo chmod 755 /mnt/sys/sbin/launchd /mnt/sys/sbin/hello-ls -la /mnt/sys/sbin /mnt/sys/private/var/select; sudo umount /mnt/sysdiff --git a/scripts/vm-sysdisk-launchd.sh b/scripts/vm-sysdisk-launchd.shdeleted file mode 100755index e486e25..0000000--- a/scripts/vm-sysdisk-launchd.sh+++ /dev/null@@ -1,152 +0,0 @@-#!/bin/bash-# In the VM: MODE=launchd puts macOS's own launchd (from /var/tmp/launchd.tar, made on the macOS host; Apple binaries stay-# local) at /sbin/launchd of the system disk; MODE=test puts the test init back.-set -euo pipefail-IMG=${IMG:-/var/tmp/sys.img}-sudo fsck.hfsplus -fy $IMG 2>&1 | tail -1-sudo mkdir -p /mnt/sys; sudo mount -o loop,rw,force -t hfsplus $IMG /mnt/sys-if [ "${MODE:-launchd}" = launchd ]; then- # FULL=1: a full userland disk (scripts/mk-fulldisk.sh) already has launchd and every daemon; /private/var comes- # from Apple's pristine data-volume template, the root symlinks are made here- if [ "${FULL:-0}" = 1 ]; then- ONLY_OURS=0- T=/mnt/sys/System/Library/Templates/Data- [ -d /mnt/sys/private/var/db ] || { [ -d $T/private/var ] && sudo cp -a $T/private/var /mnt/sys/private/; }- [ -d $T/Library ] && sudo cp -an $T/Library/. /mnt/sys/Library/ 2>/dev/null || true- for l in var:private/var tmp:private/tmp etc:private/etc; do [ -e /mnt/sys/${l%%:*} ] || sudo ln -s ${l#*:} /mnt/sys/${l%%:*}; done- sudo mkdir -p /mnt/sys/private/tmp /mnt/sys/dev /mnt/sys/Users /mnt/sys/Volumes /mnt/sys/private/var/select- sudo chmod 1777 /mnt/sys/private/tmp- [ -e /mnt/sys/System/Library/dyld ] || sudo ln -s /System/Volumes/Preboot/Cryptexes/OS/System/Library/dyld /mnt/sys/System/Library/dyld- [ -e /mnt/sys/private/var/select/sh ] || sudo ln -s /bin/bash /mnt/sys/private/var/select/sh- [ -e /mnt/sys/private/var/select/developer_dir ] || sudo ln -s /Applications/Xcode.app/Contents/Developer /mnt/sys/private/var/select/developer_dir- # no third-party software of the host (its own /Library/LaunchDaemons, /usr/local); GUI and hardware-only- # daemons (no watchdog hardware) are parked in /private/var/xnulinux-parked- # (DISABLE adds more). WindowServer and loginwindow stay: they drive XnuDisplay (kexts/XnuDisplay); the user and- # automatic login come from scripts/vm-gui-prep.sh.- sudo rm -rf /mnt/sys/usr/local- sudo find /mnt/sys/Library/LaunchDaemons /mnt/sys/Library/LaunchAgents -name '*.plist' ! -name 'com.apple.*' -delete 2>/dev/null || true- sudo mkdir -p /mnt/sys/private/var/xnulinux-parked- for d in com.apple.watchdogd com.apple.iomfb_bics_daemon com.apple.audiomxd com.apple.audio.coreaudiod com.apple.PerfPowerServices com.apple.PerfPowerServicesExtended ${DISABLE:-}; do- [ -e /mnt/sys/System/Library/LaunchDaemons/$d.plist ] && sudo mv /mnt/sys/System/Library/LaunchDaemons/$d.plist /mnt/sys/private/var/xnulinux-parked/- done- else- sudo tar xf /var/tmp/launchd.tar -C /mnt/sys --warning=no-unknown-keyword- fi- sudo mkdir -p /mnt/sys/private/var/db /mnt/sys/private/var/run /mnt/sys/private/var/log /mnt/sys/private/etc /mnt/sys/Library- [ -e /mnt/sys/etc ] || sudo ln -s private/etc /mnt/sys/etc- # ONLY_OURS=1: none of Apple's daemons (their binaries are not on this disk), only a job of ours that launchd runs- if [ "${ONLY_OURS:-1}" = 1 ]; then- sudo mkdir -p /mnt/sys/private/var/xnulinux-apple-daemons- sudo sh -c 'mv /mnt/sys/System/Library/LaunchDaemons/*.plist /mnt/sys/private/var/xnulinux-apple-daemons/ 2>/dev/null || true'- # KEEP: Apple daemons put back (their binaries come in /var/tmp/daemons.tar from the macOS host)- for d in ${KEEP:-}; do- sudo mv /mnt/sys/private/var/xnulinux-apple-daemons/$d.plist /mnt/sys/System/Library/LaunchDaemons/ 2>/dev/null || echo "no $d.plist"- done- [ -s /var/tmp/daemons.tar ] && sudo tar xf /var/tmp/daemons.tar -C /mnt/sys --warning=no-unknown-keyword- fi- sudo mkdir -p /mnt/sys/private/var/db/diagnostics /mnt/sys/private/var/db/uuidtext /mnt/sys/private/var/log /mnt/sys/private/var/run /mnt/sys/Library/Preferences- # a minimal local directory node for opendirectoryd (it panics the system without /Local/Default): root, daemon, wheel- D=/mnt/sys/private/var/db/dslocal/nodes/Default- sudo mkdir -p $D/users $D/groups $D/config /mnt/sys/private/var/root- u() { sudo tee $D/users/$1.plist >/dev/null <<UP-<?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>name</key><array><string>$1</string></array><key>uid</key><array><string>$2</string></array>-<key>gid</key><array><string>$3</string></array><key>home</key><array><string>$4</string></array>-<key>shell</key><array><string>/bin/sh</string></array><key>realname</key><array><string>$5</string></array>-<key>passwd</key><array><string>*</string></array><key>generateduid</key><array><string>FFFFEEEE-DDDD-CCCC-BBBB-AAAA0000000$2</string></array>-</dict></plist>-UP- }- u root 0 0 /var/root "System Administrator"; u daemon 1 1 /var/root "System Services"- # the same groups as /etc/group, so the directory node and libinfo's file module agree (CPython's test_grp checks both)- g() { sudo tee $D/groups/$1.plist >/dev/null <<GP-<?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>name</key><array><string>$1</string></array><key>gid</key><array><string>$2</string></array>-<key>users</key><array>${3:+<string>$3</string>}</array><key>generateduid</key><array><string>ABCDEFAB-CDEF-ABCD-EFAB-CDEF0000$4</string></array></dict></plist>-GP- }- g wheel 0 root 0000; g daemon 1 root 0001; g nobody -2 "" FFFE; g staff 20 root 0014- sudo chmod -R go-rwx /mnt/sys/private/var/db/dslocal- # flat files for libinfo's file module- # Apple's stock flat files (system accounts only, from the system's own template): libinfo's file module answers lookups such as- # getgrgid(-1) (nogroup) from them, as on a real Mac- T=/mnt/sys/System/Library/Templates/Data/private/etc- if [ -f $T/group ] && [ -f $T/passwd ]; then- sudo cp $T/group $T/passwd /mnt/sys/private/etc/- else- printf 'root:*:0:0:System Administrator:/var/root:/bin/sh\ndaemon:*:1:1:System Services:/var/root:/usr/bin/false\nnobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false\n' | sudo tee /mnt/sys/private/etc/passwd >/dev/null- printf 'wheel:*:0:root\ndaemon:*:1:root\nnobody:*:-2:\nstaff:*:20:root\n' | sudo tee /mnt/sys/private/etc/group >/dev/null- fi- sudo tee /mnt/sys/System/Library/LaunchDaemons/xnulinux.hello.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.hello</string>- <key>ProgramArguments</key>- <array>- <string>/bin/sh</string>- <string>-c</string>- <string>echo "hello from a launchd job (pid $$, parent $PPID)"; uname -sr; for i in 1 2 3; do echo "tick $i"; done; ls /System/Library/LaunchDaemons; echo "job done"</string>- </array>- <key>RunAtLoad</key><true/>- <key>StandardOutPath</key><string>/dev/console</string>- <key>StandardErrorPath</key><string>/dev/console</string>-</dict>-</plist>-PL- # en0 (XNU's link to the host's xnu0): address, route and DNS at boot (tools/hosted/net-up.sh)- sudo mkdir -p /mnt/sys/Library/xnulinux- sudo install -m 755 ~/w/poc/tools/hosted/net-up.sh /mnt/sys/Library/xnulinux/net-up.sh- sudo python3 - <<'PY'-import plistlib-plistlib.dump({"Label": "xnulinux.network", "RunAtLoad": True, "ProgramArguments": ["/bin/sh", "/Library/xnulinux/net-up.sh"]},- open("/mnt/sys/System/Library/LaunchDaemons/xnulinux.network.plist", "wb"))-PY- # 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">-<plist version="1.0">-<dict>- <key>Label</key><string>xnulinux.shell</string>- <key>ProgramArguments</key>- <array><string>/bin/bash</string><string>-i</string></array>- <key>EnvironmentVariables</key>- <dict><key>PATH</key><string>/bin:/usr/bin:/sbin:/usr/sbin</string><key>PS1</key><string>xnulinux# </string><key>TERM</key><string>dumb</string><key>HOME</key><string>/var/root</string><key>SHELL</key><string>/bin/bash</string><key>USER</key><string>root</string><key>LOGNAME</key><string>root</string></dict>- <key>RunAtLoad</key><true/>- <key>StandardInPath</key><string>/dev/console</string>- <key>StandardOutPath</key><string>/dev/console</string>- <key>StandardErrorPath</key><string>/dev/console</string>-</dict>-</plist>-PL-else- sudo cp ~/w/poc/tools/init/init /mnt/sys/sbin/launchd-fi-ls -la /mnt/sys/sbin; sudo umount /mnt/sysdiff --git a/tools/hosted/tests/af.sh b/tools/hosted/tests/af.shdeleted file mode 100644index e769ab0..0000000--- a/tools/hosted/tests/af.sh+++ /dev/null@@ -1,10 +0,0 @@-# Firewalk on :8080, then Alamofire's full xcodebuild test-cd /var/root/src/Firewalk-(./.build/release/firewalk < /dev/null > /tmp/firewalk.log 2>&1 &)-sleep 5; curl -sS -o /dev/null -w "firewalk: HTTP %{http_code}\n" http://127.0.0.1:8080/get-grep -n "static var host\|ProcessInfo\|environment\[" /var/root/src/Alamofire-5.10.2/Tests/TestHelpers.swift | head -5-cd /var/root/src/Alamofire-5.10.2-time launchctl asuser 0 xcodebuild -project Alamofire.xcodeproj -scheme "Alamofire macOS" -configuration Debug -destination "platform=macOS" -derivedDataPath /tmp/afdd7 CODE_SIGNING_ALLOWED=NO MACOSX_DEPLOYMENT_TARGET=12.0 ENABLE_THREAD_SANITIZER=NO test > /tmp/afall.log 2>&1-echo "AFRC=$?"-grep -a -E "Executed [0-9]+ tests|\*\* .* (SUCCEEDED|FAILED) \*\*" /tmp/afall.log | tail -3-grep -a "error: -\[" /tmp/afall.log | sed "s/.*error: -\[//" | cut -d" " -f1-2 | sort | uniq -c | sort -nr | head -15diff --git a/tools/hosted/tests/af2err.sh b/tools/hosted/tests/af2err.shdeleted file mode 100644index c833e71..0000000--- a/tools/hosted/tests/af2err.sh+++ /dev/null@@ -1 +0,0 @@-grep -a "error: -\[" /tmp/afall2.log | grep -a "AuthenticationInterceptor\|DownloadResponseTests" | sed "s/.*error: -\[Alamofire_macOS_Tests\.//" | cut -c1-220 | head -10diff --git a/tools/hosted/tests/afall2.sh b/tools/hosted/tests/afall2.shdeleted file mode 100644index fc718dd..0000000--- a/tools/hosted/tests/afall2.sh+++ /dev/null@@ -1,4 +0,0 @@-cd /var/root/src/Alamofire-5.10.2-launchctl asuser 0 xcodebuild -project Alamofire.xcodeproj -scheme "Alamofire macOS" -configuration Debug -destination "platform=macOS" -derivedDataPath /tmp/afdd7 CODE_SIGNING_ALLOWED=NO MACOSX_DEPLOYMENT_TARGET=12.0 ENABLE_THREAD_SANITIZER=NO test > /tmp/afall2.log 2>&1-echo "AF2 rc=$?"; grep -a -E "Executed [0-9]+ tests" /tmp/afall2.log | tail -1-grep -a "error: -\[" /tmp/afall2.log | sed "s/.*error: -\[Alamofire_macOS_Tests\.//" | cut -d" " -f1 | sort | uniq -c | sort -nrdiff --git a/tools/hosted/tests/afds.sh b/tools/hosted/tests/afds.shdeleted file mode 100644index ce213e9..0000000--- a/tools/hosted/tests/afds.sh+++ /dev/null@@ -1,3 +0,0 @@-cd /tmp-grep -a "error: -\[" afall.log | grep -a "DataStreamTests\|DataStreamConcurrency" | sed "s/.*error: -\[Alamofire_macOS_Tests\.//" | cut -c1-230 | head -16-grep -a "firewalk\|Firewalk" /tmp/firewalk.log | tail -3; tail -5 /tmp/firewalk.logdiff --git a/tools/hosted/tests/afep.sh b/tools/hosted/tests/afep.shdeleted file mode 100644index 9457b03..0000000--- a/tools/hosted/tests/afep.sh+++ /dev/null@@ -1,4 +0,0 @@-cd /var/root/src/Alamofire-5.10.2/Tests-grep -n "case stream\|case payloads\|\"/stream\|\"/payloads\|static func stream\|static func payloads\|path: \"/" TestHelpers.swift | head -12-for p in /stream/2 /payloads/2 /bytes/10 /get; do curl -s -o /dev/null -w "$p -> %{http_code}\n" http://127.0.0.1:8080$p; done-cd /var/root/src/Firewalk && git log -1 --format="%h %ad %s" --date=short && grep -rn "\"stream\"\|\"payloads\"" Sources | head -5diff --git a/tools/hosted/tests/afflaky.sh b/tools/hosted/tests/afflaky.shdeleted file mode 100644index b5392da..0000000--- a/tools/hosted/tests/afflaky.sh+++ /dev/null@@ -1,5 +0,0 @@-cd /var/root/src/Alamofire-5.10.2-for i in 1 2 3; do-launchctl asuser 0 xcodebuild -project Alamofire.xcodeproj -scheme "Alamofire macOS" -configuration Debug -destination "platform=macOS" -derivedDataPath /tmp/afdd7 CODE_SIGNING_ALLOWED=NO MACOSX_DEPLOYMENT_TARGET=12.0 ENABLE_THREAD_SANITIZER=NO -only-testing:"Alamofire macOS Tests/DownloadResponseTests/testCancelledDownloadRequest" -only-testing:"Alamofire macOS Tests/AuthenticationInterceptorTestCase/testThatInterceptorTriggersRefreshWithMultipleParallelRequestsReturning401Responses" test-without-building > /tmp/afflaky$i.log 2>&1-printf "run $i: "; grep -a -E "Executed [0-9]+ tests" /tmp/afflaky$i.log | tail -1-donediff --git a/tools/hosted/tests/afsum.sh b/tools/hosted/tests/afsum.shdeleted file mode 100644index d460507..0000000--- a/tools/hosted/tests/afsum.sh+++ /dev/null@@ -1,5 +0,0 @@-cd /tmp-grep -a "error: -\[" afall.log | sed "s/.*error: -\[Alamofire_macOS_Tests\.//" | cut -d" " -f1 | sort | uniq -c | sort -nr-grep -a "error: -\[" afall.log | grep -a DataStreamTests | head -3 | cut -c1-300-grep -a "error: -\[" afall.log | grep -a "TLSEvaluation" | head -2 | cut -c1-300-grep -a "error: -\[" afall.log | grep -av "TLSEvaluation\|DataStream" | sed "s/.*error: -\[Alamofire_macOS_Tests\.//" | cut -c1-200 | head -12diff --git a/tools/hosted/tests/arch.m b/tools/hosted/tests/arch.mdeleted file mode 100644index 7b3effc..0000000--- a/tools/hosted/tests/arch.m+++ /dev/null@@ -1,21 +0,0 @@-#import <Foundation/Foundation.h>-#import <Metal/Metal.h>-#import <objc/runtime.h>-#include <dlfcn.h>-int main(void) {- MTLCreateSystemDefaultDevice();- Dl_info info; dladdr((void *)MTLCreateSystemDefaultDevice, &info);- unsigned n = 0; const char **names = objc_copyClassNamesForImage(info.dli_fname, &n);- for (unsigned i = 0; i < n; i++) {- Class c = objc_getClass(names[i]);- if (!class_getInstanceMethod(c, sel_registerName("subType"))) continue;- printf("class %s : %s\n", names[i], class_getName(class_getSuperclass(c)));- unsigned m = 0; Method *ms = class_copyMethodList(c, &m);- for (unsigned j = 0; j < m; j++) printf(" - %s %s\n", sel_getName(method_getName(ms[j])), method_getTypeEncoding(ms[j]));- ms = class_copyMethodList(object_getClass(c), &m);- for (unsigned j = 0; j < m; j++) printf(" + %s %s\n", sel_getName(method_getName(ms[j])), method_getTypeEncoding(ms[j]));- unsigned k = 0; Ivar *iv = class_copyIvarList(c, &k);- for (unsigned j = 0; j < k; j++) printf(" ivar %s %s @%td\n", ivar_getName(iv[j]), ivar_getTypeEncoding(iv[j]), ivar_getOffset(iv[j]));- }- return 0;-}diff --git a/tools/hosted/tests/b.m b/tools/hosted/tests/b.mdeleted file mode 100644index 3f25305..0000000--- a/tools/hosted/tests/b.m+++ /dev/null@@ -1,28 +0,0 @@-#import <Foundation/Foundation.h>-#import <Metal/Metal.h>-#import <objc/runtime.h>-@interface NSObject (X)-- (id)initWithAcceleratorPort:(unsigned)port;-@end-int main(void) {- @autoreleasepool {- NSBundle *b = [NSBundle bundleWithPath:@"/Library/GPUBundles/XnuCpuMetal.bundle"];- NSError *e = nil;- printf("load: %d %s\n", [b loadAndReturnError:&e], e ? e.description.UTF8String : "");- Class c = [b principalClass];- printf("principal: %s\n", c ? class_getName(c) : "nil");- id<MTLDevice> d = [[c alloc] initWithAcceleratorPort:0];- printf("direct init: %s\n", d ? d.name.UTF8String : "nil");- if (d) {- id<MTLBuffer> buf = [d newBufferWithLength:4096 options:0];- id<MTLCommandQueue> q = [d newCommandQueue];- id<MTLCommandBuffer> cb = [q commandBuffer];- id<MTLBlitCommandEncoder> be = [cb blitCommandEncoder];- [be fillBuffer:buf range:NSMakeRange(0, 4096) value:7];- [be endEncoding]; [cb commit]; [cb waitUntilCompleted];- unsigned char *p = buf.contents;- printf("blit fill: %d %d status %ld\n", p[0], p[4095], (long)cb.status);- }- }- return 0;-}diff --git a/tools/hosted/tests/crash.sh b/tools/hosted/tests/crash.shdeleted file mode 100644index 30253e1..0000000--- a/tools/hosted/tests/crash.sh+++ /dev/null@@ -1,18 +0,0 @@-cd /tmp-ls -t /Library/Logs/DiagnosticReports /var/root/Library/Logs/DiagnosticReports 2>/dev/null | head -8-f=$(ls -t /Library/Logs/DiagnosticReports/${1:-}*.ips /var/root/Library/Logs/DiagnosticReports/${1:-}*.ips 2>/dev/null | head -1)-echo "REPORT $f"-python3 - "$f" <<'PY'-import json,sys-t=open(sys.argv[1]).read().split('\n',1)-h=json.loads(t[0]); b=json.loads(t[1])-print(h.get('app_name'), h.get('name'))-print('exc', b.get('exception'), 'term', b.get('termination'))-print('asi', b.get('asi'))-imgs=b.get('usedImages',[])-for th in b.get('threads',[]):- if th.get('triggered'):- for fr in th.get('frames',[])[:22]:- im=imgs[fr['imageIndex']] if fr.get('imageIndex') is not None and fr['imageIndex']<len(imgs) else {}- print(' ', im.get('name','?'), fr.get('symbol','?'), hex(fr.get('imageOffset',0)))-PYdiff --git a/tools/hosted/tests/d.swift b/tools/hosted/tests/d.swiftdeleted file mode 100644index d09d6ce..0000000--- a/tools/hosted/tests/d.swift+++ /dev/null@@ -1,12 +0,0 @@-import Foundation-import Metal-let p = "/Library/GPUBundles/XnuCpuMetal.bundle/Contents/MacOS/XnuCpuMetal"-let h = dlopen(p, RTLD_NOW)-print("dlopen:", h == nil ? "FAILED \(String(cString: dlerror()))" : "ok")-if let b = Bundle(path: "/Library/GPUBundles/XnuCpuMetal.bundle") {- print("bundle principal load:", b.load(), "class:", NSClassFromString("XnuCpuMetalDevice") as Any)- if let c: AnyClass = NSClassFromString("XnuCpuMetalDevice"), let s: AnyClass = NSClassFromString("IOGPUMetalDevice") {- print("subclass of IOGPUMetalDevice:", c.isSubclass(of: s))- }-}-print("metal device after load:", MTLCreateSystemDefaultDevice()?.name ?? "nil")diff --git a/tools/hosted/tests/final1.sh b/tools/hosted/tests/final1.shdeleted file mode 100644index 5617b38..0000000--- a/tools/hosted/tests/final1.sh+++ /dev/null@@ -1,10 +0,0 @@-# Alamofire's own scheme (ThreadSanitizer on) on its offline test groups; then Stats from its unmodified project (icon step included)-cd /var/root/src/Alamofire-5.10.2-time launchctl asuser 0 xcodebuild -project Alamofire.xcodeproj -scheme "Alamofire macOS" -configuration Debug -destination "platform=macOS" -derivedDataPath /tmp/aftsan CODE_SIGNING_ALLOWED=NO MACOSX_DEPLOYMENT_TARGET=12.0 -only-testing:"Alamofire macOS Tests/URLEncodedFormEncoderTests" -only-testing:"Alamofire macOS Tests/HTTPHeadersTests" -only-testing:"Alamofire macOS Tests/JSONParameterEncoderTests" test > /tmp/aftsan.log 2>&1-echo "AFTSAN rc=$?"; grep -a -E "Executed [0-9]+ tests|\*\* TEST" /tmp/aftsan.log | tail -2; grep -a -c "ThreadSanitizer\|enableThreadSanitizer\|libclang_rt.tsan" /tmp/aftsan.log; grep -a "FATAL\|incompatible with TSan" /tmp/aftsan.log | head -3-cd /var/root/src/stats-master-grep -c "Generate menu bar icon" Stats.xcodeproj/project.pbxproj-time xcodebuild -project Stats.xcodeproj -scheme Stats -configuration Release -derivedDataPath /tmp/statsdd CODE_SIGNING_ALLOWED=NO build > /tmp/stats.log 2>&1-echo "STATS rc=$?"; grep -a -E "\*\* BUILD (SUCCEEDED|FAILED) \*\*" /tmp/stats.log | tail -1; grep -a "error:" /tmp/stats.log | head -5-grep -a "Generate menu bar icon\|ictool" /tmp/stats.log | head -3 | cut -c1-200-ls -la /tmp/statsdd/Build/Products/Release/Stats.app/Contents/Resources/*.png 2>/dev/null | head -5diff --git a/tools/hosted/tests/final2.sh b/tools/hosted/tests/final2.shdeleted file mode 100644index 4bc03d0..0000000--- a/tools/hosted/tests/final2.sh+++ /dev/null@@ -1,10 +0,0 @@-# Round-6 Metal bundle into the running system, then Stats from its unmodified project (both icon renders)-bash /tmp/upd.sh-cd /var/root/src/stats-master-time xcodebuild -project Stats.xcodeproj -scheme Stats -configuration Release -derivedDataPath /tmp/statsdd2 CODE_SIGNING_ALLOWED=NO build > /tmp/stats2.log 2>&1-echo "STATS2 rc=$?"; grep -a -E "\*\* BUILD (SUCCEEDED|FAILED) \*\*" /tmp/stats2.log | tail -1-grep -a -A4 "The following build commands failed" /tmp/stats2.log | cut -c1-200-grep -a "stubbed" /tmp/stats2.log | sort | uniq -c | head-R=/tmp/statsdd2/Build/Products/Release/Stats.app/Contents/Resources; ls -la $R/MenuBarIcon*.png; file $R/MenuBarIcon*.png-du -sh /tmp/statsdd2/Build/Products/Release/Stats.app; file /tmp/statsdd2/Build/Products/Release/Stats.app/Contents/MacOS/Stats-echo "PNGB64BEGIN"; base64 -i $R/[email protected] | tr -d '\n'; echo; echo "PNGB64END"diff --git a/tools/hosted/tests/fw.sh b/tools/hosted/tests/fw.shdeleted file mode 100644index 6191c0a..0000000--- a/tools/hosted/tests/fw.sh+++ /dev/null@@ -1,7 +0,0 @@-# Build and start Alamofire's local test server Firewalk (Vapor, SwiftPM dependencies fetched over the network)-# Firewalk 0.12.3: the last release whose /payloads/:count and chunked /stream match Alamofire 5.10.2 tests (0.13 added :delay)-cd /var/root/src-[ -d Firewalk ] || git clone https://github.com/Alamofire/Firewalk.git > /tmp/fw-clone.log 2>&1-cd Firewalk && git checkout -q 0.12.3 && echo "clone rc=$? $(git log --oneline -1 2>/dev/null)"-( time swift build -c release ) > /tmp/fw-build.log 2>&1-echo "FWBUILD rc=$?" >> /tmp/fw-build.logdiff --git a/tools/hosted/tests/fw12.sh b/tools/hosted/tests/fw12.shdeleted file mode 100644index 3d37cbc..0000000--- a/tools/hosted/tests/fw12.sh+++ /dev/null@@ -1,10 +0,0 @@-export GIT_PAGER=cat PAGER=cat-cd /var/root/src/Firewalk && git checkout -q 0.12.3 && git log -1 --format="%h %ad %s" --date=short-pkill -x firewalk 2>/dev/null; sleep 1-( time swift build -c release ) > /tmp/fw12-build.log 2>&1; echo "FW12 rc=$?"; tail -3 /tmp/fw12-build.log-(./.build/release/firewalk < /dev/null > /tmp/firewalk.log 2>&1 &); sleep 5-for p in /payloads/2 /stream/2; do curl -s -o /dev/null -w "$p -> %{http_code}\n" http://127.0.0.1:8080$p; done-cd /var/root/src/Alamofire-5.10.2-launchctl asuser 0 xcodebuild -project Alamofire.xcodeproj -scheme "Alamofire macOS" -configuration Debug -destination "platform=macOS" -derivedDataPath /tmp/afdd7 CODE_SIGNING_ALLOWED=NO MACOSX_DEPLOYMENT_TARGET=12.0 ENABLE_THREAD_SANITIZER=NO -only-testing:"Alamofire macOS Tests/DataStreamTests" -only-testing:"Alamofire macOS Tests/DataStreamConcurrencyTests" -only-testing:"Alamofire macOS Tests/DataStreamIntegrationTests" test > /tmp/afds.log 2>&1-echo "AFDS rc=$?"; grep -a -E "Executed [0-9]+ tests" /tmp/afds.log | tail -1-grep -a "error: -\[" /tmp/afds.log | sed "s/.*error: -\[Alamofire_macOS_Tests\.//" | cut -c1-200 | head -8diff --git a/tools/hosted/tests/fw14.sh b/tools/hosted/tests/fw14.shdeleted file mode 100644index 72da8e7..0000000--- a/tools/hosted/tests/fw14.sh+++ /dev/null@@ -1,10 +0,0 @@-export GIT_PAGER=cat PAGER=cat-cd /var/root/src/Firewalk && git checkout -q 0.14.0 && git log -1 --format="%h %ad %s" --date=short-pkill -x firewalk 2>/dev/null; sleep 1-( time swift build -c release ) > /tmp/fw14-build.log 2>&1; echo "FW14 rc=$?"; tail -3 /tmp/fw14-build.log-(./.build/release/firewalk < /dev/null > /tmp/firewalk.log 2>&1 &); sleep 5-for p in /payloads/2 /stream/2; do curl -s -o /dev/null -w "$p -> %{http_code}\n" http://127.0.0.1:8080$p; done-cd /var/root/src/Alamofire-5.10.2-launchctl asuser 0 xcodebuild -project Alamofire.xcodeproj -scheme "Alamofire macOS" -configuration Debug -destination "platform=macOS" -derivedDataPath /tmp/afdd7 CODE_SIGNING_ALLOWED=NO MACOSX_DEPLOYMENT_TARGET=12.0 ENABLE_THREAD_SANITIZER=NO -only-testing:"Alamofire macOS Tests/DataStreamTests" -only-testing:"Alamofire macOS Tests/DataStreamConcurrencyTests" -only-testing:"Alamofire macOS Tests/DataStreamIntegrationTests" test > /tmp/afds.log 2>&1-echo "AFDS rc=$?"; grep -a -E "Executed [0-9]+ tests" /tmp/afds.log | tail -1-grep -a "error: -\[" /tmp/afds.log | sed "s/.*error: -\[Alamofire_macOS_Tests\.//" | cut -c1-200 | head -8diff --git a/tools/hosted/tests/fwst.sh b/tools/hosted/tests/fwst.shdeleted file mode 100644index a9461ef..0000000--- a/tools/hosted/tests/fwst.sh+++ /dev/null@@ -1,3 +0,0 @@-cat /tmp/fw.out /tmp/fw-clone.log 2>/dev/null | tail -5-tail -5 /tmp/fw-build.log 2>/dev/null-ls /var/root/src/Firewalk/.build 2>/dev/null | headdiff --git a/tools/hosted/tests/fwtags.sh b/tools/hosted/tests/fwtags.shdeleted file mode 100644index 4a59a48..0000000--- a/tools/hosted/tests/fwtags.sh+++ /dev/null@@ -1,5 +0,0 @@-export GIT_PAGER=cat PAGER=cat-cd /var/root/src/Firewalk && git fetch -q --tags --unshallow 2>/dev/null || git fetch -q --tags-git tag --sort=-creatordate | head -8-for t in $(git tag --sort=-creatordate | head -6); do printf "%s: " $t; git grep -c "payloads" $t -- Sources 2>/dev/null | head -1 || echo none; echo; done-grep -rn "firewalk" /var/root/src/Alamofire-5.10.2/.github 2>/dev/null | head -5diff --git a/tools/hosted/tests/gpu7.sh b/tools/hosted/tests/gpu7.shdeleted file mode 100644index d44ac90..0000000--- a/tools/hosted/tests/gpu7.sh+++ /dev/null@@ -1,10 +0,0 @@-# GPU plugin round 7 in the hosted macOS: ictool on Stats' menu bar icon, the bundle on disk vs the new one (time, peak RSS, output)-I="/Applications/Xcode.app/Contents/Applications/Icon Composer.app/Contents/Executables/ictool"-ICON=$(find /var/root/src/stats-master -name "*.icon" -maxdepth 4 | head -1); echo "icon: $ICON"-run() { /usr/bin/time -l "$I" "$ICON" --export-image --output-file /tmp/g7-$1.png --platform macOS --rendition Default --width 16 --height 16 --scale 2 > /tmp/g7-$1.log 2>&1- echo "$1 rc=$? $(grep -a 'real\|maximum resident' /tmp/g7-$1.log | tr -s ' ' | tr '\n' ' ') md5=$(md5 -q /tmp/g7-$1.png 2>/dev/null)"; }-run old1; run old2-bash /tmp/upd.sh-run new1; run new2; run new3-ls -la /var/tmp/xnu-cpu-metal-0 2>/dev/null | head -5; du -sh /var/tmp/xnu-cpu-metal-0/* 2>/dev/null-grep -a -c stubbed /tmp/g7-new3.logdiff --git a/tools/hosted/tests/grpcheck.py b/tools/hosted/tests/grpcheck.pydeleted file mode 100644index 7775c54..0000000--- a/tools/hosted/tests/grpcheck.py+++ /dev/null@@ -1,11 +0,0 @@-# The consistency CPython's test_grp checks: every getgrall() entry must round-trip through getgrgid/getgrnam-import grp-bad = 0-for e in grp.getgrall():- try:- a = grp.getgrgid(e.gr_gid); b = grp.getgrnam(e.gr_name)- if a.gr_gid != e.gr_gid or b.gr_gid != e.gr_gid:- print("mismatch", e.gr_name, e.gr_gid, a.gr_name, a.gr_gid, b.gr_gid); bad += 1- except KeyError as x:- print("missing", e.gr_name, e.gr_gid, x); bad += 1-print("groups", len(grp.getgrall()), "bad", bad)diff --git a/tools/hosted/tests/instlog.sh b/tools/hosted/tests/instlog.shdeleted file mode 100644index 2d2bbac..0000000--- a/tools/hosted/tests/instlog.sh+++ /dev/null@@ -1,2 +0,0 @@-grep -a -i "script\|error\|fail\|refused" /var/log/install.log | tail -25 | cut -c1-230-ls /Library/Developer/Packages 2>/dev/null | head; pkgutil --pkgs 2>/dev/null | grep -i "xcode\|CoreTypes\|MobileDevice\|Developer" | headdiff --git a/tools/hosted/tests/m.swift b/tools/hosted/tests/m.swiftdeleted file mode 100644index 22ddb39..0000000--- a/tools/hosted/tests/m.swift+++ /dev/null@@ -1,14 +0,0 @@-import Metal-let d = MTLCreateSystemDefaultDevice()-print("metal device:", d?.name ?? "nil")-print("all devices:", MTLCopyAllDevices().count)-if let d = d {- let b = d.makeBuffer(length: 4096)!- let q = d.makeCommandQueue()!- let c = q.makeCommandBuffer()!- let e = c.makeBlitCommandEncoder()!- e.fill(buffer: b, range: 0..<4096, value: 7)- e.endEncoding(); c.commit(); c.waitUntilCompleted()- let p = b.contents().bindMemory(to: UInt8.self, capacity: 4096)- print("blit fill:", p[0], p[4095], "status", c.status.rawValue)-}diff --git a/tools/hosted/tests/rfl.sh b/tools/hosted/tests/rfl.shdeleted file mode 100644index 3c0b8e4..0000000--- a/tools/hosted/tests/rfl.sh+++ /dev/null@@ -1,4 +0,0 @@-# Why xcodebuild -runFirstLaunch fails in the hosted macOS-launchctl asuser 0 xcodebuild -runFirstLaunch > /tmp/rfl.log 2>&1; echo "RFL rc=$?"-grep -v "^$" /tmp/rfl.log | tail -12 | cut -c1-220-log show --last 2m --style compact 2>/dev/null | grep -i "installer\|pkg\|PackageKit\|system_installd\|installd\|refused\|signature" | grep -v "AMFI: \[non-fatal\]" | tail -15 | cut -c1-240diff --git a/tools/hosted/tests/rfl9.sh b/tools/hosted/tests/rfl9.shdeleted file mode 100644index 7c03bde..0000000--- a/tools/hosted/tests/rfl9.sh+++ /dev/null@@ -1,7 +0,0 @@-# xcodebuild -runFirstLaunch from a clean system disk, timed; the packages' receipts and the install log after it-pkgutil --pkgs | grep -c "XcodeSystemResources\|MobileDevice\|CoreTypes"-S0=$(date +%s); xcodebuild -runFirstLaunch > /tmp/rfl9.log 2>&1; echo "RFL rc=$? in $(( $(date +%s) - S0 ))s"-grep -v "^$" /tmp/rfl9.log | grep -v "Package Authoring\|com.apple.xpc\|powerd" | tail -6 | cut -c1-200-pkgutil --pkgs | grep "XcodeSystemResources\|MobileDevice\|CoreTypes"-grep -a "Install Succeeded\|Install Failed\|Writing system content receipt\|Removing client" /var/log/install.log | tail -4 | cut -c1-180-S0=$(date +%s); xcodebuild -runFirstLaunch > /dev/null 2>&1; echo "RFL again rc=$? in $(( $(date +%s) - S0 ))s"diff --git a/tools/hosted/tests/s.m b/tools/hosted/tests/s.mdeleted file mode 100644index 4bede5d..0000000--- a/tools/hosted/tests/s.m+++ /dev/null@@ -1,89 +0,0 @@-// Trace Metal's device discovery: wrap the methods on the path from IORegistry to the plugin's device and log each call.-#import <Foundation/Foundation.h>-#import <Metal/Metal.h>-#import <objc/runtime.h>-#include <dlfcn.h>--static void wrapInst(const char *cls, const char *sel) {- Class c = objc_getClass(cls);- Method m = c ? class_getInstanceMethod(c, sel_registerName(sel)) : NULL;- printf("wrap -[%s %s]: %s\n", cls, sel, m ? "ok" : "missing");- if (!m) return;- IMP orig = method_getImplementation(m);- if (!strcmp(sel, "initWithAcceleratorPort:deviceClass:")) {- method_setImplementation(m, imp_implementationWithBlock(^id(id self, unsigned port, Class dc) {- printf("-> -[%s initWithAcceleratorPort:%u deviceClass:%s]\n", cls, port, dc ? class_getName(dc) : "nil");- id r = ((id (*)(id, SEL, unsigned, Class))orig)(self, sel_registerName(sel), port, dc);- printf("<- %p\n", (void *)r);- if (r) { unsigned n = 0; Ivar *iv = class_copyIvarList(object_getClass(r), &n);- for (unsigned i = 0; i < n; i++) { const char *t = ivar_getTypeEncoding(iv[i]); ptrdiff_t o = ivar_getOffset(iv[i]);- unsigned long long v = *(unsigned long long *)((char *)r + o);- printf(" ivar %s %s = 0x%llx%s%s\n", ivar_getName(iv[i]), t, v, t[0] == '@' && v ? " " : "", t[0] == '@' && v ? [[[(id)v description] substringToIndex:MIN((NSUInteger)80, [[(id)v description] length])] UTF8String] : ""); } }- return r; }));- } else if (!strcmp(sel, "processPendingCreateIOAccelServiceRequests")) {- method_setImplementation(m, imp_implementationWithBlock(^void(id self) {- printf("-> -[%s %s]\n", cls, sel); ((void (*)(id, SEL))orig)(self, sel_registerName(sel)); printf("<- done\n"); }));- } else if (!strcmp(sel, "deviceNotifyQueue")) {- method_setImplementation(m, imp_implementationWithBlock(^id(id self) {- id q = ((id (*)(id, SEL))orig)(self, sel_registerName(sel));- printf(" deviceNotifyQueue -> %s\n", q ? dispatch_queue_get_label((dispatch_queue_t)q) : "nil"); return q; }));- } else if (!strcmp(sel, "registerService:deviceClass:")) {- method_setImplementation(m, imp_implementationWithBlock(^id(id self, unsigned port, Class dc) {- printf("-> -[%s registerService:%u deviceClass:%s]\n", cls, port, dc ? class_getName(dc) : "nil");- id r = ((id (*)(id, SEL, unsigned, Class))orig)(self, sel_registerName(sel), port, dc);- printf("<- %p\n", (void *)r); return r; }));- } else if (!strcmp(sel, "initWithAcceleratorPort:")) {- method_setImplementation(m, imp_implementationWithBlock(^id(id self, unsigned port) {- printf("-> -[%s initWithAcceleratorPort:%u]\n", cls, port);- id r = ((id (*)(id, SEL, unsigned))orig)(self, sel_registerName(sel), port);- printf("<- %p\n", (void *)r); return r; }));- } else if (!strcmp(sel, "init")) {- method_setImplementation(m, imp_implementationWithBlock(^id(id self) {- printf("-> -[%s init]\n", cls);- id r = ((id (*)(id, SEL))orig)(self, sel_registerName(sel));- printf("<- %p\n", (void *)r); return r; }));- }-}--static void wrapClass(const char *cls, const char *sel) {- Class c = objc_getClass(cls);- Method m = c ? class_getClassMethod(c, sel_registerName(sel)) : NULL;- printf("wrap +[%s %s]: %s\n", cls, sel, m ? "ok" : "missing");- if (!m) return;- IMP orig = method_getImplementation(m);- method_setImplementation(m, imp_implementationWithBlock(^id(id self, unsigned port) {- printf("-> +[%s %s %u]\n", cls, sel, port);- id r = ((id (*)(id, SEL, unsigned))orig)(self, sel_registerName(sel), port);- printf("<- %p\n", (void *)r); return r; }));-}--int main(void) {- {- setvbuf(stdout, NULL, _IONBF, 0);- dlopen("/System/Library/PrivateFrameworks/IOGPU.framework/IOGPU", RTLD_NOW);- [[NSBundle bundleWithPath:@"/Library/GPUBundles/XnuCpuMetal.bundle"] load];- { Class meta = object_getClass(objc_getClass("XnuCpuMetalDevice"));- class_addMethod(meta, @selector(resolveClassMethod:), imp_implementationWithBlock(^BOOL(id self, SEL q) {- printf("?? +[XnuCpuMetalDevice %s] looked up, not implemented\n", sel_getName(q)); return NO; }), "c@::");- class_addMethod(objc_getClass("XnuCpuMetalDevice") ? meta : nil, @selector(resolveInstanceMethod:), imp_implementationWithBlock(^BOOL(id self, SEL q) {- printf("?? -[XnuCpuMetalDevice %s] looked up, not implemented\n", sel_getName(q)); return NO; }), "c@::"); }- wrapInst("MTLIOAccelServiceGlobalContext", "init");- wrapInst("MTLIOAccelService", "initWithAcceleratorPort:deviceClass:");- wrapInst("XnuCpuMetalDevice", "initWithAcceleratorPort:");- wrapClass("IOGPUMetalDevice", "registerAcceleratorService:");- wrapInst("MTLIOAccelServiceGlobalContext", "processPendingCreateIOAccelServiceRequests");- wrapInst("MTLIOAccelServiceGlobalContext", "registerService:deviceClass:");- wrapInst("MTLIOAccelServiceGlobalContext", "deviceNotifyQueue");- { unsigned n = 0; Method *ms = class_copyMethodList(objc_getClass("MTLIOAccelService"), &n);- for (unsigned i = 0; i < n; i++) printf(" -MTLIOAccelService %s\n", sel_getName(method_getName(ms[i]))); }- NSArray *all = MTLCopyAllDevices();- printf("MTLCopyAllDevices: %lu\n", (unsigned long)all.count);- id gc = nil; { Class c = objc_getClass("MTLIOAccelServiceGlobalContext"); (void)c; }- [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:2]];- printf("after run loop: %lu\n", (unsigned long)MTLCopyAllDevices().count);- dispatch_sync(dispatch_get_global_queue(0, 0), ^{ printf("global queue alive\n"); });- (void)gc;- printf("after 2 s: %lu, default: %p\n", (unsigned long)MTLCopyAllDevices().count, (void *)MTLCreateSystemDefaultDevice());- }- return 0;-}diff --git a/tools/hosted/tests/stats.sh b/tools/hosted/tests/stats.shdeleted file mode 100644index e61af4e..0000000--- a/tools/hosted/tests/stats.sh+++ /dev/null@@ -1,10 +0,0 @@-# The PNG ictool rendered (base64 to the console), then Stats with its own, unmodified project (icon step included)-echo "PNGB64BEGIN"; base64 -i /tmp/t.png | tr -d '\n'; echo; echo "PNGB64END"-cd /var/root/src/stats-master && git status --short 2>/dev/null | head -3-grep -c "Generate menu bar icon" Stats.xcodeproj/project.pbxproj-time xcodebuild -project Stats.xcodeproj -scheme Stats -configuration Release -derivedDataPath /tmp/statsdd CODE_SIGNING_ALLOWED=NO build > /tmp/stats.log 2>&1-echo "STATS rc=$?"-grep -a -E "\*\* BUILD (SUCCEEDED|FAILED) \*\*" /tmp/stats.log | tail -1-grep -a "error:" /tmp/stats.log | head -5-grep -a -A3 "Generate menu bar icon" /tmp/stats.log | head -8-ls -la /tmp/statsdd/Build/Products/Release/Stats.app/Contents/Resources/ 2>/dev/null | grep -i "menubar\|icon" | headdiff --git a/tools/hosted/tests/statsfail.sh b/tools/hosted/tests/statsfail.shdeleted file mode 100644index 338c94d..0000000--- a/tools/hosted/tests/statsfail.sh+++ /dev/null@@ -1,2 +0,0 @@-grep -a -A8 "The following build commands failed" /tmp/stats.log | cut -c1-220-grep -a -i -B2 -A6 "error\b\|fatal\|failed with\|Command .* failed" /tmp/stats.log | grep -av "^--$" | tail -25 | cut -c1-220diff --git a/tools/hosted/tests/t.sh b/tools/hosted/tests/t.shdeleted file mode 100644index b5ab4fa..0000000--- a/tools/hosted/tests/t.sh+++ /dev/null@@ -1,10 +0,0 @@-cd /tmp-xcrun swiftc -O m.swift -o m 2>&1 | tail -3-./m 2>&1 | tail -5-I="/Applications/Xcode.app/Contents/Applications/Icon Composer.app/Contents/Executables/ictool"-rm -rf /tmp/t.icon /tmp/t.png; cp -R "/var/root/src/stats-master/Stats/Supporting Files/Stats.icon" /tmp/t.icon-"$I" /tmp/t.icon --export-image --output-file /tmp/t.png --platform macOS --rendition Default --width 16 --height 16 --scale 2 > /tmp/ic.log 2>&1-echo "ictool rc=$?"; grep -v "^$" /tmp/ic.log | tail -8; ls -la /tmp/t.png-log show --last 2m --style compact 2>/dev/null | grep -i "metal\|gpubundle\|XnuCpu\|IOGPU" | tail -15-grep -rln "8080" /var/root/src/Alamofire-5.10.2/Tests | head -3-grep -rn "8080\|firewalk" /var/root/src/Alamofire-5.10.2/Tests/*.swift | head -4diff --git a/tools/hosted/tests/t10.sh b/tools/hosted/tests/t10.shdeleted file mode 100644index 4b4dbff..0000000--- a/tools/hosted/tests/t10.sh+++ /dev/null@@ -1,6 +0,0 @@-cd /tmp-bash /tmp/upd.sh-./m 2>&1 | grep -v "^metal2vulkan" | tail -4-I="/Applications/Xcode.app/Contents/Applications/Icon Composer.app/Contents/Executables/ictool"-rm -f /tmp/t.png; XNU_CPU_METAL_TRACE=1 "$I" /tmp/t.icon --export-image --output-file /tmp/t.png --platform macOS --rendition Default --width 16 --height 16 --scale 2 > /tmp/ic.log 2>&1-echo "ictool rc=$?"; grep -v "^metal2vulkan\|^XCM new\|^XCM render\|^XCM compute" /tmp/ic.log | tail -12; ls -la /tmp/t.png; file /tmp/t.pngdiff --git a/tools/hosted/tests/t11.sh b/tools/hosted/tests/t11.shdeleted file mode 100644index 8bc8ff7..0000000--- a/tools/hosted/tests/t11.sh+++ /dev/null@@ -1,2 +0,0 @@-cd /tmp-grep -v "^metal2vulkan\|^XCM new\|^XCM render\|^XCM compute" /tmp/ic.log | head -24 | cut -c1-220diff --git a/tools/hosted/tests/t12.sh b/tools/hosted/tests/t12.shdeleted file mode 100644index 8855300..0000000--- a/tools/hosted/tests/t12.sh+++ /dev/null@@ -1,4 +0,0 @@-cd /tmp-XNU_CPU_METAL_TRACE=1 "/Applications/Xcode.app/Contents/Applications/Icon Composer.app/Contents/Executables/ictool" /tmp/t.icon --export-image --output-file /tmp/t.png --platform macOS --rendition Default --width 16 --height 16 --scale 2 > /tmp/ic2.log 2>&1-echo "rc=$?"; grep -c . /tmp/ic2.log-grep -v "^metal2vulkan" /tmp/ic2.log | grep -i "XCM\|stub" | sort | uniq -c | sort -nr | head -40 | cut -c1-200diff --git a/tools/hosted/tests/t13.sh b/tools/hosted/tests/t13.shdeleted file mode 100644index 8f68c33..0000000--- a/tools/hosted/tests/t13.sh+++ /dev/null@@ -1,5 +0,0 @@-cd /tmp-pgrep -lx trustd; pgrep -lx securityd-xcrun swiftc trust.swift -o trust 2>&1 | tail -2; ./trust 2>&1 | tail -3-security verify-cert -c /var/root/src/Alamofire-5.10.2/Tests/Resources/Certificates/alamofire.org/alamofire-root-ca.cer 2>&1 | tail -2-log show --last 2m --style compact --predicate 'process == "trustd" OR subsystem == "com.apple.securityd"' 2>/dev/null | tail -8 | cut -c1-220diff --git a/tools/hosted/tests/t14.sh b/tools/hosted/tests/t14.shdeleted file mode 100644index fb02f1c..0000000--- a/tools/hosted/tests/t14.sh+++ /dev/null@@ -1,8 +0,0 @@-cd /tmp-xcrun clang -O1 va.c -o va && ./va-xcrun clang -g -fsanitize=thread tsan.c -o tsan 2>&1 | tail -2; ./tsan > /tmp/tsan.out 2>&1; echo "tsan rc=$?"; grep -E "WARNING: ThreadSanitizer|SUMMARY|shared =|FATAL|failed" /tmp/tsan.out | head -5-xcrun clang -g -fsanitize=address -x c - -o asan <<'C' 2>&1 | tail -2-#include <stdlib.h>-int main(void) { char *p = malloc(8); p[8] = 1; return p[0]; }-C-./asan > /tmp/asan.out 2>&1; echo "asan rc=$?"; grep -E "ERROR: AddressSanitizer|SUMMARY" /tmp/asan.out | head -3diff --git a/tools/hosted/tests/t2.sh b/tools/hosted/tests/t2.shdeleted file mode 100644index 5238a0e..0000000--- a/tools/hosted/tests/t2.sh+++ /dev/null@@ -1,4 +0,0 @@-cd /tmp-xcrun swiftc -O d.swift -o d 2>&1 | tail -3-./d 2>&1 | tail -8-log show --last 3m --style compact 2>/dev/null | grep -v "Sandbox:\|amfid\|AMFI\|kernel.development" | grep -i "metal\|gpubundle\|XnuCpu\|IOGPU\|accelerat" | cut -c1-300 | tail -20diff --git a/tools/hosted/tests/t3.sh b/tools/hosted/tests/t3.shdeleted file mode 100644index bafc1fd..0000000--- a/tools/hosted/tests/t3.sh+++ /dev/null@@ -1,5 +0,0 @@-cd /tmp-xcrun clang -fobjc-arc b.m -framework Foundation -framework Metal -o b 2>&1 | tail -3-XNU_CPU_METAL_TRACE=1 ./b 2>&1 | tail -12-echo "--- discovery with os_log on stderr"-OS_ACTIVITY_DT_MODE=YES ./m 2>&1 | grep -v "^$" | cut -c1-250 | tail -25diff --git a/tools/hosted/tests/t4.sh b/tools/hosted/tests/t4.shdeleted file mode 100644index 81a1932..0000000--- a/tools/hosted/tests/t4.sh+++ /dev/null@@ -1,6 +0,0 @@-cd /tmp-OS_ACTIVITY_DT_MODE=YES ./m 2>&1 | grep -v "^$\|Server root port\|bootstrap: unknown" | cut -c1-260 | head -40-echo "--- swift: MTLCopyAllDevices first"-printf '%s\n' 'import Metal' 'print("all:", MTLCopyAllDevices().map { $0.name })' > a.swift-xcrun swiftc a.swift -o a 2>&1 | tail -2-OS_ACTIVITY_DT_MODE=YES ./a 2>&1 | grep -v "^$\|Server root port\|bootstrap: unknown" | cut -c1-260 | head -30diff --git a/tools/hosted/tests/t5.sh b/tools/hosted/tests/t5.shdeleted file mode 100644index 190d27c..0000000--- a/tools/hosted/tests/t5.sh+++ /dev/null@@ -1,3 +0,0 @@-cd /tmp-xcrun clang s.m -framework Foundation -framework Metal -o s 2>&1 | grep -v warning | tail -4-./s 2>&1 | cut -c1-200 | head -80diff --git a/tools/hosted/tests/t6.sh b/tools/hosted/tests/t6.shdeleted file mode 100644index fa0706d..0000000--- a/tools/hosted/tests/t6.sh+++ /dev/null@@ -1,5 +0,0 @@-cd /tmp-rm -f /tmp/msgSends-*-NSObjCMessageLoggingEnabled=YES ./a > /dev/null 2>&1-f=$(ls /tmp/msgSends-* | head -1); echo "log $f $(wc -l < $f) lines"-grep -n "XnuCpuMetal\|MTLIOAccel\|IOGPUMetalDevice\|_MTLDevice\|MTLDevice" $f | grep -v "NSString\|NSMutable" | cut -c1-200 | head -60diff --git a/tools/hosted/tests/t7.sh b/tools/hosted/tests/t7.shdeleted file mode 100644index 50ed6de..0000000--- a/tools/hosted/tests/t7.sh+++ /dev/null@@ -1,3 +0,0 @@-cd /tmp-f=$(ls /tmp/msgSends-* | head -1)-sed -n '14530,14615p' $f | cut -c1-150diff --git a/tools/hosted/tests/t8.sh b/tools/hosted/tests/t8.shdeleted file mode 100644index cf77f40..0000000--- a/tools/hosted/tests/t8.sh+++ /dev/null@@ -1,5 +0,0 @@-cd /tmp-rm -f /tmp/msgSends-*-I="/Applications/Xcode.app/Contents/Applications/Icon Composer.app/Contents/Executables/ictool"-NSObjCMessageLoggingEnabled=YES "$I" /tmp/t.icon --export-image --output-file /tmp/t.png --platform macOS --rendition Default --width 16 --height 16 --scale 2 > /dev/null 2>&1-for f in /tmp/msgSends-*; do echo "== $f $(wc -l < $f)"; grep -n "XcmBackendDevice\|MTLLoader\|TargetDeviceArch" $f | tail -25 | cut -c1-160; donediff --git a/tools/hosted/tests/t9.sh b/tools/hosted/tests/t9.shdeleted file mode 100644index 072a37b..0000000--- a/tools/hosted/tests/t9.sh+++ /dev/null@@ -1,3 +0,0 @@-cd /tmp-xcrun clang arch.m -framework Foundation -framework Metal -o arch 2>&1 | grep error | head-./arch 2>&1 | grep -v "^metal2vulkan" | cut -c1-160 | head -80diff --git a/tools/hosted/tests/trust.swift b/tools/hosted/tests/trust.swiftdeleted file mode 100644index 4013844..0000000--- a/tools/hosted/tests/trust.swift+++ /dev/null@@ -1,9 +0,0 @@-import Foundation-import Security-// Does Security.framework's trust evaluation (trustd) work? URLSession HTTPS uses it; curl does not.-let sem = DispatchSemaphore(value: 0)-let task = URLSession.shared.dataTask(with: URL(string: "https://www.apple.com/")!) { data, resp, err in- print("URLSession https:", (resp as? HTTPURLResponse)?.statusCode ?? -1, data?.count ?? 0, err.map { "\($0)" } ?? "no error")- sem.signal()-}-task.resume(); _ = sem.wait(timeout: .now() + 30)diff --git a/tools/hosted/tests/tsan.c b/tools/hosted/tests/tsan.cdeleted file mode 100644index 688a55f..0000000--- a/tools/hosted/tests/tsan.c+++ /dev/null@@ -1,12 +0,0 @@-// A data race ThreadSanitizer must report-#include <pthread.h>-#include <stdio.h>-int shared;-static void *bump(void *arg) { (void)arg; for (int i = 0; i < 1000; i++) shared++; return NULL; }-int main(void) {- pthread_t a, b;- pthread_create(&a, NULL, bump, NULL); pthread_create(&b, NULL, bump, NULL);- pthread_join(a, NULL); pthread_join(b, NULL);- printf("shared = %d\n", shared);- return 0;-}diff --git a/tools/hosted/tests/va.c b/tools/hosted/tests/va.cdeleted file mode 100644index 1b2796c..0000000--- a/tools/hosted/tests/va.c+++ /dev/null@@ -1,17 +0,0 @@-// 47-bit user address space: a fixed mapping above 2^39, where nano malloc puts small blocks, and the advertised width-#include <stdio.h>-#include <stdlib.h>-#include <string.h>-#include <sys/mman.h>-#include <sys/sysctl.h>-int main(void) {- int bits = 0; size_t len = sizeof(bits);- sysctlbyname("machdep.virtual_address_size", &bits, &len, NULL, 0);- printf("machdep.virtual_address_size: %d\n", bits);- void *want = (void *)0x7f0000000000ULL;- char *p = mmap(want, 1 << 20, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0);- if (p == MAP_FAILED) { perror("mmap 0x7f0000000000"); } else { memset(p, 0x5a, 1 << 20); printf("mmap fixed %p: ok, byte %x\n", (void *)p, p[12345] & 0xff); }- void *s = malloc(16), *m = malloc(100);- printf("malloc(16) = %p, malloc(100) = %p\n", s, m);- return 0;-}