From 4de77856dd6a72e5a6c0b8c211194627e3cdb13a Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 25 May 2022 13:29:29 +0200 Subject: [PATCH] Tests: make openmp-rpm test compatible with RHEL distros and collections --- tests/openmp-rpm/main.fmf | 30 +++++++++++++++++++++++++++--- tests/openmp-rpm/runtest.sh | 2 +- tests/openmp-rpm/test.spec | 5 +++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/tests/openmp-rpm/main.fmf b/tests/openmp-rpm/main.fmf index ffc4bf4..2344193 100644 --- a/tests/openmp-rpm/main.fmf +++ b/tests/openmp-rpm/main.fmf @@ -1,6 +1,30 @@ summary: Test build a simple RPM package to ensure that -fopenmp works +test: "$WITH_SCL ./runtest.sh" require: - - dnf - - dnf-plugins-core - rpm-build -test: ./runtest.sh +adjust: + - because: "libomp not supported in s390x" + when: arch == s390x + enabled: false + + - because: "Use yum in RHEL < 8" + require+: + - yum-utils + environment+: + BUILDDEP_CMD: "yum-builddep" + when: distro < rhel-8 + + - because: "Use dnf in RHEL >= 8, Fedora and CentOS" + require+: + - dnf-plugins-core + environment+: + BUILDDEP_CMD: "dnf builddep" + when: distro >= rhel-8 or distro != rhel + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-build + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-build + when: "collection == llvm-toolset-14.0" \ No newline at end of file diff --git a/tests/openmp-rpm/runtest.sh b/tests/openmp-rpm/runtest.sh index 4fe82e9..37647fe 100755 --- a/tests/openmp-rpm/runtest.sh +++ b/tests/openmp-rpm/runtest.sh @@ -2,5 +2,5 @@ set -ex -dnf -y build-dep test.spec +${BUILDDEP_CMD} -y test.spec rpmbuild --define '_sourcedir .' --define '_builddir .' -bb test.spec diff --git a/tests/openmp-rpm/test.spec b/tests/openmp-rpm/test.spec index 82b1a97..e317a6a 100644 --- a/tests/openmp-rpm/test.spec +++ b/tests/openmp-rpm/test.spec @@ -1,4 +1,5 @@ %global toolchain clang +%{?scl:%global scl_prefix %{scl}-} Name: test Version: 1 @@ -6,8 +7,8 @@ Release: 1 Summary: Test package for checking that RPM packages using -fopenmp build correctly License: MIT -BuildRequires: clang -BuildRequires: libomp +BuildRequires: %{?scl_prefix}clang +BuildRequires: %{?scl_prefix}libomp Source0: test.c