formats-luau foundation: build (darklua + token passes) for Roblox and LuaJIT, compat prelude, core, Types, host adapters, API + registry, lint, tests on both runtimes; absorb deflate (codecs/Deflate + new compressor) and png (image/png + new encoder)
This commit is contained in:
commit
cdcb5b0b77
226 files changed
+8409
No files matched your search
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tests (bash tools/test.sh [filter]): generate the fixtures (tools/fixtures.py -> tests/gen), regenerate the registry,
|
||||
# build both targets (tools/build.py), then run every tests/**/*.luau twice: under `luau --codegen -O2` (the source,
|
||||
# through the .luaurc aliases) and under `luajit` (build/luajit/tests/**/*.lua, with the compat prelude), then the lint.
|
||||
# A filter runs only the tests whose path contains it (and the fixture generators whose name contains it), and skips
|
||||
# the lint. RUNTIMES="luau" or "luajit" runs one runtime only.
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
LUAU=${LUAU:-$(command -v luau || nix shell nixpkgs#luau -c sh -c 'command -v luau')}
|
||||
LUAJIT=${LUAJIT:-$(command -v luajit || nix shell nixpkgs#luajit -c sh -c 'command -v luajit')}
|
||||
RUNTIMES=${RUNTIMES:-"luau luajit"}
|
||||
LJPATH='package.path = "build/luajit/?.lua;build/luajit/?/init.lua;" .. package.path'
|
||||
fail=0
|
||||
python3 -I tools/fixtures.py $1 || { echo "FAILED: fixtures"; exit 1; }
|
||||
python3 -I tools/gen_registry.py > /dev/null || { echo "FAILED: gen_registry"; exit 1; }
|
||||
python3 -I tools/build.py || { echo "FAILED: build"; exit 1; }
|
||||
passed=0
|
||||
for t in $(find tests -name '*.luau' -not -path 'tests/gen/*' -not -path 'tests/fixtures/*' -not -name 'T.luau' | sort); do
|
||||
[ -n "$1" ] && [[ "$t" != *$1* ]] && continue
|
||||
for rt in $RUNTIMES; do
|
||||
echo "== $t ($rt)"
|
||||
if [ "$rt" = luau ]; then
|
||||
"$LUAU" --codegen -O2 "$t" || { echo "FAILED: $t ($rt)"; fail=1; continue; }
|
||||
else
|
||||
"$LUAJIT" -e "$LJPATH" "build/luajit/${t%.luau}.lua" || { echo "FAILED: $t ($rt)"; fail=1; continue; }
|
||||
fi
|
||||
passed=$((passed + 1))
|
||||
done
|
||||
done
|
||||
if [ -z "$1" ]; then
|
||||
bash tools/lint.sh || fail=1
|
||||
fi
|
||||
[ $fail -eq 0 ] && echo "formats-luau: all tests passed ($passed runs)" || echo "formats-luau: FAILURES"
|
||||
exit $fail
|
||||
Reference in new issue
Block a user