-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[CI] monolithic-linux improvements #135499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b4b4797
to
54ac9ed
Compare
54ac9ed
to
7002181
Compare
@llvm/pr-subscribers-lldb Author: Matheus Izvekov (mizvekov) ChangesSome improvements to monolithic-linux CI:
Full diff: https://github.com/llvm/llvm-project/pull/135499.diff 4 Files Affected:
diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py
index ff43547c9bbe5..17a2136a270d5 100644
--- a/.ci/compute_projects.py
+++ b/.ci/compute_projects.py
@@ -52,6 +52,9 @@
"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"}}
@@ -130,12 +133,11 @@ 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
- projects_to_test.add(modified_project)
+ # Skip all projects where we cannot run tests.
+ if modified_project in PROJECT_CHECK_TARGETS:
+ 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 e787fd8133c86..1ab1c82498932 100644
--- a/.ci/compute_projects_test.py
+++ b/.ci/compute_projects_test.py
@@ -188,6 +188,19 @@ 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 13c7a93c364db..d7c9ac147677d 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -18,7 +18,6 @@ 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
@@ -28,10 +27,14 @@ 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
# If building fails there will be no results files.
@@ -49,17 +52,28 @@ 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 \
@@ -68,69 +82,47 @@ 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 CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
+ -D LLDB_ENABLE_PYTHON=ON \
+ -D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON
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.
+# 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.
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"
- 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}" \
+ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LIBCXX_TEST_PARAMS="std=c++26" \
- -D LIBCXXABI_TEST_PARAMS="std=c++26" \
- -D LLVM_LIT_ARGS="${lit_args}"
+ -D LIBCXXABI_TEST_PARAMS="std=c++26"
echo "--- ninja runtimes C++26"
- ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
+ ninja -vC "${BUILD_DIR}" ${runtime_targets}
echo "--- cmake runtimes clang modules"
- # 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}" \
+ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LIBCXX_TEST_PARAMS="enable_modules=clang" \
- -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
- -D LLVM_LIT_ARGS="${lit_args}"
+ -D LIBCXXABI_TEST_PARAMS="enable_modules=clang"
echo "--- ninja runtimes clang modules"
- ninja -vC "${RUNTIMES_BUILD_DIR}" ${runtime_targets}
+ ninja -vC "${BUILD_DIR}" ${runtime_targets}
fi
diff --git a/lldb/test/requirements.txt b/lldb/test/requirements.txt
index 708f2327a6a04..c187180697d0b 100644
--- a/lldb/test/requirements.txt
+++ b/lldb/test/requirements.txt
@@ -5,3 +5,5 @@ psutil>=5.9.4
# See llvm.org/pr22274.
pexpect>=4.9.0; sys_platform != 'win32'
packaging
+# Required for python tests
+swig
|
Some improvements to monolithic-linux CI: 1) Add correct configuration and dependencies for LLDB testing which is actually relevant for clang changes. 2) Skip clang installation and separate configuration for runtimes. They will be build with just built clang either way. This helps in avoiding building the runtimes twice in case LLDB is tested. 3) Make sure any generated clang reproducers end up as artifacts. 4) Set up llvm-symbolizer environment variable so that its preferred over any symbolizer just built, as even if it probably works correctly, it can be much slower when built for debugging. 5) Add all projects as dependencies of `.ci`, to make sure everything is tested when it changes.
7002181
to
456d2fd
Compare
boomanaiden154
approved these changes
Apr 15, 2025
boomanaiden154
added a commit
that referenced
this pull request
Apr 17, 2025
This reverts commit a399c69. This is causing some premerge workflow failures. Examople: https://buildkite.com/llvm-project/github-pull-requests/builds/169129#01963d1d-dc75-4b4c-9952-fb60efbf91b4
When relanding it would probably be helpful to land individual improvements in separate patches rather than bundling them all together. |
var-const
pushed a commit
to ldionne/llvm-project
that referenced
this pull request
Apr 17, 2025
Some improvements to monolithic-linux CI: 1) Add correct configuration and dependencies for LLDB testing which is actually relevant for clang changes. 2) Skip clang installation and separate configuration for runtimes. They will be built with the just built clang either way. This avoids building the runtimes twice when LLDB is also tested. 3) Make sure any generated clang reproducers end up as artifacts. 4) Set up llvm-symbolizer environment variable so that its preferred over any symbolizer just built, as it can be much slower when built for debugging. 5) Add all projects as dependencies of `.ci`, to make sure everything is tested when it changes.
var-const
pushed a commit
to ldionne/llvm-project
that referenced
this pull request
Apr 17, 2025
This reverts commit a399c69. This is causing some premerge workflow failures. Examople: https://buildkite.com/llvm-project/github-pull-requests/builds/169129#01963d1d-dc75-4b4c-9952-fb60efbf91b4
mizvekov
added a commit
that referenced
this pull request
Apr 18, 2025
Add all projects as dependencies of .ci, to make sure everything is tested when it changes. Originally split-off from #135499
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
Add all projects as dependencies of .ci, to make sure everything is tested when it changes. Originally split-off from llvm#135499
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
Add all projects as dependencies of .ci, to make sure everything is tested when it changes. Originally split-off from llvm#135499
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
Add all projects as dependencies of .ci, to make sure everything is tested when it changes. Originally split-off from llvm#135499
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some improvements to monolithic-linux CI:
is actually relevant for clang changes.
They will be built with the just built clang either way.
This avoids building the runtimes twice when LLDB is also tested.
any symbolizer just built, as it can be much slower when built for debugging.
.ci
, to make sure everything istested when it changes.