blob: a3d3ca4d39a07a85807dc63c48adaa5caa58fad4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/usr/bin/env bash
# Test block-clone functionality on macOS (APFS).
#
# APFS is the default filesystem on modern Macs and natively supports
# clonefile(), so no special setup is needed — just run the tests.
#
# Usage:
# ./scripts/test_scripts/block-clone-test-mac.sh [path-to-zencore-test]
#
# If no path is given, defaults to build/macosx/<arch>/debug/zencore-test
# relative to the repository root.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
ARCH="$(uname -m)"
TEST_BINARY="${1:-$REPO_ROOT/build/macosx/$ARCH/debug/zencore-test}"
if [ ! -x "$TEST_BINARY" ]; then
echo "error: test binary not found or not executable: $TEST_BINARY" >&2
echo "hint: build with 'xmake config -m debug && xmake build zencore-test'" >&2
exit 1
fi
# Verify we're on APFS
BINARY_DIR="$(dirname "$TEST_BINARY")"
FS_TYPE="$(diskutil info "$(df "$BINARY_DIR" | tail -1 | awk '{print $1}')" 2>/dev/null | grep "Type (Bundle)" | awk '{print $NF}' || true)"
if [ "$FS_TYPE" != "apfs" ]; then
echo "warning: filesystem does not appear to be APFS (got: ${FS_TYPE:-unknown}), clone tests may skip" >&2
fi
TEST_CASES="TryCloneFile,CopyFile.Clone,SupportsBlockRefCounting,CloneQueryInterface"
echo "Running block-clone tests ..."
echo "---"
"$TEST_BINARY" \
--test-suite="core.filesystem" \
--test-case="$TEST_CASES"
echo "---"
echo "All block-clone tests passed."
|