Lua Test suites

Download the test suite for your release of Lua and follow the instructions below to run basic, complete, and internal tests.

If no test suite matches your release of Lua exactly, download the suite for the closest Lua release of the same version. Suites do not work across different versions.

The test suite is not a product; it is just a tool for our internal use. It is available here by popular demand but we cannot give any kind of support for it. You're on your own.

All files are distributed under this license. Check their checksums to confirm the integrity of the packages.

Files

filename date size checksums (sha256)
lua-5.4.6-tests.tar.gz 2023-05-02 136212 63ed5f5bcfd15dfd2f72e04c2f8c10585bb8de9e558df62b335cb9e5c1a4ef34
lua-5.4.5-tests.tar.gz 2023-04-18 136198 856103e7298d354d870010b4966ce21281cbf3373abafd50231a98561bca793d
lua-5.4.4-tests.tar.gz 2022-01-13 134094 04d28355cd67a2299dfe5708b55a0ff221ccb1a3907a3113cc103ccc05ac6aad
lua-5.4.3-tests.tar.gz 2021-03-15 131911 5d29c3022897a8290f280ebe1c6853248dfa35a668e1fc02ba9c8cde4e7bf110
lua-5.4.2-tests.tar.gz 2020-11-13 128901 91bd3163fd237b2bd0bc99127fc25b4502f4526e17ac71a3df7c218e6b0798c0
lua-5.4.1-tests.tar.gz 2020-09-30 128646 1b3792d083ea36396927b223903e364a91cb017ed3cc16f14add380353751161
lua-5.4.0-tests.tar.gz 2020-06-18 126357 f611d324ff71578d760b96f3199baaa67a806acbf90568d5d37cc99b0df938b7
lua-5.3.4-tests.tar.gz 2016-12-22 103438 b80771238271c72565e5a1183292ef31bd7166414cd0d43a8eb79845fa7f599f
lua-5.3.3-tests.tar.gz 2016-05-30 102562 13154abc20976196119db531b4169ce1ce511755879d40b4192e4173291287e5
lua-5.3.2-tests.tar.gz 2015-11-25 101342 56909863a3713dee3709b3dbd0c868237e4f5c9ea1744f5bf0ba8bafa6c4ed32
lua-5.3.1-tests.tar.gz 2015-06-10 99638 57b3230dcadd04feb680959975228fd4b5a56b91366b729bea2f537d26a0734a
lua-5.3.0-tests.tar.gz 2015-01-05 96995 0c1ff46bf7d950023a189e32a6ce3fe83bc2fbce28187cc9b38ba056c733b267
lua-5.2.2-tests.tar.gz 2013-03-07 76629 07c1071c66d9cb4dc80200ed430fc21ebbbccf1f55148b87eb0b9522932e4eb6
lua-5.2.1-tests.tar.gz 2012-07-02 76093 2346d635ee392c8d8024b07beaa10b7b66a3f861c41d575753d03155751cf114
lua-5.2.0-tests.tar.gz 2011-12-12 75065 a674018a197fa65954de0c3e8f68621c183c405a338c817d4d9d932efe14b2cf
lua5.1-tests.tar.gz 2016-01-18 55127 49e4ca6561f82ea605908c5041ab5fad66ed9930fa0686675bd51b02767f18ad

Basic tests

Open the test suite somewhere. You'll see a directory named lua-x.y.z-tests containing several .lua files and a few subdirectories.

To run some basic tests, go to this directory and run the following command:

    path/lua -e"_U=true" all.lua
Make sure you run the exact release of Lua that you wish to test. If you're in doubt, run lua -v and check the output. If the release numbers do not match, you'll have to provide an explicit path.

The tests will print lots of different messages, but no assertion should ever fail. If the test goes all its way to the end, printing a "final OK" message, then all went well.

Note that, by its very nature, Lua is heavily dependent on the underlying standard C libraries. Sometimes the test suite fails because these underlying C libraries do not follow the ANSI standard. There is not much we can do about it.

Complete tests

The test suite uses some variables to control the execution of some tests. By defining the global variable _U (e.g., with the option -e"_U=true" in the command line as done for the basic tests above), the suite skip tests that are not fully portable and that consume too much memory. This option also suppresses messages for tests not performed. The basic tests should work without problems in any system with Lua compiled without changes.

The complete test suite (that is, without the _U option) tries to test every corner of the language, its libraries, and the C API, even corners that are system dependent. Unlike Lua itself, these tests do not aim at portability, small footprint, or easy of use. Their main goal is to try to crash Lua. They are not intended for general use. You are welcome to use them, but expect to get your hands dirty.

To run the complete suite, first make sure that your test directory has subdirectories libs/ and libs/P1/, then go to subdirectory libs/ and build the C libraries there using the makefile provided (or its equivalent in your system). Now you may try to run the full test suite, by running the following command at the top-level test directory:

    path/lua all.lua
Again, make sure you run the correct release of Lua.

Do not worry if it does not work the first time you try. (That is why there is the _U option after all.) You may need to adjust small details for your system. Among others, here is a list of things that may go wrong:

Internal tests

For even harder tests, the test suite uses a special library, testC, that gives access to several internal structures in Lua. This library is only available when Lua is compiled in debug mode, as described below.

If you want to run these internal tests, copy ltests.c and ltests.h from the ltests directory to the directory with the source Lua files, and recompile Lua with the option -DLUA_USER_H='"ltests.h"' (or its equivalent to define LUA_USER_H as the string "ltests.h", including the quotes). This option adds the testC library and enables several other internal tests as well. After the recompilation, run the tests as before. Again, expect to get your hands dirty.

Good luck!