|
| 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