Remove hardcoded home path from test scripts
Share directories are now created under \$DATA_ROOT/<peer>/share/ with generated dummy files instead of pointing at /home/frejoh/Downloads. Tests are now fully self-contained and safe to share. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
15
test-tui.sh
15
test-tui.sh
@@ -19,6 +19,15 @@ CYAN='\033[0;36m'; DIM='\033[2m'; BOLD='\033[1m'; RESET='\033[0m'
|
||||
rm -rf "$DATA_ROOT"
|
||||
mkdir -p "$DATA_ROOT/bin"
|
||||
|
||||
# Seed per-peer share directories with dummy files.
|
||||
mkdir -p "$DATA_ROOT/alice/share" "$DATA_ROOT/bob/share" "$DATA_ROOT/charlie/share"
|
||||
echo "alice's notes" > "$DATA_ROOT/alice/share/notes.txt"
|
||||
dd if=/dev/urandom bs=1K count=64 2>/dev/null | base64 > "$DATA_ROOT/alice/share/photo.jpg.b64"
|
||||
dd if=/dev/urandom bs=1K count=128 2>/dev/null | base64 > "$DATA_ROOT/bob/share/archive.tar.b64"
|
||||
echo -e "file1.mp3\nfile2.mp3" > "$DATA_ROOT/bob/share/playlist.m3u"
|
||||
echo "charlie's doc" > "$DATA_ROOT/charlie/share/document.txt"
|
||||
echo "#!/bin/sh" > "$DATA_ROOT/charlie/share/script.sh"
|
||||
|
||||
# Kill any leftover processes holding our fixed ports.
|
||||
for port in "$ANCHOR_PORT" "$ALICE_IPC" "$BOB_IPC" "$CHARLIE_IPC"; do
|
||||
pid=$(lsof -ti tcp:"$port" 2>/dev/null || true)
|
||||
@@ -91,17 +100,17 @@ ANCHOR_URL="ws://127.0.0.1:${ANCHOR_PORT}/ws"
|
||||
# Daemons
|
||||
"$DATA_ROOT/bin/waste-daemon" -alias alice -data-dir "$DATA_ROOT/alice" \
|
||||
-ipc-port "$ALICE_IPC" -anchor "$ANCHOR_URL" \
|
||||
-share-dir "/home/frejoh/Downloads/alice" 2>/dev/null &
|
||||
-share-dir "$DATA_ROOT/alice/share" 2>/dev/null &
|
||||
PIDS+=($!)
|
||||
|
||||
"$DATA_ROOT/bin/waste-daemon" -alias bob -data-dir "$DATA_ROOT/bob" \
|
||||
-ipc-port "$BOB_IPC" -anchor "$ANCHOR_URL" \
|
||||
-share-dir "/home/frejoh/Downloads/bob" 2>/dev/null &
|
||||
-share-dir "$DATA_ROOT/bob/share" 2>/dev/null &
|
||||
PIDS+=($!)
|
||||
|
||||
"$DATA_ROOT/bin/waste-daemon" -alias charlie -data-dir "$DATA_ROOT/charlie" \
|
||||
-ipc-port "$CHARLIE_IPC" -anchor "$ANCHOR_URL" \
|
||||
-share-dir "/home/frejoh/Downloads/charlie" 2>/dev/null &
|
||||
-share-dir "$DATA_ROOT/charlie/share" 2>/dev/null &
|
||||
PIDS+=($!)
|
||||
|
||||
wait_port "$ALICE_IPC"
|
||||
|
||||
Reference in New Issue
Block a user