Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion e2e/run_test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ ROOT="$(cd "$SCRIPT_DIR"/.. && pwd)"
source "$SCRIPT_DIR/style.sh"

TEST="$1"
TEST_SCRIPT="$SCRIPT_DIR/$TEST"
# Handle both relative and absolute paths
if [[ $TEST == /* ]] || [[ $TEST == e2e/* ]]; then
# If it's an absolute path or already contains e2e/, use it as is
TEST_SCRIPT="$TEST"
else
# Otherwise, treat it as relative to the e2e directory
TEST_SCRIPT="$SCRIPT_DIR/$TEST"
fi

setup_isolated_env() {
TEST_ISOLATED_DIR="$(mktemp --tmpdir --directory "$(basename "$TEST").XXXXXX")"
Expand Down
17 changes: 12 additions & 5 deletions xtasks/test/e2e
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#MISE depends=["build"]
#MISE alias="e"
#MISE alias=["e", "e2e"]
#MISE description="run end-to-end tests"
set -euo pipefail

Expand All @@ -9,14 +9,21 @@ export RUST_TEST_THREADS=1
if [[ ${1:-all} == all ]]; then
./e2e/run_all_tests
else
pushd e2e
FILES="$(fd -tf "$1" --and "^test_")"
popd
# Strip e2e/ prefix if present, then extract just the filename
PATTERN="${1#e2e/}"
FILENAME="$(basename "$PATTERN")"

pushd e2e >/dev/null
FILES="$(fd -tf "$FILENAME" --and "^test_")"
popd >/dev/null

if [[ -z $FILES ]]; then
echo "Not test matches $1" >&2
echo "No test matches $1" >&2
exit 1
fi

for FILE in $FILES; do
echo "[xtask:e2e] Running test: $FILE" >&2
./e2e/run_test "$FILE"
done
fi
Loading