Tests: Split RunCMake.PrecompileHeaders into multiple tests

The test runs many cases serially.  Split them into two groups to
enable more concurrency and shorter tests.
This commit is contained in:
Brad King
2025-11-11 14:03:10 -05:00
parent ad112e1062
commit dac2823975
38 changed files with 87 additions and 22 deletions

View File

@@ -1369,6 +1369,7 @@ add_RunCMake_test("CTestCommandExpandLists")
add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
-DCMAKE_C_SIMULATE_ID=${CMAKE_C_SIMULATE_ID}
-DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION})
add_RunCMake_test(PrecompileHeaders-Reuse -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
# This test can take a long time due to the number of test cases.
# Provide an option to customize it.

View File

@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.15.0)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)

View File

@@ -0,0 +1,32 @@
include(RunCMake)
function(run_test name)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
run_cmake(${name})
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(${name}-build ${CMAKE_COMMAND} --build . --config Debug)
run_cmake_command(${name}-test ${CMAKE_CTEST_COMMAND} -C Debug)
endfunction()
function(run_build_verbose name)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
run_cmake(${name})
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(${name}-build ${CMAKE_COMMAND} --build . --verbose --config Debug)
endfunction()
run_test(PchReuseFrom-CMP0141-OLD)
run_test(PchReuseFrom-CMP0141-NEW)
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
run_test(PchReuseFrom-CMP0141-NEW-empty)
endif()
run_test(PchReuseFromPrefixed)
run_test(PchReuseFromSubdir)
run_build_verbose(PchReuseFromIgnoreOwnProps)
run_build_verbose(PchReuseFromUseUpdatedProps)
run_build_verbose(PchReuseConsistency)
run_cmake(PchReuseFromCycle)
run_cmake(PchReuseWithoutPch)
run_build_verbose(PchReuseAppend)
run_build_verbose(PchReuseDeclarationOrder)
run_test(PchReuseFromObjLib)

View File

@@ -0,0 +1,3 @@
void nothing(void)
{
}

View File

@@ -0,0 +1,13 @@
#include "foo.h"
#include "foo2.h"
int foo(void)
{
return 0;
}
int foo2(void)
{
return 0;
}

View File

@@ -0,0 +1,14 @@
#include "bar.h"
#include "foo.h"
#include "foo2.h"
int main(void)
{
int zeroSize = 0;
#ifdef HAVE_PCH_SUPPORT
zeroSize = (int)strlen("");
#endif
return foo() + foo2() + bar() + zeroSize;
}

View File

@@ -0,0 +1,9 @@
#ifndef bar_h
#define bar_h
static int bar(void)
{
return 0;
}
#endif

View File

@@ -0,0 +1,6 @@
#ifndef foo_h
#define foo_h
int foo(void);
#endif

View File

@@ -0,0 +1,6 @@
#ifndef foo2_h
#define foo2_h
int foo2(void);
#endif

View File

@@ -8,13 +8,6 @@ function(run_test name)
run_cmake_command(${name}-test ${CMAKE_CTEST_COMMAND} -C Debug)
endfunction()
function(run_build_verbose name)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
run_cmake(${name})
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(${name}-build ${CMAKE_COMMAND} --build . --verbose --config Debug)
endfunction()
run_cmake(DisabledPch)
run_cmake(PchDebugGenex)
if (RunCMake_GENERATOR MATCHES "(Ninja|Makefiles|Visual Studio)")
@@ -28,21 +21,7 @@ run_test(PchInterfaceUnity)
run_cmake(PchPrologueEpilogue)
run_test(SkipPrecompileHeaders)
run_test(CXXnotC)
run_test(PchReuseFrom-CMP0141-OLD)
run_test(PchReuseFrom-CMP0141-NEW)
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
run_test(PchReuseFrom-CMP0141-NEW-empty)
endif()
run_test(PchReuseFromPrefixed)
run_test(PchReuseFromSubdir)
run_build_verbose(PchReuseFromIgnoreOwnProps)
run_build_verbose(PchReuseFromUseUpdatedProps)
run_build_verbose(PchReuseConsistency)
run_cmake(PchReuseFromCycle)
run_cmake(PchReuseWithoutPch)
run_build_verbose(PchReuseAppend)
run_cmake(PchMultilanguage)
run_build_verbose(PchReuseDeclarationOrder)
if(RunCMake_GENERATOR MATCHES "Make|Ninja")
run_cmake(PchWarnInvalid)
@@ -52,7 +31,6 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
run_cmake(PchInstantiateTemplates)
endif()
endif()
run_test(PchReuseFromObjLib)
run_test(PchIncludedAllLanguages)
run_test(PchIncludedOneLanguage)
run_test(PchLibObjLibExe)