{"id":28479028,"url":"https://github.com/openresty/luajit2-test-suite","last_synced_at":"2025-07-03T09:30:48.094Z","repository":{"id":21533564,"uuid":"93199208","full_name":"openresty/luajit2-test-suite","owner":"openresty","description":"OpenResty's LuaJIT test suite based on Mike Pall's LuaJIT tests","archived":false,"fork":false,"pushed_at":"2025-02-11T04:49:36.000Z","size":154,"stargazers_count":29,"open_issues_count":2,"forks_count":14,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-06-07T18:07:53.211Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openresty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-02T19:53:38.000Z","updated_at":"2025-02-11T04:49:40.000Z","dependencies_parsed_at":"2025-02-11T05:34:57.722Z","dependency_job_id":null,"html_url":"https://github.com/openresty/luajit2-test-suite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/openresty/luajit2-test-suite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fluajit2-test-suite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fluajit2-test-suite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fluajit2-test-suite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fluajit2-test-suite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openresty","download_url":"https://codeload.github.com/openresty/luajit2-test-suite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openresty%2Fluajit2-test-suite/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263300068,"owners_count":23445169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-07T18:07:55.238Z","updated_at":"2025-07-03T09:30:47.881Z","avatar_url":"https://github.com/openresty.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"Name\n====\n\nluajit2-test-suite - OpenResty's branch of Mike Pall's LuaJIT 2 test suite.\n\nTable of Contents\n=================\n\n* [Name](#name)\n* [Synopsis](#synopsis)\n* [Description](#description)\n* [Prerequisites](#prerequisites)\n* [TODO](#todo)\n* [Original Notes from Mike Pall](#original-notes-from-mike-pall)\n\nSynopsis\n=========\n\n```bash\n# run the test suite in normal test mode with the luajit installed under /opt/luajit21/\n./run-tests /opt/luajit21\n\n# run the test suite in valgrind test mode with luajit installed under /opt/luajit21sysm/\n./run-tests -v /opt/luajit21sysm\n```\n\nWhen all the tests are passing, the output should look like this:\n\n```\n=== test/unportable/math_special.lua\n=== test/misc/hook_norecord.lua\n=== test/misc/hook_record.lua\n=== test/misc/snap_top2.lua\n=== test/misc/strcmp.lua\n=== test/misc/string_dump.lua\n=== test/misc/tonumber_scan.lua\n=== test/misc/api_call.lua\n=== test/misc/stackovc.lua\n=== test/misc/debug_gc.lua\n=== test/misc/stackov.lua\n=== test/misc/table_insert.lua\n=== test/misc/uclo.lua\n=== test/misc/meta_cat.lua\n...\n=== test/ffi/ffi_jit_misc.lua\n=== test/ffi/ffi_call.lua\n=== test/ffi/ffi_jit_struct.lua\n=== test/ffi/ffi_arith_ptr.lua\n=== test/ffi/ffi_callback.lua\n=== test/ffi/ffi_metatype.lua\n=== test/ffi/ffi_jit_conv.lua\n=== test/ffi/ffi_jit_complex.lua\n=== test/ffi/ffi_jit_arith.lua\n=== test/ffi/ffi_copy_fill.lua\n=== test/ffi/ffi_jit_call.lua\n=== test/ffi/ffi_tabov.lua\nAll tests successful.\n```\n\nAnd the whole command will also return the exit code 0 to indicate success.\n\nFailed tests can lead to output like below:\n\n```\n=== test/ffi/ffi_type_punning.lua\n/opt/luajit21/bin/luajit: ffi_type_punning.lua:57: assertion failed!\nstack traceback:\n\t[C]: in function 'assert'\n\tffi_type_punning.lua:57: in main chunk\n\t[C]: at 0x00404b50\nFailed test when running /opt/luajit21/bin/luajit ffi_type_punning.lua 1: 256\n=== test/ffi/ffi_err.lua\n=== test/ffi/ffi_parse_array.lua\n/opt/luajit21/bin/luajit: ../common/ffi_util.inc:22: int __attribute__((aligned(8))) [10]\nstack traceback:\n\t[C]: in function 'assert'\n\t../common/ffi_util.inc:22: in function 'checktypes'\n\tffi_parse_array.lua:32: in main chunk\n\t[C]: at 0x00404b50\nFailed test when running /opt/luajit21/bin/luajit ffi_parse_array.lua 1: 256\n=== test/ffi/ffi_const.lua\n=== test/ffi/ffi_meta_tostring.lua\n=== test/ffi/ffi_convert.lua\n/opt/luajit21/bin/luajit: ffi_convert.lua:142: failure expected\nstack traceback:\n\t[C]: in function 'error'\n\t../common/ffi_util.inc:27: in function 'fails'\n\tffi_convert.lua:142: in main chunk\n\t[C]: at 0x00404b50\nFailed test when running /opt/luajit21/bin/luajit ffi_convert.lua 1: 256\n=== test/ffi/ffi_parse_cdef.lua\n=== test/ffi/ffi_jit_misc.lua\n=== test/ffi/ffi_call.lua\n=== test/ffi/ffi_jit_struct.lua\n=== test/ffi/ffi_arith_ptr.lua\n=== test/ffi/ffi_callback.lua\n=== test/ffi/ffi_metatype.lua\n=== test/ffi/ffi_jit_conv.lua\n=== test/ffi/ffi_jit_complex.lua\n=== test/ffi/ffi_jit_arith.lua\n=== test/ffi/ffi_copy_fill.lua\n=== test/ffi/ffi_jit_call.lua\n=== test/ffi/ffi_tabov.lua\n8 tests failed.\n```\n\nIn case of test failures, the command will exit with a nonzero status code.\n\nTo run tests in multiple parallel jobs so as to utilize more than one CPU cores in your system, you can\nspecify the `-j N` option where `N` is the number of jobs to run. For example, if you have 8 spare CPU\nlogical cores in your system, you can run 8 parallel jobs like this:\n\n```\n./run-tests -v -j 8 /opt/luajit21sysm\n```\n\nThe parallel jobs feature is very useful for the valgrind test mode. For example, on my Macbook Pro,\n`-j 8` makes the valgrind test mode more than 3x faster than `-j 1` (which is the default).\nOn the other hand, for the normal mode, running the tests\nin multiple jobs actually would make the total running time longer.\n\nTo run a single test file, just specify the file path as an extra command-line argument, as in\n\n```\n./run-tests -v /opt/luajit21sysm test/misc/tnew_tdup.lua\n```\n\nand\n\n```\n./run-tests /opt/luajit21dbg test/unportable/math_special.lua\n```\n\nMultiple individual test files are also supported, as in\n\n```\n./run-tests /opt/luajit21dbg test/misc/*.lua\n```\n\nDescription\n===========\n\nThis is a test suite for LuaJIT 2.1 based on Mike Pall's personal LuaJIT test suite first published here:\n\nhttps://github.com/LuaJIT/LuaJIT-test-cleanup\n\nWe did not touch Mike's existing test files at all to make sure all the tests still test what they were\noriginally supposed to test. There is always a big risk in editing Mike's tests since we cannot\neasily test those tests with a buggy LuaJIT version.\n\nThis test suite is aimed for testing OpenResty's own branch of LuaJIT here:\n\nhttps://github.com/openresty/luajit2\n\nPrerequisites\n=============\n\nThis LuaJIT test suite requires some 3rd-party libraries like GTK 2.0, libmpc, mpfr, and C/C++ compilers.\n\nOn Fedora, for example, it is sufficient to install the dependencies using a single command:\n\n```bash\nsudo dnf install libmpc-devel gtk2-devel mpfr-devel gcc gcc-c++\n```\n\nAdditionally, the valgrind test mode requires `valgrind`. On Fedora, we can install it via\n\n```bash\nsudo dnf install valgrind\n```\n\nCurrently the `run-tests` script is written in Perl 5. So you may also need to install `perl` if your\nsystem does not have it already. For example, on Fedora, we can do\n\n```bash\nsudo dnf install perl\n```\n\nIf you want to run the tests in multiple parallel jobs, then you should also install the perl CPAN module\n`Parallel::ForkManager`. For example, on Fedora, we can install this module like this:\n\n```bash\nsudo dnf install perl-Parallel-ForkManager\n```\n\nIf your operating system does not provide prebuilt package for this perl CPAN module, then you can install\nit via the `cpan` command-line utility like this:\n\n```bash\nsudo cpan Parallel::ForkManager\n```\n\n[Back to TOC](#table-of-contents)\n\nTODO\n====\n\n* Run the benchmark scripts as well.\n* Integrate as many tests as possible from ROC-Lua 5.1, 5.2, and 5.3.\n\n[Back to TOC](#table-of-contents)\n\nOriginal Notes from Mike Pall\n=============================\n\nIn fact it doesn't even have the steps to build it or run it,\nso please don't complain.\n\nThis repo is a place to collect and cleanup tests for LuaJIT.\nThey should eventually be merged into the main LuaJIT repo.\n\nIt's definitely not in the best state and needs a serious\ncleanup effort. Sorry.\n\n\nMany issues need to be resolved before the merge can be performed:\n\n- Choose a portable test runner\n  Requirement: very few dependencies, possibly Lua/Shell only\n\n- Minimal test runner library, wherever assert() is not enough\n\n- Debugging test failures is a lot simpler, when individual tests can still\n  be run from the LuaJIT command line without any big dependencies\n\n- Define consistent grouping of all tests\n\n- Define consistent naming of all tests\n\n- Split everything into a lot of tiny tests\n\n- Reduce time taken to run the test suite\n  Separate tiers, parallelized testing\n\n- Some tests can only run under certain configurations (e.g. FFI)\n\n- Some tests need a clean slate to give reproducible results\n  Most others should be run from the same state for performance resons\n\n- Hard to check that the JIT compiler actually generates the intended code\n  Maybe use a test matching variant of the jit.dump module\n\n- Portability concerns\n\n- Avoiding undefined behavior in tests or ignoring it\n\n- Matrix of architectures + configuration options that need testing\n\n- Merge tests from other sources, e.g. the various Lua test suites.\n\n- Tests should go into the LuaJIT git repo, but in separate tarballs\n  for the releases\n\n\nThere are some benchmarks, too:\n\n- Some of the benchmarks can be used as tests (with low scaling)\n  by checksumming their output and comparing against known good results\n\n- Most benchmarks need different scalings to be useful for comparison\n  on all architectures\n\n\nNote from Mike Pall:\n\nI've removed all tests of undeterminable origin or that weren't explicitly\ncontributed with the intention of being part of a public test suite.\n\nI hereby put all Lua/LuaJIT tests and benchmarks that I wrote under the\npublic domain. I've removed any copyright headers.\n\nIf I've forgotten an attribution or you want your contributed test to be\nremoved, please open an issue.\n\nThere are some benchmarks that bear other copyrights, probably public\ndomain, BSD or MIT licensed. If the status cannot be determined, they\nneed to be replaced or removed before merging with the LuaJIT repo.\n\n[Back to TOC](#table-of-contents)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenresty%2Fluajit2-test-suite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenresty%2Fluajit2-test-suite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenresty%2Fluajit2-test-suite/lists"}