tests: re-use Fedora tests
Related: rhbz#2001107
This commit is contained in:
parent
591eb2920e
commit
6ec423923f
1
.fmf/version
Normal file
1
.fmf/version
Normal file
@ -0,0 +1 @@
|
||||
1
|
31
tests/build-gating-alternatives.fmf
Normal file
31
tests/build-gating-alternatives.fmf
Normal file
@ -0,0 +1,31 @@
|
||||
#
|
||||
# Build/PR gating tests for *LLVM 13*
|
||||
#
|
||||
# Imports and runs tests provided by Fedora LLVM git for the matching LLVM version.
|
||||
#
|
||||
# NOTE: *always* keep this file in sync with upstream, i.e. Fedora. Since we cannot "discover" a plan,
|
||||
# we must duplicate at least some part of upstream plan setup, like `adjust` or `provision`. Not necessarily
|
||||
# all steps, but if we do need some of them here, let's focus on making changes in upstream first, to preserve
|
||||
# one source of truth. Once TMT learns to include whole plans, we could drop the copied content from here.
|
||||
#
|
||||
|
||||
summary: LLD tests for build/PR gating, testing alternatives and spoiling the installation
|
||||
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
|
||||
|
||||
discover:
|
||||
- name: lld-upstream-tests
|
||||
how: fmf
|
||||
test: ld-alternative
|
||||
url: https://src.fedoraproject.org/rpms/lld.git
|
||||
ref: rawhide
|
||||
execute:
|
||||
how: tmt
|
||||
provision:
|
||||
hardware:
|
||||
memory: ">= 4 GiB"
|
47
tests/build-gating.fmf
Normal file
47
tests/build-gating.fmf
Normal file
@ -0,0 +1,47 @@
|
||||
#
|
||||
# Build/PR gating tests for *LLVM 13*
|
||||
#
|
||||
# Imports and runs tests provided by Fedora LLVM git for the matching LLVM version.
|
||||
#
|
||||
# NOTE: *always* keep this file in sync with upstream, i.e. Fedora. Since we cannot "discover" a plan,
|
||||
# we must duplicate at least some part of upstream plan setup, like `adjust` or `provision`. Not necessarily
|
||||
# all steps, but if we do need some of them here, let's focus on making changes in upstream first, to preserve
|
||||
# one source of truth. Once TMT learns to include whole plans, we could drop the copied content from here.
|
||||
#
|
||||
|
||||
summary: LLD tests for build/PR gating
|
||||
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
|
||||
|
||||
# Unfortunatelly, TMT does not support more declarative approach, we need to run commands on our own.
|
||||
- because: "On RHEL, CRB must be enabled to provide rarer packages"
|
||||
when: >-
|
||||
distro == centos
|
||||
or distro == rhel-9
|
||||
or distro == rhel-8
|
||||
prepare+:
|
||||
- name: Enable CRB
|
||||
how: shell
|
||||
script: dnf config-manager --set-enabled rhel-CRB
|
||||
|
||||
discover:
|
||||
- name: lld-upstream-tests
|
||||
how: fmf
|
||||
filter: "tag:-spoils-installation"
|
||||
url: https://src.fedoraproject.org/rpms/lld.git
|
||||
ref: rawhide
|
||||
- name: upstream-llvm-integration-testsuite
|
||||
how: fmf
|
||||
url: https://src.fedoraproject.org/rpms/llvm.git
|
||||
ref: rawhide
|
||||
test: integration-test-suite
|
||||
execute:
|
||||
how: tmt
|
||||
provision:
|
||||
hardware:
|
||||
memory: ">= 4 GiB"
|
@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
echo "usage `basename $0` [OPTIONS]"
|
||||
echo " --threads NUM The number of threads to use for running tests."
|
||||
}
|
||||
|
||||
thread_args=""
|
||||
repo_url=https://github.com/opencollab/llvm-toolchain-integration-test-suite
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--threads)
|
||||
shift
|
||||
threads="$1"
|
||||
;;
|
||||
* )
|
||||
echo "unknown option: $1"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -n "$threads" ]; then
|
||||
thread_args="-j$threads"
|
||||
fi
|
||||
|
||||
set -xe
|
||||
|
||||
cd $(mktemp -d -p /var/tmp)
|
||||
git clone $repo_url
|
||||
cd llvm-toolchain-integration-test-suite
|
||||
mkdir _build && cd _build
|
||||
cmake .. -GNinja
|
||||
ninja $thread_args check
|
@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This test assumes lld is already installed.
|
||||
|
||||
set -ex
|
||||
|
||||
function verify_ld_bfd {
|
||||
|
||||
# Verify that /usr/bin/ld points to ld.bfd.
|
||||
ls -l /etc/alternatives/ld | grep 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
|
||||
ls -l /etc/alternatives/ld | grep 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 --noautoremove lld
|
||||
|
||||
verify_ld_bfd
|
@ -1,8 +0,0 @@
|
||||
set -ex
|
||||
|
||||
|
||||
if ! id -u lld; then
|
||||
useradd lld
|
||||
fi
|
||||
|
||||
su lld -c 'bash /usr/libexec/tests/lld/run-lit-tests --threads 1'
|
@ -1,14 +0,0 @@
|
||||
# The ld-alternative test uninstalls lld, so it needs to be run by
|
||||
# itself in a separate .yml file so it doesn't modify the test
|
||||
# environment for other tests.
|
||||
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- role: standard-test-basic
|
||||
tags:
|
||||
- classic
|
||||
required_packages:
|
||||
- binutils
|
||||
- lld
|
||||
tests:
|
||||
- ld-alternative
|
@ -1,36 +0,0 @@
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- role: standard-test-basic
|
||||
tags:
|
||||
- classic
|
||||
required_packages:
|
||||
- lld
|
||||
- clang
|
||||
- gcc
|
||||
- lld-test
|
||||
# the requirements below are for the integration suite
|
||||
- cmake
|
||||
- llvm-devel
|
||||
- clang
|
||||
- clang-analyzer
|
||||
- clang-tools-extra
|
||||
- compiler-rt
|
||||
- ninja-build
|
||||
- libcxx-devel
|
||||
- libomp-devel
|
||||
- python-lit
|
||||
- lld
|
||||
- lldb
|
||||
- git
|
||||
- make
|
||||
- libstdc++-static
|
||||
- clang-devel
|
||||
tests:
|
||||
- basic:
|
||||
dir: ./
|
||||
run: echo "int main(){ return 0; }" | clang -x c -fuse-ld=lld -
|
||||
- gcc-compat-basic:
|
||||
dir: ./
|
||||
run: echo "int main(){ return 0; }" | gcc -x c -fuse-ld=lld -
|
||||
- lit-tests
|
||||
- integration-test-suite
|
Loading…
Reference in New Issue
Block a user