From 35ad3c3dc8f1d04448ec1dfc2d5835484464c465 Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Mon, 22 Aug 2022 13:28:38 +0000 Subject: [PATCH 01/20] Added the README --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..23d921a --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# compiler-rt + +Tests for compiler-rt \ No newline at end of file From ec1522e35f9fad8ae70ef790ce1f0be4f6dcb08c Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 23 Aug 2022 13:43:18 +0200 Subject: [PATCH 02/20] Init repo: * Init tmt. * Add sanity test * Add gating fmf plan --- .fmf/version | 1 + build-gating.fmf | 38 ++++++++++++++++++++++++++++++++++++++ sanity/main.fmf | 20 ++++++++++++++++++++ sanity/test.sh | 6 ++++++ sanity/test1.c | 5 +++++ 5 files changed, 70 insertions(+) create mode 100644 .fmf/version create mode 100644 build-gating.fmf create mode 100644 sanity/main.fmf create mode 100755 sanity/test.sh create mode 100644 sanity/test1.c diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/build-gating.fmf b/build-gating.fmf new file mode 100644 index 0000000..2cc1c1a --- /dev/null +++ b/build-gating.fmf @@ -0,0 +1,38 @@ +# +# Build/PR gating tests for compiler-rt +# +# Compatible with various LLVM distributions: +# +# * Fedora (ursine packages) +# * Centos 9 stream (ursine packages) +# * RHEL-9 (ursine packages) +# * RHEL-8 (Red Hat module) +# * RHEL-7 (software collection) +# + +summary: compiler-rt 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" + +discover: + - name: compiler-rt tests + how: fmf +execute: + how: tmt +provision: + hardware: + memory: ">= 4 GiB" diff --git a/sanity/main.fmf b/sanity/main.fmf new file mode 100644 index 0000000..5977f89 --- /dev/null +++ b/sanity/main.fmf @@ -0,0 +1,20 @@ +summary: compiler-rt sanity test with signed int overflow +test: "$WITH_SCL ./test.sh" +require: [] + +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + - compiler-rt + when: collection is not defined + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + - llvm-toolset-13.0-compiler-rt + when: collection == llvm-toolset-13.0 + - require+: + - llvm-toolset-14.0-clang + - llvm-toolset-14.0-compiler-rt + when: collection == llvm-toolset-14.0 diff --git a/sanity/test.sh b/sanity/test.sh new file mode 100755 index 0000000..c91953b --- /dev/null +++ b/sanity/test.sh @@ -0,0 +1,6 @@ +#!/bin/sh -eux + +clang -fsanitize=undefined -o test1 test1.c +./test1 2> test1.stderr +cat test1.stderr +grep "test1.c:3:5: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'" test1.stderr diff --git a/sanity/test1.c b/sanity/test1.c new file mode 100644 index 0000000..3a3e5a4 --- /dev/null +++ b/sanity/test1.c @@ -0,0 +1,5 @@ +int main(int argc, char **argv) { + int k = 0x7fffffff; + k += argc; + return 0; +} From 2878c430d946cb914232ef5410c65f2239ed41b9 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 23 Aug 2022 15:47:48 +0200 Subject: [PATCH 03/20] Add nitrate metadata --- sanity/main.fmf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sanity/main.fmf b/sanity/main.fmf index 5977f89..ed8a8f6 100644 --- a/sanity/main.fmf +++ b/sanity/main.fmf @@ -1,6 +1,14 @@ summary: compiler-rt sanity test with signed int overflow test: "$WITH_SCL ./test.sh" require: [] +framework: shell +tier: 1 +component: + - llvm-toolset + - compiler-rt +extra-summary: /tools/compiler-rt/sanity +extra-task: /tools/compiler-rt/sanity +extra-nitrate: TC#0614247 adjust: # Common requirements when LLVM is not SCL-ized From 75941bd254141ca01fb48e89f076c1e45832b50b Mon Sep 17 00:00:00 2001 From: Edjunior Machado Date: Fri, 30 Sep 2022 13:09:13 +0200 Subject: [PATCH 04/20] Add llvm-toolset-15.0 --- build-gating.fmf | 4 ++++ sanity/main.fmf | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/build-gating.fmf b/build-gating.fmf index 2cc1c1a..4189a4a 100644 --- a/build-gating.fmf +++ b/build-gating.fmf @@ -27,6 +27,10 @@ adjust: environment+: WITH_SCL: "scl enable llvm-toolset-14.0" when: "collection == llvm-toolset-14.0" + - because: "When testing SCL-ized LLVM, the collection must be enabled first" + environment+: + WITH_SCL: "scl enable llvm-toolset-15.0" + when: "collection == llvm-toolset-15.0" discover: - name: compiler-rt tests diff --git a/sanity/main.fmf b/sanity/main.fmf index ed8a8f6..5a19784 100644 --- a/sanity/main.fmf +++ b/sanity/main.fmf @@ -26,3 +26,7 @@ adjust: - llvm-toolset-14.0-clang - llvm-toolset-14.0-compiler-rt when: collection == llvm-toolset-14.0 + - require+: + - llvm-toolset-15.0-clang + - llvm-toolset-15.0-compiler-rt + when: collection == llvm-toolset-15.0 From fea3e11f646c2f5680fdc256ce94c3f43fe9eab4 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 27 Feb 2023 18:20:52 +0000 Subject: [PATCH 05/20] Add test for using 32-bit sanitizers on 64-bit host --- cross-compile-i686/main.fmf | 38 +++++++++++++++++++++++++++++++++++++ cross-compile-i686/test.c | 1 + cross-compile-i686/test.sh | 3 +++ 3 files changed, 42 insertions(+) create mode 100644 cross-compile-i686/main.fmf create mode 100644 cross-compile-i686/test.c create mode 100755 cross-compile-i686/test.sh diff --git a/cross-compile-i686/main.fmf b/cross-compile-i686/main.fmf new file mode 100644 index 0000000..c4ea9c7 --- /dev/null +++ b/cross-compile-i686/main.fmf @@ -0,0 +1,38 @@ +summary: compiler-rt test for rhbz#1678240 +test: "$WITH_SCL ./test.sh" +require: [] +framework: shell +tier: 1 +component: + - llvm-toolset + - compiler-rt + +adjust: + # Common requirements when LLVM is not SCL-ized + - enabled: false + because: "Test applicable only on x86_64 arch" + when: arch != x86_64 + + - require+: + - clang + - compiler-rt + - compiler-rt.i686 + - glibc-devel.i686 + when: collection is not defined + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + - llvm-toolset-13.0-compiler-rt + - llvm-toolset-13.0-compiler-rt.i686 + when: collection == llvm-toolset-13.0 + - require+: + - llvm-toolset-14.0-clang + - llvm-toolset-14.0-compiler-rt + - llvm-toolset-14.0-compiler-rt.i686 + when: collection == llvm-toolset-14.0 + - require+: + - llvm-toolset-15.0-clang + - llvm-toolset-15.0-compiler-rt + - llvm-toolset-15.0-compiler-rt.i686 + when: collection == llvm-toolset-15.0 diff --git a/cross-compile-i686/test.c b/cross-compile-i686/test.c new file mode 100644 index 0000000..2c99a52 --- /dev/null +++ b/cross-compile-i686/test.c @@ -0,0 +1 @@ +int main(){return 0;} diff --git a/cross-compile-i686/test.sh b/cross-compile-i686/test.sh new file mode 100755 index 0000000..52a9e1f --- /dev/null +++ b/cross-compile-i686/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh -eux + +clang -m32 -fsanitize=address test.c From 29186495495ac19de942e90d6152f11e40dd887a Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Tue, 21 Mar 2023 17:18:01 -0300 Subject: [PATCH 06/20] cross-compile-i686: Ensure x86_64 package is installed In a x86_64 system, compiler-rt.x86_64 provides important symlinks to let a 64-bit clang find the i686 libraries. --- cross-compile-i686/main.fmf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cross-compile-i686/main.fmf b/cross-compile-i686/main.fmf index c4ea9c7..57a4604 100644 --- a/cross-compile-i686/main.fmf +++ b/cross-compile-i686/main.fmf @@ -15,7 +15,7 @@ adjust: - require+: - clang - - compiler-rt + - compiler-rt.x86_64 - compiler-rt.i686 - glibc-devel.i686 when: collection is not defined From e43607a0f654fc91ab2a6f197764ce28bd02c858 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 26 Apr 2023 09:59:51 +0200 Subject: [PATCH 07/20] cross-compile-i686: Adjust metadata compiler-rt.i686 packages are not shipped in RHEL or CentOS, disable the test in those distros --- cross-compile-i686/main.fmf | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/cross-compile-i686/main.fmf b/cross-compile-i686/main.fmf index 57a4604..a9aabcc 100644 --- a/cross-compile-i686/main.fmf +++ b/cross-compile-i686/main.fmf @@ -13,26 +13,13 @@ adjust: because: "Test applicable only on x86_64 arch" when: arch != x86_64 + - enabled: false + because: "compiler-rt.i686 packages not shipped in RHEL/CentOS" + when: distro == rhel or distro == centos + - require+: - clang - compiler-rt.x86_64 - compiler-rt.i686 - glibc-devel.i686 when: collection is not defined - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang - - llvm-toolset-13.0-compiler-rt - - llvm-toolset-13.0-compiler-rt.i686 - when: collection == llvm-toolset-13.0 - - require+: - - llvm-toolset-14.0-clang - - llvm-toolset-14.0-compiler-rt - - llvm-toolset-14.0-compiler-rt.i686 - when: collection == llvm-toolset-14.0 - - require+: - - llvm-toolset-15.0-clang - - llvm-toolset-15.0-compiler-rt - - llvm-toolset-15.0-compiler-rt.i686 - when: collection == llvm-toolset-15.0 From 60a9f71c701c6789eb6ead000c3d67434a7416f6 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Mon, 17 Jul 2023 18:38:27 -0300 Subject: [PATCH 08/20] Better integrate with Koji When testing builds from Koji, the i686 repositories are not available on x86_64, requiring packages to be manually installed in order to run cross-compile-i686. --- build-gating.fmf | 5 +++++ setup_cross_packages.sh | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100755 setup_cross_packages.sh diff --git a/build-gating.fmf b/build-gating.fmf index 4189a4a..6a1894c 100644 --- a/build-gating.fmf +++ b/build-gating.fmf @@ -35,6 +35,11 @@ adjust: discover: - name: compiler-rt tests how: fmf + +prepare: + - how: shell + script: sh ./setup_cross_packages.sh + execute: how: tmt provision: diff --git a/setup_cross_packages.sh b/setup_cross_packages.sh new file mode 100755 index 0000000..092abbe --- /dev/null +++ b/setup_cross_packages.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +if [[ x"$KOJI_TASK_ID" != "x" ]]; then + dnf install -y koji + koji download-build --noprogress -a i686 --task-id $KOJI_TASK_ID + dnf install -y ./compiler-rt-*.i686.rpm +fi From ec1f44228b40dcb009ba6404cfa97ed64ff546a8 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 21 Sep 2023 16:00:41 +0200 Subject: [PATCH 09/20] fp16-abi: add test to check that Float16 ABI matches with clang --- fp16-abi/main.fmf | 32 ++++++++++++++++++++++++++++++++ fp16-abi/test.cpp | 14 ++++++++++++++ fp16-abi/test.sh | 15 +++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 fp16-abi/main.fmf create mode 100644 fp16-abi/test.cpp create mode 100755 fp16-abi/test.sh diff --git a/fp16-abi/main.fmf b/fp16-abi/main.fmf new file mode 100644 index 0000000..098120e --- /dev/null +++ b/fp16-abi/main.fmf @@ -0,0 +1,32 @@ +summary: Test that Float16 ABI matches with clang +test: "$WITH_SCL ./test.sh" +framework: shell +tier: 1 +component: + - llvm-toolset + - compiler-rt + +adjust: + - because: "Float16 not supported on s390x or ppc64le" + enabled: false + when: arch == s390x or arch == ppc64le + + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + - compiler-rt + when: collection is not defined + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + - llvm-toolset-13.0-compiler-rt + when: collection == llvm-toolset-13.0 + - require+: + - llvm-toolset-14.0-clang + - llvm-toolset-14.0-compiler-rt + when: collection == llvm-toolset-14.0 + - require+: + - llvm-toolset-15.0-clang + - llvm-toolset-15.0-compiler-rt + when: collection == llvm-toolset-15.0 diff --git a/fp16-abi/test.cpp b/fp16-abi/test.cpp new file mode 100644 index 0000000..3c15ea1 --- /dev/null +++ b/fp16-abi/test.cpp @@ -0,0 +1,14 @@ +// Reproducer based on this code from Steve Leung (evetsso): +// https://github.com/ROCmSoftwarePlatform/rocFFT/issues/439#issuecomment-1693835987 + +#include +#include +#include + +int main() +{ + _Float16 one_f16 = 0.123; + float one_f32 = one_f16; + std::cout << one_f32 << std::endl; + return 0; +} diff --git a/fp16-abi/test.sh b/fp16-abi/test.sh new file mode 100755 index 0000000..35b99e8 --- /dev/null +++ b/fp16-abi/test.sh @@ -0,0 +1,15 @@ +#!/bin/sh -ux +# Do NOT set exit after error flag (set -e). Let all the optimizations to be run + +tmp=$(mktemp -d) +result=0 +# Test the reproducer with all the optimization levels +for opt_level in 0 1 2 3; do + clang++ --rtlib=compiler-rt -O$opt_level test.cpp -o $tmp/test_O$opt_level + $tmp/test_O$opt_level | grep '0.122986' || result=1 +done + +rm -rf $tmp +if [[ "$result" == 1 ]]; then + exit 1 +fi From 082c661c48bbbc752d041ce4046c34c601bedd6a Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 20 Oct 2023 13:59:44 +0200 Subject: [PATCH 10/20] Add a test for checking that compiler-rt don't ship broken symlinks --- broken-symlinks/main.fmf | 16 ++++++++++++++++ broken-symlinks/test.sh | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 broken-symlinks/main.fmf create mode 100755 broken-symlinks/test.sh diff --git a/broken-symlinks/main.fmf b/broken-symlinks/main.fmf new file mode 100644 index 0000000..078f33b --- /dev/null +++ b/broken-symlinks/main.fmf @@ -0,0 +1,16 @@ +summary: Test that compiler-rt does not contain broken symlinks +test: ./test.sh +framework: shell +tier: 1 +component: + - llvm-toolset + - compiler-rt +require: + - compiler-rt + +link: + verifies: https://issues.redhat.com/browse/RHEL-7375 + +adjust: + - enabled: false + when: rhel < rhel-8 diff --git a/broken-symlinks/test.sh b/broken-symlinks/test.sh new file mode 100755 index 0000000..d1ff74c --- /dev/null +++ b/broken-symlinks/test.sh @@ -0,0 +1,16 @@ +#!/bin/sh -u + +tmp=$(mktemp -d) +# Install compiler-rt in a new root to ensure possible broken links are +# not resolved with packages installed by other tests +dnf install --quiet --installroot=${tmp} -y compiler-rt +result=0 +for file in $(rpm -ql compiler-rt); do + [[ -L ${tmp}/$file ]] || continue + if [[ ! -e ${tmp}/$file ]]; then + echo "FAIL: $file is a dangling symlink" + result=1 + fi +done +rm -rf $tmp +exit $result From 3403ca384d032f5e234194e683ecd18668d2f788 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 14 Nov 2023 09:12:03 +0100 Subject: [PATCH 11/20] broken-symlinks: update test relevancy --- broken-symlinks/main.fmf | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/broken-symlinks/main.fmf b/broken-symlinks/main.fmf index 078f33b..47be9ed 100644 --- a/broken-symlinks/main.fmf +++ b/broken-symlinks/main.fmf @@ -12,5 +12,15 @@ link: verifies: https://issues.redhat.com/browse/RHEL-7375 adjust: + # Broken symlinks were fixed with Clang Resource directory moving in LLVM 17: + # https://fedoraproject.org/wiki/Changes/LLVM-17#Detailed_Description + # There are no plans to backport that, so we disable the test + # in distros where LLVM < 17. - enabled: false - when: rhel < rhel-8 + when: distro < rhel-8 + - enabled: false + when: distro == rhel-8 and distro <= rhel-8.9 + - enabled: false + when: distro == rhel-9 and distro <= rhel-9.3 + - enabled: false + when: distro == fedora and distro <= fedora-38 From 6c3812f47267d2fc673c8795678a112792cc20c8 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 29 Feb 2024 18:41:58 +0100 Subject: [PATCH 12/20] Gather common tmt metadata Moved tests under tests directory Extracted common metadata into tests/main.fmf. --- fp16-abi/main.fmf | 32 ------------ sanity/main.fmf | 32 ------------ .../broken-symlinks}/main.fmf | 13 ++--- .../broken-symlinks}/test.sh | 0 .../cross-compile-i686}/main.fmf | 21 +++----- .../cross-compile-i686}/test.c | 0 .../cross-compile-i686}/test.sh | 0 tests/fp16-abi/main.fmf | 7 +++ {fp16-abi => tests/fp16-abi}/test.cpp | 0 {fp16-abi => tests/fp16-abi}/test.sh | 0 tests/main.fmf | 49 +++++++++++++++++++ tests/sanity/main.fmf | 5 ++ {sanity => tests/sanity}/test.sh | 0 {sanity => tests/sanity}/test1.c | 0 14 files changed, 71 insertions(+), 88 deletions(-) delete mode 100644 fp16-abi/main.fmf delete mode 100644 sanity/main.fmf rename {broken-symlinks => tests/broken-symlinks}/main.fmf (77%) rename {broken-symlinks => tests/broken-symlinks}/test.sh (100%) rename {cross-compile-i686 => tests/cross-compile-i686}/main.fmf (56%) rename {cross-compile-i686 => tests/cross-compile-i686}/test.c (100%) rename {cross-compile-i686 => tests/cross-compile-i686}/test.sh (100%) create mode 100644 tests/fp16-abi/main.fmf rename {fp16-abi => tests/fp16-abi}/test.cpp (100%) rename {fp16-abi => tests/fp16-abi}/test.sh (100%) create mode 100644 tests/main.fmf create mode 100644 tests/sanity/main.fmf rename {sanity => tests/sanity}/test.sh (100%) rename {sanity => tests/sanity}/test1.c (100%) diff --git a/fp16-abi/main.fmf b/fp16-abi/main.fmf deleted file mode 100644 index 098120e..0000000 --- a/fp16-abi/main.fmf +++ /dev/null @@ -1,32 +0,0 @@ -summary: Test that Float16 ABI matches with clang -test: "$WITH_SCL ./test.sh" -framework: shell -tier: 1 -component: - - llvm-toolset - - compiler-rt - -adjust: - - because: "Float16 not supported on s390x or ppc64le" - enabled: false - when: arch == s390x or arch == ppc64le - - # Common requirements when LLVM is not SCL-ized - - require+: - - clang - - compiler-rt - when: collection is not defined - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang - - llvm-toolset-13.0-compiler-rt - when: collection == llvm-toolset-13.0 - - require+: - - llvm-toolset-14.0-clang - - llvm-toolset-14.0-compiler-rt - when: collection == llvm-toolset-14.0 - - require+: - - llvm-toolset-15.0-clang - - llvm-toolset-15.0-compiler-rt - when: collection == llvm-toolset-15.0 diff --git a/sanity/main.fmf b/sanity/main.fmf deleted file mode 100644 index 5a19784..0000000 --- a/sanity/main.fmf +++ /dev/null @@ -1,32 +0,0 @@ -summary: compiler-rt sanity test with signed int overflow -test: "$WITH_SCL ./test.sh" -require: [] -framework: shell -tier: 1 -component: - - llvm-toolset - - compiler-rt -extra-summary: /tools/compiler-rt/sanity -extra-task: /tools/compiler-rt/sanity -extra-nitrate: TC#0614247 - -adjust: - # Common requirements when LLVM is not SCL-ized - - require+: - - clang - - compiler-rt - when: collection is not defined - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang - - llvm-toolset-13.0-compiler-rt - when: collection == llvm-toolset-13.0 - - require+: - - llvm-toolset-14.0-clang - - llvm-toolset-14.0-compiler-rt - when: collection == llvm-toolset-14.0 - - require+: - - llvm-toolset-15.0-clang - - llvm-toolset-15.0-compiler-rt - when: collection == llvm-toolset-15.0 diff --git a/broken-symlinks/main.fmf b/tests/broken-symlinks/main.fmf similarity index 77% rename from broken-symlinks/main.fmf rename to tests/broken-symlinks/main.fmf index 47be9ed..7c9b295 100644 --- a/broken-symlinks/main.fmf +++ b/tests/broken-symlinks/main.fmf @@ -1,17 +1,10 @@ summary: Test that compiler-rt does not contain broken symlinks -test: ./test.sh -framework: shell tier: 1 -component: - - llvm-toolset - - compiler-rt -require: - - compiler-rt -link: - verifies: https://issues.redhat.com/browse/RHEL-7375 +link+: + - verifies: https://issues.redhat.com/browse/RHEL-7375 -adjust: +adjust+: # Broken symlinks were fixed with Clang Resource directory moving in LLVM 17: # https://fedoraproject.org/wiki/Changes/LLVM-17#Detailed_Description # There are no plans to backport that, so we disable the test diff --git a/broken-symlinks/test.sh b/tests/broken-symlinks/test.sh similarity index 100% rename from broken-symlinks/test.sh rename to tests/broken-symlinks/test.sh diff --git a/cross-compile-i686/main.fmf b/tests/cross-compile-i686/main.fmf similarity index 56% rename from cross-compile-i686/main.fmf rename to tests/cross-compile-i686/main.fmf index a9aabcc..92e3f73 100644 --- a/cross-compile-i686/main.fmf +++ b/tests/cross-compile-i686/main.fmf @@ -1,13 +1,13 @@ summary: compiler-rt test for rhbz#1678240 -test: "$WITH_SCL ./test.sh" -require: [] -framework: shell +description: > + Test that clang -m32 -fsanitize looks for compiler-rt library in the + proper directory tier: 1 -component: - - llvm-toolset - - compiler-rt -adjust: +require+: + - compiler-rt.i686 + - glibc-devel.i686 +adjust+: # Common requirements when LLVM is not SCL-ized - enabled: false because: "Test applicable only on x86_64 arch" @@ -16,10 +16,3 @@ adjust: - enabled: false because: "compiler-rt.i686 packages not shipped in RHEL/CentOS" when: distro == rhel or distro == centos - - - require+: - - clang - - compiler-rt.x86_64 - - compiler-rt.i686 - - glibc-devel.i686 - when: collection is not defined diff --git a/cross-compile-i686/test.c b/tests/cross-compile-i686/test.c similarity index 100% rename from cross-compile-i686/test.c rename to tests/cross-compile-i686/test.c diff --git a/cross-compile-i686/test.sh b/tests/cross-compile-i686/test.sh similarity index 100% rename from cross-compile-i686/test.sh rename to tests/cross-compile-i686/test.sh diff --git a/tests/fp16-abi/main.fmf b/tests/fp16-abi/main.fmf new file mode 100644 index 0000000..30f884a --- /dev/null +++ b/tests/fp16-abi/main.fmf @@ -0,0 +1,7 @@ +summary: Test that Float16 ABI matches with clang +tier: 1 + +adjust+: + - because: "Float16 not supported on s390x or ppc64le" + enabled: false + when: arch == s390x or arch == ppc64le diff --git a/fp16-abi/test.cpp b/tests/fp16-abi/test.cpp similarity index 100% rename from fp16-abi/test.cpp rename to tests/fp16-abi/test.cpp diff --git a/fp16-abi/test.sh b/tests/fp16-abi/test.sh similarity index 100% rename from fp16-abi/test.sh rename to tests/fp16-abi/test.sh diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..4efc1fb --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,49 @@ +# Common configuration for all the tests in this repo +# All the tmt tests under this directory inherit the settings from this file +component: + - llvm-toolset + - compiler-rt + +# Default QA contact. If more are relevant use 'contact+:' in each test metadata. +contact: + - Jesus Checa Hidalgo + +# All tests are shell by default. If a specific test uses another framework +# such as beakerlib, define "framework: beakerlib" in the test's main.fmf +framework: shell + +# Always define "test" key and override in adjust or in each specific test +# metadata if needed. +test: ./test.sh + +# Commonly used keys are initialized to empty. +require: [] +link: [] +tag: [] + +adjust+: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + - compiler-rt + when: collection is not defined + + # Requirements for SCL-ized LLVM + # We need to override the test key to do the proper scl call + - test: scl enable llvm-toolset-13.0 -- ./test.sh + require+: + - llvm-toolset-13.0-clang + - llvm-toolset-13.0-compiler-rt + when: collection == llvm-toolset-13.0 + + - test: scl enable llvm-toolset-14.0 -- ./test.sh + require+: + - llvm-toolset-14.0-clang + - llvm-toolset-14.0-compiler-rt + when: collection == llvm-toolset-14.0 + + - test: scl enable llvm-toolset-15.0 -- ./test.sh + require+: + - llvm-toolset-15.0-clang + - llvm-toolset-15.0-compiler-rt + when: collection == llvm-toolset-15.0 diff --git a/tests/sanity/main.fmf b/tests/sanity/main.fmf new file mode 100644 index 0000000..03ea1be --- /dev/null +++ b/tests/sanity/main.fmf @@ -0,0 +1,5 @@ +summary: compiler-rt sanity test with signed int overflow +tier: 1 +extra-summary: /tools/compiler-rt/sanity +extra-task: /tools/compiler-rt/sanity +extra-nitrate: TC#0614247 diff --git a/sanity/test.sh b/tests/sanity/test.sh similarity index 100% rename from sanity/test.sh rename to tests/sanity/test.sh diff --git a/sanity/test1.c b/tests/sanity/test1.c similarity index 100% rename from sanity/test1.c rename to tests/sanity/test1.c From fa8bc5eb0b07cd00289cfc11a3a4a3d2f3a45610 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 1 Mar 2024 14:37:44 +0100 Subject: [PATCH 13/20] Update testplan to new metadata. Remove unused cross packages script Add integration testsuite to the plan Add prepare steps needed in RHEL/CentOS --- build-gating.fmf | 47 ------------------------------------- plans/build-gating.fmf | 51 +++++++++++++++++++++++++++++++++++++++++ setup_cross_packages.sh | 7 ------ 3 files changed, 51 insertions(+), 54 deletions(-) delete mode 100644 build-gating.fmf create mode 100644 plans/build-gating.fmf delete mode 100755 setup_cross_packages.sh diff --git a/build-gating.fmf b/build-gating.fmf deleted file mode 100644 index 6a1894c..0000000 --- a/build-gating.fmf +++ /dev/null @@ -1,47 +0,0 @@ -# -# Build/PR gating tests for compiler-rt -# -# Compatible with various LLVM distributions: -# -# * Fedora (ursine packages) -# * Centos 9 stream (ursine packages) -# * RHEL-9 (ursine packages) -# * RHEL-8 (Red Hat module) -# * RHEL-7 (software collection) -# - -summary: compiler-rt 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: "When testing SCL-ized LLVM, the collection must be enabled first" - environment+: - WITH_SCL: "scl enable llvm-toolset-15.0" - when: "collection == llvm-toolset-15.0" - -discover: - - name: compiler-rt tests - how: fmf - -prepare: - - how: shell - script: sh ./setup_cross_packages.sh - -execute: - how: tmt -provision: - hardware: - memory: ">= 4 GiB" diff --git a/plans/build-gating.fmf b/plans/build-gating.fmf new file mode 100644 index 0000000..456f328 --- /dev/null +++ b/plans/build-gating.fmf @@ -0,0 +1,51 @@ +# +# Build/PR gating tests for compiler-rt +# +# Compatible with various LLVM distributions: +# +# * Fedora (ursine packages) +# * Centos 9 stream (ursine packages) +# * RHEL-9 (ursine packages) +# * RHEL-8 (Red Hat module) +# * RHEL-7 (software collection) +# + +summary: compiler-rt 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: "On RHEL-8+, CRB must be enabled to provide rarer packages" + prepare+: + - name: Enable CRB + how: shell + script: dnf config-manager --set-enabled *-CRB + when: >- + distro == rhel and distro >= rhel-8 + + - because: "On CentOS, CRB must be enabled to provide rarer packages" + prepare+: + - name: Enable CRB + how: shell + script: dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb + when: >- + distro == centos + +discover: + - name: compiler-rt-tests + how: fmf + - name: upstream-llvm-integration-testsuite + how: fmf + url: https://src.fedoraproject.org/tests/llvm.git + ref: main + test: integration-test-suite + +execute: + how: tmt +provision: + hardware: + memory: ">= 4 GiB" diff --git a/setup_cross_packages.sh b/setup_cross_packages.sh deleted file mode 100755 index 092abbe..0000000 --- a/setup_cross_packages.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env sh - -if [[ x"$KOJI_TASK_ID" != "x" ]]; then - dnf install -y koji - koji download-build --noprogress -a i686 --task-id $KOJI_TASK_ID - dnf install -y ./compiler-rt-*.i686.rpm -fi From bf6cf7375d51e90625b6490e11f07dc9247fa0d9 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 7 Mar 2024 15:43:55 +0100 Subject: [PATCH 14/20] Add documentation to README.md --- README.md | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 23d921a..760e85e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,104 @@ -# compiler-rt +# compiler-rt Tests -Tests for compiler-rt \ No newline at end of file +This repository contains tests for compiler-rt. + +## Usage +Tests are executed using TMT (Test Management Tool). The repository includes a +TMT plan that runs all the tests by default. All the tests support the following +context dimensions: +* `distro` +* `arch` +* `collection` (only applicable to RHEL 7) + +To run the tests: +```bash +# Run in the default virtual environment +tmt -c distro= -c arch= run -avv + +# Run on a scheduled system +tmt -c distro= -c arch= run -avv provision -h connect -g + +# Run specific tests +tmt -c distro= -c arch= run -avv provision -h connect -g test -n +``` + +## Adding New Tests +Please consider the following when adding new tests: +* Test scripts must be named `test.sh`. If a different test is needed, you need +to overwrite the `test:` key in the test `main.fmf`. +* Tests must be placed under `tests/`. Additionally they can be + placed into subdirectories if grouping make sense. E.g. + `tests/regression/`. +* This repository has a common configuration under `tests/main.fmf`, inherited + by all tests. When adding new ones, be careful not to overwrite existing keys + from the inherited `tests/main.fmf`. +* When setting FMF metadata keys, do merge values instead overwriting them. E.g. +use `require+:` instead `require:`. For advanced use and more examples check +[FMF documentation](https://fmf.readthedocs.io/en/stable/features.html#merging). + +After creating the new test, consider running `tmt tests show +` to review that the resulting metadata such as requires, enable or +test keys are as expected. For example: +``` +$ tmt -c distro=fedora-39 tests show sanity +/tests/sanity + summary compiler-rt sanity test with signed int overflow + contact Jesus Checa Hidalgo + component 'llvm-toolset' and 'compiler-rt' + test ./test.sh + path /tests/sanity + framework shell + manual false + tty false + require 'clang' and 'compiler-rt' + duration 5m + enabled true + result respect + tier 1 + +$ $ tmt -c collection=llvm-toolset-15.0 tests show sanity +/tests/sanity + summary compiler-rt sanity test with signed int overflow + contact Jesus Checa Hidalgo + component 'llvm-toolset' and 'compiler-rt' + test scl enable llvm-toolset-15.0 -- ./test.sh + path /tests/sanity + framework shell + manual false + tty false + require llvm-toolset-15.0-clang + llvm-toolset-15.0-compiler-rt + duration 5m + enabled true + result respect + tier 1 + + +``` + +### Templates +Use the following templates when creating new tests. + +FMF template. Uncomment needed fields, remove the rest. +```yaml +summary: Descriptive summary for the test +# Maximum duration for the test +duration: 2m +# Short tests should be tier <= 1 so they're used for gating. +tier: 1 +# Add an additional contact(s) if applicable +# contact+: +# - Somebody +# Additional requires +# require+: +# - rpm-build +# Adjustments based on context dimensions +# adjust+: +# - when: collection is defined +# enabled: false +# because: Test not supported in collections +# link+: +# - verifies: https://issues.redhat.com/browse/... +# tag+: +# - sometag +``` From 4a8c55b5320412f8ecff47e64fc0c67699bc50fd Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 2 Apr 2024 08:51:06 +0200 Subject: [PATCH 15/20] Fix Readme formatting --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 760e85e..9bf1944 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ This repository contains tests for compiler-rt. Tests are executed using TMT (Test Management Tool). The repository includes a TMT plan that runs all the tests by default. All the tests support the following context dimensions: + * `distro` * `arch` * `collection` (only applicable to RHEL 7) @@ -24,6 +25,7 @@ tmt -c distro= -c arch= run -avv provision -h connect -g `. Additionally they can be From acc90e7a061d9db958dbc601d13418f964046413 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Mon, 15 Apr 2024 12:03:02 -0300 Subject: [PATCH 16/20] Disable cross-compile-i686 on snapshot runs i686 snapshot builds take many more hours to complete than x86_64 ones making it difficult to wait until both are available before tests start to run and still providing results in the same day. Because of that, this commit disables the test when the snapshot context is defined. --- tests/cross-compile-i686/main.fmf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/cross-compile-i686/main.fmf b/tests/cross-compile-i686/main.fmf index 92e3f73..3863a8c 100644 --- a/tests/cross-compile-i686/main.fmf +++ b/tests/cross-compile-i686/main.fmf @@ -16,3 +16,7 @@ adjust+: - enabled: false because: "compiler-rt.i686 packages not shipped in RHEL/CentOS" when: distro == rhel or distro == centos + + - enabled: false + because: "compiler-rt.i686 may not be available in snapshot builds when x86_64 tests are executed" + when: snapshot is defined From 6e7caab25c343059aa4abb52c03bb37b2b15bfc6 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 25 Apr 2024 11:29:35 +0200 Subject: [PATCH 17/20] broken-symlinks: Rewrite the test to not install in a chroot Installing the package into a chroot from the repos is a flaky approach as it's not guaranteed that the package in the repos is the same as the one being tested. Also, it's unnecessarily time consuming. Now the test checks the symlinks in the rpm and checks that they are resolved to a file owned by either compiler-rt or one of its dependencies. --- tests/broken-symlinks/main.fmf | 3 ++ tests/broken-symlinks/test.sh | 64 ++++++++++++++++++++++++++-------- 2 files changed, 52 insertions(+), 15 deletions(-) diff --git a/tests/broken-symlinks/main.fmf b/tests/broken-symlinks/main.fmf index 7c9b295..60ebba6 100644 --- a/tests/broken-symlinks/main.fmf +++ b/tests/broken-symlinks/main.fmf @@ -1,5 +1,8 @@ summary: Test that compiler-rt does not contain broken symlinks tier: 1 +framework: beakerlib +require+: + - yum-utils link+: - verifies: https://issues.redhat.com/browse/RHEL-7375 diff --git a/tests/broken-symlinks/test.sh b/tests/broken-symlinks/test.sh index d1ff74c..677eb9e 100755 --- a/tests/broken-symlinks/test.sh +++ b/tests/broken-symlinks/test.sh @@ -1,16 +1,50 @@ -#!/bin/sh -u +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +. /usr/share/beakerlib/beakerlib.sh || exit 1 -tmp=$(mktemp -d) -# Install compiler-rt in a new root to ensure possible broken links are -# not resolved with packages installed by other tests -dnf install --quiet --installroot=${tmp} -y compiler-rt -result=0 -for file in $(rpm -ql compiler-rt); do - [[ -L ${tmp}/$file ]] || continue - if [[ ! -e ${tmp}/$file ]]; then - echo "FAIL: $file is a dangling symlink" - result=1 - fi -done -rm -rf $tmp -exit $result +rlJournalStart + rlPhaseStartSetup + rlRun "tmp=$(mktemp -d)" 0 "Create a temp dir" + # Get the compiler-rt package name from the tmt required packages, which should + # address the issue of getting the correct name regardless it's a compat package + # or not. The package can be named either compiler-rt or compiler-rt[0-9]+ + rlRun "COMPILER_RT=$(rlGetYAMLdeps | tr ' ' '\n' | grep -E "compiler-rt[[:digit:]]*$")" + # Make sure to get only the main arch, so we can deal with multilib issues. + rlRun "COMPILER_RT_NVR=$(rpm -q ${COMPILER_RT} | grep $(uname -m))" + # Use dnf repoquery --installed so we *don't* query any repos but the + # local rpm database instead. That should handle packages installed + # using rpm, that are not in repos, and avoid timeouts if repo connection + # is slow. + rlRun "dnf repoquery --installed --depends --resolve $COMPILER_RT_NVR > $tmp/dependencies.log" + rlPhaseEnd + + rlPhaseStartTest + for file in $(rpm -ql $COMPILER_RT_NVR); do + # Skip iteration if the file is not a symlink + [[ -L $file ]] || continue + + # Check if the symlink resolves to a valid file. If not, it's a failure + if [[ ! -e $file ]]; then + rlFail "$file is a dangling symlink" + continue + fi + + # Up to this point, the linked file exists. + # If the owner of the target compiler-rt package itself that's + # correct and we can skip to the next file. + target=$(readlink -f $file) + OWNER_NVR=$(rpm -qf $target) + [[ "$OWNER_NVR" == "$COMPILER_RT_NVR" ]] && continue + + # The target exists but it's not owned by compiler-rt. It must be + # owned by one of its dependencies, else flag a failure. + if ! cat $tmp/dependencies.log | grep $OWNER_NVR; then + rlFail "$file pointing to $target is a dangling symlink owned by $OWNER_NVR" + fi + done + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "rm -rf $tmp" 0 "Removing temp dir" + rlPhaseEnd +rlJournalEnd From f3053280b2b44bd36c8c5986c3580379e2f54569 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Fri, 3 May 2024 15:19:59 +0200 Subject: [PATCH 18/20] Add pre-commit config and update README See also https://src.fedoraproject.org/tests/llvm/pull-request/27 --- .pre-commit-config.yaml | 14 ++++++++++++++ README.md | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..e5388a6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + +# See https://tmt.readthedocs.io/en/latest/guide.html#checking-data-validity +- repo: https://github.com/teemtee/tmt.git + rev: 1.32.2 + hooks: + - id: tmt-lint diff --git a/README.md b/README.md index 9bf1944..e373c8b 100644 --- a/README.md +++ b/README.md @@ -104,3 +104,19 @@ tier: 1 # tag+: # - sometag ``` + +### Avoid common errors using pre-commit + +This project uses [`pre-commit`](https://pre-commit.com/) + +* to [lint fmf files](https://tmt.readthedocs.io/en/latest/guide.html#lint) +* to check that you don't have [trailing + whitespaces](https://github.com/pre-commit/pre-commit-hooks?tab=readme-ov-file#trailing-whitespace) +* to check that [files end with a + newline](https://github.com/pre-commit/pre-commit-hooks?tab=readme-ov-file#end-of-file-fixer) + +Please install `pre-commit` using `pip install pre-commit` as described +[here](https://pre-commit.com/#install). Then navigate to your clone of this +project and install the git hook scripts using `pre-commit install`. This will +run pre-commit on every `git commit` that you make in this repository from now +on. From be814a631018815de8c325ac09231cfa581996f6 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 10 May 2024 09:02:04 +0200 Subject: [PATCH 19/20] broken-symlinks: Fix dnf command incompatibility with dnf5 dnf5 drops support of --resolve in favor of --providers-of= but --installed does query the repos anyway. In systems with dnf5 we fall back to dnf4 python bindings (using dnf-3) to workaround this. --- tests/broken-symlinks/main.fmf | 1 + tests/broken-symlinks/test.sh | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/broken-symlinks/main.fmf b/tests/broken-symlinks/main.fmf index 60ebba6..ddb3fe5 100644 --- a/tests/broken-symlinks/main.fmf +++ b/tests/broken-symlinks/main.fmf @@ -3,6 +3,7 @@ tier: 1 framework: beakerlib require+: - yum-utils + - python3-dnf link+: - verifies: https://issues.redhat.com/browse/RHEL-7375 diff --git a/tests/broken-symlinks/test.sh b/tests/broken-symlinks/test.sh index 677eb9e..b74d8aa 100755 --- a/tests/broken-symlinks/test.sh +++ b/tests/broken-symlinks/test.sh @@ -15,7 +15,11 @@ rlJournalStart # local rpm database instead. That should handle packages installed # using rpm, that are not in repos, and avoid timeouts if repo connection # is slow. - rlRun "dnf repoquery --installed --depends --resolve $COMPILER_RT_NVR > $tmp/dependencies.log" + # dnf5 drops support of --resolve in favor of --providers-of= + # but --installed does query the repos anyway. In systems with dnf5 we + # fall back to dnf4 python bindings (using dnf-3) to workaround this. + # Check https://src.fedoraproject.org/tests/compiler-rt/issue/16 + rlRun "dnf-3 repoquery --installed --depends --resolve $COMPILER_RT_NVR > $tmp/dependencies.log" rlPhaseEnd rlPhaseStartTest From 85fc2de3962b64fecbf60a3eaf931cd5de1ae7c0 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 5 Aug 2024 09:16:47 +0200 Subject: [PATCH 20/20] Shell static analysis Add pre-commit hook for static analysis on shell scripts (shellcheck) Fixed issues flagged by shellcheck. --- .pre-commit-config.yaml | 7 +++++++ tests/broken-symlinks/test.sh | 11 ++++++----- tests/fp16-abi/test.sh | 8 ++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e5388a6..2e27e78 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,3 +12,10 @@ repos: rev: 1.32.2 hooks: - id: tmt-lint + +- repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.10.0 + hooks: + - id: shellcheck + require_serial: true # Podman has trouble running concurrently + args: ["--exclude=SC1091"] # Ignore "Not following" sourced scripts diff --git a/tests/broken-symlinks/test.sh b/tests/broken-symlinks/test.sh index b74d8aa..be1b66c 100755 --- a/tests/broken-symlinks/test.sh +++ b/tests/broken-symlinks/test.sh @@ -4,13 +4,14 @@ rlJournalStart rlPhaseStartSetup + declare tmp rlRun "tmp=$(mktemp -d)" 0 "Create a temp dir" # Get the compiler-rt package name from the tmt required packages, which should # address the issue of getting the correct name regardless it's a compat package # or not. The package can be named either compiler-rt or compiler-rt[0-9]+ rlRun "COMPILER_RT=$(rlGetYAMLdeps | tr ' ' '\n' | grep -E "compiler-rt[[:digit:]]*$")" # Make sure to get only the main arch, so we can deal with multilib issues. - rlRun "COMPILER_RT_NVR=$(rpm -q ${COMPILER_RT} | grep $(uname -m))" + rlRun "COMPILER_RT_NVR=$(rpm -q "${COMPILER_RT}" | grep "$(uname -m)")" # Use dnf repoquery --installed so we *don't* query any repos but the # local rpm database instead. That should handle packages installed # using rpm, that are not in repos, and avoid timeouts if repo connection @@ -23,7 +24,7 @@ rlJournalStart rlPhaseEnd rlPhaseStartTest - for file in $(rpm -ql $COMPILER_RT_NVR); do + for file in $(rpm -ql "$COMPILER_RT_NVR"); do # Skip iteration if the file is not a symlink [[ -L $file ]] || continue @@ -36,13 +37,13 @@ rlJournalStart # Up to this point, the linked file exists. # If the owner of the target compiler-rt package itself that's # correct and we can skip to the next file. - target=$(readlink -f $file) - OWNER_NVR=$(rpm -qf $target) + target=$(readlink -f "$file") + OWNER_NVR=$(rpm -qf "$target") [[ "$OWNER_NVR" == "$COMPILER_RT_NVR" ]] && continue # The target exists but it's not owned by compiler-rt. It must be # owned by one of its dependencies, else flag a failure. - if ! cat $tmp/dependencies.log | grep $OWNER_NVR; then + if ! grep "$OWNER_NVR" "$tmp/dependencies.log"; then rlFail "$file pointing to $target is a dangling symlink owned by $OWNER_NVR" fi done diff --git a/tests/fp16-abi/test.sh b/tests/fp16-abi/test.sh index 35b99e8..9079123 100755 --- a/tests/fp16-abi/test.sh +++ b/tests/fp16-abi/test.sh @@ -1,15 +1,15 @@ -#!/bin/sh -ux +#!/bin/bash -ux # Do NOT set exit after error flag (set -e). Let all the optimizations to be run tmp=$(mktemp -d) result=0 # Test the reproducer with all the optimization levels for opt_level in 0 1 2 3; do - clang++ --rtlib=compiler-rt -O$opt_level test.cpp -o $tmp/test_O$opt_level - $tmp/test_O$opt_level | grep '0.122986' || result=1 + clang++ --rtlib=compiler-rt -O$opt_level test.cpp -o "${tmp}/test_O${opt_level}" + "${tmp}/test_O${opt_level}" | grep '0.122986' || result=1 done -rm -rf $tmp +rm -rf "$tmp" if [[ "$result" == 1 ]]; then exit 1 fi