Skip to content

Commit d39629f

Browse files
shinnokcvicentiu
authored andcommitted
MDEV-16075: Workaround to run MTR test suite for make test
Assign all tests added via MY_ADD_TEST to a bogus default_ignore target, so that they are not ran by default when doing bare make test. Add default test named MTR that calls mysql-test-run suite, which is now the single test run by make test. In consequence, modified unit/suite.pm to exclude the MTR test and run the real ctests flagged for default_ignore target, thus no circular loop.
1 parent 0e6d635 commit d39629f

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ INCLUDE(maintainer)
366366

367367
IF(WITH_UNIT_TESTS)
368368
ENABLE_TESTING()
369+
# This is the only instance where ADD_TEST should be used,
370+
# to make sure that make test will run MTR,
371+
# use MY_ADD_TEST macro to add other tests
372+
ADD_TEST(NAME MTR COMMAND ./mysql-test-run WORKING_DIRECTORY "mysql-test")
369373
ADD_SUBDIRECTORY(unittest/mytap)
370374
ADD_SUBDIRECTORY(unittest/strings)
371375
ADD_SUBDIRECTORY(unittest/examples)

cmake/ctest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
33

44
MACRO(MY_ADD_TEST name)
5-
ADD_TEST(${name} ${name}-t)
5+
ADD_TEST(NAME ${name} COMMAND ${name}-t CONFIGURATIONS default_ignore)
66
ENDMACRO()
77

88
MACRO (MY_ADD_TESTS)

mysql-test/suite/unit/suite.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ sub start_test {
3131
return "Not run for embedded server" if $::opt_embedded_server;
3232
return "Not configured to run ctest" unless -f "../CTestTestfile.cmake";
3333
my ($ctest_vs)= $opt_vs_config ? "--build-config $opt_vs_config" : "";
34-
my (@ctest_list)= `cd .. && ctest $opt_vs_config --show-only --verbose`;
34+
my (@ctest_list)= `cd .. && ctest $opt_vs_config -E MTR -C default_ignore --show-only --verbose`;
3535
return "No ctest" if $?;
3636

3737
my ($command, %tests);

unittest/sql/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ ELSE()
2626
ENDIF()
2727

2828
TARGET_LINK_LIBRARIES(explain_filename-t sql mytap)
29-
ADD_TEST(explain_filename explain_filename-t)
29+
MY_ADD_TEST(explain_filename explain_filename-t)

0 commit comments

Comments
 (0)