Skip to content

Commit

Permalink
Update LLVM versions in tests to 16 (bazel-contrib#221)
Browse files Browse the repository at this point in the history
Updates to 16.0.0 as default, 16.0.5 for Apple Silicon, but keeps 15.0.7 for x86 Apple.

Bonus changes:
- Include libtinfo5 in test envs
- New include dirs format as lib/clang/16/include/
  • Loading branch information
siddharthab committed Sep 19, 2023
1 parent 5a276de commit 42e0b40
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 36 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
bzlmod: false
runs-on: ${{ matrix.os }}
steps:
- if: startsWith(matrix.os, 'ubuntu')
name: Install APT packages
run: sudo apt-get -y install libtinfo5
- uses: actions/checkout@v3
- name: Test
env:
Expand All @@ -53,6 +56,9 @@ jobs:
bzlmod: [true, false]
runs-on: ${{ matrix.os }}
steps:
- if: startsWith(matrix.os, 'ubuntu')
name: Install APT packages
run: sudo apt-get -y install libtinfo5
- uses: actions/checkout@v3
- name: Test
env:
Expand Down Expand Up @@ -88,19 +94,23 @@ jobs:
abs_paths_test:
runs-on: ubuntu-latest
steps:
- name: Install APT packages
run: sudo apt-get -y install libtinfo5
- uses: actions/checkout@v3
- name: Test
run: tests/scripts/run_tests.sh -t @llvm_toolchain_with_absolute_paths//:cc-toolchain-x86_64-linux
sys_paths_test:
runs-on: ubuntu-latest
steps:
- name: Install APT packages
run: sudo apt-get -y install libtinfo5
- uses: actions/checkout@v3
- name: Download and Extract LLVM distribution
env:
release: llvmorg-15.0.6
archive: clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04
release: llvmorg-16.0.0
archive: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04
ext: .tar.xz
local_path: /tmp/llvm-15
local_path: /tmp/llvm-16
run: wget --no-verbose "https://github.com/llvm/llvm-project/releases/download/${release}/${archive}${ext}" && tar -xf "${archive}${ext}" && mv "${archive}" "${local_path}"
- name: Test
run: tests/scripts/run_tests.sh -t @llvm_toolchain_with_system_llvm//:cc-toolchain-x86_64-linux
19 changes: 8 additions & 11 deletions tests/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,15 @@ llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
# llvm_toolchain below, sys_paths_test in the workflows file, and xcompile_test
# through the `llvm_toolchain_with_sysroot` toolchain.
LLVM_VERSION = "15.0.6"
LLVM_VERSIONS = {
"": "16.0.0",
"darwin-aarch64": "16.0.5",
"darwin-x86_64": "15.0.7",
}

llvm.toolchain(
name = "llvm_toolchain",
llvm_versions = {
"": "15.0.6",
"darwin-aarch64": "15.0.7",
"darwin-x86_64": "15.0.7",
},
llvm_versions = LLVM_VERSIONS,
)
use_repo(llvm, "llvm_toolchain", "llvm_toolchain_llvm")

Expand Down Expand Up @@ -144,19 +145,15 @@ llvm.toolchain(
llvm_version = LLVM_VERSION,
# For this toolchain to work, the LLVM distribution archive would need to be unpacked here.
# A path in /tmp to be part of system tmp cleanup schedule.
toolchain_roots = {"": "/tmp/llvm-15"},
toolchain_roots = {"": "/tmp/llvm-16"},
)
use_repo(llvm, "llvm_toolchain_with_system_llvm")

# ## Toolchain example with a sysroot.

llvm.toolchain(
name = "llvm_toolchain_with_sysroot",
llvm_versions = {
"": "15.0.6",
"darwin-x86_64": "15.0.7",
"darwin-aarch64": "15.0.7",
},
llvm_versions = LLVM_VERSIONS,
sysroot = {
"linux-x86_64": "@org_chromium_sysroot_linux_x64//:sysroot",
},
Expand Down
28 changes: 11 additions & 17 deletions tests/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,24 @@ load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")
# When updating this version, also update the versions associated with
# llvm_toolchain below, sys_paths_test in the workflows file, and xcompile_test
# through the `llvm_toolchain_with_sysroot` toolchain.
LLVM_VERSION = "15.0.6"
LLVM_VERSION = "16.0.0"

LLVM_VERSIONS = {
"": "16.0.0",
"darwin-aarch64": "16.0.5",
"darwin-x86_64": "15.0.7",
}

llvm_toolchain(
name = "llvm_toolchain",
llvm_versions = {
"": "15.0.6",
"darwin-aarch64": "15.0.7",
"darwin-x86_64": "15.0.7",
},
llvm_versions = LLVM_VERSIONS,
)

# Example toolchain with user provided URLs.
# TODO(siddharthab): Add test.
llvm_toolchain(
name = "llvm_toolchain_with_urls",
llvm_versions = {
"": "15.0.6",
"darwin-aarch64": "15.0.7",
"darwin-x86_64": "15.0.7",
},
llvm_versions = LLVM_VERSIONS,
sha256 = {
"": "38bc7f5563642e73e69ac5626724e206d6d539fbef653541b34cae0ba9c3f036",
"darwin-aarch64": "867c6afd41158c132ef05a8f1ddaecf476a26b91c85def8e124414f9a9ba188d",
Expand Down Expand Up @@ -96,7 +94,7 @@ llvm_toolchain(
llvm_version = LLVM_VERSION,
# For this toolchain to work, the LLVM distribution archive would need to be unpacked here.
# A path in /tmp to be part of system tmp cleanup schedule.
toolchain_roots = {"": "/tmp/llvm-15"},
toolchain_roots = {"": "/tmp/llvm-16"},
)

## Toolchain example with a sysroot.
Expand All @@ -117,11 +115,7 @@ filegroup(

llvm_toolchain(
name = "llvm_toolchain_with_sysroot",
llvm_versions = {
"": "15.0.6",
"darwin-x86_64": "15.0.7",
"darwin-aarch64": "15.0.7",
},
llvm_versions = LLVM_VERSIONS,
sysroot = {
"linux-x86_64": "@org_chromium_sysroot_linux_x64//:sysroot",
},
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/debian_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set -exuo pipefail
# Common setup
export DEBIAN_FRONTEND=noninteractive
apt-get -qq update
apt-get -qq -y install curl zlib1g-dev >/dev/null
apt-get -qq -y install curl libtinfo5 zlib1g-dev >/dev/null
# The above command gives some verbose output that can not be silenced easily.
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=288778
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/fedora_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ for image in "${images[@]}"; do
set -exuo pipefail
# Need system glibc headers (e.g. features.h).
dnf install -qy glibc-headers
dnf install -qy glibc-headers ncurses-compat-libs
# Run tests
cd /src
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/linux_sysroot_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set -exuo pipefail
# Common setup
export DEBIAN_FRONTEND=noninteractive
apt-get -qq update
apt-get -qq -y install curl zlib1g-dev >/dev/null
apt-get -qq -y install curl libtinfo5 zlib1g-dev >/dev/null
# The above command gives some verbose output that can not be silenced easily.
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=288778
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/ubuntu_20_04_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set -exuo pipefail
# Common setup
export DEBIAN_FRONTEND=noninteractive
apt-get -qq update
apt-get -qq -y install apt-utils curl pkg-config zip zlib1g-dev unzip python >/dev/null
apt-get -qq -y install apt-utils curl libtinfo5 pkg-config zlib1g-dev >/dev/null
# The above command gives some verbose output that can not be silenced easily.
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=288778
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/ubuntu_22_04_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set -exuo pipefail
# Common setup
export DEBIAN_FRONTEND=noninteractive
apt-get -qq update
apt-get -qq -y install curl zlib1g-dev >/dev/null
apt-get -qq -y install curl libtinfo5 zlib1g-dev >/dev/null
# The above command gives some verbose output that can not be silenced easily.
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=288778
Expand Down
4 changes: 4 additions & 0 deletions toolchain/cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def cc_toolchain_config(
host_os_arch_key = _os_arch_pair(host_os, host_arch)
target_os_arch_key = _os_arch_pair(target_os, target_arch)
_check_os_arch_keys([host_os_arch_key, target_os_arch_key])
major_llvm_version = int(llvm_version.split(".")[0])

# A bunch of variables that get passed straight through to
# `create_cc_toolchain_config_info`.
Expand Down Expand Up @@ -269,6 +270,9 @@ def cc_toolchain_config(
toolchain_path_prefix + "lib/clang/{}/include".format(llvm_version),
toolchain_path_prefix + "lib/clang/{}/share".format(llvm_version),
toolchain_path_prefix + "lib64/clang/{}/include".format(llvm_version),
toolchain_path_prefix + "lib/clang/{}/include".format(major_llvm_version),
toolchain_path_prefix + "lib/clang/{}/share".format(major_llvm_version),
toolchain_path_prefix + "lib64/clang/{}/include".format(major_llvm_version),
])

sysroot_path = compiler_configuration["sysroot_path"]
Expand Down

0 comments on commit 42e0b40

Please sign in to comment.