Skip to content

Commit cde1675

Browse files
authored
Merge pull request DeusData#783 from SS-42/test/smoke-dry-run-isolation
Isolate smoke-test dry-run state
2 parents 62594c6 + 9e57c6c commit cde1675

1 file changed

Lines changed: 26 additions & 7 deletions

File tree

‎scripts/smoke-test.sh‎

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ set -euo pipefail
1212
BINARY="${1:?usage: smoke-test.sh <binary-path>}"
1313
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd)"
1414
TMPDIR=$(mktemp -d)
15+
DRYRUN_HOME=""
1516
# On MSYS2/Windows, convert POSIX path to native Windows path for the binary
1617
if command -v cygpath &>/dev/null; then
1718
TMPDIR=$(cygpath -m "$TMPDIR")
1819
fi
19-
trap 'rm -rf "$TMPDIR"' EXIT
20+
trap 'rm -rf "$TMPDIR" "${DRYRUN_HOME:-}"' EXIT
2021

2122
CLI_STDERR=$(mktemp)
2223
cli() { "$BINARY" cli "$@" 2>"$CLI_STDERR"; }
@@ -679,9 +680,27 @@ rm -f "$MCP_CL_INPUT" "$MCP_CL_OUTPUT" "$MCP_TOOL_INPUT" "$MCP_TOOL_OUTPUT"
679680
echo ""
680681
echo "=== Phase 6: CLI subcommands ==="
681682

683+
DRYRUN_HOME=$(mktemp -d)
684+
DRYRUN_CACHE="$DRYRUN_HOME/.cache/codebase-memory-mcp"
685+
mkdir -p "$DRYRUN_CACHE" \
686+
"$DRYRUN_HOME/.local/bin" \
687+
"$DRYRUN_HOME/.config" \
688+
"$DRYRUN_HOME/AppData/Roaming" \
689+
"$DRYRUN_HOME/AppData/Local"
690+
691+
run_dryrun_env() {
692+
HOME="$DRYRUN_HOME" \
693+
XDG_CONFIG_HOME="$DRYRUN_HOME/.config" \
694+
APPDATA="$DRYRUN_HOME/AppData/Roaming" \
695+
LOCALAPPDATA="$DRYRUN_HOME/AppData/Local" \
696+
CBM_CACHE_DIR="$DRYRUN_CACHE" \
697+
PATH="$DRYRUN_HOME/.local/bin:$PATH" \
698+
"$@"
699+
}
700+
682701
# 6a: install --dry-run -y
683702
echo "--- Phase 6a: install --dry-run ---"
684-
INSTALL_OUT=$("$BINARY" install --dry-run -y 2>&1)
703+
INSTALL_OUT=$(run_dryrun_env "$BINARY" install --dry-run -y 2>&1)
685704
if ! echo "$INSTALL_OUT" | grep -qi 'install\|skill\|mcp\|agent'; then
686705
echo "FAIL: install --dry-run produced unexpected output"
687706
echo "$INSTALL_OUT"
@@ -695,7 +714,7 @@ echo "OK: install --dry-run completed"
695714

696715
# 6b: uninstall --dry-run -y
697716
echo "--- Phase 6b: uninstall --dry-run ---"
698-
UNINSTALL_OUT=$("$BINARY" uninstall --dry-run -y 2>&1)
717+
UNINSTALL_OUT=$(run_dryrun_env "$BINARY" uninstall --dry-run -y 2>&1)
699718
if ! echo "$UNINSTALL_OUT" | grep -qi 'uninstall\|remov'; then
700719
echo "FAIL: uninstall --dry-run produced unexpected output"
701720
echo "$UNINSTALL_OUT"
@@ -705,7 +724,7 @@ echo "OK: uninstall --dry-run completed"
705724

706725
# 6c: update --dry-run --standard -y
707726
echo "--- Phase 6c: update --dry-run ---"
708-
UPDATE_OUT=$("$BINARY" update --dry-run --standard -y 2>&1)
727+
UPDATE_OUT=$(run_dryrun_env "$BINARY" update --dry-run --standard -y 2>&1)
709728
if ! echo "$UPDATE_OUT" | grep -qi 'dry-run'; then
710729
echo "FAIL: update --dry-run did not indicate dry-run mode"
711730
echo "$UPDATE_OUT"
@@ -730,13 +749,13 @@ echo "OK: update --dry-run --standard completed"
730749

731750
# 6d: config set/get/reset round-trip
732751
echo "--- Phase 6d: config set/get/reset ---"
733-
"$BINARY" config set auto_index true 2>/dev/null
734-
CONFIG_VAL=$("$BINARY" config get auto_index 2>/dev/null)
752+
run_dryrun_env "$BINARY" config set auto_index true 2>/dev/null
753+
CONFIG_VAL=$(run_dryrun_env "$BINARY" config get auto_index 2>/dev/null)
735754
if ! echo "$CONFIG_VAL" | grep -q 'true'; then
736755
echo "FAIL: config get auto_index returned '$CONFIG_VAL', expected 'true'"
737756
exit 1
738757
fi
739-
"$BINARY" config reset auto_index 2>/dev/null
758+
run_dryrun_env "$BINARY" config reset auto_index 2>/dev/null
740759
echo "OK: config set/get/reset round-trip"
741760

742761
# 6e: Simulated binary replacement (update flow without network)

0 commit comments

Comments
 (0)