Compare commits

...
Sign in to create a new pull request.

182 commits

Author SHA1 Message Date
Tulio Magno Quites Machado Filho
8421b02273 integration-test-suite: Disable gold tests on RHEL 11
gold's build has been disabled on ELN/RHEL 11.
Get prepared for this change.

https://src.fedoraproject.org/rpms/binutils/c/ddb3cb864e8689fe53f8accd61def4403ff94aee
2026-08-24 20:41:34 -03:00
Tulio Magno Quites Machado Filho
ce3e5b6a0d Revert "kernel-ark-build: Disable LTO tests"
This reverts commit f57ec3b76c
because the original issue has been fixed.
2026-08-20 14:19:20 -03:00
Tulio Magno Quites Machado Filho
61dd89e407 flang: Fix linking phase on older distros
Ensure libgcc is installed in order to prevent the following error:

    /usr/bin/ld: cannot find -lgcc_s: No such file or directory

This is usually pre-installed because it's a requirement for dnf, but
dnf is not guaranteed to be installed in all scenarios.
2026-07-23 12:03:25 -03:00
Nikita Popov
3fd65b9990 Only run flang test on Fedora >= 44
In Fedora 43 flang is a separate package. This causes errors when
installing packages during snapshot tmt test runs on f43.
2026-06-24 14:54:28 +00:00
Nikita Popov
6f3ff93a5f Remove checks for Fedora < 41
These Fedora versions are no longer maintained, so remove related
conditionals.
2026-06-24 14:29:53 +02:00
Tulio Magno Quites Machado Filho
48d9d59fc6 Add a new test for flang
Build and run 2 simple Fortran programs using flang in order to
guarantee we have a flang that does the most basic tasks.
2026-06-08 11:02:46 -03:00
Tulio Magno Quites Machado Filho
f57ec3b76c kernel-ark-build: Disable LTO tests
Both base-lto and debug-lto tests have been failing since Linux upstream
added a new config option. This is requiring us to waive test results
whenever we have a new build on Rawhide.
The issue is being tracked at:
https://gitlab.com/cki-project/kernel-ark/-/issues/191

The kernel-ark team disabled these tests in their infrastructure and
believe that fixing them is not a priority at the moment.

Considering that our goal with kernel-ark-build is to track build issues
caused by LLVM changes before the kernel team see them, we should keep
our tests identical to them. In other words: we should disable both LTO
tests.
2026-04-28 15:14:33 -03:00
Tulio Magno Quites Machado Filho
18972ea7ad llvm-test-suite: Enable verbose mode
This helps to investigate build issues affecting the tests by allowing
us to see which flags are passed to the compiler.
2026-04-01 12:18:56 -03:00
Tulio Magno Quites Machado Filho
6df13a6c10 kernel-ark: Use dnf5 when available
Prefer to use dnf5, when it's available on the system.
Fallback to dnf-3 otherwise.

This fixes a warning on Testing Farm that might be interpreted as failure.
2026-03-10 12:11:58 +00:00
Jesus Checa Hidalgo
b5095271a1 kernel-ark-build: add dnf-plugins-core to requires
Some systems don't have it installed by default causing an error during
the setup phase.
2026-03-06 09:23:03 +01:00
Tulio Magno Quites Machado Filho
4f4c834e22 lldb-dwz: Be compatible with compat packages
Avoid running rpm against package names because they change when we test
a compat package.
Use the executable path instead because PATH gets modified when testing
compat packages.
2026-02-26 16:30:49 -03:00
Tulio Magno Quites Machado Filho
4c4d9b3bc5 rhbz_1482491: Ignore false-positive from find
Find returns failure when it isn't able to access all subdirectories,
causing a false-positive.

Avoid that by redirecting error messages to /dev/null and counting the
amount of files found.
2026-02-02 13:58:18 -03:00
Jesus Checa Hidalgo
140490cb76 lldb-dwz: Don't check for unsupported DW_FORM values in lldb 23+
LLDB 23 adds support for DW_FORM GNU_ref_alt and GNU_strp_alt.
Since this is supported unconditionally (don't depend on any config
dependent on the distro or the maintainer) we will set a check for the
lldb version in the script, rather than overcomplicating the metadata.
2026-01-30 10:04:32 +01:00
Tulio Magno Quites Machado Filho
dc54daea6f gcc-clang-compatibility: Use the new gcc-toolset-xx-env command
GTS 15 is shifting way from scl and provides a new command called
gcc-toolset-xx-env in order to setup its environment.
2025-11-21 11:00:36 -03:00
Tulio Magno Quites Machado Filho
03f0cdd926 Remove troubleshooting code from llvm-test-suite
Sometime this code was added in order to help troubleshoot an issue with
miniFE. It hasn't helped and it's causing issues when reporting issues
in Github because this is generating a too long output.
2025-11-13 11:45:51 -03:00
Jesus Checa Hidalgo
e4d1e99d30 Comprehensive review of TMT metadata
* Test tag review: add fedora-only and multilib, removed spoils-installation
  for being a duplicate of not-in-default
* Remove outdiated architecture and distribution adjustment rules.
* Further simplification of adjust rules by using major version comparison (~<)
  (https://fmf.readthedocs.io/en/stable/context.html#major-version)
* Add bugzilla links and descriptions to some tests
* Improve README by documenting all context dimensions used and test tags.
2025-09-03 10:15:33 +02:00
Jesus Checa Hidalgo
961500a660 pie-rpm: update relevancy
Remove fedora related relevancy as versions not supporting pie are
already EOL
Added RHEL/CentOS relevancy.
2025-08-28 13:33:31 +02:00
Tulio Magno Quites Machado Filho
d342d3c08b abi-test-suite: Add improvements
1. Ensure the required packages are listed.
2. Ignore running this test on RHEL/CentOS because the llvm-test-suite
   package is not available there.
3. Ignore running this test for compat packages.
4. Remove treatment of parameters from the script because this will
   always be called from tmt without parameters.
5. Remove temporary directory.
2025-08-07 15:44:30 +00:00
Tulio Magno Quites Machado Filho
a7f0d01a63 Add abi-test-suite
Move the test from https://src.fedoraproject.org/tests/llvm-test-suite
to here. Apply the following changes:
1. Rename runtest.sh to test.sh.
2. Enable the test.
2025-08-07 15:44:30 +00:00
Tulio Magno Quites Machado Filho
a84cc4e933 llvm-test-suite: Remove argument handling
This script is called from tmt, which does not pass any arguments.
2025-08-07 09:55:14 -03:00
Tulio Magno Quites Machado Filho
8309550db6 llvm-test-suite: Move script to this repository
Move a script from https://src.fedoraproject.org/rpms/llvm-test-suite to
here. With this change, network access and git are not required.
Adds cmake to the list of required package as this was missing before.
2025-08-06 16:46:53 -03:00
Nikita Popov
f2da47a2ca Use python3 instead of python
This is necessary on RHEL 8.
2025-08-05 10:13:07 +02:00
Nikita Popov
4f6d648643 Add test for use of lldb inside venv
For https://bugzilla.redhat.com/show_bug.cgi?id=2361538.
2025-07-10 07:28:26 +00:00
Nikita Popov
6018ff44fc Add test for multilib installation
Make sure that llvm-devel and llvm-devel.i686 can be installed
at the same time.
2025-07-09 18:29:38 +02:00
Tulio Magno Quites Machado Filho
7baa9af2da Require package which
We started to see TF failures on c10s because which was not installed.
Ensure the package is installed in order to avoid these errors.
2025-06-03 17:26:09 -03:00
Nikita Popov
ed30e923cc Skip installing weak dependencies in kernel-ark-build test 2025-03-06 16:48:56 +01:00
Nikita Popov
7dfda355f9 Fix cmake-imported-targets-llvm test for compat packages
We should be looking for clangNN-devel-dependencies.txt instead
of clang-devel-dependencies.txt in that case.
2025-03-06 15:32:31 +01:00
Jesus Checa Hidalgo
d48991f42a Add test for cmake imported targets
This test will ensure that all the exported targets (imported from the
user's perspective) from the clang and llvm find_package() are shipped
and are part of a dependency of the package which provides the
find_package.
2025-03-03 09:18:02 +01:00
Jesus Checa Hidalgo
5f75e69cbd libllvm-size: Add compat package support
Detect libLLVM path using llvm-config to make the script
reusable with compat packages.
2025-02-20 09:19:52 +01:00
Jesus Checa Hidalgo
91290fc5b1 Compat package testing adjustments
* No i686 pkgs, disable cross-compile-i686
* No python pkgs, disable lldb python interpreter tests, and ensure
  lldbNN does not depend on python-lldb
* Force integration testsuite to run libomp tests.
* Do not check buildrequires in pie-rpm so the spec builds with clangNN
2025-02-19 17:36:12 +01:00
Jesus Checa Hidalgo
38d826adb5 Deprecate DevTools collection metadata
Latest devtools (containing llvm-toolset-15.0) has been EOL since
May 2024 and all that metadata is now dead code.
2025-02-19 10:51:04 +00:00
Jesus Checa Hidalgo
f2b09a5e62 Remove legacy TCMS metadata 2025-02-19 10:51:04 +00:00
Jesus Checa Hidalgo
3e6d2aa917 Disable bolt-sanity in compat testing 2025-02-19 10:30:13 +01:00
Nikita Popov
03356db82d Only run bolt test on x86_64 and aarch64 2025-02-18 12:25:50 +01:00
Nikita Popov
d40ca8022a Add sanity test for llvm-bolt
Test that instrumentation and optimization don't generate errors,
to prevent issues like https://bugzilla.redhat.com/show_bug.cgi?id=2344830.
2025-02-14 15:57:07 +00:00
Nikita Popov
d2c29f2096 Disable mlir in integration test suite for snapshots + f40
This is a fixup for https://src.fedoraproject.org/tests/llvm/pull-request/44.
I forgot that we only ship mlir in snapshots starting with fedora 41.
2025-02-14 09:34:52 +01:00
Nikita Popov
cce3cc4dde Merge fedora and snapshot configs for integration-test-suite
Now that snapshots also include libcxx and mlir, we can use the
normal fedora configuration.

Also drop the conditions for fedora versions older than 40, which
are no longer supported.
2025-02-12 12:46:33 +01:00
Nikita Popov
023ec1ee03 Update ucrt test for new file output
After a recent file update, the output is now:

> a.exe: PE32+ executable for MS Windows 5.02 (console), x86-64, 18 sections

Adjust the grep to match both the old and new output. I think the
key parts are that it's a "PE32+ executable" for x86-64.
2025-02-10 16:11:35 +01:00
Jesus Checa Hidalgo
7b47ede5cd Fix for build-gating.fmf
Exclude tests tagged with "not-in-default" from discovery.
2025-01-13 17:14:48 +01:00
Jesus Checa Hidalgo
3ee1395888 Add sanity test for python-lit 2025-01-09 10:46:49 +01:00
Jesus Checa Hidalgo
c5c7ff94a3 Fix missing "execute" in ld-alternatives testplan. 2025-01-09 09:17:38 +01:00
Jesus Checa Hidalgo
bbc0f57af4 Group lldb tests in a subdirectory 2025-01-08 13:26:59 +01:00
Jesus Checa Hidalgo
b7d140d50e Group lld tests in a directory
lld metadata adjustments are tricky and makes sense to group the tests
together to avoid as much duplicity as possible from a maintainability
point of view
2024-12-20 17:10:08 +01:00
Jesus Checa Hidalgo
9fbc967ffd Rename test scripts
Clang test scripts were named "runtest.sh". Rename them as "test.sh"
for consistency with the rest of the repo.
2024-12-20 15:08:27 +01:00
Jesus Checa Hidalgo
3e6638c72c Merge remote-tracking branch 'lld/main' into merge-test-repos 2024-12-20 13:49:15 +01:00
Jesus Checa Hidalgo
f18276601b Merge remote-tracking branch 'lldb/main' into merge-test-repos 2024-12-20 12:33:50 +01:00
Jesus Checa Hidalgo
4ff8a6a55f Merge remote-tracking branch 'compiler-rt/main' into merge-test-repos 2024-12-20 11:17:57 +01:00
Jesus Checa Hidalgo
e851d75dcc Merge remote-tracking branch 'clang/main' into merge-test-repos 2024-12-20 11:16:01 +01:00
Jesus Checa Hidalgo
40fef0bd32 zstd-support: replace readelf with llvm-readelf
In some RHEL distros, the system binutils is too old and readelf
will not print ZSTD in the section details.
2024-12-18 09:56:01 +01:00
Jesus Checa Hidalgo
25257b851b zstd-support: Fix adjust condition for distros.
Make the condition more specific to each distro Y stream,
as specifying several comma-separated distros is prone to
fail in tmt.
2024-12-17 15:08:35 +01:00
Jesus Checa Hidalgo
0abd69aae9 Add test to check zstd support is present and works 2024-12-12 14:49:38 +01:00
Tulio Magno Quites Machado Filho
b69c51a4a0 Revert commits related to debugging disk usage
The problem has been fixed and this troubleshooting code is not needed
anymore.

This reverts commits 7b5681ac95 and
336e421c1a.
2024-12-03 10:35:12 -03:00
Edjunior Machado
47cc23d2bb Expect python3.12-lit on RHEL 8 builds
Drop conditional on snapshots.
2024-11-27 16:04:19 +01:00
Jesus Checa Hidalgo
4d92417571 libllvm-size: test that libLLVM contains no debug sections 2024-11-14 18:13:35 +01:00
Tulio Magno Quites Machado Filho
7b5681ac95 Collect further information about disk usage
Continuing the investigation that started with commit 336e421c1a,
restrict the information collected on the /tmp partition because we got
a confirmation this partition is getting full.
Also, collect more details about which directories and files in /tmp are
consuming all disk space.
2024-11-14 11:40:08 -03:00
Tulio Magno Quites Machado Filho
de1663d7a9 Remove temporary files
Ensure s390x-asm-unsupported-pc-relative-addr and shlibs-cet-support
remove temporary files after a successful execution.
2024-11-14 11:40:08 -03:00
Tulio Magno Quites Machado Filho
c140bdf103 rhbz_1647130: Remove tmp_dir at the end
Guarantee the temporary directory is removed after the execution of this
test.
2024-11-13 16:30:58 -03:00
Tulio Magno Quites Machado Filho
336e421c1a Add an extra step in order to debug disk usage
Recent executions of this test on llvm-snapshots have been failing on
due to exhaustion of disk space. Print the disk usage at the end of the
execution in order to help debug this issue.
2024-11-12 15:53:40 -03:00
Jesus Checa Hidalgo
a2b93f39c8 ld-alternative: Update check on alternatives/ld symlink
Before LLD 19 /usr/bin/ld.lld was a file, and now it's a symlink to /usr/bin/lld.
Hence, /etc/alternative/ld symlink now resolves to /usr/bin/lld,
breaking our check and raising false positives.

Updating the expression to match "lld" only fixes the issue.
2024-10-14 10:06:13 +02:00
Nikita Popov
8f44f59b6f Use python3.12-lit for RHEL 8 snapshots
Also disable snapshots.fmf on rhel, because we reuse the main
rhel.fmf for snapshots in that case. snapshots.fmf is the
replacement for fedora.fmf only.
2024-08-12 14:31:16 +02:00
Nikita Popov
8e5e183f85 Allow python3.12-lldb in test 2024-08-09 09:36:50 +02:00
Jesus Checa Hidalgo
d69918d2f8 Add pre-commit config
Add pre-commit hooks for trailing whitespaces and newline at file end
Add pre-commit hook for tmt linting
Add pre-commit hook for static analysis on shell scripts (shellcheck)
Fixed issues flagged by shellcheck.
2024-08-05 09:48:18 +02:00
Jesus Checa Hidalgo
a9a9883a60 Shell static analysis
Add pre-commit hook for static analysis on shell scripts (shellcheck)
Fixed issues flagged by shellcheck.
2024-08-05 09:34:31 +02:00
Jesus Checa Hidalgo
85fc2de396 Shell static analysis
Add pre-commit hook for static analysis on shell scripts (shellcheck)
Fixed issues flagged by shellcheck.
2024-08-05 09:16:47 +02:00
Jesus Checa Hidalgo
cda9761d2e Shell static analysis
Add pre-commit hook for static analysis on shell scripts (shellcheck)
Fixed lots of issues flagged by shellcheck.
2024-08-05 09:15:19 +02:00
Jesus Checa Hidalgo
c8d36d768f Shell static analysis
Add pre-commit hook for static analysis on shell scripts (shellcheck)
Fixed lots of issues flagged by shellcheck.
2024-08-05 09:10:14 +02:00
Jesus Checa Hidalgo
71a2b1c3bf Refactor kernel-ark build test for caching and git clone retry
This commit mitigates test failures due to git unreliability and
improves test time over test reruns using cached SRPMs.
- Added CACHE_DIR_BASE, KERNEL_SRPM_PATTERN and KERNEL SRPM variables.
- Implemented checkCache() to look for an existing SRPM in the cache and
  install its build dependencies.
- Implemented cloneKernelTree() for cloning the kernel-ark repo with
  retries.
- Implemented generateSRPM() to handle all operations required to generate
  an SRPM and cache it.
- Updated main test phase to utilize caching and SRPM generation
  functions.
2024-07-23 10:01:02 +00:00
Timm Bäder
bf7e2faa36 Enable pie-rpm test by default 2024-07-19 07:28:13 +00:00
Jesus Checa Hidalgo
c45fd5b631 Update relevancy for compat packages
rust-sanity disabled, rust always uses latest llvm
binutils-plugin-ar not relevant, llvm-libs compat does not install the
symlink to LLVMgold.so
2024-07-17 13:37:32 +02:00
Jesus Checa Hidalgo
9080b2716a Update test relevancy for compat packages
llvm-test-suite and rpmmacros tests disabled for compat packages
2024-07-17 12:55:17 +02:00
Konrad Kleine
07526ca7fa For snapshots on RHEL we want to check for DWARF5 2024-07-03 16:44:21 +02:00
Jesus Checa Hidalgo
2554ce3aa3 Adjust test and plan relevancy for rhel 8.10 2024-07-01 12:36:20 +02:00
Jesus Checa Hidalgo
2b2e06a7e1 use-correct-dwarf-default: Update test
* The default version is now 5. If clang version is older than 18 then
  fall back to version 4.
* Added optional env var to overwrite required dwarf version.
* Updated fmf metadata to use dwarf4 in distros that don't support v5
* Fedora 38 is EOL, removed dead code.
2024-06-10 11:46:06 +02:00
Jesus Checa Hidalgo
06436d11ba Revert "use-correct-dwarf-default: Update test"
This reverts commit dade06cfdd.
2024-06-10 11:44:30 +02:00
Jesus Checa Hidalgo
dade06cfdd use-correct-dwarf-default: Update test
* The default version is now 5. If clang version is older than 18 then
  fall back to version 4.
* Added optional env var to overwrite required dwarf version.
* Updated fmf metadata to use dwarf4 in distros that don't support v5
* Fedora 38 is EOL, removed dead code.
2024-06-10 11:39:04 +02:00
Nikita Popov
5100dc7cf0 Perform llvm-snapshot adjustment for rhel as well
We need to install lld for snapshots on rhel as well.
2024-06-07 09:08:12 +02:00
Jesus Checa Hidalgo
3359782211 toolchains: ensure that tmt requires lld when testing snapshots 2024-06-06 08:30:12 +02:00
Jesus Checa Hidalgo
7ab65858ab toolchains: Set lld package for rhel 8.10 modules
llvm-toolset module is being updated to 18 in rhel 8.10 and we
need to test newly added lld there. Set it as recommend for now
as we still have LLVM 17 in default rhel8 stream
2024-05-31 06:48:35 +00:00
Panu Matilainen
e5e8b03b9f Add missing glibc-static build dependency to pie-rpm test 2024-05-31 06:10:54 +00:00
Panu Matilainen
ca2401025f Make the pie-rpm test spec self-contained and work with any rpm version
Move the dummy source inline to %prep and checks from runtest.sh into
%check, to take advantage of rpm facilities instead of fighting them,
and now we can just run this anywhere at all without any cumbersome
override defines and any rpm version.
2024-05-31 06:10:54 +00:00
Jesus Checa Hidalgo
f741479086 openmp-rpm: make the test compatible with rpm 4.20+ 2024-05-30 15:14:40 +02:00
Jesus Checa Hidalgo
af1c69a51d kernel-ark-build: Improve logging and fix disable updates-testing repo
dnf5 is the default pkg manager in rawhide and config-manager command
has different interface. Falling back to dnf-3.
Added lld and llvm-devel as explicit requirements in test metadata
Added extra logging of which packages (NVRs) where installed by tmt
and the amount of cpus and memory the running system has.
2024-05-23 09:03:19 +02:00
Jesus Checa Hidalgo
be814a6310 broken-symlinks: Fix dnf command incompatibility with dnf5
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.
2024-05-10 09:43:34 +02:00
Jesus Checa Hidalgo
3d9db8ae35 Create kernel-ark rebuild test
This commit adds a new test that rebuilds kernel-ark with clang to
ensure that we do not break the upstream builds. This is a squashed
commit of the following:

PoC for kernel-ark build test and plan

kernel-ark: create virtual test and run all build configurations

Created configurations for lto/non-lto and base/debug, adding proper
relevancies. Test script parametrized with environment variables so it
can be reused by all these configs.

Fix relevancy for debug/non-lto build

Fix dependency install logic

Final cleanups

Make kernel-ark-build plan to be run only if triggered manually

Rename kernel-ark plan to avoid naming confusions with the test

Add documentation for kernel-ark test
2024-05-09 16:59:21 +02:00
Konrad Kleine
4359d29013 Add pre-commit config and update README
See also https://src.fedoraproject.org/tests/llvm/pull-request/27
2024-05-03 15:29:38 +02:00
Konrad Kleine
f3053280b2 Add pre-commit config and update README
See also https://src.fedoraproject.org/tests/llvm/pull-request/27
2024-05-03 15:20:02 +02:00
Konrad Kleine
5e5ec12425 Add pre-commit config and update README
See also https://src.fedoraproject.org/tests/llvm/pull-request/27
2024-05-03 14:52:18 +02:00
Jesus Checa Hidalgo
3449426c91 Remove redundant clang requires 2024-04-25 14:25:59 +00:00
Jesus Checa Hidalgo
0297643810 remove hardcoded clang package when calling rpm command
Use the clang command to locate the correct clang package name
instead of hardcoding "clang" in the test. This is needed for the
test to work with compat packages which are named differently.
2024-04-25 14:25:59 +00:00
Jesus Checa Hidalgo
0f16004a0a openmp-rpm: Do not run dnf builddep
tmt should take care of any dependencies required by the test.
Letting the test call dnf and install packages can break the environment
and cause invalid results in subsequent tests, specially when testing
compat packages.
2024-04-25 14:25:59 +00:00
Jesus Checa Hidalgo
b3c624504c libomp: remove hardcoded clang package
Query the clang nvr checking which package provides the clang binary
instead querying directly for "clang" package. Add also support for
running  the test with compat packages (clang17, clang16)
2024-04-25 14:25:59 +00:00
Jesus Checa Hidalgo
6e7caab25c broken-symlinks: Rewrite the test to not install in a chroot
Installing the package into a chroot from the repos is a flaky approach
as it's not guaranteed that the package in the repos is the same as the
one being tested. Also, it's unnecessarily time consuming.
Now the test checks the symlinks in the rpm and checks that they are
resolved to a file owned by either compiler-rt or one of its
dependencies.
2024-04-25 11:46:26 +02:00
Timm Bäder
84b1265f72 Add more pie-rpm tests
Make sure we also get the expected behavior when _pre_pending additional
flags to $LDFLAGS
2024-04-23 11:19:34 +00:00
Jesus Checa Hidalgo
487364d65b Fix wrong relevancy for libomp tests
libomp is supported in s390x only in Fedora, and if LLVM is 18 or newer
For libomp installed from fedora repos this means Fedora >= 40, for
LLVM snapshots it's enabled always.
2024-04-16 05:47:58 +00:00
Tulio Magno Quites Machado Filho
020d712305 Run ppc64le-long-double natively on snapshot executions
Snapshot builds are able to test natively on ppc64le despite using
Fedora. This restriction only exists when running Bodhi tests.
So, let ppc64le-long-double use the same test script as RHEL.
2024-04-15 13:02:50 -03:00
Tulio Magno Quites Machado Filho
acc90e7a06 Disable cross-compile-i686 on snapshot runs
i686 snapshot builds take many more hours to complete than x86_64 ones
making it difficult to wait until both are available before tests start
to run and still providing results in the same day. Because of that,
this commit disables the test when the snapshot context is defined.
2024-04-15 12:03:02 -03:00
Tulio Magno Quites Machado Filho
f58e59b394 Temporarily tag pie-rpm as not-in-default
Filter out this test until redhat-rpm-config gets its side of the update.
Otherwise, this will cause failures when building clang on Fedora and
when running the daily snapshots.
2024-04-04 14:44:39 -03:00
Timm Bäder
0d4c50b5e0 Add test to check -pie works. 2024-04-02 14:45:23 +02:00
Jesus Checa Hidalgo
3e0a05df6c Fix readme formatting 2024-04-02 08:55:51 +02:00
Jesus Checa Hidalgo
5a88effc47 Fix readme formatting 2024-04-02 08:55:03 +02:00
Jesus Checa Hidalgo
4a8c55b532 Fix Readme formatting 2024-04-02 08:51:06 +02:00
Jesus Checa Hidalgo
2b4086412b fix readme formatting 2024-04-02 08:31:19 +02:00
Jesus Checa Hidalgo
bf6cf7375d Add documentation to README.md 2024-03-08 13:10:59 +01:00
Jesus Checa Hidalgo
fa8bc5eb0b Update testplan to new metadata.
Remove unused cross packages script
Add integration testsuite to the plan
Add prepare steps needed in RHEL/CentOS
2024-03-08 13:10:47 +01:00
Jesus Checa Hidalgo
443a26a24d Add documentation to README.md 2024-03-07 16:50:23 +01:00
Jesus Checa Hidalgo
acbe4aee52 Add documentation to README.md 2024-03-07 16:41:38 +01:00
Jesus Checa Hidalgo
6c3812f472 Gather common tmt metadata
Moved tests under tests directory
Extracted common metadata into tests/main.fmf.
2024-03-07 15:37:47 +01:00
Jesus Checa Hidalgo
c419262848 build-gating: add CRB repos in prepare for RHEL/CentOS 2024-03-07 14:36:13 +01:00
Jesus Checa Hidalgo
a07664eccf Refactor build-gating plan
Move to dedicated directory. Removed no longer needed package
adjustments which are now provided by the tests. Also included
the integration testsuite to the plan and added the needed
prepare steps for it
2024-03-07 14:08:50 +01:00
Jesus Checa Hidalgo
fa120530f1 Move tests to subdirectory and gather common metadata in tests/main.fmf 2024-03-07 13:51:56 +01:00
Jesus Checa Hidalgo
23bd2ee6b2 Add libomp component metadata to relevant tests 2024-03-07 13:29:07 +01:00
Jesus Checa Hidalgo
defae03611 Update s390x adjustments for LLVM 18
Adjust tests to reflect libomp and lld support for s390x
libomp and openmp-rpm tests need to be run in s390x for LLVM>=18
toolchains test needs to install lld package and run lld commands
2024-03-07 10:41:28 +01:00
Jesus Checa Hidalgo
77be13cc41 Update build-gating plan
Collection adjustments no longer needed.
Setup CRB in RHEL to take care of AWS/Beaker repo naming.
Add discover setup for llvm-test-suite
2024-02-29 18:13:48 +01:00
Jesus Checa Hidalgo
598eead7e1 Gather common metadata under a parent main.fmf
Metadata common to all tests include component, contact, framework,
test script and frequent required packages.
Normalized script names to 'runtest.sh'.
2024-02-29 18:13:35 +01:00
Jesus Checa Hidalgo
271a6a565d Reorganize plans: Create base config and reuse it from existing ones 2024-02-29 12:55:49 +01:00
Jesus Checa Hidalgo
9c62e92982 Move all tests to a sudbirectory 2024-02-27 12:09:20 +01:00
Jesus Checa Hidalgo
be641c9e9a Update README.md 2024-02-22 14:03:04 +01:00
Jesus Checa Hidalgo
ab620ce7f0 Reorganize tests repository.
* Created common configuration file (tests/main.fmf) to take advantage
  of fmf elasticity and inheritance.
* Cleanup and simplify all tests metadata.
* Remove no longer needed adjustments from plans
* Support lld tests in s390x for llvm >= 18
2024-02-22 13:38:32 +01:00
Jesus Checa Hidalgo
c1eaab43ec Move all the tests to a dedicated directory 2024-02-22 13:07:30 +01:00
Konrad Kleine
ca5c810d9a Use correct DWARF version
Instead of checking for DWARF4 only we now check for DWARF5 if clang is greater or equal to version 18.  Only if Fedora is less than 38 we fall back to require DWARF4.

The grep in the output of `llvm-dwarfdump` could potentially match other hex numbers and now only matches the version.
2024-02-05 20:24:09 +01:00
Jesus Checa Hidalgo
3403ca384d broken-symlinks: update test relevancy 2023-11-14 09:12:03 +01:00
Tulio Magno Quites Machado Filho
bb6d566ab8 ppc64le-long-double: Improve warnings when mock is not supported
Stop printing messages from the test that runs mock as they refer to
errors, causing confusion.
Send all these messages to /dev/null and print our own message saying
the test will be ignored.
2023-10-27 08:41:02 -03:00
Jesus Checa Hidalgo
982bb6f065 toolchains test: add support for snapshots testing 2023-10-25 12:16:01 +02:00
Jesus Checa Hidalgo
082c661c48 Add a test for checking that compiler-rt don't ship broken symlinks 2023-10-20 14:01:32 +02:00
Jesus Checa Hidalgo
ec1f44228b fp16-abi: add test to check that Float16 ABI matches with clang 2023-09-27 08:18:37 +02:00
Tulio Magno Quites Machado Filho
0e8ca2a543 Add a test that checks if debug information is disabled by default
In a recent change to clang 17.0.0, debug information got enabled by
default by mistake.
Add a test that helps to prevent that.
2023-09-20 10:57:52 -03:00
Tulio Magno Quites Machado Filho
ffe7fa64b2 Update lldb output in LLVM 17.0
There have been a few changes that require to modify the regexes used in
lldb-std-vector-prettyprint and in python-embedded-interpreter.
2023-08-09 19:08:51 -03:00
Tulio Magno Quites Machado Filho
c9cf4400a6 Remove reference to %{clang_resource_dir_readonly}
This macro has been removed in LLVM 17.0.0.
2023-08-09 16:07:41 -03:00
Tulio Magno Quites Machado Filho
f37486b615 Ignore RC suffixes in the version string
Considering the macro variables do not have the ~rcN suffix, the rpm
version must be cleaned before it's used as input to validate the
correct value in the macro version.
2023-08-09 16:05:55 -03:00
Tulio Magno Quites Machado Filho
9f63297a4a Stop using --noautoremove on dnf
According to the documentation, this parameter "disable removal of
dependencies that are no longer used". However, there are no lld
dependencies required in the test that could be impacted.

The most important package is binutils, which was manually installed and
shouldn't be removed automatically. If the package does so, that would
be a bug.
2023-07-18 10:30:31 -03:00
Tulio Magno Quites Machado Filho
60a9f71c70 Better integrate with Koji
When testing builds from Koji, the i686 repositories are not available
on x86_64, requiring packages to be manually installed in order to run
cross-compile-i686.
2023-07-17 18:38:27 -03:00
Jesus Checa Hidalgo
3ff5b7451d openmp-rpm: adjustments for fedora 39 (dnf5) 2023-07-12 18:51:33 +02:00
Jesus Checa Hidalgo
1e0115c194 gcc-clang-compatibility: Add support for gcc-toolset installations
clang may use a gcc from gcc-toolset instead the system version. In that
case we need to test the compatibility with that one, not with the
system based gcc.
2023-07-03 14:33:38 +02:00
Jesus Checa Hidalgo
5a8ea6a930 ppc64le-long-double: Adjust distro relevancy 2023-05-11 18:28:00 +02:00
Jesus Checa Hidalgo
e43607a0f6 cross-compile-i686: Adjust metadata
compiler-rt.i686 packages are not shipped in RHEL or CentOS, disable
the test in those distros
2023-04-26 09:59:51 +02:00
Tulio Magno Quites Machado Filho
5ac66c3693 Add a new test that validates the RPM macros
This new test checks if Clang's RPM macros are:
1. Installed.
2. Have correct values.
3. Point to existing directories.
2023-04-14 12:10:40 -03:00
Tulio Magno Quites Machado Filho
6a33abfde8 Install dnf-config-manager before using it
The container image centos:stream9 does not come with
'dnf config-manager' preinstalled, forcing us to install it first.
2023-04-14 12:04:30 -03:00
Tulio Magno Quites Machado Filho
22639249c6 Remove pocl-related tests
pocl has been FTBFS since Fedora 38. There is a plan to orphan it.
2023-04-04 14:43:52 -03:00
Tulio Magno Quites Machado Filho
2918649549 cross-compile-i686: Ensure x86_64 package is installed
In a x86_64 system, compiler-rt.x86_64 provides important symlinks to
let a 64-bit clang find the i686 libraries.
2023-03-21 17:18:01 -03:00
Tulio Magno Quites Machado Filho
052a886fd0 lldb-std-vector-prettyprint: Update lldb output
lldb started to print the type used in the template.
2023-03-21 15:54:43 -03:00
Tom Stellard
fea3e11f64 Add test for using 32-bit sanitizers on 64-bit host 2023-02-28 15:28:46 +00:00
Jesus Checa Hidalgo
de1d86b24b rhbz_482491: Fix missing gcc-x86_64-linux-gnu dependency in Fedora 2023-01-24 10:44:06 +01:00
Nikita Popov
048eb66cf0 Add test for ucrt64 toolchain detection on fedora 2022-12-21 11:04:24 +01:00
Jesus Checa Hidalgo
5a94d66325 libomp: query for host arch clang/libomp to avoid false positives if multilib packages are installed 2022-12-20 11:06:13 +01:00
Jesus Checa Hidalgo
4685483471 long-double: add nitrate metadata 2022-11-28 12:02:57 +01:00
Tulio Magno Quites Machado Filho
a0abe34748 Add 2 new tests that validate the ppc64le long double ABI
This patch is highly based on the ppc64le-long-double test that was
available in the previous commit.  However, it adds an extra step that
ignores mock if the test is run inside an unprivileged container
solution.

The first test (exp) evaluates if clang is able to build C programs for
both IBM double-double as well as IEEE 128-bit long double.  As Fedora uses
glibc by default, which supports both scenarios, both executables should
work.

The second test (parse) uses clang in order to evaluate if C++ programs
built with default parameters and linking against libc++ use IEEE
128-bit long double.
This test should be extended in the future in order to evaluate that
clang is able to generate C++ programs for both IBM double-double and
IEEE 128-bit long double using libstdc++.  This can't be enabled now
because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81122 .
2022-11-25 10:22:07 -03:00
Tulio Magno Quites Machado Filho
6dcae89e8c Test long double format on all architectures
Modify the ppc64le-long-double test in order to be reused and executed
on all architectures, guaranteeing that gcc and clang will provide the
same default long double format on all architectures.
2022-11-25 10:22:07 -03:00
Jesus Checa Hidalgo
7686cf01a1 ppc64le-long-double: reenable test 2022-10-25 09:44:10 +02:00
Jesus Checa Hidalgo
8454ab8df6 gcc-clang-compatibility: Test that gcc compiled objs can be linked with
clang and viceversa.
2022-10-17 12:19:10 +02:00
Edjunior Machado
75941bd254 Add llvm-toolset-15.0 2022-09-30 13:09:13 +02:00
Edjunior Machado
3270f811ee Add llvm-toolset-15.0 2022-09-30 13:06:34 +02:00
Edjunior Machado
af1b185754 Add llvm-toolset-15.0 2022-09-30 12:51:57 +02:00
Edjunior Machado
af3dcbf8a1 Add llvm-toolset-15.0 2022-09-29 10:25:03 +02:00
Jesus Checa Hidalgo
24ce28afab libomp: Refactor the test to make it suitable for the general testplan
Added checks to ensure that the versions of clang and libomp match
Test no longer requires removing packages to work.
2022-09-02 10:51:18 +02:00
Jesus Checa Hidalgo
2878c430d9 Add nitrate metadata 2022-08-23 15:47:48 +02:00
Jesus Checa Hidalgo
ec1522e35f Init repo:
* Init tmt.
* Add sanity test
* Add gating fmf plan
2022-08-23 15:32:55 +02:00
Jesus Checa Hidalgo
208cf98117 lldb-dwz: use a reproducible test
This test used /usr/bin/true to check that lldb doesn't crash with
DW_FORM values 0x1f20 and 0x1f21, but this is not happening in all
distros. Also there's no way to guarantee that it will stay this
way in future distros as well. Replaced with a a reproducible test
that generates debug info with the required DW_FORM values
2022-08-23 12:26:20 +02:00
Jesus Checa Hidalgo
7b73875f86 Pull llvm-integration-testsuite from llvm tests repo instead dist-git 2022-08-22 16:32:51 +02:00
35ad3c3dc8 Added the README 2022-08-22 13:28:38 +00:00
Jesus Checa Hidalgo
ab3d3a4e21 Add nitrate metadata 2022-08-19 15:32:02 +02:00
Jesus Checa Hidalgo
675b60ec17 Import tests from rpms/clang 2022-07-19 12:49:38 +02:00
Jesus Checa Hidalgo
fc28d8cd09 python-embedded-interpreter: fix line breakpoint
Breaking in line 9 was actually out of main() context
which might cause issues. Corrected to point to line 8
2022-07-15 12:30:16 +02:00
Jesus Checa Hidalgo
2c73313075 Add gating testplan 2022-07-13 10:09:05 +02:00
Jesus Checa Hidalgo
125e4514d1 Add nitrate metadata 2022-07-13 10:05:17 +02:00
Jesus Checa Hidalgo
a8cc88906c Import the tests from lldb dist-git 2022-07-13 09:53:06 +02:00
Jesus Checa Hidalgo
8c35ab8755 Remove remote tests from the gating plan 2022-07-13 09:41:11 +02:00
Jesus Checa Hidalgo
7744bcc340 Initialize tmt 2022-07-13 08:25:17 +02:00
Jesus Checa Hidalgo
acfc82b341 Add license files 2022-07-12 18:16:58 +02:00
Jesus Checa Hidalgo
d552bd3f39 Add nitrate metadata 2022-07-12 16:26:21 +02:00
Jesus Checa Hidalgo
ef99cd915c Add test plans 2022-07-12 13:59:46 +02:00
Jesus Checa Hidalgo
83e10c9311 Init fmf 2022-07-12 13:00:25 +02:00
Jesus Checa Hidalgo
7f8a2c1490 Import tests from lld dist-git 2022-07-12 12:29:52 +02:00
Jesus Checa Hidalgo
d4f1efb913 Add license and commitment files 2022-07-12 12:27:45 +02:00
fd67fac3a6 Added the README 2022-07-11 14:59:13 +00:00
59589a3599 Added the README 2022-07-11 14:58:02 +00:00
Timm Bäder
061565d8fd Enable -static libc++ toolchain tests 2021-03-22 11:44:05 +01:00
Tom Stellard
c7a6ef0f24 Add more toolchain tests 2021-01-30 02:54:56 +00:00
Tom Stellard
39f92abcf4 Add a test for compiling with the fedora compiler and linker flags 2020-07-29 04:17:59 +00:00
Tom Stellard
ac62af341a Add test to check that clang can find the libomp header and libraries 2020-03-20 14:52:14 +00:00
serge-sans-paille
1d620dc3b0 Test for rhbz#1794936 2020-02-13 13:57:44 +00:00
Tom Stellard
5cd5549121 Import tests from rpms/clang 2019-09-24 19:12:04 +00:00
Tom Stellard
56f24323b5 Add README file 2019-09-24 18:47:34 +00:00
127 changed files with 2076 additions and 249 deletions

View file

@ -12,3 +12,10 @@ 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,9 +7,13 @@ 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`
* `arch`
* `collection` (only applicable to RHEL 7)
* `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.
To run the tests:
```bash
@ -93,6 +97,18 @@ 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/)
@ -108,3 +124,31 @@ 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

@ -0,0 +1,31 @@
#
# 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,7 +7,6 @@
# * 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
@ -39,7 +38,7 @@ adjust:
discover:
- name: llvm-tests
how: fmf
filter: "tag:-spoils-installation"
filter: "tag:-not-in-default"
execute:
how: tmt
provision:

View file

@ -0,0 +1,18 @@
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

@ -0,0 +1,25 @@
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

14
tests/abi-test-suite/test.sh Executable file
View file

@ -0,0 +1,14 @@
#!/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,8 +4,6 @@ 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:
@ -14,4 +12,6 @@ adjust+:
enabled: false
when: distro == rhel-7
extra-nitrate: TC#0614092
- because: compat llvm-libs does not install LLVMgold.so in bfd-plugins dir
enabled: false
when: compat is defined

View file

@ -0,0 +1,22 @@
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

8
tests/bolt-sanity/test.sh Executable file
View file

@ -0,0 +1,8 @@
#!/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

@ -0,0 +1,17 @@
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

55
tests/broken-symlinks/test.sh Executable file
View file

@ -0,0 +1,55 @@
#!/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,6 +5,3 @@ 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
mock --resultdir=. --old-chroot --with compat_build --rebuild *.src.rpm
if [ $? -ne 0 ]; then
if ! mock --resultdir=. --old-chroot --with compat_build --rebuild ./*.src.rpm;
then
cat root.log
cat build.log
exit 1

View file

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

View file

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

View file

@ -0,0 +1,32 @@
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

@ -0,0 +1,12 @@
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

@ -0,0 +1,68 @@
#!/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,6 +4,7 @@
rlJournalStart
rlPhaseStartSetup
declare tmp
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "cp reproducer.c $tmp"
rlRun "pushd $tmp"

View file

@ -0,0 +1,30 @@
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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

21
tests/fedora-flags/test.sh Executable file
View file

@ -0,0 +1,21 @@
#!/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
@ -20,6 +20,8 @@ require+:
- llvm-devel
- clang
- clang-devel
adjust+:
- enabled: false
when: collection is defined
when: deploymentmode == image
because: "/usr is readonly in imagemode systems"

View file

@ -5,6 +5,7 @@
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)"

3
tests/flang/hello.f Normal file
View file

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

25
tests/flang/main.fmf Normal file
View file

@ -0,0 +1,25 @@
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

5
tests/flang/sin.f90 Normal file
View file

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

13
tests/flang/test.sh Executable file
View file

@ -0,0 +1,13 @@
#!/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

7
tests/fp16-abi/main.fmf Normal file
View file

@ -0,0 +1,7 @@
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

14
tests/fp16-abi/test.cpp Normal file
View file

@ -0,0 +1,14 @@
// 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;
}

15
tests/fp16-abi/test.sh Executable file
View file

@ -0,0 +1,15 @@
#!/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

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

View file

@ -0,0 +1,8 @@
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

@ -0,0 +1,33 @@
#!/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

@ -17,6 +17,7 @@ environment+:
NO_LIBCXX: true
NO_STATIC_LIBCXX: true
NO_LIBUNWIND: true
LIBOMP: true
adjust+:
- enabled: false

View file

@ -1,70 +0,0 @@
# 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,6 +1,5 @@
# Fedora system repos package testing.
# This setup is meant to be used with packages in system repos, not with
# compat packages, or snapshots.
# Fedora package testing.
# This setup is meant to be used with non-compat packages.
require+:
- cmake
@ -21,19 +20,5 @@ require+:
adjust+:
- enabled: false
when: distro != fedora or snapshot is defined or compat is defined
when: distro != fedora 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,8 +11,6 @@ component+:
- compiler-rt
- python3-lit
- libomp
extra-summary: /tools/llvm/integration-test-suite
extra-task: /tools/llvm/integration-test-suite
require+:
- git
@ -31,5 +29,3 @@ 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,19 +20,31 @@ environment+:
adjust+:
- enabled: false
when: distro != rhel and distro != centos or collection is defined
when: distro != rhel and distro != centos
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, centos-stream-9
when: arch == s390x and distro < rhel-8.10
- require-:
- lld
when: arch == s390x and distro == rhel-9 and distro < rhel-9.5
when: arch == s390x and distro ~< rhel-9.5
# libomp is not supported in s390x in RHEL.
# libomp is not supported in s390x in RHEL... Until LLVM 19
- require-:
- libomp-devel
when: arch == s390x
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

View file

@ -1,28 +0,0 @@
# 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,6 +31,7 @@ rlJournalStart
rlPhaseStartSetup
logTmtRequiredPackages
declare TmpDir
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
@ -42,6 +43,7 @@ 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}"

View file

@ -0,0 +1,56 @@
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

194
tests/kernel-ark-build/test.sh Executable file
View file

@ -0,0 +1,194 @@
#!/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,25 +1,6 @@
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
environment:
LIBLLVM_PATH: /usr/lib64/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
require+:
- llvm-devel

View file

@ -1,4 +1,9 @@
#!/bin/sh -eux
#!/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)"}
# 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
@ -7,4 +12,7 @@
# 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
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 ]]

20
tests/libomp/main.fmf Normal file
View file

@ -0,0 +1,20 @@
# 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

@ -0,0 +1,8 @@
#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;
}

27
tests/libomp/test.sh Executable file
View file

@ -0,0 +1,27 @@
#!/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"

5
tests/lld/basic/main.fmf Normal file
View file

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

3
tests/lld/basic/test.sh Executable file
View file

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

View file

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

View file

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

View file

@ -0,0 +1,12 @@
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

@ -0,0 +1,30 @@
#!/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

10
tests/lld/main.fmf Normal file
View file

@ -0,0 +1,10 @@
# 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

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

View file

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

20
tests/lldb/lldb-dwz/test.sh Executable file
View file

@ -0,0 +1,20 @@
#!/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

@ -0,0 +1,15 @@
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

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

View file

@ -0,0 +1,22 @@
#!/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

@ -0,0 +1,11 @@
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

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

View file

@ -0,0 +1,30 @@
#!/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,6 +1,3 @@
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

@ -0,0 +1,22 @@
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

24
tests/llvm-test-suite/test.sh Executable file
View file

@ -0,0 +1,24 @@
#!/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

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

15
tests/long-double/test.sh Executable file
View file

@ -0,0 +1,15 @@
#!/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

@ -17,41 +17,11 @@ framework: shell
test: ./test.sh
# Commonly used keys are initialized to empty.
require: []
link: []
tag: []
adjust+:
# Common requirements when LLVM is not SCL-ized
- require+:
- llvm
- llvm-libs
- llvm-devel
- clang
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
require+:
- llvm
- llvm-libs
- llvm-devel
- clang

View file

@ -0,0 +1,29 @@
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

5
tests/multilib-install/test.sh Executable file
View file

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

16
tests/openmp-rpm/main.fmf Normal file
View file

@ -0,0 +1,16 @@
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

7
tests/openmp-rpm/test.c Normal file
View file

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

8
tests/openmp-rpm/test.sh Executable file
View file

@ -0,0 +1,8 @@
#!/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

@ -0,0 +1,40 @@
%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

5
tests/pie-rpm/.gitignore vendored Normal file
View file

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

12
tests/pie-rpm/main.fmf Normal file
View file

@ -0,0 +1,12 @@
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"

71
tests/pie-rpm/pie.spec Normal file
View file

@ -0,0 +1,71 @@
%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

8
tests/pie-rpm/test.sh Executable file
View file

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

View file

@ -0,0 +1,11 @@
/* 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

@ -0,0 +1,24 @@
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

@ -0,0 +1,15 @@
/* 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

@ -0,0 +1,48 @@
#!/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

@ -0,0 +1,26 @@
#!/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

@ -0,0 +1,16 @@
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

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

View file

@ -0,0 +1,15 @@
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"

10
tests/rhbz_1482491/test.sh Executable file
View file

@ -0,0 +1,10 @@
#!/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

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

8
tests/rhbz_1647130/test.sh Executable file
View file

@ -0,0 +1,8 @@
#!/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

@ -0,0 +1,15 @@
#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

@ -0,0 +1,7 @@
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