tests: convert to TMT

This commit is contained in:
Milos Prchlik 2021-11-16 12:31:23 +01:00
parent 93a7a3acf0
commit 8f9f5acc96
14 changed files with 80 additions and 93 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

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

@ -0,0 +1,5 @@
summary: Test lld with clang
test: ./test.sh
require:
- lld
- clang

3
tests/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,21 @@
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-tests
how: fmf
test: ld-alternative
execute:
how: tmt
prepare:
- name: packages
how: install
package: lld
provision:
hardware:
memory: ">= 4 GiB"

26
tests/build-gating.fmf Normal file
View File

@ -0,0 +1,26 @@
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
discover:
- name: lld-tests
how: fmf
filter: "tag:-spoils-installation"
- name: upstream-llvm-integration-testsuite
how: fmf
url: https://src.fedoraproject.org/rpms/llvm.git
ref: rawhide
test: integration-test-suite
execute:
how: tmt
prepare:
- name: packages
how: install
package: lld
provision:
hardware:
memory: ">= 4 GiB"

View File

@ -0,0 +1,5 @@
summary: Test lld with gcc
test: ./test.sh
require:
- lld
- gcc

3
tests/gcc-compat-basic/test.sh Executable file
View File

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

View File

@ -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

View File

@ -0,0 +1,8 @@
summary: Test linker switching with alternatives
test: ./test.sh
# This test spoils the installation by removing lld, therefore it should be marked as such.
tag:
- spoils-installation
require:
- lld
- binutils

View File

@ -1,9 +1,7 @@
#!/bin/bash
#!/bin/sh -eux
# This test assumes lld is already installed.
set -ex
function verify_ld_bfd {
# Verify that /usr/bin/ld points to ld.bfd.

6
tests/lit-tests/main.fmf Normal file
View File

@ -0,0 +1,6 @@
summary: Run lld testsuite
test: ./test.sh
duration: 30m
require:
- lld
- lld-test

3
tests/lit-tests/runtest.sh → tests/lit-tests/test.sh Normal file → Executable file
View File

@ -1,5 +1,4 @@
set -ex
set -eux
if ! id -u lld; then
useradd lld

View File

@ -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

View File

@ -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