WEFT_OS/scripts/wsl-test.sh
Marco Allegretti 97ea969075 feat: weft-mount-helper -- setuid helper for EROFS+dm-verity mounts
New crate: weft-mount-helper. A privileged helper binary that sets up
dm-verity devices and mounts EROFS images for app isolation.

Commands:
  mount <img> <hash_dev> <root_hash> <mountpoint>
    - opens a named dm-verity device via veritysetup open
    - mounts the resulting /dev/mapper/<name> as EROFS read-only
    - cleans up the dm device if mount fails
  umount <mountpoint>
    - unmounts the mountpoint
    - closes the dm-verity device via veritysetup close

Device naming: derives a stable name from the mountpoint path, limited
to 31 chars (DM limit), always prefixed weft-. Root check reads
/proc/self/status euid rather than using unsafe libc calls.

Tests: device_name_sanitizes_path, device_name_truncates_long_paths.
2026-03-11 15:43:59 +01:00

46 lines
1 KiB
Bash

#!/usr/bin/env bash
set -e
PROJECT="/mnt/c/Users/might/Desktop/Development/Systems/WEFT OS"
FAKE_PC_DIR="$HOME/.local/fake-pkgconfig"
mkdir -p "$FAKE_PC_DIR"
cat > "$FAKE_PC_DIR/libdisplay-info.pc" << 'EOF'
prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib64
includedir=/usr/include
Name: libdisplay-info
Description: EDID and DisplayID library (version shim for cargo check)
Version: 0.2.9
Libs: -L${libdir} -ldisplay-info
Cflags: -I${includedir}
EOF
source "$HOME/.cargo/env"
export PKG_CONFIG_PATH="$FAKE_PC_DIR:/usr/lib64/pkgconfig:/usr/share/pkgconfig"
cd "$PROJECT"
echo "==> cargo test -p weft-compositor"
cargo test -p weft-compositor 2>&1
echo ""
echo "==> cargo test -p weft-appd"
cargo test -p weft-appd -- --test-threads=1 2>&1
echo ""
echo "==> cargo test -p weft-runtime"
cargo test -p weft-runtime -- --test-threads=1 2>&1
echo ""
echo "==> cargo test -p weft-pack"
cargo test -p weft-pack -- --test-threads=1 2>&1
echo ""
echo "==> cargo test -p weft-mount-helper"
cargo test -p weft-mount-helper -- --test-threads=1 2>&1
echo ""
echo "ALL DONE"