[clang] [llvm] [clang][ci] Move libc++ testing into the main PR pipeline (PR #93318)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Fri May 24 13:58:30 PDT 2024


https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/93318

>From 16ec4c725d86020831541a64bada8f4629a0972c Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 19:15:54 +0300
Subject: [PATCH 01/16] [clang][ci] Move libc++ testing into the main PR
 pipeline

---
 .ci/generate-buildkite-pipeline-premerge | 31 ++++++++++-
 .ci/monolithic-linux.sh                  | 65 ++++++++++++++++++++++++
 2 files changed, 95 insertions(+), 1 deletion(-)

diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index e1c66ac18e7ac..d563fa6a01120 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -85,6 +85,22 @@ function compute-projects-to-test() {
   done
 }
 
+function compute-runtimes-to-test() {
+  projects=${@}
+  for project in ${projects}; do
+    echo "${project}"
+    case ${project} in
+    clang)
+      for p in libcxx libcxxabi libunwind; do
+        echo $p
+      done
+    *)
+      # Nothing to do
+    ;;
+    esac
+  done
+}
+
 function add-dependencies() {
   projects=${@}
   for project in ${projects}; do
@@ -178,6 +194,15 @@ function check-targets() {
     cross-project-tests)
       echo "check-cross-project"
     ;;
+    libcxx)
+      echo "check-cxx"
+    ;;
+    libcxxabi)
+      echo "check-cxxabi"
+    ;;
+    libunwind)
+      echo "check-unwind"
+    ;;
     lldb)
       echo "check-all" # TODO: check-lldb may not include all the LLDB tests?
     ;;
@@ -231,6 +256,10 @@ linux_projects_to_test=$(exclude-linux $(compute-projects-to-test ${modified_pro
 linux_check_targets=$(check-targets ${linux_projects_to_test} | sort | uniq)
 linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
 
+linux_runtimes_to_test=$(compute-runtimes-to-test ${linux_projects_to_test})
+linux_runtime_check_targets=$(check-targets ${linux_runtimes_to_test} | sort | uniq)
+linux_runtimes=$(${linux_runtimes_to_test} | sort | uniq)
+
 windows_projects_to_test=$(exclude-windows $(compute-projects-to-test ${modified_projects}))
 windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq)
 windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
@@ -255,7 +284,7 @@ if [[ "${linux_projects}" != "" ]]; then
     CC: 'clang'
     CXX: 'clang++'
   commands:
-  - './.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})"'
+  - './.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"'
 EOF
 fi
 
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index b00a4b984a1d2..bbd90f7d496b1 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -54,3 +54,68 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
 echo "--- ninja"
 # Targets are not escaped as they are passed as separate arguments.
 ninja -C "${BUILD_DIR}" -k 0 ${targets}
+
+runtimes="${3}"
+runtime_targets="${4}"
+
+# Compiling runtimes with just-built Clang and running their tests
+# as an additional testing for Clang.
+if [[ "${runtimes}" != "" ]]; then
+  if [[ "${runtime_targets}" == "" ]]; then
+    echo "Runtimes to build are specified, but targets are not."
+  fi
+
+  RUNTIMES_BUILD_DIR="${MONOREPO_ROOT}/build-runtimes"
+  INSTALL_DIR="${RUNTIMES_BUILD_DIR}/install"
+  mkdir -p ${RUNTIMES_BUILD_DIR}
+
+  echo "--- cmake runtimes C++03"
+
+  cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
+      -DCMAKE_C_COMPILER="${BUILD_DIR}/bin/clang" \
+      -DCMAKE_CXX_COMPILER="${BUILD_DIR}/bin/clang++" \
+      -DLLVM_ENABLE_RUNTIMES="${runtimes}" \
+      -DLIBCXX_CXX_ABI=libcxxabi \
+      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+      -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
+      -DLIBCXX_TEST_PARAMS="std=c++03" \
+      -DLIBCXXABI_TEST_PARAMS="std=c++03"
+
+  echo "--- ninja runtimes C++03"
+
+  ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
+
+  echo "--- cmake runtimes C++26"
+
+  rm -rf "${RUNTIMES_BUILD_DIR}"
+  cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
+      -DCMAKE_C_COMPILER="${BUILD_DIR}/bin/clang" \
+      -DCMAKE_CXX_COMPILER="${BUILD_DIR}/bin/clang++" \
+      -DLLVM_ENABLE_RUNTIMES="${runtimes}" \
+      -DLIBCXX_CXX_ABI=libcxxabi \
+      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+      -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
+      -DLIBCXX_TEST_PARAMS="std=c++26" \
+      -DLIBCXXABI_TEST_PARAMS="std=c++26"
+
+  echo "--- ninja runtimes C++26"
+
+  ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
+
+  echo "--- cmake runtimes clang modules"
+
+  rm -rf "${RUNTIMES_BUILD_DIR}"
+  cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
+      -DCMAKE_C_COMPILER="${BUILD_DIR}/bin/clang" \
+      -DCMAKE_CXX_COMPILER="${BUILD_DIR}/bin/clang++" \
+      -DLLVM_ENABLE_RUNTIMES="${runtimes}" \
+      -DLIBCXX_CXX_ABI=libcxxabi \
+      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+      -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
+      -DLIBCXX_TEST_PARAMS="enable_modules=clang" \
+      -DLIBCXXABI_TEST_PARAMS="enable_modules=clang"
+
+  echo "--- ninja runtimes clang modules"
+  
+  ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
+fi

>From 5be9db11843c12f9a7e8064e68bd3218c7ad3855 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 19:17:14 +0300
Subject: [PATCH 02/16] Add missing semicolons

---
 .ci/generate-buildkite-pipeline-premerge | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index d563fa6a01120..8d55239254cea 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -94,6 +94,7 @@ function compute-runtimes-to-test() {
       for p in libcxx libcxxabi libunwind; do
         echo $p
       done
+    ;;
     *)
       # Nothing to do
     ;;

>From d2ce8f24442e25117499499ac6b3f7c4b586f0aa Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 19:21:49 +0300
Subject: [PATCH 03/16] Make a test change in clang

---
 clang/examples/PrintFunctionNames/PrintFunctionNames.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp b/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
index 6509a6440e12d..b2b785b87c25c 100644
--- a/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
+++ b/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
@@ -72,7 +72,7 @@ class PrintFunctionsConsumer : public ASTConsumer {
           *sema.LateParsedTemplateMap.find(FD)->second;
       sema.LateTemplateParser(sema.OpaqueParser, LPT);
       llvm::errs() << "late-parsed-decl: \"" << FD->getNameAsString() << "\"\n";
-    }   
+    }
   }
 };
 

>From a585ece606204a9623cca70ba73f68d5796de8e5 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 19:27:14 +0300
Subject: [PATCH 04/16] Add `set -x` to pipeline generating script

---
 .ci/generate-buildkite-pipeline-premerge | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index 8d55239254cea..16bcd34422ce1 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -19,6 +19,7 @@
 
 set -eu
 set -o pipefail
+set -x
 
 # Environment variables script works with:
 

>From 9160288e92d0556a3ca5f45d82c97348ed24f248 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 19:29:26 +0300
Subject: [PATCH 05/16] Add missing echo

---
 .ci/generate-buildkite-pipeline-premerge | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index 16bcd34422ce1..fac6d6bdc9d41 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -260,7 +260,7 @@ linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
 
 linux_runtimes_to_test=$(compute-runtimes-to-test ${linux_projects_to_test})
 linux_runtime_check_targets=$(check-targets ${linux_runtimes_to_test} | sort | uniq)
-linux_runtimes=$(${linux_runtimes_to_test} | sort | uniq)
+linux_runtimes=$(echo ${linux_runtimes_to_test} | sort | uniq)
 
 windows_projects_to_test=$(exclude-windows $(compute-projects-to-test ${modified_projects}))
 windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq)

>From ad6a5dfed34eb0edcbad3ec83b193b0f1ce919ab Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 19:36:11 +0300
Subject: [PATCH 06/16] Add more debug echoes

---
 .ci/generate-buildkite-pipeline-premerge | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index fac6d6bdc9d41..e286d1e2664c8 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -19,7 +19,6 @@
 
 set -eu
 set -o pipefail
-set -x
 
 # Environment variables script works with:
 
@@ -259,8 +258,11 @@ linux_check_targets=$(check-targets ${linux_projects_to_test} | sort | uniq)
 linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
 
 linux_runtimes_to_test=$(compute-runtimes-to-test ${linux_projects_to_test})
+echo "debug linux_runtimes_to_test: ${linux_runtimes_to_test}"
 linux_runtime_check_targets=$(check-targets ${linux_runtimes_to_test} | sort | uniq)
+echo "debug linux_runtime_check_targets: ${linux_runtime_check_targets}"
 linux_runtimes=$(echo ${linux_runtimes_to_test} | sort | uniq)
+echo "debug linux_runtimes: ${linux_runtimes}"
 
 windows_projects_to_test=$(exclude-windows $(compute-projects-to-test ${modified_projects}))
 windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq)

>From 5d56a7e54d7e22be3337d571ac640f353ebc5ac7 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 19:37:50 +0300
Subject: [PATCH 07/16] Re-enable `set -x`

---
 .ci/generate-buildkite-pipeline-premerge | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index e286d1e2664c8..c4885103ecbd4 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -19,6 +19,7 @@
 
 set -eu
 set -o pipefail
+set -x
 
 # Environment variables script works with:
 

>From 67ed5ce731f7a359c6cccb85b111e6fe71118c72 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 19:46:23 +0300
Subject: [PATCH 08/16] Removed unncessary echo

---
 .ci/generate-buildkite-pipeline-premerge | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index c4885103ecbd4..e628630257cb3 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -89,7 +89,6 @@ function compute-projects-to-test() {
 function compute-runtimes-to-test() {
   projects=${@}
   for project in ${projects}; do
-    echo "${project}"
     case ${project} in
     clang)
       for p in libcxx libcxxabi libunwind; do

>From 6cd1e08f26e8d229b9505daca594abed3500fe20 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 19:49:35 +0300
Subject: [PATCH 09/16] Remove debug echoes

---
 .ci/generate-buildkite-pipeline-premerge | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index e628630257cb3..06474323c5b12 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -258,11 +258,8 @@ linux_check_targets=$(check-targets ${linux_projects_to_test} | sort | uniq)
 linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
 
 linux_runtimes_to_test=$(compute-runtimes-to-test ${linux_projects_to_test})
-echo "debug linux_runtimes_to_test: ${linux_runtimes_to_test}"
 linux_runtime_check_targets=$(check-targets ${linux_runtimes_to_test} | sort | uniq)
-echo "debug linux_runtime_check_targets: ${linux_runtime_check_targets}"
 linux_runtimes=$(echo ${linux_runtimes_to_test} | sort | uniq)
-echo "debug linux_runtimes: ${linux_runtimes}"
 
 windows_projects_to_test=$(exclude-windows $(compute-projects-to-test ${modified_projects}))
 windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq)

>From cac43abbbc829e8bafa06cca4de68718ea4f3360 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 19:50:34 +0300
Subject: [PATCH 10/16] Remove `set -x`

---
 .ci/generate-buildkite-pipeline-premerge | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index 06474323c5b12..aaccdf0d4287d 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -19,7 +19,6 @@
 
 set -eu
 set -o pipefail
-set -x
 
 # Environment variables script works with:
 

>From 9bbf851eb0aa5393b99b9558b8bbe1d05b54fd5d Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 21:12:52 +0300
Subject: [PATCH 11/16] Remove `clang-ci` trigger from the main pipeline

---
 .ci/generate-buildkite-pipeline-premerge | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index aaccdf0d4287d..3ed5eb96eceb5 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -232,17 +232,6 @@ if echo "$modified_dirs" | grep -q -E "^(libcxx|libcxxabi|libunwind|runtimes|cma
 EOF
 fi
 
-# If clang changed.
-if echo "$modified_dirs" | grep -q -E "^(clang)$"; then
-  cat <<EOF
-- trigger: "clang-ci"
-  build:
-    message: "${buildMessage}"
-    commit: "${BUILDKITE_COMMIT}"
-    branch: "${BUILDKITE_BRANCH}"
-EOF
-fi
-
 # Generic pipeline for projects that have not defined custom steps.
 #
 # Individual projects should instead define the pre-commit CI tests that suits their

>From e2ba15e605aa5f3e2f2aa1c6e81f8021a6676ff0 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 21:13:34 +0300
Subject: [PATCH 12/16] Revert "Make a test change in clang"

This reverts commit d2ce8f24442e25117499499ac6b3f7c4b586f0aa.
---
 clang/examples/PrintFunctionNames/PrintFunctionNames.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp b/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
index b2b785b87c25c..6509a6440e12d 100644
--- a/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
+++ b/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
@@ -72,7 +72,7 @@ class PrintFunctionsConsumer : public ASTConsumer {
           *sema.LateParsedTemplateMap.find(FD)->second;
       sema.LateTemplateParser(sema.OpaqueParser, LPT);
       llvm::errs() << "late-parsed-decl: \"" << FD->getNameAsString() << "\"\n";
-    }
+    }   
   }
 };
 

>From a739134f0788ac900e6c46de4b2a59255f06063e Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 21:47:20 +0300
Subject: [PATCH 13/16] Delete `buildkite-pipeline.yml`

---
 clang/utils/ci/buildkite-pipeline.yml | 82 ---------------------------
 1 file changed, 82 deletions(-)
 delete mode 100644 clang/utils/ci/buildkite-pipeline.yml

diff --git a/clang/utils/ci/buildkite-pipeline.yml b/clang/utils/ci/buildkite-pipeline.yml
deleted file mode 100644
index 86cfcf35cc867..0000000000000
--- a/clang/utils/ci/buildkite-pipeline.yml
+++ /dev/null
@@ -1,82 +0,0 @@
-#===----------------------------------------------------------------------===##
-#
-# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-# See https://llvm.org/LICENSE.txt for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-#===----------------------------------------------------------------------===##
-
-#
-# This file describes the various pre-commit CI bots used to test Clang against
-# libc++ under various configurations. Unlike the usual libc++ CI pipeline,
-# which aims to test libc++ itself, this pipeline aims to test Clang by
-# compiling libc++ and running its test suite against the just-built Clang,
-# in various configurations.
-#
-env:
-    # LLVM RELEASE bump version
-    LLVM_HEAD_VERSION: "17"
-steps:
-  - label: "Building Clang (Linux)"
-    commands:
-      - "clang/utils/ci/run-buildbot build-clang"
-    agents:
-      queue: "linux"
-    retry:
-      automatic:
-        - exit_status: -1  # Agent was lost
-          limit: 2
-    timeout_in_minutes: 120
-
-  - wait
-
-  - label: "Testing libc++ with just-built Clang (C++03)"
-    commands:
-      - "clang/utils/ci/run-buildbot generic-cxx03"
-    artifact_paths:
-      - "**/test-results.xml"
-      - "**/crash_diagnostics/*"
-    env:
-        LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-${LLVM_HEAD_VERSION}" # TODO: Should we build that from scratch?
-        CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
-    agents:
-      queue: "linux"
-    retry:
-      automatic:
-        - exit_status: -1  # Agent was lost
-          limit: 2
-    timeout_in_minutes: 120
-
-  - label: "Testing libc++ with just-built Clang (C++26)"
-    commands:
-      - "clang/utils/ci/run-buildbot generic-cxx26"
-    artifact_paths:
-      - "**/test-results.xml"
-      - "**/crash_diagnostics/*"
-    env:
-        LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-${LLVM_HEAD_VERSION}" # TODO: Should we build that from scratch?
-        CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
-    agents:
-      queue: "linux"
-    retry:
-      automatic:
-        - exit_status: -1  # Agent was lost
-          limit: 2
-    timeout_in_minutes: 120
-
-  - label: "Testing libc++ with just-built Clang (w/ Clang Modules)"
-    commands:
-      - "clang/utils/ci/run-buildbot generic-modules"
-    artifact_paths:
-      - "**/test-results.xml"
-      - "**/crash_diagnostics/*"
-    env:
-        LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-${LLVM_HEAD_VERSION}" # TODO: Should we build that from scratch?
-        CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
-    agents:
-      queue: "linux"
-    retry:
-      automatic:
-        - exit_status: -1  # Agent was lost
-          limit: 2
-    timeout_in_minutes: 120

>From 8d10d51a3e084fea5dc771dbe3103ade2cc001f9 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 23:48:32 +0300
Subject: [PATCH 14/16] Add whitespaces to CMake arguments

---
 .ci/monolithic-linux.sh | 48 ++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index bbd90f7d496b1..4389f0e137170 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -72,14 +72,14 @@ if [[ "${runtimes}" != "" ]]; then
   echo "--- cmake runtimes C++03"
 
   cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
-      -DCMAKE_C_COMPILER="${BUILD_DIR}/bin/clang" \
-      -DCMAKE_CXX_COMPILER="${BUILD_DIR}/bin/clang++" \
-      -DLLVM_ENABLE_RUNTIMES="${runtimes}" \
-      -DLIBCXX_CXX_ABI=libcxxabi \
-      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-      -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-      -DLIBCXX_TEST_PARAMS="std=c++03" \
-      -DLIBCXXABI_TEST_PARAMS="std=c++03"
+      -D CMAKE_C_COMPILER="${BUILD_DIR}/bin/clang" \
+      -D CMAKE_CXX_COMPILER="${BUILD_DIR}/bin/clang++" \
+      -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
+      -D LIBCXX_CXX_ABI=libcxxabi \
+      -D CMAKE_BUILD_TYPE=RelWithDebInfo \
+      -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
+      -D LIBCXX_TEST_PARAMS="std=c++03" \
+      -D LIBCXXABI_TEST_PARAMS="std=c++03"
 
   echo "--- ninja runtimes C++03"
 
@@ -89,14 +89,14 @@ if [[ "${runtimes}" != "" ]]; then
 
   rm -rf "${RUNTIMES_BUILD_DIR}"
   cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
-      -DCMAKE_C_COMPILER="${BUILD_DIR}/bin/clang" \
-      -DCMAKE_CXX_COMPILER="${BUILD_DIR}/bin/clang++" \
-      -DLLVM_ENABLE_RUNTIMES="${runtimes}" \
-      -DLIBCXX_CXX_ABI=libcxxabi \
-      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-      -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-      -DLIBCXX_TEST_PARAMS="std=c++26" \
-      -DLIBCXXABI_TEST_PARAMS="std=c++26"
+      -D CMAKE_C_COMPILER="${BUILD_DIR}/bin/clang" \
+      -D CMAKE_CXX_COMPILER="${BUILD_DIR}/bin/clang++" \
+      -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
+      -D LIBCXX_CXX_ABI=libcxxabi \
+      -D CMAKE_BUILD_TYPE=RelWithDebInfo \
+      -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
+      -D LIBCXX_TEST_PARAMS="std=c++26" \
+      -D LIBCXXABI_TEST_PARAMS="std=c++26"
 
   echo "--- ninja runtimes C++26"
 
@@ -106,14 +106,14 @@ if [[ "${runtimes}" != "" ]]; then
 
   rm -rf "${RUNTIMES_BUILD_DIR}"
   cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
-      -DCMAKE_C_COMPILER="${BUILD_DIR}/bin/clang" \
-      -DCMAKE_CXX_COMPILER="${BUILD_DIR}/bin/clang++" \
-      -DLLVM_ENABLE_RUNTIMES="${runtimes}" \
-      -DLIBCXX_CXX_ABI=libcxxabi \
-      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-      -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-      -DLIBCXX_TEST_PARAMS="enable_modules=clang" \
-      -DLIBCXXABI_TEST_PARAMS="enable_modules=clang"
+      -D CMAKE_C_COMPILER="${BUILD_DIR}/bin/clang" \
+      -D CMAKE_CXX_COMPILER="${BUILD_DIR}/bin/clang++" \
+      -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
+      -D LIBCXX_CXX_ABI=libcxxabi \
+      -D CMAKE_BUILD_TYPE=RelWithDebInfo \
+      -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
+      -D LIBCXX_TEST_PARAMS="enable_modules=clang" \
+      -D LIBCXXABI_TEST_PARAMS="enable_modules=clang"
 
   echo "--- ninja runtimes clang modules"
   

>From 9c1b04af304f4ab0aeaaf0f968731724353e14f2 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 23:57:17 +0300
Subject: [PATCH 15/16] Intall Clang and use it for libc++ builds

---
 .ci/monolithic-linux.sh | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index 4389f0e137170..a5fc705fe04b1 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -18,6 +18,7 @@ set -o pipefail
 
 MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
 BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
+INSTALL_DIR="${BUILD_DIR}/install"
 rm -rf "${BUILD_DIR}"
 
 ccache --zero-stats
@@ -49,7 +50,8 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
       -D LLVM_ENABLE_LLD=ON \
       -D CMAKE_CXX_FLAGS=-gmlt \
       -D LLVM_CCACHE_BUILD=ON \
-      -D MLIR_ENABLE_BINDINGS_PYTHON=ON
+      -D MLIR_ENABLE_BINDINGS_PYTHON=ON \
+      -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
 
 echo "--- ninja"
 # Targets are not escaped as they are passed as separate arguments.
@@ -65,6 +67,10 @@ if [[ "${runtimes}" != "" ]]; then
     echo "Runtimes to build are specified, but targets are not."
   fi
 
+  echo "--- ninja install-clang"
+
+  ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
+
   RUNTIMES_BUILD_DIR="${MONOREPO_ROOT}/build-runtimes"
   INSTALL_DIR="${RUNTIMES_BUILD_DIR}/install"
   mkdir -p ${RUNTIMES_BUILD_DIR}
@@ -72,8 +78,8 @@ if [[ "${runtimes}" != "" ]]; then
   echo "--- cmake runtimes C++03"
 
   cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
-      -D CMAKE_C_COMPILER="${BUILD_DIR}/bin/clang" \
-      -D CMAKE_CXX_COMPILER="${BUILD_DIR}/bin/clang++" \
+      -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
+      -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
       -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
       -D LIBCXX_CXX_ABI=libcxxabi \
       -D CMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -89,8 +95,8 @@ if [[ "${runtimes}" != "" ]]; then
 
   rm -rf "${RUNTIMES_BUILD_DIR}"
   cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
-      -D CMAKE_C_COMPILER="${BUILD_DIR}/bin/clang" \
-      -D CMAKE_CXX_COMPILER="${BUILD_DIR}/bin/clang++" \
+      -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
+      -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
       -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
       -D LIBCXX_CXX_ABI=libcxxabi \
       -D CMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -106,8 +112,8 @@ if [[ "${runtimes}" != "" ]]; then
 
   rm -rf "${RUNTIMES_BUILD_DIR}"
   cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
-      -D CMAKE_C_COMPILER="${BUILD_DIR}/bin/clang" \
-      -D CMAKE_CXX_COMPILER="${BUILD_DIR}/bin/clang++" \
+      -D CMAKE_C_COMPILER="${INSTALL_DIR}/bin/clang" \
+      -D CMAKE_CXX_COMPILER="${INSTALL_DIR}/bin/clang++" \
       -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
       -D LIBCXX_CXX_ABI=libcxxabi \
       -D CMAKE_BUILD_TYPE=RelWithDebInfo \

>From 34c2cb900c6d01c6a7bc3ff11c0386c6bfdb18b4 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Fri, 24 May 2024 23:58:08 +0300
Subject: [PATCH 16/16] Add non-zero exit when only 3 arguments are passed to
 the `monolithic-linux.sh`

---
 .ci/monolithic-linux.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index a5fc705fe04b1..0036c3e680afa 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -65,6 +65,7 @@ runtime_targets="${4}"
 if [[ "${runtimes}" != "" ]]; then
   if [[ "${runtime_targets}" == "" ]]; then
     echo "Runtimes to build are specified, but targets are not."
+    exit 1
   fi
 
   echo "--- ninja install-clang"



More information about the cfe-commits mailing list