Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/workflows/cling-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: 'Cling Test CI'

on:
pull_request:
paths:
- 'interpreter/cling/**'
- '.github/workflows/cling-test.yml'

env:
PYTHONUNBUFFERED: true
OS_APPLICATION_CREDENTIAL_ID: '7f5b64a265244623a3a933308569bdba'
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
OS_AUTH_TYPE: 'v3applicationcredential'
OS_AUTH_URL: 'https://keystone.cern.ch/v3'
OS_IDENTITY_API_VERSION: 3
OS_INTERFACE: 'public'
OS_REGION_NAME: 'cern'
GLOBAL_OVERRIDES: 'asserts=ON LLVM_ENABLE_ASSERTIONS=ON'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
check-cling:
# For any event that is not a PR, the CI will always run. In PRs, the CI
# can be skipped if the tag [skip-ci] or [skip ci] is written in the title.
if: |
(github.repository_owner == 'root-project' && github.event_name != 'pull_request') ||
(github.event_name == 'pull_request' && !(
contains(github.event.pull_request.title, '[skip-ci]') ||
contains(github.event.pull_request.title, '[skip ci]') ||
contains(github.event.pull_request.labels.*.name, 'skip ci')
))

permissions:
contents: read

strategy:
fail-fast: false
matrix:
# Specify image + (optional) build option overrides
#
# Available images: https://github.com/root-project/root-ci-images
# Common configs: {Release,Debug,RelWithDebInfo)
# Build options: https://root.cern/install/build_from_source/#all-build-options
include:
- image: alma10
platform_config: alma10-minimal

runs-on:
- self-hosted
- linux
- ${{ matrix.architecture == null && 'x64' || matrix.architecture }}

Check failure on line 54 in .github/workflows/cling-test.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

property "architecture" is not defined in object type {image: string; platform_config: string}

Check failure on line 54 in .github/workflows/cling-test.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

property "architecture" is not defined in object type {image: string; platform_config: string}
- ${{ matrix.extra-runs-on == null && 'cpu' || matrix.extra-runs-on }}

Check failure on line 55 in .github/workflows/cling-test.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

property "extra-runs-on" is not defined in object type {image: string; platform_config: string}

Check failure on line 55 in .github/workflows/cling-test.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

property "extra-runs-on" is not defined in object type {image: string; platform_config: string}

name: Cling Tests

container:
image: registry.cern.ch/root-ci/${{ matrix.image }}:buildready # KEEP IN SYNC WITH env key below
options: --security-opt label=disable --rm ${{ matrix.property == 'gpu' && '--device nvidia.com/gpu=all' || '' }} # KEEP IN SYNC WITH env key below

Check failure on line 61 in .github/workflows/cling-test.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

property "property" is not defined in object type {image: string; platform_config: string}
volumes:
- ${{ matrix.image }}_ccache_volume:/github/home/.cache/ccache
env:
CONTAINER_IMAGE: "registry.cern.ch/root-ci/${{ matrix.image }}:buildready" #KEEP IN SYNC WITH ABOVE
CONTAINER_OPTIONS: "--security-opt label=disable --rm ${{ matrix.property == 'gpu' && '--device nvidia.com/gpu=all' || '' }}" #KEEP IN SYNC WITH ABOVE

Check failure on line 66 in .github/workflows/cling-test.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

property "property" is not defined in object type {image: string; platform_config: string}

steps:
- name: Configure large ccache
if: ${{ matrix.is_special }}

Check failure on line 70 in .github/workflows/cling-test.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

property "is_special" is not defined in object type {image: string; platform_config: string}
run: |
ccache -o max_size=5G
ccache -p || true
ccache -s || true

- name: Configure small ccache
if: ${{ !matrix.is_special }}

Check failure on line 77 in .github/workflows/cling-test.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

property "is_special" is not defined in object type {image: string; platform_config: string}
run: |
ccache -o max_size=1.5G
ccache -p || true
ccache -s || true

- name: Set up Python Virtual Env
# if the `if` expr is false, `if` still has exit code 0.
# if the `if` block is entered, the block's exit code becomes the exit
# code of the `if`.
run: 'if [ -d /py-venv/ROOT-CI/bin/ ]; then . /py-venv/ROOT-CI/bin/activate && echo PATH=$PATH >> $GITHUB_ENV; fi'

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref_name }}

Check failure on line 92 in .github/workflows/cling-test.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

property "ref_name" is not defined in object type {}

- name: Pull Request Build
env:
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') }}
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
CMAKE_GENERATOR: ${{ matrix.cmake_generator }}

Check failure on line 98 in .github/workflows/cling-test.yml

View workflow job for this annotation

GitHub Actions / lint-action-files

property "cmake_generator" is not defined in object type {image: string; platform_config: string}
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
run: ".github/workflows/root-ci-config/build_root.py
--buildtype RelWithDebInfo
--platform ${{ matrix.image }}
--dockeropts \"$CONTAINER_OPTIONS\"
--incremental $INCREMENTAL
--base_ref ${{ github.base_ref }}
--sha ${{ github.sha }}
--pull_repository ${{ github.event.pull_request.head.repo.clone_url }}
--head_ref refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
--head_sha ${{ github.event.pull_request.head.sha }}
--repository ${{ github.server_url }}/${{ github.repository }}
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
--clingtests_only true
"

- name: ccache info (post)
run: |
ccache -s || true
26 changes: 17 additions & 9 deletions .github/workflows/root-ci-config/build_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
# the target branch in the ROOT repository using base_ref and head_ref:
# - The base_ref is e.g. "master" or "v6-38-00-patches"
# - The head_ref for PRs is formatted as <PR branch>:<Fork branch> e.g. "refs/pull/20742/head:cppyy_fixup"
if not ":" in args.head_ref:

Check failure on line 62 in .github/workflows/root-ci-config/build_root.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E713)

.github/workflows/root-ci-config/build_root.py:62:16: E713 Test for membership should be `not in`
build_utils.print_error(f"This has been identified as a PR build. However, the head-ref is {args.head_ref}.")
branch_in_fork = args.head_ref.split(":")[-1]
if branch_in_fork == args.base_ref:
Expand All @@ -85,7 +85,7 @@

if "minimal" in platform_options and platform_options["minimal"] == "ON":
options_dict = platform_options
print(f"Minimal build detected in the platform options. Ignoring global configuration.")

Check failure on line 88 in .github/workflows/root-ci-config/build_root.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F541)

.github/workflows/root-ci-config/build_root.py:88:15: F541 f-string without any placeholders
else:
options_dict.update(platform_options)
print(f"Build option overrides for {args.platform_config}:")
Expand All @@ -102,6 +102,9 @@
ctest_custom_flags = options_dict['ROOT_CTEST_CUSTOM_FLAGS']
options_dict.pop('ROOT_CTEST_CUSTOM_FLAGS') # we do not want a -D called like that

if args.clingtests_only:
options_dict['clingtest'] = "ON"

options = build_utils.cmake_options_from_dict(options_dict)
print("Full build options")
for key, val in sorted(options_dict.items()):
Expand Down Expand Up @@ -165,7 +168,7 @@
# Delete all the .gcda files produces by an artefact.
build_utils.remove_file_match_ext(WORKDIR, "gcda")

build(options, args.buildtype)
build(options, args.buildtype, args.clingtests_only)

# Build artifacts should only be uploaded for full builds, and only for
# "official" branches (master, v?-??-??-patches), i.e. not for pull_request
Expand All @@ -177,7 +180,7 @@
if args.binaries:
create_binaries(args.buildtype)

if testing:
if testing and not args.clingtests_only:
extra_ctest_flags = ''
if WINDOWS:
extra_ctest_flags += '--repeat until-pass:5 '
Expand All @@ -191,7 +194,7 @@
if args.coverage:
create_coverage_xml()

if testing and ctest_returncode != 0:
if testing and not args.clingtests_only and ctest_returncode != 0:
handle_test_failure(ctest_returncode)

print_trace()
Expand Down Expand Up @@ -220,6 +223,7 @@
parser.add_argument("--dockeropts", default=None, help="Extra docker options, if any")
parser.add_argument("--incremental", default="false", help="Do incremental build")
parser.add_argument("--buildtype", default="Release", help="Release|Debug|RelWithDebInfo")
parser.add_argument("--clingtests_only", default="false", help="Run only clingtests")
parser.add_argument("--coverage", default="false", help="Create Coverage report in XML")
parser.add_argument("--sha", default=None, help="sha that triggered the event")
parser.add_argument("--base_ref", default=None, help="Ref to target branch")
Expand All @@ -236,6 +240,7 @@

# Set argument to True if matched
args.incremental = args.incremental.lower() in ('yes', 'true', '1', 'on')
args.clingtests_only = args.clingtests_only.lower() in ('yes', 'true', '1', 'on')
args.coverage = args.coverage.lower() in ('yes', 'true', '1', 'on')
args.binaries = args.binaries.lower() in ('yes', 'true', '1', 'on')

Expand Down Expand Up @@ -429,20 +434,23 @@


@github_log_group("Build")
def cmake_build(buildtype):
def cmake_build(buildtype, clingtests_only = False):
generator_flags = "-- '-verbosity:minimal'" if WINDOWS else ""
parallel_jobs = "4" if WINDOWS else str(os.cpu_count())

builddir = os.path.join(WORKDIR, "build")
result = subprocess_with_log(f"""
cmake --build '{builddir}' --config '{buildtype}' --parallel '{parallel_jobs}' {generator_flags}
""")
command = f"""
cmake --build '{builddir}' --config '{buildtype}' --parallel '{parallel_jobs}' {generator_flags}"""
if clingtests_only:
command += " --target check-cling"

result = subprocess_with_log(command)

if result != 0:
die(result, "Failed to build")


def build(options, buildtype):
def build(options, buildtype, clingtests_only = False):
if not os.path.isdir(os.path.join(WORKDIR, "build")):
builddir = os.path.join(WORKDIR, "build")
result = subprocess_with_log(f"mkdir {builddir}")
Expand All @@ -457,7 +465,7 @@

dump_requested_config(options)

cmake_build(buildtype)
cmake_build(buildtype, clingtests_only)


@github_log_group("Create binary packages")
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/root-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches:
- '**'
paths-ignore:
- '**'
- 'doc/**'
- 'documentation/**'
- 'README/ReleaseNotes/**'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#endif

#include <cling/Interpreter/Visibility.h>
#include <cling/Utils/Output.h>

#if __cplusplus >= 201703L
#include <filesystem>
Expand Down Expand Up @@ -152,7 +153,12 @@ namespace cling {

#ifdef __cpp_lib_source_location
CLING_LIB_EXPORT
std::string printValue(const std::source_location* location);
std::string printValue(const std::source_location* location) {
cling::ostrstream strm;
strm << location->file_name() << ":" << location->line() << ":"
<< location->function_name();
return strm.str().str();
}
#endif

// cling::Value
Expand Down
13 changes: 11 additions & 2 deletions interpreter/cling/lib/Interpreter/Transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,18 @@ namespace cling {
// declaration, because each time Sema believes a vtable is used it emits
// that callback.
// For reference (clang::CodeGen::CodeGenModule::EmitVTable).
if (oldDCI.m_Call != kCCIHandleVTable
&& oldDCI.m_Call != kCCIHandleCXXImplicitFunctionInstantiation)
if (oldDCI.m_Call != kCCIHandleVTable &&
oldDCI.m_Call != kCCIHandleCXXImplicitFunctionInstantiation) {
// Allow duplicates for inline/constexpr functions
if (oldDCI == DCI && DCI.m_DGR.isSingleDecl()) {
if (const FunctionDecl* FD =
dyn_cast_or_null<FunctionDecl>(DCI.m_DGR.getSingleDecl())) {
if (FD->isInlined())
continue;
}
}
assert(oldDCI != DCI && "Duplicates?!");
}
}
// We want to assert there is only one wrapper per transaction.
checkForWrapper = true;
Expand Down
16 changes: 0 additions & 16 deletions interpreter/cling/lib/Interpreter/ValuePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@
#include "llvm/Support/Format.h"

#include <locale>
#if __cplusplus >= 202002L
#include <version>
#endif
#ifdef __cpp_lib_source_location
#include <source_location>
#endif
#include <string>

using namespace cling;
Expand Down Expand Up @@ -557,16 +551,6 @@ namespace cling {
return toUnicode(Val, 'L', 'x');
}

#ifdef __cpp_lib_source_location
CLING_LIB_EXPORT
std::string printValue(const std::source_location* location) {
cling::ostrstream strm;
strm << location->file_name() << ":" << location->line() << ":"
<< location->function_name();
return strm.str().str();
}
#endif

} // end namespace cling

namespace {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------

// RUN: %cling %s -Xclang -verify 2>&1 | FileCheck %s

// Check that explicit instantiation of a template after an implicit
// instantiation of a constexpr member does not trigger an assertion.

extern "C" int printf(const char* fmt, ...);

template <class T> struct Box {
constexpr Box() : {}
};

Box<int> b; // Trigger implicit instantiation
template class Box<int>; // Explicit instantiation, forces re-instantiation

printf("Ran without assertions\n"); // CHECK: Ran without assertions

// expected-no-diagnostics
Loading