From a18f46f73e59bdcf91d25a7d104d990916d60145 Mon Sep 17 00:00:00 2001 From: Edd Barrett Date: Wed, 20 Nov 2024 09:53:26 +0000 Subject: [PATCH 1/3] Hook in the OpenResty LuaJIT test suite. https://github.com/openresty/luajit2-test-suite We run a subset of it. See comment in `run.sh` for which subset. --- .buildbot.sh | 11 ++-- .gitmodules | 3 ++ third_party_tests/luajit2-test-suite | 1 + third_party_tests/run.sh | 80 ++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 .gitmodules create mode 160000 third_party_tests/luajit2-test-suite create mode 100644 third_party_tests/run.sh diff --git a/.buildbot.sh b/.buildbot.sh index 0bdb844..233a90e 100644 --- a/.buildbot.sh +++ b/.buildbot.sh @@ -51,6 +51,11 @@ cd .. YKD_NEW_CODEGEN=1 YK_BUILD_TYPE=debug make -j `nproc` -# Run the test suite -cd tests && YKD_NEW_CODEGEN=1 YKD_SERIALISE_COMPILATION=1 \ - ../src/lua -e"_U=true" all.lua +# Run the bundled test suite. +cd tests +YKD_NEW_CODEGEN=1 YKD_SERIALISE_COMPILATION=1 ../src/lua -e"_U=true" all.lua +cd .. + +# Run third-party test suites. +cd third_party_tests +YKD_SERIALISE_COMPILATION=1 sh run.sh ../src/lua diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d30197f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "third_party_tests/luajit2-test-suite"] + path = third_party_tests/luajit2-test-suite + url = https://github.com/openresty/luajit2-test-suite diff --git a/third_party_tests/luajit2-test-suite b/third_party_tests/luajit2-test-suite new file mode 160000 index 0000000..a3a5deb --- /dev/null +++ b/third_party_tests/luajit2-test-suite @@ -0,0 +1 @@ +Subproject commit a3a5deb5d97d57fb4da567017a621ae73ee7305e diff --git a/third_party_tests/run.sh b/third_party_tests/run.sh new file mode 100644 index 0000000..2eed4f3 --- /dev/null +++ b/third_party_tests/run.sh @@ -0,0 +1,80 @@ +#!/bin/sh +# +# Run third party test suites. + +set -eu + +# OpenResty LuaJIT Tests. +# +# Selection criteria. We include tests which: +# +# - Run under regular Lua with exit status zero (success). +# +# - Don't need external native libraries, like GTK. +# +# - Don't neeed LuaJIT-specific C extensions (i.e. the ctest and cpptest +# shared objects). +# +# - Aren't an FFI test +# +# - Don't immediately exit if not run under LuaJIT, i.e. the test doesn't do +# `if not jit or not jit.status or not jit.status() then return end` +# +# - Are "portable" (i.e. not tests from the "unportable" directory) +# +# This basically amounts to a subset of the `misc` directory. Some of the +# remaining tests are still designed to test something specific about LuaJIT, +# but there's no harm in runing them anyway. +# +# To skip a test, prefix the file name with `-` and add a comment below saying +# why. +ORSTY_MISC_TESTS="ack.lua ack_notail.lua alias_alloc.lua \ + assign_tset_prevnil.lua assign_tset_tmp.lua cat_jit.lua constov.lua \ + coro_traceback.lua coro_yield.lua dse_array.lua dse_field.lua dualnum.lua \ + exit_frame.lua exit_growstack.lua fac.lua fastfib.lua fib.lua for_dir.lua \ + fori_coerce.lua fuse.lua fwd_hrefk_rollback.lua fwd_tnew_tdup.lua \ + fwd_upval.lua gc_rechain.lua hook_line.lua iter-bug.lua jit_record.lua \ + jloop-itern-stack-check-fix.lua kfold.lua loop_unroll.lua math_random.lua \ + meta_arith_jit.lua meta_arith.lua meta_cat.lua meta_comp.lua meta_eq.lua \ + meta_framegap.lua meta_getset.lua meta_nomm.lua meta_pairs.lua \ + meta_tget.lua meta_tset.lua meta_tset_nilget.lua meta_tset_resize.lua \ + meta_tset_str.lua multi_result_call_next.lua nsieve.lua pairs_bug.lua \ + parse_comp.lua parse_hex.lua pcall_jit.lua phi_copyspill.lua \ + phi_rot18.lua phi_rot8.lua phi_rot9.lua phi_rotx.lua recsum.lua \ + recsump.lua recurse_tail.lua select.lua self.lua sink_alloc.lua \ + sink_nosink.lua snap_gcexit.lua snap_top.lua sort.lua stack_gc.lua \ + stackovc.lua stackov.lua stitch.lua strcmp.lua string_char.lua \ + string_op.lua string_sub_opt.lua table_alias.lua table_insert.lua \ + table_remove.lua tak.lua tcall_base.lua tcall_loop.lua tlen_loop.lua \ + tnew_tdup.lua uclo.lua unordered_jit.lua unordered.lua vararg_jit.lua \ + wbarrier_jit.lua wbarrier.lua wbarrier_obar.lua xpcall_jit.lua" + +if [ $# -ne 1 ]; then + echo "usage: $0 " + exit 1 +fi + +lua=$1 +failed="" + +# Run the OpenResty LuaJIT tests. +for t in $ORSTY_MISC_TESTS; do + if [ "${t#-}" != "$t" ]; then + echo "-> Skipping $t" + else + echo "-> Running $t" + if ! $lua luajit2-test-suite/test/misc/$t; then + echo "FAILED" + failed="$failed $t" + fi + fi +done + +# Report any test failures. +if [ ! -z "$failed" ]; then + echo "The following tests failed:" + for t in $failed; do + echo " $t" + done + exit 1 +fi From dc984ac0776c3611c06b2d196b0d5a4315c47a58 Mon Sep 17 00:00:00 2001 From: Edd Barrett Date: Fri, 13 Dec 2024 14:57:06 +0000 Subject: [PATCH 2/3] Fix docker warning. https://docs.docker.com/reference/build-checks/json-args-recommended/ --- .buildbot_dockerfile_debian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildbot_dockerfile_debian b/.buildbot_dockerfile_debian index 4145509..1a6462f 100644 --- a/.buildbot_dockerfile_debian +++ b/.buildbot_dockerfile_debian @@ -19,4 +19,4 @@ RUN useradd -m -u ${CI_UID} ci && chown ${CI_UID}:${CI_UID} . ARG CI_RUNNER ENV CI_RUNNER=${CI_RUNNER} COPY --chown=${CI_UID}:${CI_UID} . . -CMD sh -x .buildbot.sh +CMD ["sh", "-x", ".buildbot.sh"] From bfac49068103f2ed1c498a198a90b9e0cf992270 Mon Sep 17 00:00:00 2001 From: Edd Barrett Date: Fri, 13 Dec 2024 15:16:32 +0000 Subject: [PATCH 3/3] Remove old references to YKD_NEW_CODEGEN --- .buildbot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildbot.sh b/.buildbot.sh index 233a90e..dc54277 100644 --- a/.buildbot.sh +++ b/.buildbot.sh @@ -49,11 +49,11 @@ YKB_YKLLVM_BUILD_ARGS="define:CMAKE_C_COMPILER=/usr/bin/clang,define:CMAKE_CXX_C export PATH=`pwd`/bin:${PATH} cd .. -YKD_NEW_CODEGEN=1 YK_BUILD_TYPE=debug make -j `nproc` +YK_BUILD_TYPE=debug make -j `nproc` # Run the bundled test suite. cd tests -YKD_NEW_CODEGEN=1 YKD_SERIALISE_COMPILATION=1 ../src/lua -e"_U=true" all.lua +YKD_SERIALISE_COMPILATION=1 ../src/lua -e"_U=true" all.lua cd .. # Run third-party test suites.