Skip to content

Commit c45c4cc

Browse files
authored
Merge pull request #98 from vext01/more-tests
Add OpenResty LuaJIT tests.
2 parents 7ced271 + bfac490 commit c45c4cc

File tree

5 files changed

+94
-5
lines changed

5 files changed

+94
-5
lines changed

.buildbot.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@ YKB_YKLLVM_BUILD_ARGS="define:CMAKE_C_COMPILER=/usr/bin/clang,define:CMAKE_CXX_C
4949
export PATH=`pwd`/bin:${PATH}
5050
cd ..
5151

52-
YKD_NEW_CODEGEN=1 YK_BUILD_TYPE=debug make -j `nproc`
52+
YK_BUILD_TYPE=debug make -j `nproc`
5353

54-
# Run the test suite
55-
cd tests && YKD_NEW_CODEGEN=1 YKD_SERIALISE_COMPILATION=1 \
56-
../src/lua -e"_U=true" all.lua
54+
# Run the bundled test suite.
55+
cd tests
56+
YKD_SERIALISE_COMPILATION=1 ../src/lua -e"_U=true" all.lua
57+
cd ..
58+
59+
# Run third-party test suites.
60+
cd third_party_tests
61+
YKD_SERIALISE_COMPILATION=1 sh run.sh ../src/lua

.buildbot_dockerfile_debian

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ RUN useradd -m -u ${CI_UID} ci && chown ${CI_UID}:${CI_UID} .
1919
ARG CI_RUNNER
2020
ENV CI_RUNNER=${CI_RUNNER}
2121
COPY --chown=${CI_UID}:${CI_UID} . .
22-
CMD sh -x .buildbot.sh
22+
CMD ["sh", "-x", ".buildbot.sh"]

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "third_party_tests/luajit2-test-suite"]
2+
path = third_party_tests/luajit2-test-suite
3+
url = https://github.com/openresty/luajit2-test-suite

third_party_tests/luajit2-test-suite

Submodule luajit2-test-suite added at a3a5deb

third_party_tests/run.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/sh
2+
#
3+
# Run third party test suites.
4+
5+
set -eu
6+
7+
# OpenResty LuaJIT Tests.
8+
#
9+
# Selection criteria. We include tests which:
10+
#
11+
# - Run under regular Lua with exit status zero (success).
12+
#
13+
# - Don't need external native libraries, like GTK.
14+
#
15+
# - Don't neeed LuaJIT-specific C extensions (i.e. the ctest and cpptest
16+
# shared objects).
17+
#
18+
# - Aren't an FFI test
19+
#
20+
# - Don't immediately exit if not run under LuaJIT, i.e. the test doesn't do
21+
# `if not jit or not jit.status or not jit.status() then return end`
22+
#
23+
# - Are "portable" (i.e. not tests from the "unportable" directory)
24+
#
25+
# This basically amounts to a subset of the `misc` directory. Some of the
26+
# remaining tests are still designed to test something specific about LuaJIT,
27+
# but there's no harm in runing them anyway.
28+
#
29+
# To skip a test, prefix the file name with `-` and add a comment below saying
30+
# why.
31+
ORSTY_MISC_TESTS="ack.lua ack_notail.lua alias_alloc.lua \
32+
assign_tset_prevnil.lua assign_tset_tmp.lua cat_jit.lua constov.lua \
33+
coro_traceback.lua coro_yield.lua dse_array.lua dse_field.lua dualnum.lua \
34+
exit_frame.lua exit_growstack.lua fac.lua fastfib.lua fib.lua for_dir.lua \
35+
fori_coerce.lua fuse.lua fwd_hrefk_rollback.lua fwd_tnew_tdup.lua \
36+
fwd_upval.lua gc_rechain.lua hook_line.lua iter-bug.lua jit_record.lua \
37+
jloop-itern-stack-check-fix.lua kfold.lua loop_unroll.lua math_random.lua \
38+
meta_arith_jit.lua meta_arith.lua meta_cat.lua meta_comp.lua meta_eq.lua \
39+
meta_framegap.lua meta_getset.lua meta_nomm.lua meta_pairs.lua \
40+
meta_tget.lua meta_tset.lua meta_tset_nilget.lua meta_tset_resize.lua \
41+
meta_tset_str.lua multi_result_call_next.lua nsieve.lua pairs_bug.lua \
42+
parse_comp.lua parse_hex.lua pcall_jit.lua phi_copyspill.lua \
43+
phi_rot18.lua phi_rot8.lua phi_rot9.lua phi_rotx.lua recsum.lua \
44+
recsump.lua recurse_tail.lua select.lua self.lua sink_alloc.lua \
45+
sink_nosink.lua snap_gcexit.lua snap_top.lua sort.lua stack_gc.lua \
46+
stackovc.lua stackov.lua stitch.lua strcmp.lua string_char.lua \
47+
string_op.lua string_sub_opt.lua table_alias.lua table_insert.lua \
48+
table_remove.lua tak.lua tcall_base.lua tcall_loop.lua tlen_loop.lua \
49+
tnew_tdup.lua uclo.lua unordered_jit.lua unordered.lua vararg_jit.lua \
50+
wbarrier_jit.lua wbarrier.lua wbarrier_obar.lua xpcall_jit.lua"
51+
52+
if [ $# -ne 1 ]; then
53+
echo "usage: $0 <lua-bin>"
54+
exit 1
55+
fi
56+
57+
lua=$1
58+
failed=""
59+
60+
# Run the OpenResty LuaJIT tests.
61+
for t in $ORSTY_MISC_TESTS; do
62+
if [ "${t#-}" != "$t" ]; then
63+
echo "-> Skipping $t"
64+
else
65+
echo "-> Running $t"
66+
if ! $lua luajit2-test-suite/test/misc/$t; then
67+
echo "FAILED"
68+
failed="$failed $t"
69+
fi
70+
fi
71+
done
72+
73+
# Report any test failures.
74+
if [ ! -z "$failed" ]; then
75+
echo "The following tests failed:"
76+
for t in $failed; do
77+
echo " $t"
78+
done
79+
exit 1
80+
fi

0 commit comments

Comments
 (0)