Merge topic 'trace-ninja-dashc' into release-4.4

727522d835 instrumentation: Fully resolve compile trace path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12257
This commit is contained in:
Brad King
2026-07-09 17:18:42 +00:00
committed by Kitware Robot
4 changed files with 35 additions and 6 deletions

View File

@@ -1098,8 +1098,16 @@ std::string cmInstrumentation::GetCompileTraceFile(
outputPath.substr(0, outputPath.size() - ext.size()), ".json");
}
}
if (!cmSystemTools::FileIsFullPath(traceFile)) {
traceFile = cmStrCat(workingDir, '/', traceFile);
if (cmSystemTools::FileIsFullPath(traceFile)) {
return traceFile;
}
if (cmSystemTools::FileExists(cmStrCat(workingDir, '/', traceFile), true)) {
return cmStrCat(workingDir, '/', traceFile);
}
if (cmSystemTools::FileExists(cmStrCat(this->binaryDir, '/', traceFile),
true)) {
return cmStrCat(this->binaryDir, '/', traceFile);
}
return traceFile;

View File

@@ -119,9 +119,9 @@ private:
static bool IsInstrumentableTargetType(cmStateEnums::TargetType type);
void PrepareDataForCDash(std::string const& data_dir,
std::string const& index_path);
static std::string GetCompileTraceFile(
std::vector<std::string> const& command, Json::Value const& outputs,
std::string const& workingDir);
std::string GetCompileTraceFile(std::vector<std::string> const& command,
Json::Value const& outputs,
std::string const& workingDir);
void CollectCompileTraceFile(Json::Value& root, std::string traceFile,
long int oldTimestamp,
std::string const& commandHash,

View File

@@ -8,6 +8,7 @@ function(instrument test)
set(OPTIONS
"BUILD"
"BUILD_MAKE_PROGRAM"
"BUILD_MAKE_PROGRAM_CHANGE_DIR"
"INSTALL"
"INSTALL_PARALLEL"
"TEST"
@@ -181,7 +182,13 @@ function(instrument test)
set(RunCMake_QUIET_ERROR 1)
# Force reconfigure to test for double preBuild & postBuild hooks
file(TOUCH ${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt)
run_cmake_command(${test}-make-program ${RunCMake_MAKE_PROGRAM})
if (ARGS_BUILD_MAKE_PROGRAM_CHANGE_DIR)
set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY ${RunCMake_BINARY_DIR})
run_cmake_command(${test}-make-program ${RunCMake_MAKE_PROGRAM} -C ${RunCMake_TEST_BINARY_DIR})
unset(RunCMake_TEST_COMMAND_WORKING_DIRECTORY)
else()
run_cmake_command(${test}-make-program ${RunCMake_MAKE_PROGRAM})
endif()
unset(RunCMake_TEST_OUTPUT_MERGE)
unset(RunCMake_QUIET_ERROR)
endif()
@@ -434,4 +441,13 @@ if(NOT Skip_BUILD_MAKE_PROGRAM_Case)
instrument(cmake-command-build-snippet
BUILD_MAKE_PROGRAM
CHECK_SCRIPT check-data-dir.cmake)
if (NOT Skip_COMPILE_TRACE_QUERY_Case AND NOT RunCMake_GENERATOR STREQUAL "NMake Makefiles")
instrument(cmake-command-compile-trace-make-program
BUILD_MAKE_PROGRAM BUILD_MAKE_PROGRAM_CHANGE_DIR COMPILE_TRACE_QUERY
CONFIGURE_ARGS
"-DINSTRUMENT_COMPILE_TRACE=DEFAULT"
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
CHECK_SCRIPT check-data-dir.cmake
)
endif()
endif()

View File

@@ -0,0 +1,5 @@
cmake_instrumentation(
API_VERSION 1
DATA_VERSION 1
OPTIONS compileTrace
)