chore(env): rename test env sample
This commit is contained in:
parent
96efe21b50
commit
7831ae5a7b
@ -50,7 +50,7 @@ Two independent timeout layers, ordered so the finer one fires first.
|
|||||||
|
|
||||||
**Layer 1 — `libtest` per-case timeout (primary).** [`apis/libtest.lua`](../../packages/trapos-test/apis/libtest.lua) races each test case against a timer with `parallel.waitForAny(runner, timer)`. The default is `DEFAULT_TIMEOUT_SECONDS = 3`. When the timer wins, the case fails with a distinct message containing the token `libtest timeout` and, in `--verbose`, an extra `TIMEOUT … (libtest)` diagnostic. `--timeout <seconds>` overrides the default; `--no-timeout` disables the layer. `runtest` forwards both flags to each case script. This only interrupts cases that yield (the usual hang); a non-yielding CPU loop cannot be preempted in ComputerCraft.
|
**Layer 1 — `libtest` per-case timeout (primary).** [`apis/libtest.lua`](../../packages/trapos-test/apis/libtest.lua) races each test case against a timer with `parallel.waitForAny(runner, timer)`. The default is `DEFAULT_TIMEOUT_SECONDS = 3`. When the timer wins, the case fails with a distinct message containing the token `libtest timeout` and, in `--verbose`, an extra `TIMEOUT … (libtest)` diagnostic. `--timeout <seconds>` overrides the default; `--no-timeout` disables the layer. `runtest` forwards both flags to each case script. This only interrupts cases that yield (the usual hang); a non-yielding CPU loop cannot be preempted in ComputerCraft.
|
||||||
|
|
||||||
**Layer 2 — shell watchdog (backstop).** The `Justfile` `test:` recipe keeps its `TRAPOS_TEST_TIMEOUT_SECONDS` watchdog as an independent double-check. Its default matches the libtest default (`.env.test` ships `3`; the recipe falls back to `3`) so libtest fires first for yielding cases in normal runs and the watchdog only catches what Lua cannot — a non-yielding loop, a wedged libtest, or a deliberately bypassed case. Its SIGTERM message is worded differently from the `libtest timeout` message, so the two layers are never confused.
|
**Layer 2 — shell watchdog (backstop).** The `Justfile` `test:` recipe keeps its `TRAPOS_TEST_TIMEOUT_SECONDS` watchdog as an independent double-check. Its default matches the libtest default (`env.sample` ships `3`; the recipe falls back to `3`) so libtest fires first for yielding cases in normal runs and the watchdog only catches what Lua cannot — a non-yielding loop, a wedged libtest, or a deliberately bypassed case. Its SIGTERM message is worded differently from the `libtest timeout` message, so the two layers are never confused.
|
||||||
|
|
||||||
### How to write tests properly
|
### How to write tests properly
|
||||||
|
|
||||||
|
|||||||
@ -39,5 +39,5 @@ generate-env:
|
|||||||
printf '%s\n' "$line"
|
printf '%s\n' "$line"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done < .env.test > .env
|
done < env.sample > .env
|
||||||
printf '%s\n' 'Generated .env'
|
printf '%s\n' 'Generated .env'
|
||||||
|
|||||||
@ -20,7 +20,7 @@ _craftos-test *args: stage
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
|
|
||||||
if [ -f .env.test ]; then set -a; . ./.env.test; set +a; fi
|
if [ -f env.sample ]; then set -a; . ./env.sample; set +a; fi
|
||||||
|
|
||||||
pretty=0
|
pretty=0
|
||||||
has_output=0
|
has_output=0
|
||||||
@ -98,7 +98,7 @@ _timeout-fixture script shell_timeout extra_flag expect: check-install stage
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
repo='{{justfile_directory()}}'
|
repo='{{justfile_directory()}}'
|
||||||
if [ -f "$repo/.env.test" ]; then set -a; . "$repo/.env.test"; set +a; fi
|
if [ -f "$repo/env.sample" ]; then set -a; . "$repo/env.sample"; set +a; fi
|
||||||
rom_arg=""
|
rom_arg=""
|
||||||
if [ "$(uname -s)" = "Darwin" ]; then
|
if [ "$(uname -s)" = "Darwin" ]; then
|
||||||
rom_arg="--rom /Applications/CraftOS-PC.app/Contents/Resources"
|
rom_arg="--rom /Applications/CraftOS-PC.app/Contents/Resources"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user