Skip to content

Commit 612bdee

Browse files
authored
test: lake: more robust tests/serve (#4346)
In Lake's `tests/serve`, save server log to a file and give it a timeout (one smaller than CMake's).
1 parent 28cf1cf commit 612bdee

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/lake/tests/serve/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/lakefile.lean
2+
/serve.log

src/lake/tests/serve/clean.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rm -rf .lake lakefile.lean
1+
rm -rf .lake lakefile.lean serve.log

src/lake/tests/serve/test.sh

+2-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ echo "does not compile" > lakefile.lean
2525
# ---
2626

2727
MSGS="$INIT_REQ$INITD_NOT$SD_REQ$EXIT_NOT"
28-
echo -n "$MSGS" | ${LAKE:-../../.lake/build/bin/lake} serve >/dev/null
28+
echo -n "$MSGS" | ${LAKE:-../../.lake/build/bin/lake} serve > serve.log
2929
echo "tested 49"
3030

3131
# ---
@@ -34,12 +34,9 @@ echo "tested 49"
3434
# ---
3535

3636
# Test that `lake setup-file` produces the error from `LAKE_INVALID_CONFIG`
37-
set -x
38-
# NOTE: For some reason, using `!` here does not work on macOS
3937
(LAKE_INVALID_CONFIG=$'foo\n' $LAKE setup-file ./Irrelevant.lean 2>&1 && exit 1 || true) | grep --color foo
40-
set +x
4138

4239
# Test that `lake serve` produces the `Invalid Lake configuration message`.
4340
MSGS="$INIT_REQ$INITD_NOT$OPEN_REQ"
44-
grep -q "Invalid Lake configuration" < <(set +e; (echo -n "$MSGS" && $TAIL --pid=$$ -f /dev/null) | $LAKE serve)
41+
grep -q "Invalid Lake configuration" <(set +e; (echo -n "$MSGS" && $TAIL --pid=$$ -f /dev/null) | timeout 30s $LAKE serve | tee serve.log)
4542
echo "tested 116"

0 commit comments

Comments
 (0)