tests: switch to TMT

This commit is contained in:
Milos Prchlik 2021-10-18 16:01:51 +02:00 committed by sergesanspaille
parent cd6d62e280
commit f7ecf95dc7
28 changed files with 155 additions and 164 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,4 @@
summary: clang-format-diff
test: ./test.sh
require:
- clang-tools-extra

View File

@ -1,6 +1,4 @@
#!/bin/bash
set -ex
#!/bin/sh -eux
# Check that clang-format-diff is in PATH.
# rhbz#1939018

19
tests/default.fmf Normal file
View File

@ -0,0 +1,19 @@
summary: Clang tests
discover:
- name: Local tests
how: fmf
filter: "tag:-not-in-default"
- name: "LLVM's integration test suite"
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: clang
provision:
hardware:
memory: ">= 4 GiB"

View File

@ -0,0 +1,5 @@
summary: fedora-flags
test: ./test.sh
require:
- annobin
- redhat-rpm-config

View File

@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/sh -eux
set -ex pipefail
set pipefail
cflags=`rpm -D '%toolchain clang' -E %{build_cflags}`
cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}`

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

13
tests/libomp/main.fmf Normal file
View File

@ -0,0 +1,13 @@
# TODO: get fitting summary - what's the purpose of this test? Comment from the STI version says:
#
# We want to make sure libomp is not already present on the system to ensure
# that clang pulls in the correct libomp dependencies when it is installed.
summary: libomp tests
# This test requires a special preparation, see `/tests/tests-libomp` plan. As such,
# it shouldn't be part of the `/tests/default` plan.
tag:
- not-in-default
test: ./test.sh
require:
- clang
- libomp

View File

@ -0,0 +1,6 @@
# TODO: once llvm-test-suite is converted to TMT, we can just link the test from plan.
summary: Run tests from llvm-test-suite package
test: ./test.sh
require:
- git
- clang

View File

@ -0,0 +1,7 @@
#!/bin/sh -eux
# TODO: tmt does not support a remote git repo as a requirement, one has to clone it "manually".
git clone --depth 1 https://src.fedoraproject.org/rpms/llvm-test-suite.git llvm-test-suite
cd llvm-test-suite/tests/test-suite
./runtest.sh

View File

@ -0,0 +1,12 @@
# TODO REVIEW: better summary
summary: ""
test: ./test.sh
require:
- clang
- lld
- compiler-rt
- libcxx-devel
- libcxx-static
- glibc-devel
- glibc-static
- gcc

View File

@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/sh -eux
# Tests for using a full LLVM toolchain: clang + compiler-rt + libcxx + lld
set -ex pipefail
set pipefail
# Test compile a C program.
cat << EOF | \

16
tests/pocl/main.fmf Normal file
View File

@ -0,0 +1,16 @@
# TODO REVIEW: get fitting summary - what's the purpose of this test? Comment from the STI version says:
#
# This is separate from tests.yml because we want to run the tests without
# clang installed.
summary: pocl
# This test requires a special preparation, see `/tests/tests-pocl` plan. As such,
# it shouldn't be part of the `/tests/default` plan.
tag:
- not-in-default
# rhbz#1582884
test: ./test.sh
require:
- git
- ocl-icd-devel
- pocl
- gcc

7
tests/pocl/test.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh -eux
# TODO: tmt does not support a remote git repo as a requirement, one has to clone it "manually".
git clone --depth 1 https://src.fedoraproject.org/rpms/pocl.git pocl
cd pocl/tests/simple-opencl-no-clang
./runtest.sh

View File

@ -0,0 +1,4 @@
summary: RHBZ1647130
test: ./test.sh
require:
- clang

View File

@ -1,6 +1,4 @@
#!/bin/sh
set -e
set -x
#!/bin/sh -eux
tmp_cpp=`mktemp -t XXXXX.cpp`
tmp_dir=`mktemp -d`

View File

@ -0,0 +1,4 @@
summary: RHBZ1657544
test: ./test.sh
require:
- clang

View File

@ -1,6 +1,4 @@
#!/bin/sh
set -e
set -x
#!/bin/sh -eux
clang++ from_chars.cpp
./a.out 100 | grep 100

View File

@ -0,0 +1,5 @@
summary: rhbz-482491
test: ./test.sh
require:
- clang
- libgcc

3
tests/rhbz_482491/test.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh -eux
find /usr -name 'libgcc_s.so*' && echo "int main(){}" | clang -v -x c -

16
tests/tests-libomp.fmf Normal file
View File

@ -0,0 +1,16 @@
summary: libomp tests
discover:
how: fmf
test: libomp
execute:
how: tmt
prepare:
# We want to make sure libomp is not already present on the system to ensure
# that clang pulls in the correct libomp dependencies when it is installed.
- name: Drop libomp
how: shell
script: |
dnf erase -y libomp libomp-devel clang clang-libs
provision:
hardware:
memory: ">= 4 GiB"

View File

@ -1,21 +0,0 @@
- hosts: localhost
pre_tasks:
# We want to make sure libomp is not already present on the system to ensure
# that clang pulls in the correct libomp dependencies when it is installed.
- name: Uninstall libomp
package:
name: "{{ item }}"
state: absent
with_items:
- libomp
- libomp-devel
- clang
- clang-libs
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- clang
tests:
- libomp

18
tests/tests-pocl.fmf Normal file
View File

@ -0,0 +1,18 @@
summary: pocl tests
discover:
how: fmf
test: pocl
execute:
how: tmt
prepare:
# Programs linked against pocl should be able to run without clang installed,
# so when we run the test we want to make sure clang is not installed to
# verify we haven't introduced an implicit dependency on clang.
- name: Drop clang
how: shell
script: |
dnf erase -y clang
provision:
hardware:
memory: ">= 4 GiB"

View File

@ -1,63 +0,0 @@
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- clang
- llvm-test-suite
- ninja-build
- gcc-x86_64-linux-gnu
# FIXME: It would be nice if we could only install dependencies for a
# single test rather than installing dependencies for all tests. This
# will help us catch bugs with implicit package dependencies e.g.
# package A depends on package B but does not have an explicit Requires.
# These are required for the llvm-toolchain test:
- clang
- lld
- compiler-rt
- libcxx-devel
- libcxx-static
- glibc-devel
- glibc-static
- gcc
# Required for fedora-flags:
- annobin
- redhat-rpm-config
# Required for clang-format-diff
- clang-tools-extra
# 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
repositories:
- repo: "https://src.fedoraproject.org/rpms/llvm-test-suite.git"
dest: "llvm-test-suite"
tests:
- rhbz#482491:
dir: ./
run: find /usr -name 'libgcc_s.so*' && echo "int main(){}" | clang -v -x c -
- llvm-test-suite/tests/test-suite
# ABI test suite is too greedy on the FS
#- llvm-test-suite/abi-test-suite
- rhbz_1657544
- rhbz_1647130
- llvm-toolchain
- fedora-flags
- toolchains
- clang-format-diff
- integration-test-suite

View File

@ -1,28 +0,0 @@
# This is separate from tests.yml because we want to run the tests without
# clang installed.
# FIXME: Is there some way we can put this yaml definition in the tests/pocl
# repo? Right now we need to copy and paste this everywhere the test is run.
- hosts: localhost
pre_tasks:
# Programs linked against pocl should be able to run without clang installed,
# so when we run the test we want to make sure clang is not installed to
# verify we haven't introduced an implicit dependency on clang.
- name: Uninstall clang
package:
name: clang
state: absent
tags: classic
roles:
- role: standard-test-basic
tags:
- classic
repositories:
- repo: "https://src.fedoraproject.org/rpms/pocl.git"
dest: "pocl"
required_packages:
- ocl-icd-devel
- pocl
- gcc
tests:
# rhbz#1582884
- pocl/tests/simple-opencl-no-clang

View File

@ -0,0 +1,7 @@
# TODO REVIEW: better summary
summary: ""
test: ./test.sh
# TODO REVIEW: are these all requirements? test.sh seems to run quite a lot of stuff, looks like we
# need more packages from LLVM family.
require:
- clang

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -eux
set pipefail