From 68ea116380b62b98da8c8492228b3d48d846920b Mon Sep 17 00:00:00 2001 From: Orkun Tokdemir <ilhanorkuntokdemir@gmail.com> Date: Tue, 16 Jul 2024 21:50:34 +0200 Subject: Autogen: Fix autogen test separation bugs When 6ee5c431 is merged, `autogen_test_number` is put into the wrong scope. The problem is that RunCmake.Autogen_Qt5_X tests are created only Qt6 prefix is provided. This commit moves it to the upper scope. Fix Xcode specific bug where `foreach(exe IN ITEMS Moc Uic Rcc)` should be removed. --- Tests/RunCMake/Autogen_common/utils.cmake | 58 +++++++++++++++---------------- Tests/RunCMake/CMakeLists.txt | 2 +- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/Tests/RunCMake/Autogen_common/utils.cmake b/Tests/RunCMake/Autogen_common/utils.cmake index 86efa85..1208807 100644 --- a/Tests/RunCMake/Autogen_common/utils.cmake +++ b/Tests/RunCMake/Autogen_common/utils.cmake @@ -223,37 +223,35 @@ function(autogen_executable_test exe) endif() if (RunCMake_GENERATOR MATCHES "Xcode") - foreach(exe IN ITEMS Moc Uic Rcc) - block() - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${exe}Example-build) - set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMake-configure") - set(RunCMake_TEST_EXPECT_stderr ".*") - run_cmake_with_options(${exe}Example ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_MAKE_PROGRAM ${CMAKE_COMMAND}) - run_make_program(${RunCMake_TEST_BINARY_DIR} --build . --config Debug) - if (exe STREQUAL "Moc") - set(expected_count 16) - elseif (exe STREQUAL "Uic") - set(expected_count 4) - else() - set(expected_count 12) - endif() - expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-Auto${exe}") - expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-Auto${exe}") + block() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${exe}Example-build) + set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMake-configure") + set(RunCMake_TEST_EXPECT_stderr ".*") + run_cmake_with_options(${exe}Example ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_MAKE_PROGRAM ${CMAKE_COMMAND}) + run_make_program(${RunCMake_TEST_BINARY_DIR} --build . --config Debug) + if (exe STREQUAL "Moc") + set(expected_count 16) + elseif (exe STREQUAL "Uic") + set(expected_count 4) + else() + set(expected_count 12) + endif() + expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-Auto${exe}") + expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-Auto${exe}") - if (exe STREQUAL "Moc" OR exe STREQUAL "Uic") - expect_n_times("${make_program_stdout}" "AutoGen:" 20 "${exe}Example-build-AutoGen:") - endif() + if (exe STREQUAL "Moc" OR exe STREQUAL "Uic") + expect_n_times("${make_program_stdout}" "AutoGen:" 20 "${exe}Example-build-AutoGen:") + endif() - foreach(config IN ITEMS Debug Release RelWithDebInfo) - block() - run_make_program(${RunCMake_TEST_BINARY_DIR} --build . --config ${config}) - not_expect("${make_program_stdout}" "Auto${exe}" "${exe}Example-${config}_Auto${exe}") - not_expect("${make_program_stdout}" "AutoGen:" "${exe}Example-${config}_AutoGen") - endblock() - endforeach() - endblock() - endforeach() + foreach(config IN ITEMS Debug Release RelWithDebInfo) + block() + run_make_program(${RunCMake_TEST_BINARY_DIR} --build . --config ${config}) + not_expect("${make_program_stdout}" "Auto${exe}" "${exe}Example-${config}_Auto${exe}") + not_expect("${make_program_stdout}" "AutoGen:" "${exe}Example-${config}_AutoGen") + endblock() + endforeach() + endblock() endif() endfunction() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index db5ef96..0e112a8 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -284,6 +284,7 @@ if(CMake_TEST_APPLE_SILICON) add_RunCMake_test(AppleSilicon) endif() set(want_NoQt_test TRUE) +set(autogen_test_number 1 2 3 4 5 6) if(CMake_TEST_Qt6 AND Qt6Widgets_FOUND) # Work around Qt6 not finding sibling dependencies without CMAKE_PREFIX_PATH cmake_path(GET Qt6_DIR PARENT_PATH base_dir) # <base>/lib/cmake @@ -291,7 +292,6 @@ if(CMake_TEST_Qt6 AND Qt6Widgets_FOUND) cmake_path(GET base_dir PARENT_PATH base_dir) # <base> # Note: Since RunCMake.Autogen tests cause time out on some CI, # we split the tests. - set(autogen_test_number 1 2 3 4 5) foreach(val IN ITEMS ${autogen_test_number}) add_RunCMake_test("Autogen_Qt6_${val}" TEST_DIR "Autogen_${val}" -Dwith_qt_version=6 -- cgit v0.12