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.
This commit is contained in:
Orkun Tokdemir
2024-07-16 21:50:34 +02:00
parent 25abc95715
commit 68ea116380
2 changed files with 29 additions and 31 deletions

View File

@@ -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()

View File

@@ -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