From 631142116cd29d3ff06cbebdbadb4f4e1ed13561 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Fri, 17 Apr 2026 11:07:22 +0200 Subject: [PATCH] [roottest] Add a test for CLING_PROFILE The feature seems to have stopped working after the last llvm upgrade. --- roottest/cling/other/CMakeLists.txt | 4 ++++ roottest/cling/other/testPerfMap.sh | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 roottest/cling/other/testPerfMap.sh diff --git a/roottest/cling/other/CMakeLists.txt b/roottest/cling/other/CMakeLists.txt index 6ee494a75e080..7bac74f151ebb 100644 --- a/roottest/cling/other/CMakeLists.txt +++ b/roottest/cling/other/CMakeLists.txt @@ -61,3 +61,7 @@ ROOTTEST_ADD_TEST(checkMissingSymbolExitCode ROOTTEST_ADD_TEST(assertDirWithParen MACRO assertDirWithParen.C LABELS roottest regression cling) + +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + add_test(NAME testPerfMap COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/testPerfMap.sh) +endif() \ No newline at end of file diff --git a/roottest/cling/other/testPerfMap.sh b/roottest/cling/other/testPerfMap.sh new file mode 100644 index 0000000000000..308d8d5ef19f7 --- /dev/null +++ b/roottest/cling/other/testPerfMap.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +OUTPUT=$(mktemp /tmp/testPerfMap_XXXXX) +CLING_PROFILE=1 root.exe -b -q -e "int testFunc42() { return 42; }" -e "testFunc42()" > ${OUTPUT} & +PERF_MAP=/tmp/perf-${!}.map + +wait + +grep -q 42 ${OUTPUT} || { echo "Root process did not return the expected result in ${OUTPUT}" >&2; exit 1; } +test -f ${PERF_MAP} || { echo "No perf map found in ${PERF_MAP}" >&2; exit 1; } + +if [ -f ${PERF_MAP} ]; then + c++filt < ${PERF_MAP} | grep 'testFunc42\(\)' || { echo "The test function was not exported to the perf map." >&2; exit 2; } +fi