forked from LuaJIT/LuaJIT
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The patch replaces the main test runner prove(1) with CTest [1]. The benefits are: - less external dependencies, prove(1) is gone - running tests by test title - extended test running options in comparison to prove(1) - unified test output (finally!) Note, it is not possible to attach targets to the automatically generated `test` target. It means that target `test` now is executing `LuaJIT-test`, but not `LuaJIT-lint`. Note, the testsuites in `test/LuaJIT-tests` and in `test/PUC-Rio-Lua-5.1` directories have their own test runners and currently CTest runs these testsuites as a single tests. In a future we could change these test runners to specify test from outside and after this we could run tests separately by CTest in these test suites. Note, it is not possible to add dependencies to `add_test()` in CMake, see [2]. It means that all object files and executables must be build before running ctest(1). Users in SO thread [3] recommends wraps ctest(1) in CMake by another target and use it for running or use `FIXTURES_SETUP` or `FIXTURES_REQUIRED` when CMake version >= 3.7. As a workaround one must call target `all` before running `ctest`. User-visible changes are: $ cmake -S . -B build $ cmake --build build --target test --parallel Using CTest in a build directory: $ ctest # Running all tests. $ ctest -L tarantool # Running tests in tarantool-tests dir. $ ctest -L tarantool-c # Running tests in tarantool-c-tests dir. $ ctest -L lua-Harness # Running tests in lua-Harness dir. $ ctest -L luajit # Running tests in LuaJIT dir. $ ctest -L lua # Running tests in PUC-Rio-Lua-5.1 dir. $ ctest --rerun-fail $ ctest -V $ ctest --output-on-failure 1. https://cmake.org/cmake/help/latest/manual/ctest.1.html 2. https://gitlab.kitware.com/cmake/cmake/-/issues/8774 3. https://stackoverflow.com/questions/733475/cmake-ctest-make-test-doesnt-build-tests
- Loading branch information
Showing
7 changed files
with
102 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
# See the rationale in the root CMakeLists.txt | ||
cmake_minimum_required(VERSION 3.1 FATAL_ERROR) | ||
|
||
add_custom_target(LuaJIT-tests DEPENDS ${LUAJIT_TEST_BINARY}) | ||
|
||
add_custom_command(TARGET LuaJIT-tests | ||
COMMENT "Running LuaJIT-tests" | ||
# The test suite has its own test runner | ||
# (test/LuaJIT-tests/test.lua), it is not possible | ||
# to run these tests separately by CTest. | ||
message(STATUS "Add test test/LuaJIT-tests") | ||
add_test(NAME "test/LuaJIT-tests" | ||
COMMAND | ||
${LUAJIT_TEST_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/test.lua | ||
+slow +ffi +bit +jit | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
set_tests_properties("test/LuaJIT-tests" PROPERTIES | ||
LABELS luajit | ||
TIMEOUT 10 | ||
) | ||
|
||
add_custom_target(LuaJIT-tests | ||
COMMAND ctest -L luajit ${TEST_FLAGS} | ||
DEPENDS luajit-main | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters