diff --git a/build-gating-libomp.fmf b/build-gating-libomp.fmf deleted file mode 100644 index 1ddd29e..0000000 --- a/build-gating-libomp.fmf +++ /dev/null @@ -1,37 +0,0 @@ -summary: libomp clang 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 - - - because: "When testing SCL-ized LLVM, the collection must be enabled first" - environment+: - WITH_SCL: "scl enable llvm-toolset-13.0" - when: "collection == llvm-toolset-13.0" - - because: "When testing SCL-ized LLVM, the collection must be enabled first" - environment+: - WITH_SCL: "scl enable llvm-toolset-14.0" - when: "collection == llvm-toolset-14.0" - - - because: "libomp not supported in s390x" - when: arch == s390x - enabled: false - -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: | - yum erase -y libomp libomp-devel clang clang-libs -provision: - hardware: - memory: ">= 4 GiB" diff --git a/libomp/main.fmf b/libomp/main.fmf index a7b414e..62c7973 100644 --- a/libomp/main.fmf +++ b/libomp/main.fmf @@ -1,12 +1,6 @@ -# 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 +# 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 test: "$WITH_SCL ./runtest.sh" framework: shell tier: 1 @@ -17,29 +11,18 @@ extra-summary: /tools/clang/libomp extra-task: /tools/clang/libomp extra-nitrate: TC#0614137 +require: + - clang + - clang-libs + - libomp + - libomp-devel + adjust: - because: "libomp is not supported in s390x" when: arch == s390x enabled: false - # Common requirements when LLVM is not SCL-ized - - require: - - clang - - clang-libs - - libomp - - libomp-devel - when: "collection is not defined" - - # Requirements for SCL-ized LLVM - - require: - - llvm-toolset-13.0-clang - - llvm-toolset-13.0-clang-libs - - llvm-toolset-13.0-libomp - - llvm-toolset-13.0-libomp-devel - when: "collection == llvm-toolset-13.0" - - require: - - llvm-toolset-14.0-clang - - llvm-toolset-14.0-clang-libs - - llvm-toolset-14.0-libomp - - llvm-toolset-14.0-libomp-devel - when: "collection == llvm-toolset-14.0" \ No newline at end of file + # Dependencies in rhel-7 are handled differently: there are no recommends, + # only requires. + - when: distro <= rhel-7 + enabled: false diff --git a/libomp/runtest.sh b/libomp/runtest.sh index f07dbbc..5bd2532 100755 --- a/libomp/runtest.sh +++ b/libomp/runtest.sh @@ -2,6 +2,21 @@ set -exo pipefail +CLANG_VERSION=`rpm --queryformat="%{version}" -q clang` +LIBOMP_DEPENDENCIES="libomp libomp-devel" + +# Ensure clang depends on the correct clang-libs version +rpm -q --requires clang | grep "clang-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-libs | grep "${lomp_dep}.* = ${CLANG_VERSION}" + [[ "$(rpm --queryformat="%{version}" -q ${lomp_dep})" == "${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"