https://github.com/zyn0217 created 
https://github.com/llvm/llvm-project/pull/136078

None

>From e70b8283d7778568ff715f8cc400732ad92ac321 Mon Sep 17 00:00:00 2001
From: Younan Zhang <zyn7...@gmail.com>
Date: Thu, 17 Apr 2025 11:45:52 +0800
Subject: [PATCH] Revert "[CI] monolithic-linux improvements (#135499)"

This reverts commit a399c6926a8701083c767cbb041e22ff92e9d717.
---
 .ci/compute_projects.py      | 10 ++---
 .ci/compute_projects_test.py | 13 -------
 .ci/monolithic-linux.sh      | 72 ++++++++++++++++++++----------------
 lldb/test/requirements.txt   |  2 -
 4 files changed, 44 insertions(+), 53 deletions(-)

diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py
index 17a2136a270d5..ff43547c9bbe5 100644
--- a/.ci/compute_projects.py
+++ b/.ci/compute_projects.py
@@ -52,9 +52,6 @@
     "clang": {"clang-tools-extra", "compiler-rt", "cross-project-tests"},
     "clang-tools-extra": {"libc"},
     "mlir": {"flang"},
-    # Test everything if ci scripts are changed.
-    # FIXME: Figure out what is missing and add here.
-    ".ci": {"llvm", "clang", "lld", "lldb"},
 }
 
 DEPENDENT_RUNTIMES_TO_TEST = {"clang": {"libcxx", "libcxxabi", "libunwind"}}
@@ -133,11 +130,12 @@ def _add_dependencies(projects: Set[str]) -> Set[str]:
 def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> 
Set[str]:
     projects_to_test = set()
     for modified_project in modified_projects:
+        # Skip all projects where we cannot run tests.
+        if modified_project not in PROJECT_CHECK_TARGETS:
+            continue
         if modified_project in RUNTIMES:
             continue
-        # Skip all projects where we cannot run tests.
-        if modified_project in PROJECT_CHECK_TARGETS:
-            projects_to_test.add(modified_project)
+        projects_to_test.add(modified_project)
         if modified_project not in DEPENDENTS_TO_TEST:
             continue
         for dependent_project in DEPENDENTS_TO_TEST[modified_project]:
diff --git a/.ci/compute_projects_test.py b/.ci/compute_projects_test.py
index 1ab1c82498932..e787fd8133c86 100644
--- a/.ci/compute_projects_test.py
+++ b/.ci/compute_projects_test.py
@@ -188,19 +188,6 @@ def test_exclude_gn(self):
         self.assertEqual(env_variables["runtimes_to_build"], "")
         self.assertEqual(env_variables["runtimes_check_targets"], "")
 
-     def test_ci(self):
-        env_variables = compute_projects.get_env_variables(
-            [".ci/compute_projects.py"], "Linux"
-        )
-        self.assertEqual(env_variables["projects_to_build"],
-                         "clang;lld;llvm;lldb")
-        self.assertEqual(env_variables["project_check_targets"], "check-clang
-                         check-lld check-llvm check-lldb")
-        self.assertEqual(env_variables["runtimes_to_build"],
-                         "libcxx;libcxxabi;libunwind")
-        self.assertEqual(env_variables["runtimes_check_targets"], "check-cxx
-                         check-cxxabi check-unwind")
-
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index f81a14cca6cb3..6461c9d40ad59 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
@@ -27,14 +28,10 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then
   ccache --clear
 fi
 
-mkdir -p artifacts/reproducers
-
-# Make sure any clang reproducers will end up as artifacts.
-export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers`
-
 function at-exit {
   retcode=$?
 
+  mkdir -p artifacts
   ccache --print-stats > artifacts/ccache_stats.txt
   cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
 
@@ -53,28 +50,17 @@ trap at-exit EXIT
 
 projects="${1}"
 targets="${2}"
-runtimes="${3}"
 
 lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml 
--use-unique-output-file-name --timeout=1200 --time-tests"
 
 echo "--- cmake"
-
 export PIP_BREAK_SYSTEM_PACKAGES=1
 pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
 pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
 pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
-
-# Set the system llvm-symbolizer as preferred.
-export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer`
-[[ ! -f "${LLVM_SYMBOLIZER_PATH}" ]] && echo "llvm-symbolizer not found!"
-
-# Set up all runtimes either way. libcxx is a dependency of LLDB.
-# If it ends up being unused, not much harm.
 cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
       -D LLVM_ENABLE_PROJECTS="${projects}" \
-      -D LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
       -G Ninja \
-      -D CMAKE_PREFIX_PATH="${HOME}/.local" \
       -D CMAKE_BUILD_TYPE=Release \
       -D LLVM_ENABLE_ASSERTIONS=ON \
       -D LLVM_BUILD_EXAMPLES=ON \
@@ -83,47 +69,69 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
       -D LLVM_ENABLE_LLD=ON \
       -D CMAKE_CXX_FLAGS=-gmlt \
       -D LLVM_CCACHE_BUILD=ON \
-      -D LIBCXX_CXX_ABI=libcxxabi \
       -D MLIR_ENABLE_BINDINGS_PYTHON=ON \
-      -D LLDB_ENABLE_PYTHON=ON \
-      -D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON
+      -D CMAKE_INSTALL_PREFIX="${INSTALL_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}"
 
-# Run runtimes tests.
-# We don't need to do a clean separate build of runtimes, because runtimes
-# will be built against just built clang, and because LIBCXX_TEST_PARAMS
-# and LIBCXXABI_TEST_PARAMS only affect lit configuration, which successfully
-# propagates without a clean build. Other that those two variables, builds
-# are supposed to be the same.
+# 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."
     exit 1
   fi
 
+  echo "--- ninja install-clang"
+
+  ninja -C ${BUILD_DIR} install-clang install-clang-resource-headers
+
+  RUNTIMES_BUILD_DIR="${MONOREPO_ROOT}/build-runtimes"
+  INSTALL_DIR="${BUILD_DIR}/install"
+  mkdir -p ${RUNTIMES_BUILD_DIR}
+
   echo "--- cmake runtimes C++26"
 
-  cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
+  rm -rf "${RUNTIMES_BUILD_DIR}"
+  cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
+      -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 \
+      -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
       -D LIBCXX_TEST_PARAMS="std=c++26" \
-      -D LIBCXXABI_TEST_PARAMS="std=c++26"
+      -D LIBCXXABI_TEST_PARAMS="std=c++26" \
+      -D LLVM_LIT_ARGS="${lit_args}"
 
   echo "--- ninja runtimes C++26"
 
-  ninja -vC "${BUILD_DIR}" ${runtime_targets}
+  ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
 
   echo "--- cmake runtimes clang modules"
 
-  cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
+  # We don't need to do a clean build of runtimes, because LIBCXX_TEST_PARAMS
+  # and LIBCXXABI_TEST_PARAMS only affect lit configuration, which successfully
+  # propagates without a clean build. Other that those two variables, builds
+  # are supposed to be the same.
+
+  cmake -S "${MONOREPO_ROOT}/runtimes" -B "${RUNTIMES_BUILD_DIR}" -GNinja \
+      -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 \
+      -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
       -D LIBCXX_TEST_PARAMS="enable_modules=clang" \
-      -D LIBCXXABI_TEST_PARAMS="enable_modules=clang"
+      -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
+      -D LLVM_LIT_ARGS="${lit_args}"
 
   echo "--- ninja runtimes clang modules"
 
-  ninja -vC "${BUILD_DIR}" ${runtime_targets}
+  ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
 fi
diff --git a/lldb/test/requirements.txt b/lldb/test/requirements.txt
index c187180697d0b..708f2327a6a04 100644
--- a/lldb/test/requirements.txt
+++ b/lldb/test/requirements.txt
@@ -5,5 +5,3 @@ psutil>=5.9.4
 # See llvm.org/pr22274.
 pexpect>=4.9.0; sys_platform != 'win32'
 packaging
-# Required for python tests
-swig

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to