2020-11-14 17:28:17 +03:00
|
|
|
#!/usr/bin/env sh
|
2017-09-08 13:24:57 +03:00
|
|
|
|
2017-11-22 14:42:32 +03:00
|
|
|
set -e; # will make the script stop if there are any errors
|
2018-05-19 07:48:41 +03:00
|
|
|
set -u; # will make the script stop if there is use of undefined
|
|
|
|
|
|
|
|
NO_SDL=0
|
2020-11-19 00:29:13 +03:00
|
|
|
if [ $# -gt 0 ] && [ "$1" = "--no_sdl" ]; then
|
2018-05-19 07:48:41 +03:00
|
|
|
NO_SDL=1
|
|
|
|
fi
|
2017-11-22 14:42:32 +03:00
|
|
|
|
2020-11-09 13:47:15 +03:00
|
|
|
./scripts/build.sh
|
2019-09-24 22:56:12 +03:00
|
|
|
|
2020-11-19 22:36:54 +03:00
|
|
|
echo "Build and run some examples"
|
|
|
|
./test/execute.sh ./examples/functor.carp
|
|
|
|
./test/execute.sh ./examples/external_struct.carp
|
|
|
|
./test/execute.sh ./examples/updating.carp
|
|
|
|
./test/execute.sh ./examples/sorting.carp
|
|
|
|
./test/execute.sh ./examples/generic_structs.carp
|
|
|
|
./test/execute.sh ./examples/maps.carp
|
|
|
|
./test/execute.sh ./examples/sumtypes.carp
|
|
|
|
|
2020-11-23 08:30:43 +03:00
|
|
|
echo "Build and run some tests that print (check their output)"
|
|
|
|
./test/execute.sh ./test/produces-output/basics.carp
|
|
|
|
./test/execute.sh ./test/produces-output/function_members.carp
|
|
|
|
./test/execute.sh ./test/produces-output/globals.carp
|
|
|
|
./test/execute.sh ./test/produces-output/lambdas.carp
|
|
|
|
./test/execute.sh ./test/produces-output/setting_variables.carp
|
2021-06-15 09:02:44 +03:00
|
|
|
./test/execute.sh ./test/produces-output/repl.carp
|
2020-11-23 08:30:43 +03:00
|
|
|
|
2020-11-19 22:36:54 +03:00
|
|
|
echo "Actual tests (using the test suite)"
|
|
|
|
for f in ./test/*.carp; do
|
|
|
|
echo $f
|
|
|
|
./scripts/carp.sh -x --log-memory $f
|
|
|
|
echo
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Test for correct error messages when doing "carp --check" on the source."
|
2020-11-28 15:11:43 +03:00
|
|
|
for f in ./test/test-for-errors/*.carp; do
|
2020-11-19 22:36:54 +03:00
|
|
|
echo $f
|
|
|
|
./test/check.sh $f
|
|
|
|
done
|
|
|
|
|
2020-11-23 08:30:43 +03:00
|
|
|
echo "Make sure the benchmarks compile."
|
|
|
|
for f in ./bench/*.carp; do
|
|
|
|
echo $f
|
|
|
|
./scripts/carp.sh -b $f
|
|
|
|
done
|
|
|
|
|
2020-11-19 22:36:54 +03:00
|
|
|
echo "Compile-only examples"
|
|
|
|
compileOnlyExamples="\
|
|
|
|
examples/mutual_recursion.carp \
|
2020-11-23 08:30:43 +03:00
|
|
|
examples/guessing_game.carp \
|
|
|
|
examples/unicode.carp \
|
2021-02-04 10:35:48 +03:00
|
|
|
examples/benchmark_*.carp \
|
2020-11-19 22:36:54 +03:00
|
|
|
examples/nested_lambdas.carp
|
|
|
|
"
|
|
|
|
|
|
|
|
for e in $compileOnlyExamples ; do
|
|
|
|
echo $e
|
|
|
|
./scripts/carp.sh $e -b
|
|
|
|
done
|
|
|
|
|
2020-11-23 08:30:43 +03:00
|
|
|
# Make sure a no-core build works
|
2020-11-19 22:36:54 +03:00
|
|
|
echo ./examples/no_core.carp
|
|
|
|
./scripts/carp.sh ./examples/no_core.carp --no-core --no-profile -b
|
|
|
|
|
|
|
|
# Run tests which rely on SDL unless the `--no_sdl` argument was passed in
|
|
|
|
if [ ${NO_SDL} -eq 0 ]; then
|
|
|
|
echo "Compile-only SDL examples"
|
|
|
|
compileOnlySdlExamples="
|
2020-11-23 08:30:43 +03:00
|
|
|
examples/langtons_ant.carp
|
|
|
|
examples/reptile.carp
|
|
|
|
examples/carp_demo.carp
|
|
|
|
examples/minimal_sdl.carp
|
|
|
|
examples/sounds.carp
|
|
|
|
examples/fonts.carp
|
|
|
|
"
|
2020-11-19 22:36:54 +03:00
|
|
|
|
|
|
|
for e in $compileOnlySdlExamples ; do
|
|
|
|
echo $e
|
|
|
|
./scripts/carp.sh $e -b
|
|
|
|
done
|
|
|
|
fi
|
2018-05-19 07:48:41 +03:00
|
|
|
|
2019-09-21 00:39:04 +03:00
|
|
|
# Generate docs
|
2020-11-09 13:47:15 +03:00
|
|
|
./scripts/carp.sh ./docs/core/generate_core_docs.carp
|
2020-05-11 14:59:19 +03:00
|
|
|
|
|
|
|
# Generate SDL docs unless the `--no_sdl` argument was passed in
|
2020-11-19 00:29:13 +03:00
|
|
|
if [ ${NO_SDL} -eq 0 ]; then
|
2020-11-09 13:47:15 +03:00
|
|
|
./scripts/carp.sh ./docs/sdl/generate_sdl_docs.carp
|
2020-05-11 14:59:19 +03:00
|
|
|
fi
|
2018-03-27 11:52:17 +03:00
|
|
|
|
2017-12-14 00:09:12 +03:00
|
|
|
echo "ALL TESTS DONE."
|