Files
mac_linuxgpu/scripts/test-xarray-safety.sh
T
geramyloveless 953cf0149c mac_linuxgpu: upstream Linux amdgpu on macOS
Runs the unmodified upstream Linux amdgpu and amdkfd drivers on Apple
Silicon Macs inside a DriverKit system extension, for AMD GPUs attached
over Thunderbolt. The Linux sources come from a pinned submodule and are
compiled against linuxu, a userspace implementation of the Linux kernel
APIs they use. Includes the HSA runtime, the host installer app, the
setup and firmware fetch scripts, and the offline test suite.
2026-10-02 18:49:17 -07:00

18 lines
965 B
Bash

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
work=$(mktemp -d "${TMPDIR:-/tmp}/xarray-safety.XXXXXX")
trap 'rm -rf "$work"' EXIT
common=(-w -std=gnu11 -g -O1 -fsanitize=address,undefined -fno-sanitize-recover=all
-ffunction-sections -fdata-sections -Ilinuxu/headers)
heap=(-Dmalloc=dext_test_malloc -Dcalloc=dext_test_calloc -Drealloc=dext_test_realloc
-Daligned_alloc=dext_test_aligned_alloc -Dfree=dext_test_free
-Dstrdup=dext_test_strdup -Dstrndup=dext_test_strndup)
clang "${common[@]}" -c linuxu/tests/dext_heap_backend.c -o "$work/backend.o"
clang "${common[@]}" "${heap[@]}" -DLINUXU_DEXT_DK=1 -c linuxu/src/shims/dext_alloc.c -o "$work/heap.o"
mkdir -p build/tests
clang "${common[@]}" "${heap[@]}" linuxu/tests/test_xarray_safety.c \
linuxu/src/xarray.c linuxu/src/rcu.c linuxu/src/sync.c "$work/heap.o" "$work/backend.o" \
-Wl,-dead_strip -lpthread -o build/tests/test_xarray_safety
build/tests/test_xarray_safety