Compare commits

..

1 commit

Author SHA1 Message Date
Jesus Checa Hidalgo
483eb7a897 Create compat18 branch 2024-07-16 13:23:55 +02:00
127 changed files with 266 additions and 2084 deletions

View file

@ -12,10 +12,3 @@ repos:
rev: 1.32.2
hooks:
- id: tmt-lint
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.10.0
hooks:
- id: shellcheck
require_serial: true # Podman has trouble running concurrently
args: ["--exclude=SC1091"] # Ignore "Not following" sourced scripts

View file

@ -7,13 +7,9 @@ Tests are executed using TMT (Test Management Tool). The repository includes a
TMT plan that runs all the tests by default. All the tests support the following
context dimensions:
* `distro`: The distribution version running the tests (e.g. `rhel-9.6`,
`fedora-42`, `centos-stream-10`)
* `arch`: The hardware architecture of the host running the tests (e.g. `aarch64`,
`s390x`, `x86_64`)
* `compat`: Indicates a run for fedora compat-versioned packages (e.g. `llvm18`)
* `snapshot`: Indicates a run for [llvm snapshots](
https://github.com/fedora-llvm-team/llvm-snapshots) copr build.
* `distro`
* `arch`
* `collection` (only applicable to RHEL 7)
To run the tests:
```bash
@ -97,18 +93,6 @@ tier: 1
# - sometag
```
### Test Tags
The following tags are used to control which tests are included or excluded in
TMT plans. Please be cautious when adding or removing these tags, as they are
used by plans in multiple repositories.
* `fedora-only`: The test applies to Fedora distros only.
* `not-in-default`: Excludes the test from the default test plan. This is useful
for resource-intensive tests that are better suited for a dedicated test plan
or could potentially break the test system.
* `multilib`: Requires 32-bit (i686) package dependencies.
### Avoid common errors using pre-commit
This project uses [`pre-commit`](https://pre-commit.com/)
@ -124,31 +108,3 @@ Please install `pre-commit` using `pip install pre-commit` as described
project and install the git hook scripts using `pre-commit install`. This will
run pre-commit on every `git commit` that you make in this repository from now
on.
## Test specific documentation
### kernel-ark-rebuild
The `kernel-ark-rebuild` test is a special test that we use to ensure that clang,
llvm, and lld builds do not break [Always Ready Kernel](
https://gitlab.com/cki-project/kernel-ark) builds, which are done in Fedora
Rawhide. This is a virtual test comprised of 4 tests corresponding to different
build configurations for the kernel:
* base
* base/lto
* debug
* debug/lto
Due to this, this test is not regularly run on PRs opened in tests/clang, as
running the 4 tests can take about 6 hours. Instead, if you modify the test
you are expected to run it on your own and provide the results in the Pull
Request. A specific tmt test plan named `kernel-ark-gating.fmf` is provided for
that. It can be run using Testing Farm with this command:
```
testing-farm request -c initiator=human -c distro=fedora-rawhide -c arch=<your-arch> \
--compose Fedora-Rawhide --git-url <url-to-your-fork> --git-ref <your-pr-branch> \
--plan kernel-ark-gating
```
You need an [API key](https://docs.testing-farm.io/Testing%20Farm/0.1/onboarding.html)
to be able to use Testing Farm. If you don't have on, please ask for help running
the test when opening a Pull Request.

View file

@ -1,31 +0,0 @@
#
# Build/PR gating tests for LLD
#
# Compatible with various LLVM distributions:
#
# * Fedora (ursine packages)
# * Centos 9 stream (ursine packages)
# * RHEL-9 (ursine packages)
# * RHEL-8 (Red Hat module)
#
summary: LLD tests for build/PR gating, testing alternatives and spoiling the installation
discover:
how: fmf
test: ld-alternative
execute:
how: tmt
adjust+:
- because: "Plan to be ran when either executed locally, or executed by CI system to gate a build or PR."
when: >-
trigger is defined
and trigger != commit
and trigger != build
enabled: false
- because: lld is not shipped in s390x on LLVM < 18
enabled: false
when: arch == s390x and distro ~< rhel-8.10
- enabled: false
when: arch == s390x and distro ~< rhel-9.5

View file

@ -7,6 +7,7 @@
# * Centos 9 stream (ursine packages)
# * RHEL-9 (ursine packages)
# * RHEL-8 (Red Hat module)
# * RHEL-7 (software collection)
#
summary: LLVM tests for build/PR gating
@ -38,7 +39,7 @@ adjust:
discover:
- name: llvm-tests
how: fmf
filter: "tag:-not-in-default"
filter: "tag:-spoils-installation"
execute:
how: tmt
provision:

View file

@ -1,18 +0,0 @@
summary: Build latest kernel-ark with clang using different build configurations
discover:
how: fmf
test: kernel-ark-build
execute:
how: tmt
provision:
hardware:
memory: ">=16 GiB"
cpu:
cores: ">=8"
# We do not want to run this test on every pull request done to tests/clang.
# Only allow to run manually when the test is really modified to prevent
# using too much time and resources in non-related pull requests.
adjust:
- when: initiator is not defined or initiator != human
enabled: false

View file

@ -1,25 +0,0 @@
summary: Run ABI tests from llvm-test-suite package
duration: 1h
tag+:
- fedora-only
adjust+:
- because: "llvm-test-suite is available for Fedora, not RHEL/CentOS"
when: >-
distro == rhel
or distro == centos
enabled: false
- because: ABI testsuite only supported in x86*
enabled: false
when: arch != x86_64
- because: "llvm test suite not built for compat packages"
enabled: false
when: compat is defined
require+:
- clang
- llvm-test-suite
- python3

View file

@ -1,14 +0,0 @@
#!/bin/bash
testsuite_dir="/usr/share/llvm-test-suite/"
compiler="clang"
set -xe
tmpdir=$(mktemp -d -p /var/tmp)
pushd "$tmpdir"
cp -r $testsuite_dir/ABI-Testsuite .
cd ABI-Testsuite
python3 linux-x86.py $compiler test -v
popd
rm -rf "$tmpdir"

View file

@ -4,6 +4,8 @@ duration: 1m
require+:
- binutils
tier: 1
extra-summary: /tools/llvm/binutils-plugin-ar
extra-task: /tools/llvm/binutils-plugin-ar
adjust+:
# This will not work in RHEL-7. Check for further information:
@ -15,3 +17,5 @@ adjust+:
- because: compat llvm-libs does not install LLVMgold.so in bfd-plugins dir
enabled: false
when: compat is defined
extra-nitrate: TC#0614092

View file

@ -1,22 +0,0 @@
summary: Sanity check that llvm-bolt works
tier: 1
tag+:
- fedora-only
adjust+:
- because: "llvm-bolt is available for Fedora, not RHEL/CentOS"
when: distro != fedora
enabled: false
- because: "llvm-bolt only supports x86_64 and aarch64"
when: arch != x86_64 and arch != aarch64
enabled: false
- because: "llvm-bolt not shipped in compat packages"
when: compat is defined
enabled: false
require+:
- llvm-bolt
- clang

View file

@ -1,8 +0,0 @@
#!/bin/sh -eux
echo "int main() { return 0; }" > test.c
clang -Wl,--emit-relocs test.c
llvm-bolt a.out -instrument -o a.instrumented.out
./a.instrumented.out
llvm-bolt a.out -data /tmp/prof.fdata -o a.bolt.out
./a.bolt.out

View file

@ -1,17 +0,0 @@
summary: Test that compiler-rt does not contain broken symlinks
tier: 1
framework: beakerlib
require+:
- yum-utils
- python3-dnf
link+:
- verifies: https://issues.redhat.com/browse/RHEL-7375
adjust+:
# Broken symlinks were fixed with Clang Resource directory moving in LLVM 17:
# https://fedoraproject.org/wiki/Changes/LLVM-17#Detailed_Description
# There are no plans to backport that, so we disable the test
# in distros where LLVM < 17.
- enabled: false
when: distro ~<= rhel-9.3

View file

@ -1,55 +0,0 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
. /usr/share/beakerlib/beakerlib.sh || exit 1
rlJournalStart
rlPhaseStartSetup
declare tmp
rlRun "tmp=$(mktemp -d)" 0 "Create a temp dir"
# Get the compiler-rt package name from the tmt required packages, which should
# address the issue of getting the correct name regardless it's a compat package
# or not. The package can be named either compiler-rt or compiler-rt[0-9]+
rlRun "COMPILER_RT=$(rlGetYAMLdeps | tr ' ' '\n' | grep -E "compiler-rt[[:digit:]]*$")"
# Make sure to get only the main arch, so we can deal with multilib issues.
rlRun "COMPILER_RT_NVR=$(rpm -q "${COMPILER_RT}" | grep "$(uname -m)")"
# Use dnf repoquery --installed so we *don't* query any repos but the
# local rpm database instead. That should handle packages installed
# using rpm, that are not in repos, and avoid timeouts if repo connection
# is slow.
# dnf5 drops support of --resolve in favor of --providers-of=<attribute>
# but --installed does query the repos anyway. In systems with dnf5 we
# fall back to dnf4 python bindings (using dnf-3) to workaround this.
# Check https://src.fedoraproject.org/tests/compiler-rt/issue/16
rlRun "dnf-3 repoquery --installed --depends --resolve $COMPILER_RT_NVR > $tmp/dependencies.log"
rlPhaseEnd
rlPhaseStartTest
for file in $(rpm -ql "$COMPILER_RT_NVR"); do
# Skip iteration if the file is not a symlink
[[ -L $file ]] || continue
# Check if the symlink resolves to a valid file. If not, it's a failure
if [[ ! -e $file ]]; then
rlFail "$file is a dangling symlink"
continue
fi
# Up to this point, the linked file exists.
# If the owner of the target compiler-rt package itself that's
# correct and we can skip to the next file.
target=$(readlink -f "$file")
OWNER_NVR=$(rpm -qf "$target")
[[ "$OWNER_NVR" == "$COMPILER_RT_NVR" ]] && continue
# The target exists but it's not owned by compiler-rt. It must be
# owned by one of its dependencies, else flag a failure.
if ! grep "$OWNER_NVR" "$tmp/dependencies.log"; then
rlFail "$file pointing to $target is a dangling symlink owned by $OWNER_NVR"
fi
done
rlPhaseEnd
rlPhaseStartCleanup
rlRun "rm -rf $tmp" 0 "Removing temp dir"
rlPhaseEnd
rlJournalEnd

View file

@ -5,3 +5,6 @@ framework: shell
component:
- llvm-toolset
- llvm
extra-summary: /tools/llvm/build-compat
extra-task: /tools/llvm/build-compat
extra-nitrate: TC#0614093

View file

@ -4,8 +4,8 @@ dnf download --disablerepo=* --enablerepo=test-llvm --source llvm
# The src.rpm is available in the directory the test run from.
set +e
if ! mock --resultdir=. --old-chroot --with compat_build --rebuild ./*.src.rpm;
then
mock --resultdir=. --old-chroot --with compat_build --rebuild *.src.rpm
if [ $? -ne 0 ]; then
cat root.log
cat build.log
exit 1

View file

@ -1,8 +0,0 @@
summary: clang-format-diff
tier: 1
link+:
verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1939018
require+:
- clang-tools-extra

View file

@ -1,5 +0,0 @@
#!/bin/sh -eux
# Check that clang-format-diff is in PATH.
# rhbz#1939018
clang-format-diff -h

View file

@ -1,32 +0,0 @@
cmake_minimum_required(VERSION 3.20.0)
project(SimpleProject)
# Find LLVM package and save all the imported targets into a list.
find_package(LLVM REQUIRED CONFIG)
get_property(LLVMImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
# Find Clang package and save all the imported targets into a list. As Clang's
# find_package depends on LLVM - it calls find_package(LLVM) internally - this
# implicitly import all the LLVM targets too, so we have to filter these out
# with the previous list.
find_package(Clang REQUIRED CONFIG)
get_property(ClangImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
list(REMOVE_ITEM ClangImportedTargets ${LLVMImportedTargets})
# Filter out targets imported from internal find_package such as FFI, LibEdit, ZLIB, etc
# These might or might not be installed in the user's system. These are prefixed
# with "<MODULE>::" (e.g. LibEdit::LibEdit).
list(FILTER LLVMImportedTargets EXCLUDE REGEX "::")
# For all imported targets by LLVM get the location of the object and dump It
# to an output.txt file. The test script will parse it later.
foreach(target IN LISTS LLVMImportedTargets)
get_target_property(tgt_loc ${target} LOCATION)
file(APPEND ${CMAKE_BINARY_DIR}/llvm_targets.txt "${tgt_loc}\n")
endforeach()
# Do the same operation with Clang imported targets
foreach(target IN LISTS ClangImportedTargets)
get_target_property(tgt_loc ${target} LOCATION)
file(APPEND ${CMAKE_BINARY_DIR}/clang_targets.txt "${tgt_loc}\n")
endforeach()

View file

@ -1,12 +0,0 @@
summary: Test LLVM and Clang's find_package imported targets
description: |
This test ensures that all the exported targets provided by LLVM and Clang's
find_package are really present in the system, and are provided by a either
llvm/clang-devel package or a package is directly dependent on them.
framework: beakerlib
tier: 1
require+:
- cmake
- llvm-devel
- clang-devel
- which

View file

@ -1,68 +0,0 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
. /usr/share/beakerlib/beakerlib.sh || exit 1
rlJournalStart
rlPhaseStartSetup
rlRun "set -o pipefail"
declare LLVM_DEVEL CLANG_DEVEL src_dir tmp_dir
# Guess the name of the -devel packages. This is needed to make the test
# agnostic to versioned/unversioned packages. This should work equally
# for llvm19-devel or llvm-devel.
rlRun "LLVM_DEVEL=$(rpm -qf --qf '%{name}-devel' "$(which llc)")"
rlRun "CLANG_DEVEL=$(rpm -qf --qf '%{name}-devel' "$(which clang)")"
rlRun "tmp_dir=$(mktemp -d -p /var/tmp)"
rlRun "src_dir=$(pwd)"
# Gather rpms required *explicitly* by the currently installed
# llvm-devel and clang-devel. We'll consider each package dependent on
# itself.
for pkg in $LLVM_DEVEL $CLANG_DEVEL; do
dependencies=$(rpm -q --requires "$pkg" | cut -d ' ' -f 1 )
{
for req in $dependencies; do
rpm -q --whatprovides "$req"
done
} | sort -u > "${tmp_dir}/${pkg}-dependencies.txt"
rpm -q "$pkg" >> "${tmp_dir}/${pkg}-dependencies.txt"
done
rlRun "pushd $tmp_dir"
rlPhaseEnd
rlPhaseStartTest
# The CMakeLists.txt will produce two text files named llvm_targets.txt
# and clang_targets.txt, which contains the locations of all the
# libraries and executables exported (imported from user's persective)
# as targets.
rlRun "cmake $src_dir"
# llvm-devel must be a dependency of clang-devel, as ClangConfig.cmake
# depends on LLVMConfig.cmake.
rlAssertGrep "$LLVM_DEVEL" "${tmp_dir}/${CLANG_DEVEL}-dependencies.txt"
# For each imported target file, check who provides it and if the provider
# is in the dependency list (or is the package itself).
# Do not use rlAssertGrep, it will report hundreds of PASS lines making
# the log unnecessarily big.
rlLog "Parsing LLVM imported targets"
while IFS= read -r importedFile; do
if ! grep -q "$(rpm -qf "${importedFile}")" "${tmp_dir}/${LLVM_DEVEL}-dependencies.txt"; then
rlFail "${importedFile} is imported as a CMake target by ${LLVM_DEVEL}, but it's not part of any of its required packages."
fi
done < llvm_targets.txt
rlLog "Parsing Clang imported targets"
while IFS= read -r importedFile; do
if ! grep -q "$(rpm -qf "${importedFile}")" "${tmp_dir}/${CLANG_DEVEL}-dependencies.txt"; then
rlFail "${importedFile} is imported as a CMake target by ${CLANG_DEVEL}, but it's not part of any of its required packages."
fi
done < clang_targets.txt
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -rf $tmp_dir" 0 "Remove temporary directory: $tmp_dir"
rlPhaseEnd
rlJournalEnd

View file

@ -4,7 +4,6 @@
rlJournalStart
rlPhaseStartSetup
declare tmp
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "cp reproducer.c $tmp"
rlRun "pushd $tmp"

View file

@ -1,30 +0,0 @@
summary: compiler-rt test for rhbz#1678240
description: >
Test that clang -m32 -fsanitize looks for compiler-rt library in the
proper directory
tier: 1
tag+:
- multilib
- fedora-only
require+:
- compiler-rt.i686
- glibc-devel.i686
adjust+:
# Common requirements when LLVM is not SCL-ized
- enabled: false
because: "Test applicable only on x86_64 arch"
when: arch != x86_64
- enabled: false
because: "compiler-rt.i686 packages not shipped in RHEL/CentOS"
when: distro == rhel or distro == centos
- enabled: false
because: "compiler-rt.i686 may not be available in snapshot builds when x86_64 tests are executed"
when: snapshot is defined
- enabled: false
because: "compat packages are not configured for multilib"
when: compat is defined

View file

@ -1 +0,0 @@
int main(){return 0;}

View file

@ -1,3 +0,0 @@
#!/bin/sh -eux
clang -m32 -fsanitize=address test.c

View file

@ -1,5 +0,0 @@
#include <stdio.h>
void hello() {
printf("Hello World\n");
}

View file

@ -1,5 +0,0 @@
#include <iostream>
void hello() {
std::cout << "Hello World\n";
}

View file

@ -1,6 +0,0 @@
void hello();
int main(int argc, char **argv) {
hello();
return 0;
}

View file

@ -1,6 +0,0 @@
void hello();
int main(int argc, char **argv) {
hello();
return 0;
}

View file

@ -1,5 +0,0 @@
summary: fedora-flags
description: Build sample C/C++ code with default system flags from redhat-rpm-config
require+:
- redhat-rpm-config
tier: 1

View file

@ -1,21 +0,0 @@
#!/bin/bash
# shellcheck disable=SC2086
set -ex pipefail
cflags=$(rpm -D '%toolchain clang' -E '%{build_cflags}')
cxxflags=$(rpm -D '%toolchain clang' -E '%{build_cxxflags}')
ldflags=$(rpm -D '%toolchain clang' -E '%{build_ldflags}')
# Test a c program
clang $cflags -c hello.c -o hello.o
clang $cflags -c main.c -o main.o
clang $ldflags -o hello main.o hello.o
./hello | grep "Hello World"
# Test a cxx program
clang++ $cxxflags -c hello.cpp -o hello-cpp.o
clang++ $cxxflags -c main.cpp -o main-cpp.o
clang++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o
./hello-cpp | grep "Hello World"

View file

@ -1,4 +1,4 @@
summary: Find LLVM package with CMake.
summary: Find LLVM package with CMake
description: |
Find LLVM package with CMake. This is to guarantee that building the packages
together (aka "big-merge") but only installing them partially (e.g. llvm
@ -17,11 +17,9 @@ require+:
- git
- make
- cmake
- llvm-devel
- clang
- clang-devel
- llvm18-devel
- clang18
- clang18-devel
adjust+:
- enabled: false
when: deploymentmode == image
because: "/usr is readonly in imagemode systems"
when: collection is defined

View file

@ -5,7 +5,6 @@
rlJournalStart
rlPhaseStartSetup
rlRun "set -o pipefail"
declare loc_old loc_new tmp_dir
rlRun "loc_old=$(which clang-tblgen)"
rlRun "loc_new=$(mktemp)"
rlRun "tmp_dir=$(mktemp -d -p /var/tmp)"

View file

@ -1,3 +0,0 @@
PROGRAM HELLO
PRINT '(A)', 'Hello, world'
END

View file

@ -1,25 +0,0 @@
summary: Run simple tests for flang
tag+:
- fedora-only
adjust+:
- because: "flang is available for Fedora, not RHEL/CentOS"
when: >-
distro == rhel
or distro == centos
enabled: false
- because: "flang is only part of llvm since Fedora 44"
when: snapshot is defined and distro < fedora-44
enabled: false
- because: "flang is not built for compat packages"
enabled: false
when: compat is defined
require+:
- flang
- llvm-devel
- libgcc
duration: 1h

View file

@ -1,5 +0,0 @@
program sin
real :: pi
pi = 4*atan(1.0)
print *, sin(pi/2)
end program

View file

@ -1,13 +0,0 @@
#!/usr/bin/bash
# Compile and run simple Fortran programs in order to evaluate if Flang is
# minimally funcional.
set -e
flang hello.f -o hello
./hello | grep -q "Hello, world"
rm hello
flang sin.f90 -o sin
./sin | grep -q "1."
rm sin

View file

@ -1,7 +0,0 @@
summary: Test that Float16 ABI matches with clang
tier: 1
adjust+:
- because: "Float16 not supported on s390x or ppc64le"
enabled: false
when: arch == s390x or arch == ppc64le

View file

@ -1,14 +0,0 @@
// Reproducer based on this code from Steve Leung (evetsso):
// https://github.com/ROCmSoftwarePlatform/rocFFT/issues/439#issuecomment-1693835987
#include <iostream>
#include <algorithm>
#include <vector>
int main()
{
_Float16 one_f16 = 0.123;
float one_f32 = one_f16;
std::cout << one_f32 << std::endl;
return 0;
}

View file

@ -1,15 +0,0 @@
#!/bin/bash -ux
# Do NOT set exit after error flag (set -e). Let all the optimizations to be run
tmp=$(mktemp -d)
result=0
# Test the reproducer with all the optimization levels
for opt_level in 0 1 2 3; do
clang++ --rtlib=compiler-rt -O$opt_level test.cpp -o "${tmp}/test_O${opt_level}"
"${tmp}/test_O${opt_level}" | grep '0.122986' || result=1
done
rm -rf "$tmp"
if [[ "$result" == 1 ]]; then
exit 1
fi

View file

@ -1,6 +0,0 @@
#include <iostream>
int main(){
std::cout << "Hello world!\n";
return 0;
}

View file

@ -1,8 +0,0 @@
summary: Test that both gcc/clang compile/link compatibility.
description:
Build an object file with g++, link it with clang++ and viceversa, to ensure
that objects compiled with one can be linked with the other.
tier: 1
require+:
- gcc-c++

View file

@ -1,33 +0,0 @@
#!/bin/bash -eux
tmp=$(mktemp -d)
# clang not necessarily depends on system gcc. It might depend on gcc from
# gcc-toolset-XX, in such case we need to test the compatibility with that one.
# We can get that from `clang -v` output.
TOOLSET=$(clang -v |& grep "Selected GCC installation" | grep -P -o '(dev|gcc-)toolset-[0-9]*') ||:
if [[ "" = "${TOOLSET}" ]]; then
GCC="g++"
else
# GTS 15 started to shift away from scl in favor of the
# gcc-toolset-xx-env command.
if command -v "${TOOLSET}-env" &>/dev/null; then
GCC="${TOOLSET}-env -- g++"
echo "Testing with g++ from ${TOOLSET} using ${TOOLSET}-env"
else
GCC="scl enable ${TOOLSET} -- g++"
echo "Testing with g++ from ${TOOLSET}"
fi
fi
# Build the source with GCC, link it with clang
${GCC} -c hello.cpp -o "${tmp}/hello.o"
clang++ -o "${tmp}"/hello "${tmp}/hello.o"
"${tmp}/hello" | grep "Hello world"
rm -rf "${tmp:?}"/*
# Build the source with clang, link it with GCC
clang++ -c hello.cpp -o "${tmp}/hello.o"
${GCC} -o "${tmp}"/hello "${tmp}/hello.o"
"${tmp}/hello" | grep "Hello world"
rm -rf "${tmp:?}"/*

View file

@ -3,21 +3,20 @@
require+:
- cmake
- clang
- clang-analyzer
- clang-devel
- clang-tools-extra
- compiler-rt
- lld
- libomp-devel
- llvm-devel
- clang18
- clang18-analyzer
- clang18-devel
- clang18-tools-extra
- compiler-rt18
- lld18
- libomp18-devel
- llvm18-devel
- python3-lit
environment+:
NO_LIBCXX: true
NO_STATIC_LIBCXX: true
NO_LIBUNWIND: true
LIBOMP: true
adjust+:
- enabled: false

View file

@ -0,0 +1,70 @@
# DevTools collections settings.
environment+:
NO_LIBCXX: true
NO_STATIC_LIBCXX: true
NO_LIBUNWIND: true
adjust+:
- enabled: false
when: collection is not defined
continue: false
# Requirements for SCL-ized LLVM
- require+:
- llvm-toolset-13.0-cmake
- llvm-toolset-13.0-clang
- llvm-toolset-13.0-clang-analyzer
- llvm-toolset-13.0-clang-devel
- llvm-toolset-13.0-clang-tools-extra
- llvm-toolset-13.0-compiler-rt
- llvm-toolset-13.0-lld
- llvm-toolset-13.0-lldb
- llvm-toolset-13.0-libomp-devel
- llvm-toolset-13.0-llvm-devel
- llvm-toolset-13.0-python3-lit
when: "collection == llvm-toolset-13.0"
- require+:
- llvm-toolset-14.0-cmake
- llvm-toolset-14.0-clang
- llvm-toolset-14.0-clang-analyzer
- llvm-toolset-14.0-clang-devel
- llvm-toolset-14.0-clang-tools-extra
- llvm-toolset-14.0-compiler-rt
- llvm-toolset-14.0-lld
- llvm-toolset-14.0-lldb
- llvm-toolset-14.0-libomp-devel
- llvm-toolset-14.0-llvm-devel
- llvm-toolset-14.0-python3-lit
when: "collection == llvm-toolset-14.0"
- require+:
- llvm-toolset-15.0-cmake
- llvm-toolset-15.0-clang
- llvm-toolset-15.0-clang-analyzer
- llvm-toolset-15.0-clang-devel
- llvm-toolset-15.0-clang-tools-extra
- llvm-toolset-15.0-compiler-rt
- llvm-toolset-15.0-lld
- llvm-toolset-15.0-lldb
- llvm-toolset-15.0-libomp-devel
- llvm-toolset-15.0-llvm-devel
- llvm-toolset-15.0-python3-lit
when: "collection == llvm-toolset-15.0"
# lld not supported in s390x or ppc64. If any lld package was added to
# requirements, remove it.
- require-:
- llvm-toolset-13.0-lld
- llvm-toolset-14.0-lld
- llvm-toolset-15.0-lld
when: >-
collection is defined and arch == s390x
or arch == ppc64
# libomp not supported in s390x. If any libomp-devel package was added to
# requirements, remove it.
- require-:
- llvm-toolset-13.0-libomp-devel
- llvm-toolset-14.0-libomp-devel
- llvm-toolset-15.0-libomp-devel
when: collection is defined and arch == s390x

View file

@ -1,5 +1,6 @@
# Fedora package testing.
# This setup is meant to be used with non-compat packages.
# Fedora system repos package testing.
# This setup is meant to be used with packages in system repos, not with
# compat packages, or snapshots.
require+:
- cmake
@ -20,5 +21,19 @@ require+:
adjust+:
- enabled: false
when: distro != fedora or compat is defined
when: distro != fedora or snapshot is defined or compat is defined
continue: false
# libomp and lld are supported in s390x for LLVM >= 18. Until tmt provides
# a way to provide custom contexts, we need to filter out by distro versions.
- require-:
- lld
- libomp-devel
when: arch == s390x and distro < fedora-40
# libunwind is not built for s390x in LLVM < 17
- require-:
- llvm-libunwind-devel
environment+:
NO_LIBUNWIND: true
when: arch == s390x and distro < fedora-39

View file

@ -11,6 +11,8 @@ component+:
- compiler-rt
- python3-lit
- libomp
extra-summary: /tools/llvm/integration-test-suite
extra-task: /tools/llvm/integration-test-suite
require+:
- git
@ -29,3 +31,5 @@ recommend+:
# was part of binutils (e.g RHEL 8), or in distros where gold is deprecated
# (e.g. future Fedoras)
- binutils-gold
extra-nitrate: TC#0614094

View file

@ -20,31 +20,19 @@ environment+:
adjust+:
- enabled: false
when: distro != rhel and distro != centos
when: distro != rhel and distro != centos or collection is defined
continue: false
# lld is supported in s390x for LLVM >= 18. Until tmt provides
# a way to provide custom contexts, we need to filter out by distro versions.
- require-:
- lld
when: arch == s390x and distro < rhel-8.10
when: arch == s390x and distro < rhel-8.10, centos-stream-9
- require-:
- lld
when: arch == s390x and distro ~< rhel-9.5
when: arch == s390x and distro == rhel-9 and distro < rhel-9.5
# libomp is not supported in s390x in RHEL... Until LLVM 19
# libomp is not supported in s390x in RHEL.
- require-:
- libomp-devel
when: arch == s390x and distro ~< rhel-9.6.0
# RHEL 8 use python3.12
- require-:
- python3-lit
when: distro == rhel-8
- require+:
- python3.12-lit
when: distro == rhel-8
- environment+:
NO_GOLD: true
when: distro >= rhel-11
when: arch == s390x

View file

@ -0,0 +1,28 @@
# llvm-snapshots specific setup.
# These are daily builds (latest upstream sources) of a reduced set of the llvm
# components in currently supported Fedora releases.
# Supported components can be checked in:
# https://copr.fedorainfracloud.org/coprs/g/fedora-llvm-team/llvm-snapshots/monitor/
require+:
- cmake
- clang
- clang-analyzer
- clang-devel
- clang-tools-extra
- compiler-rt
- lld
- lldb
- libomp-devel
- llvm-devel
- python3-lit
environment+:
NO_LIBCXX: true
NO_STATIC_LIBCXX: true
NO_LIBUNWIND: true
adjust+:
- enabled: false
when: snapshot is not defined
continue: false

View file

@ -21,7 +21,7 @@ function logTmtRequiredPackages(){
rlLog "# Installed packages:"
rlLog "#----------------------------#"
for pkg in $TMT_REQUIRES; do
rlAssertRpm "$pkg"
rlAssertRpm $pkg
done;
rlLog "#----------------------------#"
@ -31,7 +31,6 @@ rlJournalStart
rlPhaseStartSetup
logTmtRequiredPackages
declare TmpDir
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
@ -43,13 +42,13 @@ rlJournalStart
rlRun "mkdir _build && cd _build"
CONFIG_CMD="cmake .."
CONFIG_CMD+="${NO_GOLD:+ -DENABLE_GOLD_TESTS=OFF}"
CONFIG_CMD+="${NO_LIBCXX:+ -DENABLE_LIBCXX=OFF}"
CONFIG_CMD+="${NO_STATIC_LIBCXX:+ -DENABLE_STATIC_LIBCXX=OFF}"
CONFIG_CMD+="${NO_LIBUNWIND:+ -DENABLE_LIBUNWIND=OFF}"
rlRun "${CONFIG_CMD}" 0 "Configure testsuite"
rlRun "cmake --build . --target check" 0 "Run testsuite"
# Filtered out scanbuild_py_make.txt, check https://bugzilla.redhat.com/show_bug.cgi?id=2275093
rlRun "lit --show-unsupported --show-xfail --filter-out scanbuild_py_makefile.txt -v tests" 0 "Run testsuite"
rlPhaseEnd
rlPhaseStartCleanup

View file

@ -1,56 +0,0 @@
summary: Build kernel-ark with clang
framework: beakerlib
component+:
- llvm
- lld
# CKI pipelines times out after 5h. 4h is safe for us.
duration: 4h
tier: 1
require+:
- llvm-devel
- lld
- git
- make
- gcc
- flex
- bison
- bzip2
- rpm-build
- dnf-plugins-core
adjust+:
- when: distro is not defined or distro != fedora-rawhide
enabled: false
because: Only meaninful in Rawhide
link+:
- verifies: https://issues.redhat.com/browse/LLVM-72
tag+:
- not-in-default
- fedora-only
/base:
summary+: " (base/non-LTO)"
/debug:
summary+: " (debug/non-LTO)"
environment+:
ENABLE_DEBUG: 1
adjust+:
- enabled: false
when: arch != x86_64 and arch != aarch64
/base-lto:
summary+: " (base/LTO)"
environment+:
ENABLE_LTO: 1
adjust+:
- enabled: false
when: arch != x86_64 and arch != aarch64
/debug-lto:
summary+: " (debug/LTO)"
environment+:
ENABLE_LTO: 1
ENABLE_DEBUG: 1
adjust+:
- enabled: false
when: arch != x86_64 and arch != aarch64

View file

@ -1,194 +0,0 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
. /usr/share/beakerlib/beakerlib.sh || exit 1
## General configuration variables. Can be overridden via environment
# Kernel branch to build. Typically ark-latest or os-build.
KERNEL_BRANCH=${KERNEL_BRANCH:-"ark-latest"}
KERNEL_GIT_URL=${KERNEL_GIT_URL:-"https://gitlab.com/cki-project/kernel-ark.git"}
## Helper variables to handle cached/generated SRPM
CACHE_DIR_BASE="/var/tmp/kernel-"
KERNEL_SRPM_PATTERN="kernel-*.src.rpm"
# Path to the kernel SRPM to build.
KERNEL_SRPM=""
# Environment variables to configure the kernel build:
# * ENABLE_LTO: If set, it will build kernel-ark with clang_lto.
# * ENABLE_DEBUG: If set, it will build kernel-ark in debug mode.
CLANG_MODE=${ENABLE_LTO:+"--with clang_lto"}
CLANG_MODE=${CLANG_MODE:-"--with clang"}
# Build mode, base or debug
BUILD_MODE=${ENABLE_DEBUG:+"--with debug --without base"}
BUILD_MODE=${BUILD_MODE:-"--with base --without debug"}
# Log installed packages required by TMT
logTmtRequiredPackages() {
if [[ ! -e $TMT_TEST_METADATA ]]; then
rlLogWarning "${FUNCNAME[0]}: No TMT_TEST_METADATA file found. Run the test from tmt"
return
fi
TMT_REQUIRES=$(rlGetYAMLdeps)
rlLog "# Installed packages:"
rlLog "#----------------------------#"
for pkg in $TMT_REQUIRES; do
rlAssertRpm "$pkg"
done
rlLog "#----------------------------#"
}
# Check if a previous test run created a kernel SRPM for the latest commit
# If found, the abspath is stored in KERNEL_SRPM global variable
# Returns 0 if srpm found, 1 otherwise.
checkCache() {
local commit_hash
local cache_dir
local cached_srpm
commit_hash=$(git ls-remote "${KERNEL_GIT_URL}" "${KERNEL_BRANCH}" | awk '{print $1}')
rlLog "Latest commit for ${KERNEL_BRANCH} branch: $commit_hash"
cache_dir="${CACHE_DIR_BASE}${commit_hash}/"
if [[ -d "$cache_dir" ]]; then
cached_srpm=$(find "$cache_dir" -name "${KERNEL_SRPM_PATTERN}")
if [[ -n "$cached_srpm" ]]; then
rlLog "Found cached SRPM: $cached_srpm"
rlRun "dnf builddep -y $cached_srpm > install-buildreqs.log 2>&1"
rlFileSubmit install-buildreqs.log
KERNEL_SRPM="$cached_srpm"
return 0
fi
fi
rlLog "Cached kernel SRPM not found"
return 1
}
# Attempts to clone the kernel-ark tree in the CWD, at most 3 times.
# Returns 0 on success, 1 otherwise
cloneKernelTree() {
local retries=3
local delay=10
rlLog "Cloning kernel"
while [[ $retries -gt 0 ]]; do
rlRun "git clone -q --branch ${KERNEL_BRANCH} ${KERNEL_GIT_URL}" 0-255
retcode=$?
if [[ $retcode -eq 0 ]]; then
return 0
else
retries=$((retries - 1))
rlLog "Clone failed, wait ${delay}s and retry ($retries retries left)"
sleep $delay
fi
done
return "$retcode"
}
# In a kernel-ark repository, do all the operations needed to generate an SRPM
# If the kernel is generated return the abspath in KERNEL_SRPM global variable
# Returns 0 on success, 1 otherwise
generateSRPM() {
local generated_srpm
local commit_hash
local cache_dir
if ! cloneKernelTree; then
rlFail "Failed to clone kernel tree"
return 1
fi
rlRun "pushd kernel-ark"
rlLog "Gathering and installing missing build requirements"
rlRun "make dist-get-buildreqs > make-buildreqs.log 2>&1"
rlFileSubmit make-buildreqs.log
if grep -q 'Missing dependencies:' make-buildreqs.log; then
# Getting the build requirements is quite tricky as it might contain
# not only package names but also "provides" perl(ExtUtils::Embed) which
# can break the dnf command if not escaped properly. The safest way is
# to create an array which contains each req as argument, then pass the
# array to dnf. Bash will later pass each element properly quoted.
# rlRun can also easily break the command due to special characters
# so we don't use it here.
read -ra KERNEL_BUILDREQS <<< "$(sed -n 's/Missing dependencies://p' make-buildreqs.log)"
rlLog "Installing dependencies: ${KERNEL_BUILDREQS[*]}"
dnf install --setopt=install_weak_deps=False -y "${KERNEL_BUILDREQS[@]}" > install-buildreqs.log 2>&1 || \
rlFail "$(cat install-buildreqs.log)"
rlFileSubmit install-buildreqs.log
elif grep 'PASS:' make-buildreqs.log; then
rlLog "All dependencies were already installed"
else
rlLogWarning "Error getting dependencies, the build might fail"
rlRun "cat make-buildreqs.log"
fi
rlLog "Generating SRPM"
rlRun "make dist-srpm > dist-srpm.log 2>&1"
rlFileSubmit dist-srpm.log
generated_srpm=$(find "$(pwd)" -name "$KERNEL_SRPM_PATTERN")
if [[ -e "$generated_srpm" ]]; then
rlLog "Caching generated SRPM"
commit_hash=$(git rev-parse HEAD)
cache_dir="${CACHE_DIR_BASE}${commit_hash}/"
rlRun "mkdir -p $cache_dir"
rlRun "cp $generated_srpm $cache_dir"
KERNEL_SRPM="$generated_srpm"
rlRun "popd"
return 0
else
rlLogWarning "Failed to generate SRPM"
rlRun "popd"
return 1
fi
}
rlJournalStart
rlPhaseStartSetup
rlRun "nproc"
rlRun "free -h"
logTmtRequiredPackages
declare tmp
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "pushd $tmp"
rlRun "set -o pipefail"
if rlIsFedora; then
rlLog "Disable updates-testing"
if command -v dnf5; then
rlRun "dnf5 config-manager setopt updates-testing.enabled=0"
else
rlRun "dnf-3 config-manager --set-disabled updates-testing"
fi
fi
rlPhaseEnd
rlPhaseStartTest
# Check if kernel package was generated by a previous test run
# and generate a new one if it wasn't
checkCache
if [[ -e "$KERNEL_SRPM" ]]; then
rlLog "Using cached kernel SRPM: $KERNEL_SRPM"
else
rlLog "No kernel SRPM found, generating new SRPM"
generateSRPM
fi
if [[ -e "$KERNEL_SRPM" ]]; then
BUILD_FLAGS="--target $(uname -m) --with up --with toolchain_clang "
BUILD_FLAGS+="--without trace --without arm64_16k --without arm64_64k "
BUILD_FLAGS+="--without realtime --without zfcpdump "
BUILD_FLAGS+="${CLANG_MODE} ${BUILD_MODE}"
rlLog "Building kernel (branch $KERNEL_BRANCH)"
rlRun "rpmbuild ${BUILD_FLAGS} --rebuild ${KERNEL_SRPM} > build.log 2>&1"
rlFileSubmit build.log
else
rlFail "Kernel SRPM not found, finishing test"
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $tmp" 0 "Remove tmp directory"
rlPhaseEnd
rlJournalEnd

View file

@ -1,6 +1,25 @@
summary: Check that libLLVM.so has been properly stripped
tier: 1
duration: 1m
extra-summary: /tools/llvm/libllvm-size
extra-task: /tools/llvm/libllvm-size
require+:
- llvm-devel
environment:
LIBLLVM_PATH: /usr/lib64/llvm18/lib/libLLVM.so
adjust+:
- because: "With SCL-ized LLVM, library path is different"
environment+:
LIBLLVM_PATH: /opt/rh/llvm-toolset-13.0/root/usr/lib64/libLLVM.so
when: "collection == llvm-toolset-13.0"
- because: "With SCL-ized LLVM, library path is different"
environment+:
LIBLLVM_PATH: /opt/rh/llvm-toolset-14.0/root/usr/lib64/libLLVM.so
when: "collection == llvm-toolset-14.0"
- because: "With SCL-ized LLVM, library path is different"
environment+:
LIBLLVM_PATH: /opt/rh/llvm-toolset-15.0/root/usr/lib64/libLLVM.so
when: "collection == llvm-toolset-15.0"
extra-nitrate: TC#0614095

View file

@ -1,9 +1,4 @@
#!/bin/bash -eux
# Retrieve libLLVM path if not set via environment variable. This is necessary
# to make the test flexible enough to use it with both compat and unversioned
# packages.
LIBLLVM_PATH=${LIBLLVM_PATH:-"$(llvm-config --libfiles)"}
#!/bin/sh -eux
# There is a bug in the build process when it runs out of disk space
# while stripping binaries, which causes the strip to fail, but does
@ -12,7 +7,4 @@ LIBLLVM_PATH=${LIBLLVM_PATH:-"$(llvm-config --libfiles)"}
# is less than 500MB to ensure it was successfully stripped.
# https://bugzilla.redhat.com/show_bug.cgi?id=1793250
test "$(stat -L -c %s "$LIBLLVM_PATH")" -lt 524288000
# Ensure libLLVM has no debug info
[[ $(llvm-readelf -S "$LIBLLVM_PATH" | grep -c '\.debug') -eq 0 ]]
test $(stat -L -c %s $LIBLLVM_PATH) -lt 524288000

View file

@ -1,20 +0,0 @@
# The point of this test is to ensure that clang/clang-libs demand the correct
# libomp packages, and is able to use openmp headers and libraries
summary: test clang can find libomp header and libraries
tier: 1
component+:
- libomp
require+:
- clang-libs
- libomp
- libomp-devel
adjust+:
# Right now libomp in s390x is supported only in LLVM >= 18 in Fedora
# And in LLVM >= 19 in CentOS/RHEL
# TODO until tmt allows to use custom adjusted contexts we need to do this
# indirect adjustment using the distro version.
- when: arch == s390x and distro ~< rhel-9.6.0
enabled: false
continue: false

View file

@ -1,8 +0,0 @@
#include <omp.h>
#include <stdio.h>
int main(int argc, char **argv) {
int nthreads = omp_get_num_threads();
printf("Num Threads: %d\n", nthreads);
return 0;
}

View file

@ -1,27 +0,0 @@
#!/bin/bash
set -exo pipefail
CLANG_PKG=$(rpm -qf --queryformat '%{name}' "$(readlink -f "$(type -p clang)")")
# For compat packages, we want to check if there's a package suffix: clang17 instead clang for example
PKG_SUFFIX=${CLANG_PKG#clang}
CLANG_NVR=$(rpm -q "$CLANG_PKG")
CLANG_VERSION=$(rpm --queryformat="%{version}" -q "$CLANG_NVR")
LIBOMP_DEPENDENCIES="libomp${PKG_SUFFIX} libomp${PKG_SUFFIX}-devel"
# Ensure clang depends on the correct clang-libs version
rpm -q --requires "$CLANG_NVR" | grep "${CLANG_PKG}-libs.* = ${CLANG_VERSION}"
# Check that weak dependencies are correct. The versions of these should be the same
# as clang's to guarantee the ABI compatibility, and that version should be actually
# installed as well.
for lomp_dep in $LIBOMP_DEPENDENCIES; do
rpm -q --recommends "clang${PKG_SUFFIX}-libs" | grep "${lomp_dep}.* = ${CLANG_VERSION}"
[[ "$(rpm --queryformat="%{version}" -q "${lomp_dep}"."$(uname -m)")" == "${CLANG_VERSION}" ]]
done
# Perform a sanity test to ensure everything works as expected
clang -fopenmp openmp-compile-link-test.c
./a.out | grep "Num Threads: 1"

View file

@ -1,5 +0,0 @@
summary: Test lld with clang
tier: 1
require+:
- clang

View file

@ -1,3 +0,0 @@
#!/bin/sh -eux
echo "int main(){ return 0; }" | clang -x c -fuse-ld=lld -

View file

@ -1,4 +0,0 @@
summary: Test lld with gcc
require+:
- gcc
tier: 1

View file

@ -1,3 +0,0 @@
#!/bin/sh -eux
echo "int main(){ return 0; }" | gcc -x c -fuse-ld=lld -

View file

@ -1,12 +0,0 @@
summary: Test linker switching with alternatives
# This test spoils the installation by removing lld.
tag+:
- not-in-default
require+:
- binutils
tier: 1
adjust+:
- because: lld is not installed as ld alternative in rhel < 9
enabled: false
when: distro < rhel-9

View file

@ -1,30 +0,0 @@
#!/bin/bash -eux
# This test assumes lld is already installed.
verify_ld_bfd (){
# Verify that /usr/bin/ld points to ld.bfd.
[[ $(readlink -f /etc/alternatives/ld) == *"ld.bfd" ]]
# Run ld and verify it invokes ld.bfd
/usr/bin/ld --version | grep 'GNU ld'
}
# Verify ld.bfd is still the system linker when lld is installed
verify_ld_bfd
# Set lld as the system linker
update-alternatives --set ld /usr/bin/ld.lld
# Verify that /usr/bin/ld points to lld
[[ $(readlink -f /etc/alternatives/ld) == *"lld" ]]
# Run ld and verify it invokes lld
/usr/bin/ld --version | grep 'LLD'
# Uninstall lld and make sure the /usr/bin/ld is reset to ld.bfd
dnf -y remove lld
verify_ld_bfd

View file

@ -1,10 +0,0 @@
# Common adjustments for lld tests
require+:
- lld
adjust+:
- because: lld is not shipped in s390x on LLVM < 18
enabled: false
when: arch == s390x and distro < rhel-8.10
- enabled: false
when: arch == s390x and distro ~< rhel-9.5

View file

@ -1,6 +0,0 @@
#include <stdio.h>
int main(int argc, char **argv) {
printf("hello!\n");
return 0;
}

View file

@ -1,6 +0,0 @@
summary: "Test that lldb doesn't crash with dwz debuginfo"
require+:
- lldb
- gcc
- dwz
tier: 1

View file

@ -1,20 +0,0 @@
#!/bin/bash -eux
gcc -gdwarf-4 -o hello1 hello.c
# Copy the binary so we can create a common file for duplicated debuginfo
cp hello1 hello2
# dwz overwrites the binaries
dwz hello1 hello2 -m hello.common
lldb -b -o 'b main' -o 'run --usage' -o c -- hello1 2>&1 | tee lldb.log
exe=$(command -v lldb)
# Until LLVM 23, DW_FORM GNU_ref_alt and GNU_strp_alt are unsupported.
# In that case, lldb should report "unsupported DW_FORM values: 0x1f20 0x1f21"
# as a warning, and continue the execution without any crash. Support added in:
# https://github.com/llvm/llvm-project/commit/16149ca93227d0d26a2f7387e95ad30971e99f43
if [[ "$(rpm -q --qf "%{version}" -f $exe | cut -d. -f1)" -lt "23" ]] ; then
grep "unsupported DW_FORM values" lldb.log
fi
grep "stop reason = breakpoint" lldb.log
# Ensure the process ends successfully (no crashes)
grep -E "Process [0-9]+ exited with status = 0" lldb.log

View file

@ -1,15 +0,0 @@
summary: "Test lldb std::vector pretty printer"
require+:
- lldb
- gcc-c++
tier: 1
adjust+:
# rhbz#2077932 rhbz#2082508
- because: "std::vector pretty printer does not work properly in RHEL<9 due to older libstdc++"
enabled: false
when: distro < rhel-9
- because: "Python packages not shipped in compat packages, hence no prettyprinter"
when: compat is defined
enabled: false

View file

@ -1,9 +0,0 @@
#include <stdio.h>
#include <vector>
int
main ()
{
std::vector<int> v (1, 2);
std::vector<int>::iterator it(v.begin());
return 0;
}

View file

@ -1,22 +0,0 @@
#!/bin/sh -eux
g++ -g test.cpp
lldb -b -o 'breakpoint set --file test.cpp --line 7' -o run -o 'p v' -- a.out | tee lldb.log
# Starting with LLVM 17.0, the expected output is:
# (std::vector<int>) size=1 {
# [0] = 2
# In LLVM 16.0, the expected output is:
# (std::vector<int, std::allocator<(int)> >) $0 = size=1 {
# [0] = 2
# shellcheck disable=SC2016
test "$(grep -c \
-e '(std::vector<int\(, std::allocator<\(int\)\?> \)\?>) \($0 = \)\?size=1 {' \
-e '\[0\] = 2' \
lldb.log \
)" -eq 2
rm lldb.log

View file

@ -1,11 +0,0 @@
summary: "Test lldb embedded interpreter (rhbz#1567262)"
description: "Ensure that lldb depends on python3-lldb"
require+:
- lldb
- gcc-c++
- which
tier: 1
adjust+:
- because: "Python pkgs not shipped in compat, lldb should NOT depend on python3-lldb"
result: xfail
when: compat is defined

View file

@ -1,9 +0,0 @@
#include <stdio.h>
#include <vector>
int
main ()
{
int i = 1;
float f = 1.0;
return 0;
}

View file

@ -1,30 +0,0 @@
#!/bin/sh -eux
# Verify the formal side of things, lldb should really depend on its Python bits
LLDB_PACKAGE=${LLDB_PACKAGE:-$(rpm -qf "$(which lldb)")}
rpm -q --requires "$LLDB_PACKAGE" | grep "python3\(\.12\)\?-lldb"
# Sanity test
g++ -g test.cpp
run_test() {
lldb -b -o 'breakpoint set --file test.cpp --line 8' \
-o run -o 'p i' -o 'p f'\
-- a.out | tee lldb.log
# shellcheck disable=SC2016
test "$(grep -c \
-e '(int) \($0 = \)\?1' \
-e '(float) \($1 = \)\?1' \
lldb.log \
)" -eq 2
rm lldb.log
}
run_test
# Now try again inside virtualenv
python3 -m venv venv
source ./venv/bin/activate
run_test

View file

@ -1,3 +1,6 @@
summary: Make sure llvm-config symlink is properly set up
tier: 1
duration: 1m
extra-summary: /tools/llvm/llvm-config
extra-task: /tools/llvm/llvm-config
extra-nitrate: TC#0614096

View file

@ -1,22 +0,0 @@
summary: Run tests from llvm-test-suite package
tag+:
- fedora-only
adjust+:
- because: "llvm-test-suite is available for Fedora, not RHEL/CentOS"
when: >-
distro == rhel
or distro == centos
enabled: false
- because: "llvm test suite not built for compat packages"
enabled: false
when: compat is defined
require+:
- clang
- cmake
- ninja-build
- llvm-test-suite
duration: 1h

View file

@ -1,24 +0,0 @@
#!/bin/bash
cc="clang"
cxx="clang++"
testsuite_dir="/usr/share/llvm-test-suite/"
set -xe
# This test consumes almost 2GiB. This space may not be available on /tmp on
# all servers. We need to guarantee that physical disk is used in order to
# avoid spurious failures.
tmpdir=$(mktemp -d -p /var/tmp llvm-test-suite.XXXXXXXXXX)
pushd $tmpdir
cmake -G Ninja $testsuite_dir \
-DCMAKE_C_COMPILER=$cc \
-DCMAKE_CXX_COMPILER=$cxx \
-DTEST_SUITE_LIT_FLAGS="-sv"
ninja -v check
popd
# Remove temporary files in case of success.
rm -rf $tmpdir

View file

@ -1,8 +0,0 @@
summary: Test that gcc and clang use the same long double format
duration: 5m
tier: 1
require+:
- gcc
id: 4096a1bb-d2a5-4aeb-b14d-fc465c293e32

View file

@ -1,15 +0,0 @@
#!/bin/bash -e
# Use __LDBL_MANT_DIG__ as a way to distinguish between long double formats.
# While this is not guaranteed to change for all formats, it provides a
# reliable enough method for testing which long double format is being used.
# If this test fails, either gcc or clang changed the default long double
# format, requiring to investigate why that happened and the best way to
# solve this in the long term.
gcc_output=$(gcc -E -dM -x c /dev/null | grep -e __LDBL_MANT_DIG__)
clang_output=$(clang -E -dM -x c /dev/null | grep -e __LDBL_MANT_DIG__)
echo "gcc: $gcc_output"
echo "clang: $clang_output"
test "$gcc_output" = "$clang_output"

View file

@ -14,14 +14,44 @@ framework: shell
# Always define "test" key and override in adjust or in each specific test
# metadata if needed.
test: ./test.sh
test: "PATH=/usr/lib64/llvm18/bin:$PATH ./test.sh"
# Commonly used keys are initialized to empty.
require: []
link: []
tag: []
require+:
- llvm
- llvm-libs
- llvm-devel
- clang
adjust+:
# Common requirements when LLVM is not SCL-ized
- require+:
- llvm18
- llvm18-libs
- llvm18-devel
- clang18
when: collection is not defined
# Requirements for SCL-ized LLVM
# We need to override the test key to do the proper scl call
- test: scl enable llvm-toolset-13.0 -- ./test.sh
require+:
- llvm-toolset-13.0-llvm
- llvm-toolset-13.0-llvm-libs
- llvm-toolset-13.0-llvm-devel
- llvm-toolset-13.0-clang
when: collection == llvm-toolset-13.0
- test: scl enable llvm-toolset-14.0 -- ./test.sh
require+:
- llvm-toolset-14.0-llvm
- llvm-toolset-14.0-llvm-libs
- llvm-toolset-14.0-llvm-devel
- llvm-toolset-14.0-clang
when: collection == llvm-toolset-14.0
- test: scl enable llvm-toolset-15.0 -- ./test.sh
require+:
- llvm-toolset-15.0-llvm
- llvm-toolset-15.0-llvm-libs
- llvm-toolset-15.0-llvm-devel
- llvm-toolset-15.0-clang
when: collection == llvm-toolset-15.0

View file

@ -1,29 +0,0 @@
summary: Make sure that multilib installation works
tier: 1
tag+:
- multilib
require+:
- llvm-devel
- llvm-devel.i686
link:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2365079
adjust+:
- enabled: false
because: "Test applicable only on x86_64 arch"
when: arch != x86_64
- enabled: false
because: "i686 packages may not be available in snapshot builds when x86_64 tests are executed"
when: snapshot is defined
- enabled: false
because: "compat packages are not compatible with multilib"
when: compat is defined
- enabled: false
because: "i686 not supported in RHEL-10 and newer"
when: distro >= rhel-10 or distro >= centos-stream-10

View file

@ -1,5 +0,0 @@
#!/bin/sh -eux
# For now just check that installation works.
rpm -q llvm-devel.x86_64
rpm -q llvm-devel.i686

View file

@ -1,16 +0,0 @@
summary: Test build a simple RPM package to ensure that -fopenmp works
require+:
- rpm-build
- libomp
tier: 1
component+:
- libomp
adjust+:
# Right now libomp in s390x is supported only in LLVM >= 18 in Fedora
# And in LLVM >= 19 in CentOS/RHEL
# TODO until tmt allows to use custom adjusted contexts we need to do this
# indirect adjustment using the distro version.
- when: arch == s390x and distro ~< rhel-9.6.0
enabled: false
continue: false

View file

@ -1,7 +0,0 @@
int main(int argc, char **argv) {
int res = 1;
#pragma omp parallel
#pragma omp single
res = 0;
return res;
}

View file

@ -1,8 +0,0 @@
#!/bin/bash
set -ex
# Do not run dnf builddep here. TMT should take care of any packages needed to
# run the test. If the rpmbuild fails due to missing packages, then fmf metadata
# needs to be fixed.
QA_RPATHS=$(( 0x0001 )) rpmbuild --define "_sourcedir $PWD" -bb test.spec

View file

@ -1,40 +0,0 @@
%global toolchain clang
%{?scl:%global scl_prefix %{scl}-}
Name: test
Version: 1
Release: 1
Summary: Test package for checking that RPM packages using -fopenmp build correctly
License: MIT
# Do not set buildrequires, tmt should cover any requirements to build.
# If not, tmt test metadata must be updated.
# BuildRequires: %{?scl_prefix}clang
# BuildRequires: %{?scl_prefix}libomp
Source0: test.c
%global debug_package %{nil}
%description
clang was adding RUNPATH to binaries that use OpenMP, and since RUNPATH
is prohibited in Fedora builds, this was causing packages using clang
and OpenMP to fail to build.
References:
https://fedoraproject.org/wiki/Changes/Broken_RPATH_will_fail_rpmbuild
https://github.com/llvm/llvm-project/commit/9b9d08111b618d74574ba03e5cc3d752ecc56f55
%build
clang ${CFLAGS} -c %{SOURCE0} -o test.o
clang ${LDFLAGS} -fopenmp test.o -o main
%check
./main
%install
install -d %{buildroot}%{_bindir}
install main %{buildroot}%{_bindir}
%files
%{_bindir}/main

View file

@ -1,5 +0,0 @@
pie
pie-static
pie-shared
pie-no-pie
pie.o

View file

@ -1,12 +0,0 @@
summary: Check that we build rpms with -pie
tier: 1
require+:
- clang-libs
- rpm-build
- glibc-static
adjust+:
- enabled: false
when: distro < rhel-10 or distro < centos-stream-10
because: "Default linking with pie only in CentOS/RHEL 10 and newer"

View file

@ -1,71 +0,0 @@
%global toolchain clang
Name: pie
Version: 1
Release: %autorelease
Summary: Check that -pie is passed.
License: MIT
BuildRequires: clang glibc-static
%description
Make sure the standard configuration from redhat-rpm-config passes -pie when linking.
%prep
%setup -c -T
cat << EOF > pie.c
int main(int argc, char **argv) {
return 0;
}
EOF
%build
LDFLAGS="${LDFLAGS} -Werror"
clang ${CFLAGS} -c pie.c -o %{NAME}.o
# Regular
clang ${LDFLAGS} %{NAME}.o -o %{NAME}
# With -shared
clang ${LDFLAGS} -shared %{NAME}.o -o %{NAME}-shared-pre
clang -shared ${LDFLAGS} %{NAME}.o -o %{NAME}-shared-post
# With -static
clang ${LDFLAGS} -static %{NAME}.o -o %{NAME}-static-pre
clang -static ${LDFLAGS} %{NAME}.o -o %{NAME}-static-post
# With -no-pie
clang ${LDFLAGS} -no-pie %{NAME}.o -o %{NAME}-no-pie-pre
clang -no-pie ${LDFLAGS} %{NAME}.o -o %{NAME}-no-pie-post
%check
if [[ "$(file ./pie)" != *"pie executable"* ]]; then
exit 1
fi
if [[ "$(file ./pie-shared-pre)" == *"pie executable"* ]]; then
exit 1
fi
if [[ "$(file ./pie-shared-post)" == *"pie executable"* ]]; then
exit 1
fi
if [[ "$(file ./pie-static-pre)" == *"pie executable"* ]]; then
exit 1
fi
if [[ "$(file ./pie-static-post)" == *"pie executable"* ]]; then
exit 1
fi
if [[ "$(file ./pie-no-pie-pre)" == *"pie executable"* ]]; then
exit 1
fi
if [[ "$(file ./pie-no-pie-post)" == *"pie executable"* ]]; then
exit 1
fi
%changelog
%autochangelog

View file

@ -1,8 +0,0 @@
#!/bin/bash
set -ex
set pipefail
#${BUILDDEP_CMD} -y pie.spec
QA_RPATHS=$(( 0x0001 )) rpmbuild -bb --nodeps ./pie.spec

View file

@ -1,11 +0,0 @@
/* Use a libm funcion that returns well-known results depending on the long
double format being used. */
#include <math.h>
#include <stdio.h>
int main() {
printf("%La\n", expl(1.0L));
return 0;
}

View file

@ -1,24 +0,0 @@
summary: Test binary compatibility of the long double format on ppc64le
duration: 1h
tier: 1
adjust+:
- because: "Fedora CI runs in x86_64 only, emulate with qemu and mock"
require+:
- qemu-user-static
- mock
test: ./runtest-fedora.sh
when: distro == fedora and arch == x86_64 and snapshot is not defined
continue: false
- enabled: false
when: arch != ppc64le
- because: "glibc in RHEL older than 9 don't support IEEE 128bit doubles"
enabled: false
when: distro < rhel-9 or distro < centos-stream-9
- because: "The test runs natively on RHEL so get gcc to build"
require+:
- gcc
when: distro != fedora or snapshot is defined

View file

@ -1,15 +0,0 @@
/* Check how the C++ standard library parses the following number correctly.
On IBM double-double, the 7 least significant bits are messed up.
On IEEE 128-bit long double, this number is correctly represented. */
#include <sstream>
#include <stdio.h>
int main() {
long double d;
std::stringstream ss("0x1.5bf0a8b1457695355fb8ac404e7ap+1");
ss >> d;
printf("%La\n", d);
return 0;
}

View file

@ -1,48 +0,0 @@
#!/bin/bash -e
fedora_release=$(rpm -E "%{fedora}")
mock_root=fedora-$fedora_release-ppc64le
mock_cmd="mock -r $mock_root --isolation=simple"
run_test () {
test_name=$1
expected=$2
echo "Running $test_name"
echo "Expected output: $expected"
actual=$($mock_cmd -q --shell "./$test_name")
echo "Actual output: $actual"
if [[ "$expected" == "$actual" ]]; then
return 0;
else
return 1;
fi
}
# Avoid running mock in unsupported environments, e.g. on a non-privileged
# container.
if $mock_cmd -q --shell true &> /dev/null; then
$mock_cmd --install clang libcxx-devel
# glibc supports both long double types, so the following should work.
$mock_cmd --copyin exp.c /builddir/exp.c
$mock_cmd -q --shell -- clang -mabi=ibmlongdouble -fno-builtin exp.c -o exp-ibm -lm
$mock_cmd -q --shell -- clang -mabi=ieeelongdouble -fno-builtin exp.c -o exp-ieee -lm
run_test exp-ibm "0x1.5bf0a8b1457695355fb8ac404ecp+1"
run_test exp-ieee "0x1.5bf0a8b1457695355fb8ac404e7ap+1"
# Test if libc++ is providing the correct ABI.
$mock_cmd --copyin parse.cpp /builddir/parse.cpp
$mock_cmd -q --shell -- clang++ -stdlib=libc++ -fno-builtin parse.cpp -o parse -lm
if [[ $fedora_release -gt 37 ]]; then
run_test parse "0x1.5bf0a8b1457695355fb8ac404e7ap+1"
else
run_test parse "0x1.5bf0a8b1457695355fb8ac404e8p+1"
fi
else
echo "This environment does not support mock. This test will be ignored."
fi

View file

@ -1,26 +0,0 @@
#!/bin/bash -e
run_test () {
test_name=$1
expected=$2
echo "Running $test_name"
echo "Expected output: $expected"
actual=$("./$test_name")
echo "Actual output: $actual"
if [[ "$expected" == "$actual" ]]; then
return 0;
else
return 1;
fi
}
# glibc supports both long double types, so the following should work.
clang -mabi=ibmlongdouble -fno-builtin exp.c -o exp-ibm -lm
clang -mabi=ieeelongdouble -fno-builtin exp.c -o exp-ieee -lm
run_test exp-ibm "0x1.5bf0a8b1457695355fb8ac404ecp+1"
run_test exp-ieee "0x1.5bf0a8b1457695355fb8ac404e7ap+1"
# TODO: Build and run the parse test when CentOS/RHEL get libc++-devel.

View file

@ -1,16 +0,0 @@
summary: Trivial sanity test for python-lit
component:
- llvm-toolset
- python-lit
require+:
- python3-lit
tier: 1
adjust+:
# RHEL 8 use python3.12
- require-:
- python3-lit
when: distro == rhel-8
- require+:
- python3.12-lit
when: distro == rhel-8

View file

@ -1,3 +0,0 @@
#! /bin/sh -eux
lit --version

View file

@ -1,15 +0,0 @@
summary: rhbz-1482491
description: |
"Test that clang is able to find the right libgcc_s"
require+:
- libgcc
tier: 1
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1482491
adjust+:
# gcc-x86_64-linux-gnu is not available in RHEL
- require+:
- gcc-x86_64-linux-gnu
when: "distro == fedora"

View file

@ -1,10 +0,0 @@
#!/bin/bash -eux
n=$(find /usr -name 'libgcc_s.so*' 2>/dev/null | wc -l)
if [[ $n -lt 1 ]]; then
echo "Error: could not find libgcc_s.so"
exit 1
fi
echo "int main(){}" | clang -v -x c -

View file

@ -1,6 +0,0 @@
summary: RHBZ1647130
description: Test that scan-build and scan-view can run without aborting
tier: 1
require+:
- clang-analyzer

View file

@ -1,8 +0,0 @@
#!/bin/bash -ex
tmp_cpp=$(mktemp -t XXXXX.cpp)
tmp_dir=$(mktemp -d)
echo 'int main(int argc, char*argv[]) { while(argc--) new int(); return 0; }' > "$tmp_cpp"
scan-build -o "$tmp_dir" clang++ -c "$tmp_cpp" -o /dev/null
(scan-view --no-browser "$tmp_dir"/* & WPID=$! && sleep 10s && kill $WPID)
rm -rf "$tmp_cpp" "$tmp_dir"

View file

@ -1,15 +0,0 @@
#include <charconv>
#include <iostream>
#include <cstring>
using namespace std;
int main(int argc, char **argv)
{
size_t r=0;
const char *begin = argv[1];
const char *end = begin + strlen(begin);
from_chars(begin, end, r);
cout << r << '\n';
return 0;
}

View file

@ -1,7 +0,0 @@
summary: RHBZ1657544
description: |
Test that clang++ does not use the symbol __muloti4
tier: 1
link+:
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1657544

Some files were not shown because too many files have changed in this diff Show more