fix: save repo root path in test_installer.sh for later cd

The test script was failing because it changed directories during execution
(to /tmp/test-config/interfaces) and then tried to use a relative path
to navigate back to the repo root, which failed.

Fix: Save the absolute path to repo root at the beginning and reuse it
when needed instead of calculating it relative to the current directory.

Fixes the error: 'cd: tests/..: No such file or directory'
This commit is contained in:
torlando-tech 2025-10-29 10:25:01 -04:00
commit 5f47e995bc

View file

@ -48,6 +48,7 @@ check_package() {
echo "Running install.sh (self-contained installer)..."
# Navigate to repository root (script is in tests/ directory)
cd "$(dirname "$0")/.."
REPO_ROOT="$(pwd)"
chmod +x install.sh
mkdir -p /tmp/test-config
@ -184,7 +185,7 @@ echo ""
# Test --skip-experimental flag
echo "Testing --skip-experimental flag..."
cd "$(dirname "$0")/.."
cd "$REPO_ROOT"
# Run with --skip-experimental to verify it doesn't fail
./install.sh --config /tmp/test-config-skip --skip-experimental > /tmp/skip-test.log 2>&1 <<EOF
n