From 56f24323b5c437f7dd6b0bf104f1efb422b0acf0 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 24 Sep 2019 18:47:34 +0000 Subject: [PATCH 001/178] Add README file --- README.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 README.rst diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..e69de29 From 5cd554912135a2663bae1d9ce3d1165ec4b42424 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 24 Sep 2019 18:52:54 +0000 Subject: [PATCH 002/178] Import tests from rpms/clang --- llvm-toolchain/runtest.sh | 29 +++++++++++++++++++++++++++++ rhbz_1647130/runtest.sh | 10 ++++++++++ rhbz_1657544/from_chars.cpp | 15 +++++++++++++++ rhbz_1657544/runtest.sh | 6 ++++++ tests-clang.yml | 25 +++++++++++++++++++++++++ 5 files changed, 85 insertions(+) create mode 100755 llvm-toolchain/runtest.sh create mode 100755 rhbz_1647130/runtest.sh create mode 100644 rhbz_1657544/from_chars.cpp create mode 100755 rhbz_1657544/runtest.sh create mode 100644 tests-clang.yml diff --git a/llvm-toolchain/runtest.sh b/llvm-toolchain/runtest.sh new file mode 100755 index 0000000..eeebda5 --- /dev/null +++ b/llvm-toolchain/runtest.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# Tests for using a full LLVM toolchain: clang + compiler-rt + libcxx + lld + +set -ex pipefail + +# Test compile a C program. +cat << EOF | \ + clang -fuse-ld=lld -rtlib=compiler-rt -x c - && \ + ./a.out | grep 'Hello World' + +#include +int main(int argc, char **argv) { + printf("Hello World\n"); + return 0; +} +EOF + +# Test compile a C++ program. +cat << EOF | \ + clang++ -x c++ -fuse-ld=lld -rtlib=compiler-rt -stdlib=libc++ - && \ + ./a.out | grep 'Hello World' + +#include +int main(int argc, char **argv) { + std::cout << "Hello World\n"; + return 0; +} +EOF diff --git a/rhbz_1647130/runtest.sh b/rhbz_1647130/runtest.sh new file mode 100755 index 0000000..ab515c7 --- /dev/null +++ b/rhbz_1647130/runtest.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -e +set -x + +tmp_cpp=`mktemp -t XXXXX.cpp` +tmp_dir=`mktemp -d` +echo 'int main(int argc, char*argv[]) { while(argc--) new int(); return 0; }' > $tmp_cpp +scan-build -o $tmp_dir clang++ -c $tmp_cpp -o /dev/null +(scan-view --no-browser $tmp_dir/* & WPID=$! && sleep 10s && kill $WPID) + diff --git a/rhbz_1657544/from_chars.cpp b/rhbz_1657544/from_chars.cpp new file mode 100644 index 0000000..b76be22 --- /dev/null +++ b/rhbz_1657544/from_chars.cpp @@ -0,0 +1,15 @@ +#include +#include +#include + +using namespace std; + +int main(int argc, char **argv) +{ + size_t r=0; + const char *begin = argv[1]; + const char *end = begin + strlen(begin); + from_chars(begin, end, r); + cout << r << '\n'; + return 0; +} diff --git a/rhbz_1657544/runtest.sh b/rhbz_1657544/runtest.sh new file mode 100755 index 0000000..758de0b --- /dev/null +++ b/rhbz_1657544/runtest.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +set -x + +clang++ from_chars.cpp +./a.out 100 | grep 100 diff --git a/tests-clang.yml b/tests-clang.yml new file mode 100644 index 0000000..da7beb2 --- /dev/null +++ b/tests-clang.yml @@ -0,0 +1,25 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + required_packages: + # Required for rhbz_1657544 + - clang + # Required for rhbz_1647130 + - clang-analyzer + # 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 + - glibc-devel + - gcc + tests: + - rhbz_1657544 + - rhbz_1647130 + - llvm-toolchain From 1d620dc3b09e95a81309460c29f60db3bc9a2bf5 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Thu, 13 Feb 2020 13:54:53 +0000 Subject: [PATCH 003/178] Test for rhbz#1794936 --- rhbz_1794936/runtest.sh | 6 ++++++ tests-clang.yml | 2 ++ 2 files changed, 8 insertions(+) create mode 100755 rhbz_1794936/runtest.sh diff --git a/rhbz_1794936/runtest.sh b/rhbz_1794936/runtest.sh new file mode 100755 index 0000000..33f7072 --- /dev/null +++ b/rhbz_1794936/runtest.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +set -x + +echo 'int main() { return 0; }' | clang -flto -fsanitize=cfi -fvisibility=hidden -xc - + diff --git a/tests-clang.yml b/tests-clang.yml index da7beb2..53fd139 100644 --- a/tests-clang.yml +++ b/tests-clang.yml @@ -15,6 +15,7 @@ # These are required for the llvm-toolchain test: - clang - lld + # required for rhbz_1794936 - compiler-rt - libcxx-devel - glibc-devel @@ -22,4 +23,5 @@ tests: - rhbz_1657544 - rhbz_1647130 + - rhbz_1794936 - llvm-toolchain From ac62af341a3583d7a88bca69aa072b2e88171414 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 20 Mar 2020 03:05:15 +0000 Subject: [PATCH 004/178] Add test to check that clang can find the libomp header and libraries --- libomp/openmp-compile-link-test.c | 8 ++++++++ libomp/runtest.sh | 7 +++++++ tests-libomp.yml | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 libomp/openmp-compile-link-test.c create mode 100755 libomp/runtest.sh create mode 100644 tests-libomp.yml diff --git a/libomp/openmp-compile-link-test.c b/libomp/openmp-compile-link-test.c new file mode 100644 index 0000000..a2b6004 --- /dev/null +++ b/libomp/openmp-compile-link-test.c @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char **argv) { + int nthreads = omp_get_num_threads(); + printf("Num Threads: %d\n", nthreads); + return 0; +} diff --git a/libomp/runtest.sh b/libomp/runtest.sh new file mode 100755 index 0000000..f07dbbc --- /dev/null +++ b/libomp/runtest.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -exo pipefail + +clang -fopenmp openmp-compile-link-test.c + +./a.out | grep "Num Threads: 1" diff --git a/tests-libomp.yml b/tests-libomp.yml new file mode 100644 index 0000000..17def2e --- /dev/null +++ b/tests-libomp.yml @@ -0,0 +1,19 @@ +- 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 + roles: + - role: standard-test-basic + tags: + - classic + required_packages: + - clang + tests: + - libomp From 39f92abcf48d6836b7ca6977a9e2bb9d5f71f4b2 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 29 Jul 2020 03:45:26 +0000 Subject: [PATCH 005/178] Add a test for compiling with the fedora compiler and linker flags --- fedora-flags/hello.c | 5 +++++ fedora-flags/hello.cpp | 5 +++++ fedora-flags/main.c | 6 ++++++ fedora-flags/main.cpp | 6 ++++++ fedora-flags/runtest.sh | 20 ++++++++++++++++++++ tests-clang.yml | 4 ++++ 6 files changed, 46 insertions(+) create mode 100644 fedora-flags/hello.c create mode 100644 fedora-flags/hello.cpp create mode 100644 fedora-flags/main.c create mode 100644 fedora-flags/main.cpp create mode 100755 fedora-flags/runtest.sh diff --git a/fedora-flags/hello.c b/fedora-flags/hello.c new file mode 100644 index 0000000..51b259b --- /dev/null +++ b/fedora-flags/hello.c @@ -0,0 +1,5 @@ +#include + +void hello() { + printf("Hello World\n"); +} diff --git a/fedora-flags/hello.cpp b/fedora-flags/hello.cpp new file mode 100644 index 0000000..400612b --- /dev/null +++ b/fedora-flags/hello.cpp @@ -0,0 +1,5 @@ +#include + +void hello() { + std::cout << "Hello World\n"; +} diff --git a/fedora-flags/main.c b/fedora-flags/main.c new file mode 100644 index 0000000..1a3455d --- /dev/null +++ b/fedora-flags/main.c @@ -0,0 +1,6 @@ +void hello(); + +int main(int argc, char **argv) { + hello(); + return 0; +} diff --git a/fedora-flags/main.cpp b/fedora-flags/main.cpp new file mode 100644 index 0000000..1a3455d --- /dev/null +++ b/fedora-flags/main.cpp @@ -0,0 +1,6 @@ +void hello(); + +int main(int argc, char **argv) { + hello(); + return 0; +} diff --git a/fedora-flags/runtest.sh b/fedora-flags/runtest.sh new file mode 100755 index 0000000..96d1cc8 --- /dev/null +++ b/fedora-flags/runtest.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -ex pipefail + +cflags=`rpm -D '%toolchain clang' -E %{build_cflags}` +cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}` +ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}` + + +# Test a c program +clang $cflags -c hello.c -o hello.o +clang $cflags -c main.c -o main.o +clang $ldflags -o hello main.o hello.o +./hello | grep "Hello World" + +# Test a cxx program +clang++ $cxxflags -c hello.cpp -o hello-cpp.o +clang++ $cxxflags -c main.cpp -o main-cpp.o +clang++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o +./hello-cpp | grep "Hello World" diff --git a/tests-clang.yml b/tests-clang.yml index 53fd139..a3f9353 100644 --- a/tests-clang.yml +++ b/tests-clang.yml @@ -20,8 +20,12 @@ - libcxx-devel - glibc-devel - gcc + # Required for fedora-flags: + - annobin + - redhat-rpm-config tests: - rhbz_1657544 - rhbz_1647130 - rhbz_1794936 - llvm-toolchain + - fedora-flags From c7a6ef0f245f245555bf04d0494bfeb7cbd0b757 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 28 Jan 2021 22:50:09 +0000 Subject: [PATCH 006/178] Add more toolchain tests --- tests-clang.yml | 5 ++++ toolchains/hello.c | 5 ++++ toolchains/hello.cpp | 5 ++++ toolchains/runtest.sh | 70 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 toolchains/hello.c create mode 100644 toolchains/hello.cpp create mode 100755 toolchains/runtest.sh diff --git a/tests-clang.yml b/tests-clang.yml index a3f9353..e27d3a3 100644 --- a/tests-clang.yml +++ b/tests-clang.yml @@ -23,9 +23,14 @@ # Required for fedora-flags: - annobin - redhat-rpm-config + # Required for toolchains: + - glibc-static + - libstdc++-static + - libcxx-static tests: - rhbz_1657544 - rhbz_1647130 - rhbz_1794936 - llvm-toolchain + - toolchains - fedora-flags diff --git a/toolchains/hello.c b/toolchains/hello.c new file mode 100644 index 0000000..f5c80a9 --- /dev/null +++ b/toolchains/hello.c @@ -0,0 +1,5 @@ +#include +int main(int argc, char **argv) { + printf("Hello World\n"); + return 0; +} diff --git a/toolchains/hello.cpp b/toolchains/hello.cpp new file mode 100644 index 0000000..bda4087 --- /dev/null +++ b/toolchains/hello.cpp @@ -0,0 +1,5 @@ +#include +int main(int argc, char **argv) { + std::cout << "Hello World\n"; + return 0; +} diff --git a/toolchains/runtest.sh b/toolchains/runtest.sh new file mode 100755 index 0000000..c452ddd --- /dev/null +++ b/toolchains/runtest.sh @@ -0,0 +1,70 @@ +#!/bin/sh + +set pipefail + +status=0 + +test_toolchain() { + + toolchain=$@ + args="" + + while [ $# -gt 0 ]; do + case $1 in + clang) + compiler=$1 + src=hello.c + ;; + clang++) + compiler=$1 + src=hello.cpp + ;; + compiler-rt) + args="$args -rtlib=$1" + ;; + libc++) + args="$args -stdlib=$1" + ;; + lld) + args="$args -fuse-ld=$1" + ;; + *) + args="$args $1" + ;; + esac + shift + done + + cmd="$compiler $args $src" + rm -f a.out + echo "* $toolchain" + echo " command: $cmd" + if $cmd && ./a.out | grep -q 'Hello World'; then + echo " PASS" + else + echo " FAIL" + status=1 + fi +} + +for compiler in clang clang++; do + for rtlib in "" compiler-rt; do + for linker in "" lld; do + for cxxlib in "" libc++; do + if [ "$compiler" = "clang" -a -n "$cxxlib" ]; then + continue + fi + for args in "" -static; do + # Skip known failures + # TODO: Fix these + if [[ "$args" = "-static" && ( "$rtlib" = "compiler-rt" || "$cxxlib" = "libc++" ) ]]; then + continue + fi + test_toolchain $compiler $rtlib $linker $cxxlib $args + done + done + done + done +done + +exit $status From 061565d8fdefd78309f6c5a8ddd493be8b682a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 16 Mar 2021 12:04:52 +0100 Subject: [PATCH 007/178] Enable -static libc++ toolchain tests --- tests-clang.yml | 2 ++ toolchains/runtest.sh | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests-clang.yml b/tests-clang.yml index e27d3a3..7456128 100644 --- a/tests-clang.yml +++ b/tests-clang.yml @@ -27,6 +27,8 @@ - glibc-static - libstdc++-static - libcxx-static + - libcxxabi-devel + - libcxxabi-static tests: - rhbz_1657544 - rhbz_1647130 diff --git a/toolchains/runtest.sh b/toolchains/runtest.sh index c452ddd..c928ae4 100755 --- a/toolchains/runtest.sh +++ b/toolchains/runtest.sh @@ -47,6 +47,10 @@ test_toolchain() { fi } +clang --version +dnf info installed clang | grep ^Source +echo "" + for compiler in clang clang++; do for rtlib in "" compiler-rt; do for linker in "" lld; do @@ -57,9 +61,15 @@ for compiler in clang clang++; do for args in "" -static; do # Skip known failures # TODO: Fix these - if [[ "$args" = "-static" && ( "$rtlib" = "compiler-rt" || "$cxxlib" = "libc++" ) ]]; then + if [[ "$args" = "-static" && "$rtlib" = "compiler-rt" ]]; then continue fi + + # Static libc++ needs -pthread + if [[ "$args" = "-static" && "$cxxlib" = "libc++" ]]; then + args="$args -pthread" + fi + test_toolchain $compiler $rtlib $linker $cxxlib $args done done From 59589a359907d185e46576f41d746c175f3ae086 Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Mon, 11 Jul 2022 14:58:02 +0000 Subject: [PATCH 008/178] 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..d6f5046 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# lldb + +lldb tests \ No newline at end of file From fd67fac3a6031ba3316a13c98e5169e174eaecb8 Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Mon, 11 Jul 2022 14:59:13 +0000 Subject: [PATCH 009/178] 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..5723d60 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# lld + +Tests for lld \ No newline at end of file From d4f1efb91372cf196e1a70497cb0c76fb055dff9 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 12 Jul 2022 12:27:45 +0200 Subject: [PATCH 010/178] Add license and commitment files --- COMMITMENT | 46 ++++++++ LICENSE | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 385 insertions(+) create mode 100644 COMMITMENT create mode 100644 LICENSE diff --git a/COMMITMENT b/COMMITMENT new file mode 100644 index 0000000..a687e0d --- /dev/null +++ b/COMMITMENT @@ -0,0 +1,46 @@ +GPL Cooperation Commitment +Version 1.0 + +Before filing or continuing to prosecute any legal proceeding or claim +(other than a Defensive Action) arising from termination of a Covered +License, we commit to extend to the person or entity ('you') accused +of violating the Covered License the following provisions regarding +cure and reinstatement, taken from GPL version 3. As used here, the +term 'this License' refers to the specific Covered License being +enforced. + + However, if you cease all violation of this License, then your + license from a particular copyright holder is reinstated (a) + provisionally, unless and until the copyright holder explicitly + and finally terminates your license, and (b) permanently, if the + copyright holder fails to notify you of the violation by some + reasonable means prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is + reinstated permanently if the copyright holder notifies you of the + violation by some reasonable means, this is the first time you + have received notice of violation of this License (for any work) + from that copyright holder, and you cure the violation prior to 30 + days after your receipt of the notice. + +We intend this Commitment to be irrevocable, and binding and +enforceable against us and assignees of or successors to our +copyrights. + +Definitions + +'Covered License' means the GNU General Public License, version 2 +(GPLv2), the GNU Lesser General Public License, version 2.1 +(LGPLv2.1), or the GNU Library General Public License, version 2 +(LGPLv2), all as published by the Free Software Foundation. + +'Defensive Action' means a legal proceeding or claim that We bring +against you in response to a prior proceeding or claim initiated by +you or your affiliate. + +'We' means each contributor to this repository as of the date of +inclusion of this file, including subsidiaries of a corporate +contributor. + +This work is available under a Creative Commons Attribution-ShareAlike +4.0 International license (https://creativecommons.org/licenses/by-sa/4.0/). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. From 7f8a2c14905154639cb6e7ac9b3a8dd400603208 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 12 Jul 2022 12:29:52 +0200 Subject: [PATCH 011/178] Import tests from lld dist-git --- basic/main.fmf | 23 +++++++++++++++++++++++ basic/test.sh | 3 +++ gcc-compat-basic/main.fmf | 25 +++++++++++++++++++++++++ gcc-compat-basic/test.sh | 3 +++ ld-alternative/main.fmf | 28 ++++++++++++++++++++++++++++ ld-alternative/test.sh | 30 ++++++++++++++++++++++++++++++ 6 files changed, 112 insertions(+) create mode 100644 basic/main.fmf create mode 100755 basic/test.sh create mode 100644 gcc-compat-basic/main.fmf create mode 100755 gcc-compat-basic/test.sh create mode 100644 ld-alternative/main.fmf create mode 100755 ld-alternative/test.sh diff --git a/basic/main.fmf b/basic/main.fmf new file mode 100644 index 0000000..803433c --- /dev/null +++ b/basic/main.fmf @@ -0,0 +1,23 @@ +summary: Test lld with clang +test: "$WITH_SCL ./test.sh" +require: [] +adjust: + - because: lld is not shipped for s390x and ppc64 + enabled: false + when: arch == s390x or arch == ppc64 + + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + - lld + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + - llvm-toolset-13.0-lld + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + - llvm-toolset-14.0-lld + when: "collection == llvm-toolset-14.0" diff --git a/basic/test.sh b/basic/test.sh new file mode 100755 index 0000000..2c6d046 --- /dev/null +++ b/basic/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh -eux + +echo "int main(){ return 0; }" | clang -x c -fuse-ld=lld - diff --git a/gcc-compat-basic/main.fmf b/gcc-compat-basic/main.fmf new file mode 100644 index 0000000..45ec4c8 --- /dev/null +++ b/gcc-compat-basic/main.fmf @@ -0,0 +1,25 @@ +summary: Test lld with gcc +test: "$WITH_SCL ./test.sh" +require: + - gcc +adjust: + - because: lld is not shipped for s390x and ppc64 + enabled: false + when: arch == s390x or arch == ppc64 + + - because: system gcc is too old in rhel-7 + enabled: false + when: distro <= rhel-7 + + # Common requirements when LLVM is not SCL-ized + - require+: + - lld + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-lld + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-lld + when: "collection == llvm-toolset-14.0" diff --git a/gcc-compat-basic/test.sh b/gcc-compat-basic/test.sh new file mode 100755 index 0000000..0cf9c51 --- /dev/null +++ b/gcc-compat-basic/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh -eux + +echo "int main(){ return 0; }" | gcc -x c -fuse-ld=lld - diff --git a/ld-alternative/main.fmf b/ld-alternative/main.fmf new file mode 100644 index 0000000..ae55769 --- /dev/null +++ b/ld-alternative/main.fmf @@ -0,0 +1,28 @@ +summary: Test linker switching with alternatives +test: "$WITH_SCL ./test.sh" +# This test spoils the installation by removing lld, therefore it should be marked as such. +tag: + - spoils-installation +require: + - binutils +adjust: + - because: lld is not shipped for s390x and ppc64 + enabled: false + when: arch == s390x or arch == ppc64 + + - because: lld is not installed as ld alternative in rhel < 9 + enabled: false + when: distro < rhel-9 + + # Common requirements when LLVM is not SCL-ized + - require+: + - lld + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-lld + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-lld + when: "collection == llvm-toolset-14.0" diff --git a/ld-alternative/test.sh b/ld-alternative/test.sh new file mode 100755 index 0000000..3f646bd --- /dev/null +++ b/ld-alternative/test.sh @@ -0,0 +1,30 @@ +#!/bin/sh -eux + +# This test assumes lld is already installed. + +function verify_ld_bfd { + + # Verify that /usr/bin/ld points to ld.bfd. + ls -l /etc/alternatives/ld | grep ld.bfd + + # Run ld and verify it invokes ld.bfd + /usr/bin/ld --version | grep 'GNU ld' +} + + +# Verify ld.bfd is still the system linker when lld is installed +verify_ld_bfd + +# Set lld as the system linker +update-alternatives --set ld /usr/bin/ld.lld + +# Verify that /usr/bin/ld points to lld +ls -l /etc/alternatives/ld | grep ld.lld + +# Run ld and verify it invokes lld +/usr/bin/ld --version | grep 'LLD' + +# Uninstall lld and make sure the /usr/bin/ld is reset to ld.bfd +dnf -y remove --noautoremove lld + +verify_ld_bfd From 83e10c9311c25207779f315c5af4628e7df884f6 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 12 Jul 2022 13:00:25 +0200 Subject: [PATCH 012/178] Init fmf --- .fmf/version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .fmf/version diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 From ef99cd915c054a6989a9e7b50702b78762efe718 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 12 Jul 2022 13:39:14 +0200 Subject: [PATCH 013/178] Add test plans --- build-gating-alternatives.fmf | 43 ++++++++++++++++++++++ build-gating.fmf | 67 +++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 build-gating-alternatives.fmf create mode 100644 build-gating.fmf diff --git a/build-gating-alternatives.fmf b/build-gating-alternatives.fmf new file mode 100644 index 0000000..9ca8c6d --- /dev/null +++ b/build-gating-alternatives.fmf @@ -0,0 +1,43 @@ +# +# Build/PR gating tests for LLD +# +# 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: 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 + + - because: lld is not shipped for s390x or ppc64 + enabled: false + when: arch == s390x or arch == ppc64 + + - 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: lld-tests + how: fmf + test: ld-alternative +execute: + how: tmt +provision: + hardware: + memory: ">= 4 GiB" diff --git a/build-gating.fmf b/build-gating.fmf new file mode 100644 index 0000000..ac2daa9 --- /dev/null +++ b/build-gating.fmf @@ -0,0 +1,67 @@ +# +# Build/PR gating tests for LLD +# +# 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: 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 + + - because: lld is not shipped for s390x and ppc64 + enabled: false + when: arch == s390x or arch == ppc64 + + - 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" + + # Unfortunately, TMT does not support more declarative approach, we need to run commands on our own. + - because: "On RHEL, CRB must be enabled to provide rarer packages" + prepare+: + - name: Enable CRB + how: shell + script: dnf config-manager --set-enabled beaker-CRB + when: >- + distro == rhel-9 + or distro == rhel-8 + + # Unfortunately, TMT does not support more declarative approach, we need to run commands on our own. + - because: "On CentOS, CRB must be enabled to provide rarer packages" + prepare+: + - name: Enable CRB + how: shell + script: dnf config-manager --set-enabled crb + when: >- + distro == centos + +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 +provision: + hardware: + memory: ">= 4 GiB" From d552bd3f39946bd04645d67637375d096676afab Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 12 Jul 2022 16:22:33 +0200 Subject: [PATCH 014/178] Add nitrate metadata --- basic/main.fmf | 15 ++++++++++++--- gcc-compat-basic/main.fmf | 15 ++++++++++++--- ld-alternative/main.fmf | 15 ++++++++++++--- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/basic/main.fmf b/basic/main.fmf index 803433c..b97eb59 100644 --- a/basic/main.fmf +++ b/basic/main.fmf @@ -1,6 +1,15 @@ summary: Test lld with clang test: "$WITH_SCL ./test.sh" require: [] +framework: shell +tier: 1 +component: + - llvm-toolset + - lld +extra-summary: /tools/lld/basic +extra-task: /tools/lld/basic +extra-nitrate: TC#0614058 + adjust: - because: lld is not shipped for s390x and ppc64 enabled: false @@ -10,14 +19,14 @@ adjust: - require+: - clang - lld - when: "collection is not defined" + when: collection is not defined # Requirements for SCL-ized LLVM - require+: - llvm-toolset-13.0-clang - llvm-toolset-13.0-lld - when: "collection == llvm-toolset-13.0" + when: collection == llvm-toolset-13.0 - require+: - llvm-toolset-14.0-clang - llvm-toolset-14.0-lld - when: "collection == llvm-toolset-14.0" + when: collection == llvm-toolset-14.0 diff --git a/gcc-compat-basic/main.fmf b/gcc-compat-basic/main.fmf index 45ec4c8..c964a6f 100644 --- a/gcc-compat-basic/main.fmf +++ b/gcc-compat-basic/main.fmf @@ -2,6 +2,15 @@ summary: Test lld with gcc test: "$WITH_SCL ./test.sh" require: - gcc +framework: shell +tier: 1 +component: + - llvm-toolset + - lld +extra-summary: /tools/lld/gcc-compat-basic +extra-task: /tools/lld/gcc-compat-basic +extra-nitrate: TC#0614059 + adjust: - because: lld is not shipped for s390x and ppc64 enabled: false @@ -14,12 +23,12 @@ adjust: # Common requirements when LLVM is not SCL-ized - require+: - lld - when: "collection is not defined" + when: collection is not defined # Requirements for SCL-ized LLVM - require+: - llvm-toolset-13.0-lld - when: "collection == llvm-toolset-13.0" + when: collection == llvm-toolset-13.0 - require+: - llvm-toolset-14.0-lld - when: "collection == llvm-toolset-14.0" + when: collection == llvm-toolset-14.0 diff --git a/ld-alternative/main.fmf b/ld-alternative/main.fmf index ae55769..4cdfcf7 100644 --- a/ld-alternative/main.fmf +++ b/ld-alternative/main.fmf @@ -5,6 +5,15 @@ tag: - spoils-installation require: - binutils +framework: shell +tier: 1 +component: + - llvm-toolset + - lld +extra-summary: /tools/lld/ld-alternative +extra-task: /tools/lld/ld-alternative +extra-nitrate: TC#0614060 + adjust: - because: lld is not shipped for s390x and ppc64 enabled: false @@ -17,12 +26,12 @@ adjust: # Common requirements when LLVM is not SCL-ized - require+: - lld - when: "collection is not defined" + when: collection is not defined # Requirements for SCL-ized LLVM - require+: - llvm-toolset-13.0-lld - when: "collection == llvm-toolset-13.0" + when: collection == llvm-toolset-13.0 - require+: - llvm-toolset-14.0-lld - when: "collection == llvm-toolset-14.0" + when: collection == llvm-toolset-14.0 From acfc82b3416f16fb31cfbd6a3d3540189a5ba3e8 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 12 Jul 2022 18:16:58 +0200 Subject: [PATCH 015/178] Add license files --- COMMITMENT | 46 ++++++++ LICENSE | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 385 insertions(+) create mode 100644 COMMITMENT create mode 100644 LICENSE diff --git a/COMMITMENT b/COMMITMENT new file mode 100644 index 0000000..a687e0d --- /dev/null +++ b/COMMITMENT @@ -0,0 +1,46 @@ +GPL Cooperation Commitment +Version 1.0 + +Before filing or continuing to prosecute any legal proceeding or claim +(other than a Defensive Action) arising from termination of a Covered +License, we commit to extend to the person or entity ('you') accused +of violating the Covered License the following provisions regarding +cure and reinstatement, taken from GPL version 3. As used here, the +term 'this License' refers to the specific Covered License being +enforced. + + However, if you cease all violation of this License, then your + license from a particular copyright holder is reinstated (a) + provisionally, unless and until the copyright holder explicitly + and finally terminates your license, and (b) permanently, if the + copyright holder fails to notify you of the violation by some + reasonable means prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is + reinstated permanently if the copyright holder notifies you of the + violation by some reasonable means, this is the first time you + have received notice of violation of this License (for any work) + from that copyright holder, and you cure the violation prior to 30 + days after your receipt of the notice. + +We intend this Commitment to be irrevocable, and binding and +enforceable against us and assignees of or successors to our +copyrights. + +Definitions + +'Covered License' means the GNU General Public License, version 2 +(GPLv2), the GNU Lesser General Public License, version 2.1 +(LGPLv2.1), or the GNU Library General Public License, version 2 +(LGPLv2), all as published by the Free Software Foundation. + +'Defensive Action' means a legal proceeding or claim that We bring +against you in response to a prior proceeding or claim initiated by +you or your affiliate. + +'We' means each contributor to this repository as of the date of +inclusion of this file, including subsidiaries of a corporate +contributor. + +This work is available under a Creative Commons Attribution-ShareAlike +4.0 International license (https://creativecommons.org/licenses/by-sa/4.0/). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. From 7744bcc340ecb38b174d82736ad7d619732c5989 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 13 Jul 2022 08:25:17 +0200 Subject: [PATCH 016/178] Initialize tmt --- .fmf/version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .fmf/version diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 From 8c35ab87554d703589f5ab983a47c3a1b114e820 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 13 Jul 2022 09:41:11 +0200 Subject: [PATCH 017/178] Remove remote tests from the gating plan --- build-gating.fmf | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/build-gating.fmf b/build-gating.fmf index ac2daa9..b22513f 100644 --- a/build-gating.fmf +++ b/build-gating.fmf @@ -32,34 +32,10 @@ adjust: WITH_SCL: "scl enable llvm-toolset-14.0" when: "collection == llvm-toolset-14.0" - # Unfortunately, TMT does not support more declarative approach, we need to run commands on our own. - - because: "On RHEL, CRB must be enabled to provide rarer packages" - prepare+: - - name: Enable CRB - how: shell - script: dnf config-manager --set-enabled beaker-CRB - when: >- - distro == rhel-9 - or distro == rhel-8 - - # Unfortunately, TMT does not support more declarative approach, we need to run commands on our own. - - because: "On CentOS, CRB must be enabled to provide rarer packages" - prepare+: - - name: Enable CRB - how: shell - script: dnf config-manager --set-enabled crb - when: >- - distro == centos - 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 provision: From a8cc88906ce4780137c54f4dfb9189ac66797e44 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 13 Jul 2022 09:53:06 +0200 Subject: [PATCH 018/178] Import the tests from lldb dist-git --- lldb-dwz/main.fmf | 18 ++++++++++++++++++ lldb-dwz/test.sh | 9 +++++++++ lldb-std-vector-prettyprint/main.fmf | 11 +++++++++++ lldb-std-vector-prettyprint/test.cpp | 9 +++++++++ lldb-std-vector-prettyprint/test.sh | 13 +++++++++++++ python-embedded-interpreter/main.fmf | 24 ++++++++++++++++++++++++ python-embedded-interpreter/test.cpp | 9 +++++++++ python-embedded-interpreter/test.sh | 19 +++++++++++++++++++ 8 files changed, 112 insertions(+) create mode 100644 lldb-dwz/main.fmf create mode 100755 lldb-dwz/test.sh create mode 100644 lldb-std-vector-prettyprint/main.fmf create mode 100644 lldb-std-vector-prettyprint/test.cpp create mode 100755 lldb-std-vector-prettyprint/test.sh create mode 100644 python-embedded-interpreter/main.fmf create mode 100644 python-embedded-interpreter/test.cpp create mode 100755 python-embedded-interpreter/test.sh diff --git a/lldb-dwz/main.fmf b/lldb-dwz/main.fmf new file mode 100644 index 0000000..2cbc00e --- /dev/null +++ b/lldb-dwz/main.fmf @@ -0,0 +1,18 @@ +summary: "Test that lldb doesn't crash with dwz debuginfo" +test: "$WITH_SCL ./test.sh" +require: + - coreutils-debuginfo + +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - lldb + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-lldb + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-lldb + when: "collection == llvm-toolset-14.0" diff --git a/lldb-dwz/test.sh b/lldb-dwz/test.sh new file mode 100755 index 0000000..d9f8a31 --- /dev/null +++ b/lldb-dwz/test.sh @@ -0,0 +1,9 @@ +#!/bin/sh -eux + +lldb -b -o 'b main' -o run -o c -- true 2>&1 | tee lldb.log + +# lldb should report unsupported dwarf data, yet shouldn't crash +grep "unsupported DW_FORM values" lldb.log +grep "stop reason = breakpoint" lldb.log +# Ensure the process ends successfully (no crashes) +grep -E "Process [0-9]+ exited with status = 0" lldb.log diff --git a/lldb-std-vector-prettyprint/main.fmf b/lldb-std-vector-prettyprint/main.fmf new file mode 100644 index 0000000..443022a --- /dev/null +++ b/lldb-std-vector-prettyprint/main.fmf @@ -0,0 +1,11 @@ +summary: "Test lldb std::vector pretty printer" +test: "$WITH_SCL ./test.sh" +require: + - gcc-c++ + - lldb + +adjust: + # rhbz#2077932 rhbz#2082508 + - because: "std::vector pretty printer does not work properly in RHEL<9 due to older libstdc++" + enabled: false + when: distro < rhel-9 \ No newline at end of file diff --git a/lldb-std-vector-prettyprint/test.cpp b/lldb-std-vector-prettyprint/test.cpp new file mode 100644 index 0000000..397efa4 --- /dev/null +++ b/lldb-std-vector-prettyprint/test.cpp @@ -0,0 +1,9 @@ +#include +#include +int +main () +{ + std::vector v (1, 2); + std::vector::iterator it(v.begin()); + return 0; +} diff --git a/lldb-std-vector-prettyprint/test.sh b/lldb-std-vector-prettyprint/test.sh new file mode 100755 index 0000000..c87edea --- /dev/null +++ b/lldb-std-vector-prettyprint/test.sh @@ -0,0 +1,13 @@ +#!/bin/sh -eux + +g++ -g test.cpp + +lldb -b -o 'breakpoint set --file test.cpp --line 7' -o run -o 'p v' -- a.out | tee lldb.log + +test `grep \ + -e '(std::vector >) $0 = size=1 {' \ + -e '\[0\] = 2' \ + lldb.log \ + | wc -l` -eq 2 + +rm lldb.log diff --git a/python-embedded-interpreter/main.fmf b/python-embedded-interpreter/main.fmf new file mode 100644 index 0000000..12b58fe --- /dev/null +++ b/python-embedded-interpreter/main.fmf @@ -0,0 +1,24 @@ +summary: "Test lldb embedded interpreter (rhbz#1567262)" +description: "Ensure that lldb depends on python3-lldb" +test: "$WITH_SCL ./test.sh" +require: + - gcc-c++ +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - lldb + environment+: + LLDB_PACKAGE: lldb + when: collection is not defined + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-lldb + environment+: + LLDB_PACKAGE: llvm-toolset-13.0-lldb + when: collection == llvm-toolset-13.0 + - require+: + - llvm-toolset-14.0-lldb + environment+: + LLDB_PACKAGE: llvm-toolset-14.0-lldb + when: collection == llvm-toolset-14.0 diff --git a/python-embedded-interpreter/test.cpp b/python-embedded-interpreter/test.cpp new file mode 100644 index 0000000..78427c2 --- /dev/null +++ b/python-embedded-interpreter/test.cpp @@ -0,0 +1,9 @@ +#include +#include +int +main () +{ + int i = 1; + float f = 1.0; + return 0; +} diff --git a/python-embedded-interpreter/test.sh b/python-embedded-interpreter/test.sh new file mode 100755 index 0000000..52b42e4 --- /dev/null +++ b/python-embedded-interpreter/test.sh @@ -0,0 +1,19 @@ +#!/bin/sh -eux + +# Verify the formal side of things, lldb should really depend on its Python bits. +rpm -q --requires "$LLDB_PACKAGE" | grep python3-lldb + +# Sanity test +g++ -g test.cpp + +lldb -b -o 'breakpoint set --file test.cpp --line 9' \ + -o run -o 'p i' -o 'p f'\ + -- a.out | tee lldb.log + +test `grep \ + -e '(int) $0 = 1' \ + -e '(float) $1 = 1' \ + lldb.log \ + | wc -l` -eq 2 + +rm lldb.log From 125e4514d160aaa2ef30e652a874b81dff09d71e Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 13 Jul 2022 10:05:17 +0200 Subject: [PATCH 019/178] Add nitrate metadata --- lldb-dwz/main.fmf | 14 +++++++++++--- lldb-std-vector-prettyprint/main.fmf | 10 +++++++++- python-embedded-interpreter/main.fmf | 9 +++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/lldb-dwz/main.fmf b/lldb-dwz/main.fmf index 2cbc00e..89e0bf8 100644 --- a/lldb-dwz/main.fmf +++ b/lldb-dwz/main.fmf @@ -2,17 +2,25 @@ summary: "Test that lldb doesn't crash with dwz debuginfo" test: "$WITH_SCL ./test.sh" require: - coreutils-debuginfo +framework: shell +tier: 1 +component: + - llvm-toolset + - lldb +extra-summary: /tools/lldb/lldb-dwz +extra-task: /tools/lldb/lldb-dwz +extra-nitrate: TC#0614064 adjust: # Common requirements when LLVM is not SCL-ized - require+: - lldb - when: "collection is not defined" + when: collection is not defined # Requirements for SCL-ized LLVM - require+: - llvm-toolset-13.0-lldb - when: "collection == llvm-toolset-13.0" + when: collection == llvm-toolset-13.0 - require+: - llvm-toolset-14.0-lldb - when: "collection == llvm-toolset-14.0" + when: collection == llvm-toolset-14.0 diff --git a/lldb-std-vector-prettyprint/main.fmf b/lldb-std-vector-prettyprint/main.fmf index 443022a..b1988ab 100644 --- a/lldb-std-vector-prettyprint/main.fmf +++ b/lldb-std-vector-prettyprint/main.fmf @@ -3,9 +3,17 @@ test: "$WITH_SCL ./test.sh" require: - gcc-c++ - lldb +framework: shell +tier: 1 +component: + - llvm-toolset + - lldb +extra-summary: /tools/lldb/lldb-std-vector-prettyprint +extra-task: /tools/lldb/lldb-std-vector-prettyprint +extra-nitrate: TC#0614065 adjust: # rhbz#2077932 rhbz#2082508 - because: "std::vector pretty printer does not work properly in RHEL<9 due to older libstdc++" enabled: false - when: distro < rhel-9 \ No newline at end of file + when: distro < rhel-9 diff --git a/python-embedded-interpreter/main.fmf b/python-embedded-interpreter/main.fmf index 12b58fe..dd776f4 100644 --- a/python-embedded-interpreter/main.fmf +++ b/python-embedded-interpreter/main.fmf @@ -3,6 +3,15 @@ description: "Ensure that lldb depends on python3-lldb" test: "$WITH_SCL ./test.sh" require: - gcc-c++ +framework: shell +tier: 1 +component: + - llvm-toolset + - lldb +extra-summary: /tools/lldb/python-embedded-interpreter +extra-task: /tools/lldb/python-embedded-interpreter +extra-nitrate: TC#0614066 + adjust: # Common requirements when LLVM is not SCL-ized - require+: From 2c7331307558c3f8ed2dffbceaea4fcd16a85339 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 13 Jul 2022 10:09:05 +0200 Subject: [PATCH 020/178] Add gating testplan --- build-gating.fmf | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 build-gating.fmf diff --git a/build-gating.fmf b/build-gating.fmf new file mode 100644 index 0000000..4f135da --- /dev/null +++ b/build-gating.fmf @@ -0,0 +1,38 @@ +# +# Build/PR gating tests for LLDB +# +# 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: lldb 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 rust-toolset-1.58" + 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: lldb-tests + how: fmf +execute: + how: tmt +provision: + hardware: + memory: ">= 4 GiB" From fc28d8cd091c0e64f5547d7446823353c393c99b Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 15 Jul 2022 12:30:16 +0200 Subject: [PATCH 021/178] python-embedded-interpreter: fix line breakpoint Breaking in line 9 was actually out of main() context which might cause issues. Corrected to point to line 8 --- python-embedded-interpreter/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-embedded-interpreter/test.sh b/python-embedded-interpreter/test.sh index 52b42e4..e495f58 100755 --- a/python-embedded-interpreter/test.sh +++ b/python-embedded-interpreter/test.sh @@ -6,7 +6,7 @@ rpm -q --requires "$LLDB_PACKAGE" | grep python3-lldb # Sanity test g++ -g test.cpp -lldb -b -o 'breakpoint set --file test.cpp --line 9' \ +lldb -b -o 'breakpoint set --file test.cpp --line 8' \ -o run -o 'p i' -o 'p f'\ -- a.out | tee lldb.log From 675b60ec17df5092f9551a744edb806ec0095528 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 14 Jul 2022 15:54:33 +0200 Subject: [PATCH 022/178] Import tests from rpms/clang --- .fmf/version | 1 + build-gating-libomp.fmf | 37 ++++++++++++++++ build-gating-pocl.fmf | 32 ++++++++++++++ build-gating.fmf | 63 +++++++++++++++++++++++++++ clang-format-diff/main.fmf | 15 +++++++ clang-format-diff/test.sh | 5 +++ fedora-flags/main.fmf | 30 +++++++++++++ libomp/main.fmf | 36 +++++++++++++++ llvm-test-suite/main.fmf | 18 ++++++++ llvm-test-suite/test.sh | 7 +++ llvm-toolchain/runtest.sh | 29 ------------ openmp-rpm/main.fmf | 30 +++++++++++++ openmp-rpm/runtest.sh | 6 +++ openmp-rpm/test.c | 7 +++ openmp-rpm/test.spec | 36 +++++++++++++++ pocl/main.fmf | 24 ++++++++++ pocl/test.sh | 7 +++ ppc64le-long-double/main.fmf | 33 ++++++++++++++ ppc64le-long-double/runtest-fedora.sh | 14 ++++++ ppc64le-long-double/runtest.sh | 9 ++++ rhbz_1647130/main.fmf | 19 ++++++++ rhbz_1657544/main.fmf | 16 +++++++ rhbz_1657544/runtest.sh | 4 +- rhbz_1794936/runtest.sh | 6 --- rhbz_482491/main.fmf | 17 ++++++++ rhbz_482491/test.sh | 3 ++ tests-clang.yml | 38 ---------------- tests-libomp.yml | 19 -------- toolchains/main.fmf | 55 +++++++++++++++++++++++ toolchains/runtest.sh | 28 ++++++++++-- use-dwarf4-by-default/main.fmf | 20 +++++++++ use-dwarf4-by-default/test.sh | 7 +++ 32 files changed, 573 insertions(+), 98 deletions(-) create mode 100644 .fmf/version create mode 100644 build-gating-libomp.fmf create mode 100644 build-gating-pocl.fmf create mode 100644 build-gating.fmf create mode 100644 clang-format-diff/main.fmf create mode 100755 clang-format-diff/test.sh create mode 100644 fedora-flags/main.fmf create mode 100644 libomp/main.fmf create mode 100644 llvm-test-suite/main.fmf create mode 100755 llvm-test-suite/test.sh delete mode 100755 llvm-toolchain/runtest.sh create mode 100644 openmp-rpm/main.fmf create mode 100755 openmp-rpm/runtest.sh create mode 100644 openmp-rpm/test.c create mode 100644 openmp-rpm/test.spec create mode 100644 pocl/main.fmf create mode 100755 pocl/test.sh create mode 100644 ppc64le-long-double/main.fmf create mode 100755 ppc64le-long-double/runtest-fedora.sh create mode 100755 ppc64le-long-double/runtest.sh create mode 100644 rhbz_1647130/main.fmf create mode 100644 rhbz_1657544/main.fmf delete mode 100755 rhbz_1794936/runtest.sh create mode 100644 rhbz_482491/main.fmf create mode 100755 rhbz_482491/test.sh delete mode 100644 tests-clang.yml delete mode 100644 tests-libomp.yml create mode 100644 toolchains/main.fmf create mode 100644 use-dwarf4-by-default/main.fmf create mode 100755 use-dwarf4-by-default/test.sh 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-libomp.fmf b/build-gating-libomp.fmf new file mode 100644 index 0000000..1ddd29e --- /dev/null +++ b/build-gating-libomp.fmf @@ -0,0 +1,37 @@ +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/build-gating-pocl.fmf b/build-gating-pocl.fmf new file mode 100644 index 0000000..4b74ced --- /dev/null +++ b/build-gating-pocl.fmf @@ -0,0 +1,32 @@ +summary: PoCL 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: "PoCL is shipped with Fedora, not RHEL/CentOS" + when: >- + distro == rhel + or distro == centos + enabled: false + +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" diff --git a/build-gating.fmf b/build-gating.fmf new file mode 100644 index 0000000..58b77df --- /dev/null +++ b/build-gating.fmf @@ -0,0 +1,63 @@ +# +# Build/PR gating tests for clang +# +# Compatible with various LLVM 13 distributions: +# +# * Fedora (ursine packages) +# * Centos 9 stream (ursine packages) +# * RHEL-9 (ursine packages) +# * RHEL-8 (Red Hat module) +# * RHEL-7 (software collection) +# + +summary: 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" + + # Unfortunately, TMT does not support more declarative approach, we need to run commands on our own. + - because: "On RHEL, CRB must be enabled to provide rarer packages" + prepare+: + - name: Enable CRB + how: shell + script: dnf config-manager --set-enabled rhel-CRB + when: >- + distro == rhel-9 + or distro == rhel-8 + + # Unfortunately, TMT does not support more declarative approach, we need to run commands on our own. + - because: "On CentOS, CRB must be enabled to provide rarer packages" + prepare+: + - name: Enable CRB + how: shell + script: dnf config-manager --set-enabled crb + when: >- + distro == centos + +discover: + - name: clang-tests + how: fmf + filter: "tag:-not-in-default" + - name: upstream-llvm-integration-testsuite + how: fmf + url: https://src.fedoraproject.org/rpms/llvm.git + ref: rawhide + test: integration-test-suite +execute: + how: tmt +provision: + hardware: + memory: ">= 4 GiB" diff --git a/clang-format-diff/main.fmf b/clang-format-diff/main.fmf new file mode 100644 index 0000000..06ed176 --- /dev/null +++ b/clang-format-diff/main.fmf @@ -0,0 +1,15 @@ +summary: clang-format-diff +test: "$WITH_SCL ./test.sh" +adjust: + # Common requirements when LLVM is not SCL-ized + - require: + - clang-tools-extra + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require: + - llvm-toolset-13.0-clang-tools-extra + when: "collection == llvm-toolset-13.0" + - require: + - llvm-toolset-14.0-clang-tools-extra + when: "collection == llvm-toolset-14.0" diff --git a/clang-format-diff/test.sh b/clang-format-diff/test.sh new file mode 100755 index 0000000..d6fcb47 --- /dev/null +++ b/clang-format-diff/test.sh @@ -0,0 +1,5 @@ +#!/bin/sh -eux + +# Check that clang-format-diff is in PATH. +# rhbz#1939018 +clang-format-diff -h diff --git a/fedora-flags/main.fmf b/fedora-flags/main.fmf new file mode 100644 index 0000000..945b493 --- /dev/null +++ b/fedora-flags/main.fmf @@ -0,0 +1,30 @@ +summary: fedora-flags +test: "$WITH_SCL ./runtest.sh" +require: + - redhat-rpm-config +adjust: + + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + when: "collection == llvm-toolset-14.0" + + - because: s390x does not have epel repo which is required to provide rpm macros + enabled: false + when: >- + distro == rhel-7 + and arch == s390x + + # Note: this needs epel-release repo to be available + - because: "To enable rpm macros not available by default (e.g. build_cflags), epel-rpm-macros is needed" + require+: + - epel-rpm-macros + when: distro == rhel-7 diff --git a/libomp/main.fmf b/libomp/main.fmf new file mode 100644 index 0000000..d9c5b5c --- /dev/null +++ b/libomp/main.fmf @@ -0,0 +1,36 @@ +# 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: "$WITH_SCL ./runtest.sh" +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 diff --git a/llvm-test-suite/main.fmf b/llvm-test-suite/main.fmf new file mode 100644 index 0000000..7d61dfb --- /dev/null +++ b/llvm-test-suite/main.fmf @@ -0,0 +1,18 @@ +# 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 + +adjust: + - because: "llvm-test-suite is available for Fedora, not RHEL/CentOS" + when: >- + distro == rhel + or distro == centos + enabled: false + +test: "$WITH_SCL ./test.sh" + +require: + - git + - clang + - ninja-build + - llvm-test-suite +duration: 1h diff --git a/llvm-test-suite/test.sh b/llvm-test-suite/test.sh new file mode 100755 index 0000000..85418bc --- /dev/null +++ b/llvm-test-suite/test.sh @@ -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 diff --git a/llvm-toolchain/runtest.sh b/llvm-toolchain/runtest.sh deleted file mode 100755 index eeebda5..0000000 --- a/llvm-toolchain/runtest.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -# Tests for using a full LLVM toolchain: clang + compiler-rt + libcxx + lld - -set -ex pipefail - -# Test compile a C program. -cat << EOF | \ - clang -fuse-ld=lld -rtlib=compiler-rt -x c - && \ - ./a.out | grep 'Hello World' - -#include -int main(int argc, char **argv) { - printf("Hello World\n"); - return 0; -} -EOF - -# Test compile a C++ program. -cat << EOF | \ - clang++ -x c++ -fuse-ld=lld -rtlib=compiler-rt -stdlib=libc++ - && \ - ./a.out | grep 'Hello World' - -#include -int main(int argc, char **argv) { - std::cout << "Hello World\n"; - return 0; -} -EOF diff --git a/openmp-rpm/main.fmf b/openmp-rpm/main.fmf new file mode 100644 index 0000000..2344193 --- /dev/null +++ b/openmp-rpm/main.fmf @@ -0,0 +1,30 @@ +summary: Test build a simple RPM package to ensure that -fopenmp works +test: "$WITH_SCL ./runtest.sh" +require: + - rpm-build +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/openmp-rpm/runtest.sh b/openmp-rpm/runtest.sh new file mode 100755 index 0000000..37647fe --- /dev/null +++ b/openmp-rpm/runtest.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -ex + +${BUILDDEP_CMD} -y test.spec +rpmbuild --define '_sourcedir .' --define '_builddir .' -bb test.spec diff --git a/openmp-rpm/test.c b/openmp-rpm/test.c new file mode 100644 index 0000000..b20d164 --- /dev/null +++ b/openmp-rpm/test.c @@ -0,0 +1,7 @@ +int main(int argc, char **argv) { + int res = 1; +#pragma omp parallel +#pragma omp single + res = 0; + return res; +} diff --git a/openmp-rpm/test.spec b/openmp-rpm/test.spec new file mode 100644 index 0000000..e317a6a --- /dev/null +++ b/openmp-rpm/test.spec @@ -0,0 +1,36 @@ +%global toolchain clang +%{?scl:%global scl_prefix %{scl}-} + +Name: test +Version: 1 +Release: 1 +Summary: Test package for checking that RPM packages using -fopenmp build correctly +License: MIT + +BuildRequires: %{?scl_prefix}clang +BuildRequires: %{?scl_prefix}libomp + +Source0: test.c + +%description +clang was adding RUNPATH to binaries that use OpenMP, and since RUNPATH +is prohibited in Fedora builds, this was causing packages using clang +and OpenMP to fail to build. + +References: +https://fedoraproject.org/wiki/Changes/Broken_RPATH_will_fail_rpmbuild +https://github.com/llvm/llvm-project/commit/9b9d08111b618d74574ba03e5cc3d752ecc56f55 + +%build +clang ${CFLAGS} -c %{SOURCE0} -o test.o +clang ${LDFLAGS} -fopenmp test.o -o main + +%check +./main + +%install +install -d %{buildroot}%{_bindir} +install main %{buildroot}%{_bindir} + +%files +%{_bindir}/main diff --git a/pocl/main.fmf b/pocl/main.fmf new file mode 100644 index 0000000..1143416 --- /dev/null +++ b/pocl/main.fmf @@ -0,0 +1,24 @@ +# 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 + +adjust: + - because: "PoCL is shipped with Fedora, not RHEL/CentOS" + when: >- + distro == rhel + or distro == centos + enabled: false + +# 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: "$WITH_SCL ./test.sh" +require: + - git + - ocl-icd-devel + - pocl + - gcc diff --git a/pocl/test.sh b/pocl/test.sh new file mode 100755 index 0000000..fd9f92b --- /dev/null +++ b/pocl/test.sh @@ -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 diff --git a/ppc64le-long-double/main.fmf b/ppc64le-long-double/main.fmf new file mode 100644 index 0000000..70cb665 --- /dev/null +++ b/ppc64le-long-double/main.fmf @@ -0,0 +1,33 @@ +summary: Test that gcc and clang use the same long double format on ppc64le +test: $WITH_SCL ./runtest.sh +duration: 1h +# see https://bugzilla.redhat.com/show_bug.cgi?id=2100546 +enabled: false +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + when: "collection is not defined" + + - because: "Fedora CI runs in x86_64 only, emulate with qemu and mock" + require+: + - qemu-user-static + - mock + test: ./runtest-fedora.sh + when: distro == fedora and arch == x86_64 + continue: false + + - enabled: false + when: arch != ppc64le + + - require+: + - gcc + when: distro != fedora + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + when: "collection == llvm-toolset-14.0" diff --git a/ppc64le-long-double/runtest-fedora.sh b/ppc64le-long-double/runtest-fedora.sh new file mode 100755 index 0000000..25dbb9c --- /dev/null +++ b/ppc64le-long-double/runtest-fedora.sh @@ -0,0 +1,14 @@ +set -e + +fedora_release=`rpm -E %{fedora}` +mock_root=fedora-$fedora_release-ppc64le +triple=ppc64le-redhat-linux + +mock -r $mock_root --isolation=simple --install gcc +gcc_output=$(mock -r $mock_root --isolation=simple -q --shell gcc -E -dM -x c /dev/null | grep -e __LONG_DOUBLE_IEEE128__ -e __LONG_DOUBLE_IBM128__) +clang_output=$(clang -target $triple -E -dM -x c /dev/null | grep -e __LONG_DOUBLE_IEEE128__ -e __LONG_DOUBLE_IBM128__) + +echo "gcc: $gcc_output" +echo "clang: $clang_output" + +test "$gcc_output" = "$clang_output" diff --git a/ppc64le-long-double/runtest.sh b/ppc64le-long-double/runtest.sh new file mode 100755 index 0000000..8061bd7 --- /dev/null +++ b/ppc64le-long-double/runtest.sh @@ -0,0 +1,9 @@ +set -e + +gcc_output=$(gcc -E -dM -x c /dev/null | grep -e __LONG_DOUBLE_IEEE128__ -e __LONG_DOUBLE_IBM128__) +clang_output=$(clang -E -dM -x c /dev/null | grep -e __LONG_DOUBLE_IEEE128__ -e __LONG_DOUBLE_IBM128__) + +echo "gcc: $gcc_output" +echo "clang: $clang_output" + +test "$gcc_output" = "$clang_output" diff --git a/rhbz_1647130/main.fmf b/rhbz_1647130/main.fmf new file mode 100644 index 0000000..bcc8565 --- /dev/null +++ b/rhbz_1647130/main.fmf @@ -0,0 +1,19 @@ +summary: RHBZ1647130 +test: "$WITH_SCL ./runtest.sh" +require: [] +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + - clang-analyzer + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + - llvm-toolset-13.0-clang-analyzer + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + - llvm-toolset-14.0-clang-analyzer + when: "collection == llvm-toolset-14.0" \ No newline at end of file diff --git a/rhbz_1657544/main.fmf b/rhbz_1657544/main.fmf new file mode 100644 index 0000000..5849a70 --- /dev/null +++ b/rhbz_1657544/main.fmf @@ -0,0 +1,16 @@ +summary: RHBZ1657544 +test: "$WITH_SCL ./runtest.sh" +require: [] +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + when: "collection == llvm-toolset-14.0" diff --git a/rhbz_1657544/runtest.sh b/rhbz_1657544/runtest.sh index 758de0b..58c088f 100755 --- a/rhbz_1657544/runtest.sh +++ b/rhbz_1657544/runtest.sh @@ -1,6 +1,4 @@ -#!/bin/sh -set -e -set -x +#!/bin/sh -eux clang++ from_chars.cpp ./a.out 100 | grep 100 diff --git a/rhbz_1794936/runtest.sh b/rhbz_1794936/runtest.sh deleted file mode 100755 index 33f7072..0000000 --- a/rhbz_1794936/runtest.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -set -e -set -x - -echo 'int main() { return 0; }' | clang -flto -fsanitize=cfi -fvisibility=hidden -xc - - diff --git a/rhbz_482491/main.fmf b/rhbz_482491/main.fmf new file mode 100644 index 0000000..f0929e9 --- /dev/null +++ b/rhbz_482491/main.fmf @@ -0,0 +1,17 @@ +summary: rhbz-482491 +test: "$WITH_SCL ./test.sh" +require: + - libgcc +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + when: "collection == llvm-toolset-14.0" \ No newline at end of file diff --git a/rhbz_482491/test.sh b/rhbz_482491/test.sh new file mode 100755 index 0000000..2360238 --- /dev/null +++ b/rhbz_482491/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh -eux + +find /usr -name 'libgcc_s.so*' && echo "int main(){}" | clang -v -x c - diff --git a/tests-clang.yml b/tests-clang.yml deleted file mode 100644 index 7456128..0000000 --- a/tests-clang.yml +++ /dev/null @@ -1,38 +0,0 @@ -- hosts: localhost - roles: - - role: standard-test-basic - tags: - - classic - required_packages: - # Required for rhbz_1657544 - - clang - # Required for rhbz_1647130 - - clang-analyzer - # 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 - # required for rhbz_1794936 - - compiler-rt - - libcxx-devel - - glibc-devel - - gcc - # Required for fedora-flags: - - annobin - - redhat-rpm-config - # Required for toolchains: - - glibc-static - - libstdc++-static - - libcxx-static - - libcxxabi-devel - - libcxxabi-static - tests: - - rhbz_1657544 - - rhbz_1647130 - - rhbz_1794936 - - llvm-toolchain - - toolchains - - fedora-flags diff --git a/tests-libomp.yml b/tests-libomp.yml deleted file mode 100644 index 17def2e..0000000 --- a/tests-libomp.yml +++ /dev/null @@ -1,19 +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 - roles: - - role: standard-test-basic - tags: - - classic - required_packages: - - clang - tests: - - libomp diff --git a/toolchains/main.fmf b/toolchains/main.fmf new file mode 100644 index 0000000..9edf27f --- /dev/null +++ b/toolchains/main.fmf @@ -0,0 +1,55 @@ +# TODO REVIEW: better summary +summary: "" +test: "$WITH_SCL ./runtest.sh" +require: + - glibc-static + - yum-utils + # This require EPEL/CRB to be enabled on RHEL + - libstdc++-static +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + - compiler-rt + - lld + 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-lld + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + - llvm-toolset-14.0-compiler-rt + - llvm-toolset-14.0-lld + when: "collection == llvm-toolset-14.0" + + # lld not supported in s390x or ppc64. If any lld package was added to + # requirements, remove it. + - require-: + - lld + - llvm-toolset-13.0-lld + - llvm-toolset-14.0-lld + when: arch == s390x or arch == ppc64 + + - environment+: + CXXLIBS: "libc++" + require+: + - libcxx-devel + - libcxx-static + when: "distro == fedora" + because: testing against libcxx package in Fedora + + - environment+: + CXXLIBS: "libstdc++" + require+: + - libstdc++ + when: >- + distro == rhel + or distro == centos + because: testing against libstdc++ package in RHEL as libcxx is not shipped with RHEL + +# 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. diff --git a/toolchains/runtest.sh b/toolchains/runtest.sh index c928ae4..65594e6 100755 --- a/toolchains/runtest.sh +++ b/toolchains/runtest.sh @@ -1,7 +1,13 @@ -#!/bin/sh +#!/bin/sh -eux set pipefail +if [ -z "${CXXLIBS:-}" ]; then + echo "CXXLIBS variable is a required input but it's not specified!" + echo "Test metadata should have picked a proper value, depending on distro." + exit 1 +fi + status=0 test_toolchain() { @@ -25,6 +31,9 @@ test_toolchain() { libc++) args="$args -stdlib=$1" ;; + libstdc++) + args="$args -stdlib=$1" + ;; lld) args="$args -fuse-ld=$1" ;; @@ -48,13 +57,14 @@ test_toolchain() { } clang --version -dnf info installed clang | grep ^Source +# Repoquery is needed instead yum info for compatibility with RHEL-7 +repoquery -i --installed $(rpm -qf $(which clang)) | grep ^Source echo "" for compiler in clang clang++; do for rtlib in "" compiler-rt; do for linker in "" lld; do - for cxxlib in "" libc++; do + for cxxlib in "" $CXXLIBS; do if [ "$compiler" = "clang" -a -n "$cxxlib" ]; then continue fi @@ -70,6 +80,18 @@ for compiler in clang clang++; do args="$args -pthread" fi + # lld is not supported in s390x and ppc64 + if [[ "$(uname -m)" = "s390x" || "$(uname -m)" = "ppc64" ]] \ + && [[ "$linker" = "lld" ]]; + then + continue + fi + + # compiler-rt does not provide builtins for s390x + if [[ "$(uname -m)" = "s390x" && "$rtlib" = "compiler-rt" ]]; then + continue + fi + test_toolchain $compiler $rtlib $linker $cxxlib $args done done diff --git a/use-dwarf4-by-default/main.fmf b/use-dwarf4-by-default/main.fmf new file mode 100644 index 0000000..3151d7e --- /dev/null +++ b/use-dwarf4-by-default/main.fmf @@ -0,0 +1,20 @@ +summary: Test that clang uses DWARFv4 by default +test: "$WITH_SCL ./test.sh" +require: + - libgcc +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + - llvm + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + - llvm-toolset-13.0-llvm + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + - llvm-toolset-14.0-llvm + when: "collection == llvm-toolset-14.0" diff --git a/use-dwarf4-by-default/test.sh b/use-dwarf4-by-default/test.sh new file mode 100755 index 0000000..5da8196 --- /dev/null +++ b/use-dwarf4-by-default/test.sh @@ -0,0 +1,7 @@ +#!/bin/sh -eux + +echo "int main(){ return 0; }" | clang -g -v -x c - 2> build.log +# Make sure that clang is using the expected flag to use DWARF 4 +grep -q "\-dwarf-version=4" build.log +# Inspect the binary to double check expected DWARF version +llvm-dwarfdump a.out | grep -i version | grep 0x0004 From ab3d3a4e21666ff6ba4ad500757351a8932cb22c Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 19 Jul 2022 16:09:46 +0200 Subject: [PATCH 023/178] Add nitrate metadata --- clang-format-diff/main.fmf | 9 +++++++++ fedora-flags/main.fmf | 9 +++++++++ libomp/main.fmf | 9 +++++++++ openmp-rpm/main.fmf | 11 ++++++++++- ppc64le-long-double/main.fmf | 9 +++++++++ rhbz_1647130/main.fmf | 11 ++++++++++- rhbz_1657544/main.fmf | 9 +++++++++ rhbz_482491/main.fmf | 11 ++++++++++- toolchains/main.fmf | 9 +++++++++ use-dwarf4-by-default/main.fmf | 9 +++++++++ 10 files changed, 93 insertions(+), 3 deletions(-) diff --git a/clang-format-diff/main.fmf b/clang-format-diff/main.fmf index 06ed176..474f375 100644 --- a/clang-format-diff/main.fmf +++ b/clang-format-diff/main.fmf @@ -1,5 +1,14 @@ summary: clang-format-diff test: "$WITH_SCL ./test.sh" +framework: shell +tier: 1 +component: + - llvm-toolset + - clang +extra-summary: /tools/clang/clang-format-diff +extra-task: /tools/clang/clang-format-diff +extra-nitrate: TC#0614126 + adjust: # Common requirements when LLVM is not SCL-ized - require: diff --git a/fedora-flags/main.fmf b/fedora-flags/main.fmf index 945b493..552687a 100644 --- a/fedora-flags/main.fmf +++ b/fedora-flags/main.fmf @@ -2,6 +2,15 @@ summary: fedora-flags test: "$WITH_SCL ./runtest.sh" require: - redhat-rpm-config +framework: shell +tier: 1 +component: + - llvm-toolset + - clang +extra-summary: /tools/clang/fedora-flags +extra-task: /tools/clang/fedora-flags +extra-nitrate: TC#0614127 + adjust: # Common requirements when LLVM is not SCL-ized diff --git a/libomp/main.fmf b/libomp/main.fmf index d9c5b5c..a7b414e 100644 --- a/libomp/main.fmf +++ b/libomp/main.fmf @@ -8,6 +8,15 @@ summary: libomp tests tag: - not-in-default test: "$WITH_SCL ./runtest.sh" +framework: shell +tier: 1 +component: + - llvm-toolset + - clang +extra-summary: /tools/clang/libomp +extra-task: /tools/clang/libomp +extra-nitrate: TC#0614137 + adjust: - because: "libomp is not supported in s390x" when: arch == s390x diff --git a/openmp-rpm/main.fmf b/openmp-rpm/main.fmf index 2344193..11c2906 100644 --- a/openmp-rpm/main.fmf +++ b/openmp-rpm/main.fmf @@ -2,6 +2,15 @@ summary: Test build a simple RPM package to ensure that -fopenmp works test: "$WITH_SCL ./runtest.sh" require: - rpm-build +framework: shell +tier: 1 +component: + - llvm-toolset + - clang +extra-summary: /tools/clang/openmp-rpm +extra-task: /tools/clang/openmp-rpm +extra-nitrate: TC#0614128 + adjust: - because: "libomp not supported in s390x" when: arch == s390x @@ -27,4 +36,4 @@ adjust: when: "collection == llvm-toolset-13.0" - require+: - llvm-toolset-14.0-build - when: "collection == llvm-toolset-14.0" \ No newline at end of file + when: "collection == llvm-toolset-14.0" diff --git a/ppc64le-long-double/main.fmf b/ppc64le-long-double/main.fmf index 70cb665..f7e596b 100644 --- a/ppc64le-long-double/main.fmf +++ b/ppc64le-long-double/main.fmf @@ -3,6 +3,15 @@ test: $WITH_SCL ./runtest.sh duration: 1h # see https://bugzilla.redhat.com/show_bug.cgi?id=2100546 enabled: false +framework: shell +tier: 1 +component: + - llvm-toolset + - clang +extra-summary: /tools/clang/ppc64le-long-double +extra-task: /tools/clang/ppc64le-long-double +extra-nitrate: TC#0614129 + adjust: # Common requirements when LLVM is not SCL-ized - require+: diff --git a/rhbz_1647130/main.fmf b/rhbz_1647130/main.fmf index bcc8565..27e91d0 100644 --- a/rhbz_1647130/main.fmf +++ b/rhbz_1647130/main.fmf @@ -1,6 +1,15 @@ summary: RHBZ1647130 test: "$WITH_SCL ./runtest.sh" require: [] +framework: shell +tier: 1 +component: + - llvm-toolset + - clang +extra-summary: /tools/clang/rhbz_167130 +extra-task: /tools/clang/rhbz_167130 +extra-nitrate: TC#0614130 + adjust: # Common requirements when LLVM is not SCL-ized - require+: @@ -16,4 +25,4 @@ adjust: - require+: - llvm-toolset-14.0-clang - llvm-toolset-14.0-clang-analyzer - when: "collection == llvm-toolset-14.0" \ No newline at end of file + when: "collection == llvm-toolset-14.0" diff --git a/rhbz_1657544/main.fmf b/rhbz_1657544/main.fmf index 5849a70..485b498 100644 --- a/rhbz_1657544/main.fmf +++ b/rhbz_1657544/main.fmf @@ -1,6 +1,15 @@ summary: RHBZ1657544 test: "$WITH_SCL ./runtest.sh" require: [] +framework: shell +tier: 1 +component: + - llvm-toolset + - clang +extra-summary: /tools/clang/rhbz_165744 +extra-task: /tools/clang/rhbz_165744 +extra-nitrate: TC#0614131 + adjust: # Common requirements when LLVM is not SCL-ized - require+: diff --git a/rhbz_482491/main.fmf b/rhbz_482491/main.fmf index f0929e9..4b83da6 100644 --- a/rhbz_482491/main.fmf +++ b/rhbz_482491/main.fmf @@ -2,6 +2,15 @@ summary: rhbz-482491 test: "$WITH_SCL ./test.sh" require: - libgcc +framework: shell +tier: 1 +component: + - llvm-toolset + - clang +extra-summary: /tools/clang/rhbz_482194 +extra-task: /tools/clang/rhbz_482194 +extra-nitrate: TC#0614132 + adjust: # Common requirements when LLVM is not SCL-ized - require+: @@ -14,4 +23,4 @@ adjust: when: "collection == llvm-toolset-13.0" - require+: - llvm-toolset-14.0-clang - when: "collection == llvm-toolset-14.0" \ No newline at end of file + when: "collection == llvm-toolset-14.0" diff --git a/toolchains/main.fmf b/toolchains/main.fmf index 9edf27f..0709ba3 100644 --- a/toolchains/main.fmf +++ b/toolchains/main.fmf @@ -6,6 +6,15 @@ require: - yum-utils # This require EPEL/CRB to be enabled on RHEL - libstdc++-static +framework: shell +tier: 1 +component: + - llvm-toolset + - clang +extra-summary: /tools/clang/toolchains +extra-task: /tools/clang/toolchains +extra-nitrate: TC#0614133 + adjust: # Common requirements when LLVM is not SCL-ized - require+: diff --git a/use-dwarf4-by-default/main.fmf b/use-dwarf4-by-default/main.fmf index 3151d7e..e0d4749 100644 --- a/use-dwarf4-by-default/main.fmf +++ b/use-dwarf4-by-default/main.fmf @@ -2,6 +2,15 @@ summary: Test that clang uses DWARFv4 by default test: "$WITH_SCL ./test.sh" require: - libgcc +framework: shell +tier: 1 +component: + - llvm-toolset + - clang +extra-summary: /tools/clang/use-dwarf4-by-default +extra-task: /tools/clang/use-dwarf4-by-default +extra-nitrate: TC#0614134 + adjust: # Common requirements when LLVM is not SCL-ized - require+: From 35ad3c3dc8f1d04448ec1dfc2d5835484464c465 Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Mon, 22 Aug 2022 13:28:38 +0000 Subject: [PATCH 024/178] 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 7b73875f869e8895d95d39d1b4fc80a3a5406806 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 22 Aug 2022 16:29:07 +0200 Subject: [PATCH 025/178] Pull llvm-integration-testsuite from llvm tests repo instead dist-git --- build-gating.fmf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-gating.fmf b/build-gating.fmf index 58b77df..d13dc0e 100644 --- a/build-gating.fmf +++ b/build-gating.fmf @@ -53,8 +53,8 @@ discover: filter: "tag:-not-in-default" - name: upstream-llvm-integration-testsuite how: fmf - url: https://src.fedoraproject.org/rpms/llvm.git - ref: rawhide + url: https://src.fedoraproject.org/tests/llvm.git + ref: main test: integration-test-suite execute: how: tmt From 208cf98117f4298174367aa692657e81fead99df Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 22 Aug 2022 18:53:15 +0200 Subject: [PATCH 026/178] lldb-dwz: use a reproducible test This test used /usr/bin/true to check that lldb doesn't crash with DW_FORM values 0x1f20 and 0x1f21, but this is not happening in all distros. Also there's no way to guarantee that it will stay this way in future distros as well. Replaced with a a reproducible test that generates debug info with the required DW_FORM values --- lldb-dwz/hello.c | 6 ++++++ lldb-dwz/main.fmf | 3 ++- lldb-dwz/test.sh | 9 +++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 lldb-dwz/hello.c diff --git a/lldb-dwz/hello.c b/lldb-dwz/hello.c new file mode 100644 index 0000000..7d2a65e --- /dev/null +++ b/lldb-dwz/hello.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + printf("hello!\n"); + return 0; +} diff --git a/lldb-dwz/main.fmf b/lldb-dwz/main.fmf index 89e0bf8..e2a10dc 100644 --- a/lldb-dwz/main.fmf +++ b/lldb-dwz/main.fmf @@ -1,7 +1,8 @@ summary: "Test that lldb doesn't crash with dwz debuginfo" test: "$WITH_SCL ./test.sh" require: - - coreutils-debuginfo + - gcc + - dwz framework: shell tier: 1 component: diff --git a/lldb-dwz/test.sh b/lldb-dwz/test.sh index d9f8a31..0050155 100755 --- a/lldb-dwz/test.sh +++ b/lldb-dwz/test.sh @@ -1,8 +1,13 @@ #!/bin/sh -eux -lldb -b -o 'b main' -o run -o c -- true 2>&1 | tee lldb.log +gcc -gdwarf-4 -o hello1 hello.c +# Copy the binary so we can create a common file for duplicated debuginfo +cp hello1 hello2 +# dwz overwrites the binaries +dwz hello1 hello2 -m hello.common +lldb -b -o 'b main' -o 'run --usage' -o c -- hello1 2>&1 | tee lldb.log -# lldb should report unsupported dwarf data, yet shouldn't crash +# lldb should report "unsupported DW_FORM values: 0x1f20 0x1f21", yet shouldn't crash grep "unsupported DW_FORM values" lldb.log grep "stop reason = breakpoint" lldb.log # Ensure the process ends successfully (no crashes) From ec1522e35f9fad8ae70ef790ce1f0be4f6dcb08c Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 23 Aug 2022 13:43:18 +0200 Subject: [PATCH 027/178] 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 028/178] 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 24ce28afab31f8edb20a382b3c9a868188446a08 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 30 Aug 2022 11:01:15 +0200 Subject: [PATCH 029/178] libomp: Refactor the test to make it suitable for the general testplan Added checks to ensure that the versions of clang and libomp match Test no longer requires removing packages to work. --- build-gating-libomp.fmf | 37 ----------------------------------- libomp/main.fmf | 43 +++++++++++++---------------------------- libomp/runtest.sh | 15 ++++++++++++++ 3 files changed, 28 insertions(+), 67 deletions(-) delete mode 100644 build-gating-libomp.fmf 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" From af3dcbf8a1d75c6a9c649012d97ab1e75486ba09 Mon Sep 17 00:00:00 2001 From: Edjunior Machado Date: Thu, 29 Sep 2022 10:25:03 +0200 Subject: [PATCH 030/178] Add llvm-toolset-15.0 --- build-gating.fmf | 4 ++++ lldb-dwz/main.fmf | 3 +++ python-embedded-interpreter/main.fmf | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/build-gating.fmf b/build-gating.fmf index 4f135da..e3a6bcf 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: lldb-tests diff --git a/lldb-dwz/main.fmf b/lldb-dwz/main.fmf index e2a10dc..3892b15 100644 --- a/lldb-dwz/main.fmf +++ b/lldb-dwz/main.fmf @@ -25,3 +25,6 @@ adjust: - require+: - llvm-toolset-14.0-lldb when: collection == llvm-toolset-14.0 + - require+: + - llvm-toolset-15.0-lldb + when: collection == llvm-toolset-15.0 diff --git a/python-embedded-interpreter/main.fmf b/python-embedded-interpreter/main.fmf index dd776f4..97c9dfa 100644 --- a/python-embedded-interpreter/main.fmf +++ b/python-embedded-interpreter/main.fmf @@ -31,3 +31,8 @@ adjust: environment+: LLDB_PACKAGE: llvm-toolset-14.0-lldb when: collection == llvm-toolset-14.0 + - require+: + - llvm-toolset-15.0-lldb + environment+: + LLDB_PACKAGE: llvm-toolset-15.0-lldb + when: collection == llvm-toolset-15.0 From af1b18575497745c281272a9d053044d4de52c3a Mon Sep 17 00:00:00 2001 From: Edjunior Machado Date: Fri, 30 Sep 2022 12:51:57 +0200 Subject: [PATCH 031/178] Add llvm-toolset-15.0 --- build-gating.fmf | 4 ++++ clang-format-diff/main.fmf | 3 +++ fedora-flags/main.fmf | 3 +++ openmp-rpm/main.fmf | 3 +++ ppc64le-long-double/main.fmf | 3 +++ rhbz_1647130/main.fmf | 4 ++++ rhbz_1657544/main.fmf | 3 +++ rhbz_482491/main.fmf | 3 +++ toolchains/main.fmf | 6 ++++++ use-dwarf4-by-default/main.fmf | 4 ++++ 10 files changed, 36 insertions(+) diff --git a/build-gating.fmf b/build-gating.fmf index d13dc0e..c75fa5d 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" # Unfortunately, TMT does not support more declarative approach, we need to run commands on our own. - because: "On RHEL, CRB must be enabled to provide rarer packages" diff --git a/clang-format-diff/main.fmf b/clang-format-diff/main.fmf index 474f375..15f4b9f 100644 --- a/clang-format-diff/main.fmf +++ b/clang-format-diff/main.fmf @@ -22,3 +22,6 @@ adjust: - require: - llvm-toolset-14.0-clang-tools-extra when: "collection == llvm-toolset-14.0" + - require: + - llvm-toolset-15.0-clang-tools-extra + when: "collection == llvm-toolset-15.0" diff --git a/fedora-flags/main.fmf b/fedora-flags/main.fmf index 552687a..f2ce847 100644 --- a/fedora-flags/main.fmf +++ b/fedora-flags/main.fmf @@ -25,6 +25,9 @@ adjust: - require+: - llvm-toolset-14.0-clang when: "collection == llvm-toolset-14.0" + - require+: + - llvm-toolset-15.0-clang + when: "collection == llvm-toolset-15.0" - because: s390x does not have epel repo which is required to provide rpm macros enabled: false diff --git a/openmp-rpm/main.fmf b/openmp-rpm/main.fmf index 11c2906..df4fc35 100644 --- a/openmp-rpm/main.fmf +++ b/openmp-rpm/main.fmf @@ -37,3 +37,6 @@ adjust: - require+: - llvm-toolset-14.0-build when: "collection == llvm-toolset-14.0" + - require+: + - llvm-toolset-15.0-build + when: "collection == llvm-toolset-15.0" diff --git a/ppc64le-long-double/main.fmf b/ppc64le-long-double/main.fmf index f7e596b..cadaa7f 100644 --- a/ppc64le-long-double/main.fmf +++ b/ppc64le-long-double/main.fmf @@ -40,3 +40,6 @@ adjust: - require+: - llvm-toolset-14.0-clang when: "collection == llvm-toolset-14.0" + - require+: + - llvm-toolset-15.0-clang + when: "collection == llvm-toolset-15.0" diff --git a/rhbz_1647130/main.fmf b/rhbz_1647130/main.fmf index 27e91d0..ea2d70d 100644 --- a/rhbz_1647130/main.fmf +++ b/rhbz_1647130/main.fmf @@ -26,3 +26,7 @@ adjust: - llvm-toolset-14.0-clang - llvm-toolset-14.0-clang-analyzer when: "collection == llvm-toolset-14.0" + - require+: + - llvm-toolset-15.0-clang + - llvm-toolset-15.0-clang-analyzer + when: "collection == llvm-toolset-15.0" diff --git a/rhbz_1657544/main.fmf b/rhbz_1657544/main.fmf index 485b498..0b6ab59 100644 --- a/rhbz_1657544/main.fmf +++ b/rhbz_1657544/main.fmf @@ -23,3 +23,6 @@ adjust: - require+: - llvm-toolset-14.0-clang when: "collection == llvm-toolset-14.0" + - require+: + - llvm-toolset-15.0-clang + when: "collection == llvm-toolset-15.0" diff --git a/rhbz_482491/main.fmf b/rhbz_482491/main.fmf index 4b83da6..7be4913 100644 --- a/rhbz_482491/main.fmf +++ b/rhbz_482491/main.fmf @@ -24,3 +24,6 @@ adjust: - require+: - llvm-toolset-14.0-clang when: "collection == llvm-toolset-14.0" + - require+: + - llvm-toolset-15.0-clang + when: "collection == llvm-toolset-15.0" diff --git a/toolchains/main.fmf b/toolchains/main.fmf index 0709ba3..b527e5c 100644 --- a/toolchains/main.fmf +++ b/toolchains/main.fmf @@ -34,6 +34,11 @@ adjust: - llvm-toolset-14.0-compiler-rt - llvm-toolset-14.0-lld when: "collection == llvm-toolset-14.0" + - require+: + - llvm-toolset-15.0-clang + - llvm-toolset-15.0-compiler-rt + - llvm-toolset-15.0-lld + when: "collection == llvm-toolset-15.0" # lld not supported in s390x or ppc64. If any lld package was added to # requirements, remove it. @@ -41,6 +46,7 @@ adjust: - lld - llvm-toolset-13.0-lld - llvm-toolset-14.0-lld + - llvm-toolset-15.0-lld when: arch == s390x or arch == ppc64 - environment+: diff --git a/use-dwarf4-by-default/main.fmf b/use-dwarf4-by-default/main.fmf index e0d4749..3e54df0 100644 --- a/use-dwarf4-by-default/main.fmf +++ b/use-dwarf4-by-default/main.fmf @@ -27,3 +27,7 @@ adjust: - llvm-toolset-14.0-clang - llvm-toolset-14.0-llvm when: "collection == llvm-toolset-14.0" + - require+: + - llvm-toolset-15.0-clang + - llvm-toolset-15.0-llvm + when: "collection == llvm-toolset-15.0" From 3270f811eebd1267d8fac0ca84ded6eeb018eefc Mon Sep 17 00:00:00 2001 From: Edjunior Machado Date: Fri, 30 Sep 2022 13:06:34 +0200 Subject: [PATCH 032/178] Add llvm-toolset-15.0 --- basic/main.fmf | 4 ++++ build-gating-alternatives.fmf | 4 ++++ build-gating.fmf | 4 ++++ gcc-compat-basic/main.fmf | 3 +++ ld-alternative/main.fmf | 3 +++ 5 files changed, 18 insertions(+) diff --git a/basic/main.fmf b/basic/main.fmf index b97eb59..f4d96e0 100644 --- a/basic/main.fmf +++ b/basic/main.fmf @@ -30,3 +30,7 @@ adjust: - llvm-toolset-14.0-clang - llvm-toolset-14.0-lld when: collection == llvm-toolset-14.0 + - require+: + - llvm-toolset-15.0-clang + - llvm-toolset-15.0-lld + when: collection == llvm-toolset-15.0 diff --git a/build-gating-alternatives.fmf b/build-gating-alternatives.fmf index 9ca8c6d..0d52a79 100644 --- a/build-gating-alternatives.fmf +++ b/build-gating-alternatives.fmf @@ -31,6 +31,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: lld-tests diff --git a/build-gating.fmf b/build-gating.fmf index b22513f..e67f5a8 100644 --- a/build-gating.fmf +++ b/build-gating.fmf @@ -31,6 +31,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: lld-tests diff --git a/gcc-compat-basic/main.fmf b/gcc-compat-basic/main.fmf index c964a6f..f2abfd2 100644 --- a/gcc-compat-basic/main.fmf +++ b/gcc-compat-basic/main.fmf @@ -32,3 +32,6 @@ adjust: - require+: - llvm-toolset-14.0-lld when: collection == llvm-toolset-14.0 + - require+: + - llvm-toolset-15.0-lld + when: collection == llvm-toolset-15.0 diff --git a/ld-alternative/main.fmf b/ld-alternative/main.fmf index 4cdfcf7..382ed4e 100644 --- a/ld-alternative/main.fmf +++ b/ld-alternative/main.fmf @@ -35,3 +35,6 @@ adjust: - require+: - llvm-toolset-14.0-lld when: collection == llvm-toolset-14.0 + - require+: + - llvm-toolset-15.0-lld + when: collection == llvm-toolset-15.0 From 75941bd254141ca01fb48e89f076c1e45832b50b Mon Sep 17 00:00:00 2001 From: Edjunior Machado Date: Fri, 30 Sep 2022 13:09:13 +0200 Subject: [PATCH 033/178] 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 8454ab8df6c4364b6a2bbfd9d727650c6afd4e1b Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 17 Oct 2022 12:15:28 +0200 Subject: [PATCH 034/178] gcc-clang-compatibility: Test that gcc compiled objs can be linked with clang and viceversa. --- gcc-clang-compatibility/hello.cpp | 6 ++++++ gcc-clang-compatibility/main.fmf | 31 +++++++++++++++++++++++++++++++ gcc-clang-compatibility/test.sh | 15 +++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 gcc-clang-compatibility/hello.cpp create mode 100644 gcc-clang-compatibility/main.fmf create mode 100755 gcc-clang-compatibility/test.sh diff --git a/gcc-clang-compatibility/hello.cpp b/gcc-clang-compatibility/hello.cpp new file mode 100644 index 0000000..8f7c3e9 --- /dev/null +++ b/gcc-clang-compatibility/hello.cpp @@ -0,0 +1,6 @@ +#include + +int main(){ + std::cout << "Hello world!\n"; + return 0; +} diff --git a/gcc-clang-compatibility/main.fmf b/gcc-clang-compatibility/main.fmf new file mode 100644 index 0000000..b880df5 --- /dev/null +++ b/gcc-clang-compatibility/main.fmf @@ -0,0 +1,31 @@ +summary: Test that both gcc/clang compile/link compatibility. +description: + Build an object file with g++, link it with clang++ and viceversa, to ensure + that objects compiled with one can be linked with the other. +test: "$WITH_SCL ./test.sh" +framework: shell +tier: 1 +component: + - llvm-toolset + - clang +extra-summary: /tools/clang/gcc-clang-compatibility +extra-task: /tools/clang/gcc-clang-compatibility + +require: + - gcc-c++ + +adjust: + - require+: + - clang + when: collection is not defined + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + when: "collection == llvm-toolset-14.0" + - require+: + - llvm-toolset-15.0-clang + when: "collection == llvm-toolset-15.0" diff --git a/gcc-clang-compatibility/test.sh b/gcc-clang-compatibility/test.sh new file mode 100755 index 0000000..e2d4b0d --- /dev/null +++ b/gcc-clang-compatibility/test.sh @@ -0,0 +1,15 @@ +#!/bin/sh -eux + +tmp=$(mktemp -d) + +# Build the source with GCC, link it with clang +g++ -c hello.cpp -o ${tmp}/hello.o +clang++ -o ${tmp}/hello ${tmp}/hello.o +${tmp}/hello | grep "Hello world" +rm -rf ${tmp}/* + +# Build the source with clang, link it with GCC +clang++ -c hello.cpp -o ${tmp}/hello.o +g++ -o ${tmp}/hello ${tmp}/hello.o +${tmp}/hello | grep "Hello world" +rm -rf ${tmp}/* From 7686cf01a1ff4f0910de90a6742812a1ef6575cc Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 25 Oct 2022 09:44:10 +0200 Subject: [PATCH 035/178] ppc64le-long-double: reenable test --- ppc64le-long-double/main.fmf | 2 -- 1 file changed, 2 deletions(-) diff --git a/ppc64le-long-double/main.fmf b/ppc64le-long-double/main.fmf index cadaa7f..5c01f70 100644 --- a/ppc64le-long-double/main.fmf +++ b/ppc64le-long-double/main.fmf @@ -1,8 +1,6 @@ summary: Test that gcc and clang use the same long double format on ppc64le test: $WITH_SCL ./runtest.sh duration: 1h -# see https://bugzilla.redhat.com/show_bug.cgi?id=2100546 -enabled: false framework: shell tier: 1 component: From 6dcae89e8c76ba6f752dfc5661dfcdc913cf05a3 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Fri, 18 Nov 2022 15:49:40 -0300 Subject: [PATCH 036/178] Test long double format on all architectures Modify the ppc64le-long-double test in order to be reused and executed on all architectures, guaranteeing that gcc and clang will provide the same default long double format on all architectures. --- {ppc64le-long-double => long-double}/main.fmf | 20 ++++--------------- long-double/runtest.sh | 15 ++++++++++++++ ppc64le-long-double/runtest-fedora.sh | 14 ------------- ppc64le-long-double/runtest.sh | 9 --------- 4 files changed, 19 insertions(+), 39 deletions(-) rename {ppc64le-long-double => long-double}/main.fmf (61%) create mode 100755 long-double/runtest.sh delete mode 100755 ppc64le-long-double/runtest-fedora.sh delete mode 100755 ppc64le-long-double/runtest.sh diff --git a/ppc64le-long-double/main.fmf b/long-double/main.fmf similarity index 61% rename from ppc64le-long-double/main.fmf rename to long-double/main.fmf index 5c01f70..1232292 100644 --- a/ppc64le-long-double/main.fmf +++ b/long-double/main.fmf @@ -1,14 +1,13 @@ -summary: Test that gcc and clang use the same long double format on ppc64le +summary: Test that gcc and clang use the same long double format test: $WITH_SCL ./runtest.sh -duration: 1h +duration: 5m framework: shell tier: 1 component: - llvm-toolset - clang -extra-summary: /tools/clang/ppc64le-long-double -extra-task: /tools/clang/ppc64le-long-double -extra-nitrate: TC#0614129 +extra-summary: /tools/clang/long-double +extra-task: /tools/clang/long-double adjust: # Common requirements when LLVM is not SCL-ized @@ -16,17 +15,6 @@ adjust: - clang when: "collection is not defined" - - because: "Fedora CI runs in x86_64 only, emulate with qemu and mock" - require+: - - qemu-user-static - - mock - test: ./runtest-fedora.sh - when: distro == fedora and arch == x86_64 - continue: false - - - enabled: false - when: arch != ppc64le - - require+: - gcc when: distro != fedora diff --git a/long-double/runtest.sh b/long-double/runtest.sh new file mode 100755 index 0000000..d69e2c3 --- /dev/null +++ b/long-double/runtest.sh @@ -0,0 +1,15 @@ +set -e + +# Use __LDBL_MANT_DIG__ as a way to distinguish between long double formats. +# While this is not guaranteed to change for all formats, it provides a +# reliable enough method for testing which long double format is being used. +# If this test fails, either gcc or clang changed the default long double +# format, requiring to investigate why that happened and the best way to +# solve this in the long term. +gcc_output=$(gcc -E -dM -x c /dev/null | grep -e __LDBL_MANT_DIG__) +clang_output=$(clang -E -dM -x c /dev/null | grep -e __LDBL_MANT_DIG__) + +echo "gcc: $gcc_output" +echo "clang: $clang_output" + +test "$gcc_output" = "$clang_output" diff --git a/ppc64le-long-double/runtest-fedora.sh b/ppc64le-long-double/runtest-fedora.sh deleted file mode 100755 index 25dbb9c..0000000 --- a/ppc64le-long-double/runtest-fedora.sh +++ /dev/null @@ -1,14 +0,0 @@ -set -e - -fedora_release=`rpm -E %{fedora}` -mock_root=fedora-$fedora_release-ppc64le -triple=ppc64le-redhat-linux - -mock -r $mock_root --isolation=simple --install gcc -gcc_output=$(mock -r $mock_root --isolation=simple -q --shell gcc -E -dM -x c /dev/null | grep -e __LONG_DOUBLE_IEEE128__ -e __LONG_DOUBLE_IBM128__) -clang_output=$(clang -target $triple -E -dM -x c /dev/null | grep -e __LONG_DOUBLE_IEEE128__ -e __LONG_DOUBLE_IBM128__) - -echo "gcc: $gcc_output" -echo "clang: $clang_output" - -test "$gcc_output" = "$clang_output" diff --git a/ppc64le-long-double/runtest.sh b/ppc64le-long-double/runtest.sh deleted file mode 100755 index 8061bd7..0000000 --- a/ppc64le-long-double/runtest.sh +++ /dev/null @@ -1,9 +0,0 @@ -set -e - -gcc_output=$(gcc -E -dM -x c /dev/null | grep -e __LONG_DOUBLE_IEEE128__ -e __LONG_DOUBLE_IBM128__) -clang_output=$(clang -E -dM -x c /dev/null | grep -e __LONG_DOUBLE_IEEE128__ -e __LONG_DOUBLE_IBM128__) - -echo "gcc: $gcc_output" -echo "clang: $clang_output" - -test "$gcc_output" = "$clang_output" From a0abe34748c8ca3c2c0de073bff13559eb912243 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Thu, 24 Nov 2022 15:32:17 -0300 Subject: [PATCH 037/178] Add 2 new tests that validate the ppc64le long double ABI This patch is highly based on the ppc64le-long-double test that was available in the previous commit. However, it adds an extra step that ignores mock if the test is run inside an unprivileged container solution. The first test (exp) evaluates if clang is able to build C programs for both IBM double-double as well as IEEE 128-bit long double. As Fedora uses glibc by default, which supports both scenarios, both executables should work. The second test (parse) uses clang in order to evaluate if C++ programs built with default parameters and linking against libc++ use IEEE 128-bit long double. This test should be extended in the future in order to evaluate that clang is able to generate C++ programs for both IBM double-double and IEEE 128-bit long double using libstdc++. This can't be enabled now because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81122 . --- ppc64le-long-double/exp.c | 11 +++++++ ppc64le-long-double/main.fmf | 43 ++++++++++++++++++++++++ ppc64le-long-double/parse.cpp | 15 +++++++++ ppc64le-long-double/runtest-fedora.sh | 47 +++++++++++++++++++++++++++ ppc64le-long-double/runtest.sh | 29 +++++++++++++++++ 5 files changed, 145 insertions(+) create mode 100644 ppc64le-long-double/exp.c create mode 100644 ppc64le-long-double/main.fmf create mode 100644 ppc64le-long-double/parse.cpp create mode 100755 ppc64le-long-double/runtest-fedora.sh create mode 100755 ppc64le-long-double/runtest.sh diff --git a/ppc64le-long-double/exp.c b/ppc64le-long-double/exp.c new file mode 100644 index 0000000..56dc872 --- /dev/null +++ b/ppc64le-long-double/exp.c @@ -0,0 +1,11 @@ +/* Use a libm funcion that returns well-known results depending on the long + double format being used. */ + +#include +#include + +int main() { + printf("%La\n", expl(1.0L)); + + return 0; +} diff --git a/ppc64le-long-double/main.fmf b/ppc64le-long-double/main.fmf new file mode 100644 index 0000000..02f25c5 --- /dev/null +++ b/ppc64le-long-double/main.fmf @@ -0,0 +1,43 @@ +summary: Test binary compatibility of the long double format on ppc64le +test: $WITH_SCL ./runtest.sh +duration: 1h +framework: shell +tier: 1 +component: + - llvm-toolset + - clang +extra-summary: /tools/clang/ppc64le-long-double +extra-task: /tools/clang/ppc64le-long-double +extra-nitrate: TC#0614129 + +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + when: "collection is not defined" + + - because: "Fedora CI runs in x86_64 only, emulate with qemu and mock" + require+: + - qemu-user-static + - mock + test: ./runtest-fedora.sh + when: distro == fedora and arch == x86_64 + continue: false + + - enabled: false + when: arch != ppc64le + + - require+: + - gcc + when: distro != fedora + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + when: "collection == llvm-toolset-14.0" + - require+: + - llvm-toolset-15.0-clang + when: "collection == llvm-toolset-15.0" diff --git a/ppc64le-long-double/parse.cpp b/ppc64le-long-double/parse.cpp new file mode 100644 index 0000000..a2eb734 --- /dev/null +++ b/ppc64le-long-double/parse.cpp @@ -0,0 +1,15 @@ +/* Check how the C++ standard library parses the following number correctly. + On IBM double-double, the 7 least significant bits are messed up. + On IEEE 128-bit long double, this number is correctly represented. */ +#include +#include + +int main() { + long double d; + std::stringstream ss("0x1.5bf0a8b1457695355fb8ac404e7ap+1"); + + ss >> d; + printf("%La\n", d); + + return 0; +} diff --git a/ppc64le-long-double/runtest-fedora.sh b/ppc64le-long-double/runtest-fedora.sh new file mode 100755 index 0000000..3177313 --- /dev/null +++ b/ppc64le-long-double/runtest-fedora.sh @@ -0,0 +1,47 @@ +set -e + +fedora_release=`rpm -E %{fedora}` +mock_root=fedora-$fedora_release-ppc64le +triple=ppc64le-redhat-linux + +mock_cmd="mock -r $mock_root --isolation=simple" + +run_test () { + test_name=$1 + expected=$2 + + echo "Running $test_name" + echo "Expected output: $expected" + actual=$($mock_cmd -q --shell ./$test_name) + echo "Actual output: $actual" + + if [[ x$expected == x$actual ]]; then + return 0; + else + return 1; + fi +} + +# Avoid running mock in unsupported environments, e.g. on a non-privileged +# container. +if $mock_cmd -q --shell true; then + $mock_cmd --install clang libcxx-devel + + # glibc supports both long double types, so the following should work. + $mock_cmd --copyin exp.c /builddir/exp.c + $mock_cmd -q --shell -- clang -mabi=ibmlongdouble -fno-builtin exp.c -o exp-ibm -lm + $mock_cmd -q --shell -- clang -mabi=ieeelongdouble -fno-builtin exp.c -o exp-ieee -lm + + run_test exp-ibm "0x1.5bf0a8b1457695355fb8ac404ecp+1" + run_test exp-ieee "0x1.5bf0a8b1457695355fb8ac404e7ap+1" + + # Test if libc++ is providing the correct ABI. + $mock_cmd --copyin parse.cpp /builddir/parse.cpp + $mock_cmd -q --shell -- clang++ -stdlib=libc++ -fno-builtin parse.cpp -o parse -lm + + if [[ $fedora_release -gt 37 ]]; then + run_test parse "0x1.5bf0a8b1457695355fb8ac404e7ap+1" + else + run_test parse "0x1.5bf0a8b1457695355fb8ac404e8p+1" + fi +fi diff --git a/ppc64le-long-double/runtest.sh b/ppc64le-long-double/runtest.sh new file mode 100755 index 0000000..be357d5 --- /dev/null +++ b/ppc64le-long-double/runtest.sh @@ -0,0 +1,29 @@ +set -e + +triple=ppc64le-redhat-linux + + +run_test () { + test_name=$1 + expected=$2 + + echo "Running $test_name" + echo "Expected output: $expected" + actual=$(./$test_name) + echo "Actual output: $actual" + + if [[ x$expected == x$actual ]]; then + return 0; + else + return 1; + fi +} + +# glibc supports both long double types, so the following should work. +clang -mabi=ibmlongdouble -fno-builtin exp.c -o exp-ibm -lm +clang -mabi=ieeelongdouble -fno-builtin exp.c -o exp-ieee -lm + +run_test exp-ibm "0x1.5bf0a8b1457695355fb8ac404ecp+1" +run_test exp-ieee "0x1.5bf0a8b1457695355fb8ac404e7ap+1" + +# TODO: Build and run the parse test when CentOS/RHEL get libc++-devel. From 4685483471bf56e6bc68e643cf8936593f9b86a7 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 28 Nov 2022 12:02:57 +0100 Subject: [PATCH 038/178] long-double: add nitrate metadata --- long-double/main.fmf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/long-double/main.fmf b/long-double/main.fmf index 1232292..71b2b42 100644 --- a/long-double/main.fmf +++ b/long-double/main.fmf @@ -8,6 +8,7 @@ component: - clang extra-summary: /tools/clang/long-double extra-task: /tools/clang/long-double +extra-nitrate: TC#0614593 adjust: # Common requirements when LLVM is not SCL-ized @@ -29,3 +30,4 @@ adjust: - require+: - llvm-toolset-15.0-clang when: "collection == llvm-toolset-15.0" +id: 4096a1bb-d2a5-4aeb-b14d-fc465c293e32 From 5a94d663259b3a3be4f400ab92776bb786e899c2 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 20 Dec 2022 10:10:28 +0100 Subject: [PATCH 039/178] libomp: query for host arch clang/libomp to avoid false positives if multilib packages are installed --- libomp/runtest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libomp/runtest.sh b/libomp/runtest.sh index 5bd2532..2f3b9a5 100755 --- a/libomp/runtest.sh +++ b/libomp/runtest.sh @@ -2,7 +2,7 @@ set -exo pipefail -CLANG_VERSION=`rpm --queryformat="%{version}" -q clang` +CLANG_VERSION=$(rpm --queryformat="%{version}" -q clang.$(uname -m)) LIBOMP_DEPENDENCIES="libomp libomp-devel" # Ensure clang depends on the correct clang-libs version @@ -13,7 +13,7 @@ rpm -q --requires clang | grep "clang-libs.* = ${CLANG_VERSION}" # 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}" ]] + [[ "$(rpm --queryformat="%{version}" -q ${lomp_dep}.$(uname -m))" == "${CLANG_VERSION}" ]] done # Perform a sanity test to ensure everything works as expected From 048eb66cf04ffefa46c38c462b58b42fef622449 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 20 Dec 2022 11:05:38 +0100 Subject: [PATCH 040/178] Add test for ucrt64 toolchain detection on fedora --- ucrt64-toolchain/main.fmf | 12 ++++++++++++ ucrt64-toolchain/runtest.sh | 4 ++++ ucrt64-toolchain/test.cpp | 6 ++++++ 3 files changed, 22 insertions(+) create mode 100644 ucrt64-toolchain/main.fmf create mode 100755 ucrt64-toolchain/runtest.sh create mode 100644 ucrt64-toolchain/test.cpp diff --git a/ucrt64-toolchain/main.fmf b/ucrt64-toolchain/main.fmf new file mode 100644 index 0000000..bd31699 --- /dev/null +++ b/ucrt64-toolchain/main.fmf @@ -0,0 +1,12 @@ +summary: Test that ucrt64 toolchain is detected +test: ./runtest.sh +component: + - clang +require: + - clang + - ucrt64-gcc-c++ + +adjust: + - enabled: false + when: distro != fedora or distro < fedora-37 + because: "The ucrt64 toolchain is only available since Fedora 37" diff --git a/ucrt64-toolchain/runtest.sh b/ucrt64-toolchain/runtest.sh new file mode 100755 index 0000000..2b3f166 --- /dev/null +++ b/ucrt64-toolchain/runtest.sh @@ -0,0 +1,4 @@ +set -eux + +clang++ --target=x86_64-windows-gnu test.cpp +file a.exe | grep "PE32+ executable (console) x86-64, for MS Windows" diff --git a/ucrt64-toolchain/test.cpp b/ucrt64-toolchain/test.cpp new file mode 100644 index 0000000..9c6f43b --- /dev/null +++ b/ucrt64-toolchain/test.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + std::cout << "Hello world" << std::endl; + return 0; +} From de1d86b24b2e201bcfc1c95f7c6ae5f0a293e087 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 24 Jan 2023 10:44:06 +0100 Subject: [PATCH 041/178] rhbz_482491: Fix missing gcc-x86_64-linux-gnu dependency in Fedora --- rhbz_482491/main.fmf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rhbz_482491/main.fmf b/rhbz_482491/main.fmf index 7be4913..6a3fa23 100644 --- a/rhbz_482491/main.fmf +++ b/rhbz_482491/main.fmf @@ -1,4 +1,6 @@ summary: rhbz-482491 +description: | + "Test that clang is able to find the right libgcc_s" test: "$WITH_SCL ./test.sh" require: - libgcc @@ -11,7 +13,15 @@ extra-summary: /tools/clang/rhbz_482194 extra-task: /tools/clang/rhbz_482194 extra-nitrate: TC#0614132 +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1482491 + adjust: + # gcc-x86_64-linux-gnu is not available in RHEL + - require+: + - gcc-x86_64-linux-gnu + when: "distro == fedora" + # Common requirements when LLVM is not SCL-ized - require+: - clang From fea3e11f646c2f5680fdc256ce94c3f43fe9eab4 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 27 Feb 2023 18:20:52 +0000 Subject: [PATCH 042/178] 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 052a886fd081f503b7e2b60bdc2379a91c155317 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Tue, 21 Mar 2023 15:53:50 -0300 Subject: [PATCH 043/178] lldb-std-vector-prettyprint: Update lldb output lldb started to print the type used in the template. --- lldb-std-vector-prettyprint/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb-std-vector-prettyprint/test.sh b/lldb-std-vector-prettyprint/test.sh index c87edea..7ca0d8e 100755 --- a/lldb-std-vector-prettyprint/test.sh +++ b/lldb-std-vector-prettyprint/test.sh @@ -5,7 +5,7 @@ g++ -g test.cpp lldb -b -o 'breakpoint set --file test.cpp --line 7' -o run -o 'p v' -- a.out | tee lldb.log test `grep \ - -e '(std::vector >) $0 = size=1 {' \ + -e '(std::vector >) $0 = size=1 {' \ -e '\[0\] = 2' \ lldb.log \ | wc -l` -eq 2 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 044/178] 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 22639249c66fb4b506d79e38f9ce32f4757f0ffd Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Tue, 4 Apr 2023 14:43:52 -0300 Subject: [PATCH 045/178] Remove pocl-related tests pocl has been FTBFS since Fedora 38. There is a plan to orphan it. --- build-gating-pocl.fmf | 32 -------------------------------- pocl/main.fmf | 24 ------------------------ pocl/test.sh | 7 ------- 3 files changed, 63 deletions(-) delete mode 100644 build-gating-pocl.fmf delete mode 100644 pocl/main.fmf delete mode 100755 pocl/test.sh diff --git a/build-gating-pocl.fmf b/build-gating-pocl.fmf deleted file mode 100644 index 4b74ced..0000000 --- a/build-gating-pocl.fmf +++ /dev/null @@ -1,32 +0,0 @@ -summary: PoCL 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: "PoCL is shipped with Fedora, not RHEL/CentOS" - when: >- - distro == rhel - or distro == centos - enabled: false - -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" diff --git a/pocl/main.fmf b/pocl/main.fmf deleted file mode 100644 index 1143416..0000000 --- a/pocl/main.fmf +++ /dev/null @@ -1,24 +0,0 @@ -# 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 - -adjust: - - because: "PoCL is shipped with Fedora, not RHEL/CentOS" - when: >- - distro == rhel - or distro == centos - enabled: false - -# 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: "$WITH_SCL ./test.sh" -require: - - git - - ocl-icd-devel - - pocl - - gcc diff --git a/pocl/test.sh b/pocl/test.sh deleted file mode 100755 index fd9f92b..0000000 --- a/pocl/test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/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 From 6a33abfde80e0f53370158224a35630e65096941 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Fri, 14 Apr 2023 12:04:30 -0300 Subject: [PATCH 046/178] Install dnf-config-manager before using it The container image centos:stream9 does not come with 'dnf config-manager' preinstalled, forcing us to install it first. --- build-gating.fmf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-gating.fmf b/build-gating.fmf index c75fa5d..59192a1 100644 --- a/build-gating.fmf +++ b/build-gating.fmf @@ -47,7 +47,7 @@ adjust: prepare+: - name: Enable CRB how: shell - script: dnf config-manager --set-enabled crb + script: dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb when: >- distro == centos From 5ac66c3693e3ca140d9ff3e8496052cb922ab713 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Fri, 14 Apr 2023 12:10:40 -0300 Subject: [PATCH 047/178] Add a new test that validates the RPM macros This new test checks if Clang's RPM macros are: 1. Installed. 2. Have correct values. 3. Point to existing directories. --- rpmmacros/main.fmf | 11 +++++++++++ rpmmacros/runtest.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 rpmmacros/main.fmf create mode 100755 rpmmacros/runtest.sh diff --git a/rpmmacros/main.fmf b/rpmmacros/main.fmf new file mode 100644 index 0000000..265b158 --- /dev/null +++ b/rpmmacros/main.fmf @@ -0,0 +1,11 @@ +summary: Test if RPM macros are properly set +test: "./runtest.sh" +framework: shell +tier: 1 +component: + - clang +require: + - clang + - clang-devel +extra-summary: /tools/clang/rpmmacros +extra-task: /tools/clang/rpmmacros diff --git a/rpmmacros/runtest.sh b/rpmmacros/runtest.sh new file mode 100755 index 0000000..a1d14bb --- /dev/null +++ b/rpmmacros/runtest.sh @@ -0,0 +1,43 @@ +#!/bin/sh -eux + +clang_pkg=${1:-"clang"} +macros_path="/usr/lib/rpm/macros.d/macros.clang" + +set pipefail + +if ! rpm -q $clang_pkg > /dev/null; then + echo "Could not find package $clang_pkg" + exit 1 +fi + +if [[ ! -f "$macros_path" ]]; then + echo "Could not find \"/usr/lib/rpm/macros.d/macros.clang\"" + exit 1 +fi + +echo "Contents of \"$macros_path\":" +cat "$macros_path" +echo + +rpm_version=$(rpm -q $clang_pkg --qf "%{version}") +macro_version=$(rpm --eval "%{clang_version}") + +if [[ "$rpm_version" != "$macro_version" ]]; then + echo "The value of RPM macro %{clang_version} is incorrect!" + echo " Expected: \"$rpm_version\"" + echo " Got: \"$macro_version\"" + exit 1 +fi + +resource_dir=$(rpm --eval "%{clang_resource_dir}") +resource_dir_readonly=$(rpm --eval "%{clang_resource_dir_readonly}") + +if [[ ! -d "$resource_dir" ]]; then + echo "Could not find \"$resource_dir\"" + exit 1 +fi + +if [[ ! -d "$resource_dir_readonly" ]]; then + echo "Could not find \"$resource_dir_readonly\"" + exit 1 +fi From e43607a0f654fc91ab2a6f197764ce28bd02c858 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 26 Apr 2023 09:59:51 +0200 Subject: [PATCH 048/178] 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 5a8ea6a93088d85271777d4e449193a118cfc61d Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 11 May 2023 18:28:00 +0200 Subject: [PATCH 049/178] ppc64le-long-double: Adjust distro relevancy --- ppc64le-long-double/main.fmf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ppc64le-long-double/main.fmf b/ppc64le-long-double/main.fmf index 02f25c5..cd4e68f 100644 --- a/ppc64le-long-double/main.fmf +++ b/ppc64le-long-double/main.fmf @@ -27,6 +27,10 @@ adjust: - enabled: false when: arch != ppc64le + - because: "glibc in RHEL older than 9 don't support IEEE 128bit doubles" + enabled: false + when: distro < rhel-9 + - require+: - gcc when: distro != fedora From 1e0115c194924959bd5d62696868e9d628e1548e Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 3 Jul 2023 14:26:14 +0200 Subject: [PATCH 050/178] gcc-clang-compatibility: Add support for gcc-toolset installations clang may use a gcc from gcc-toolset instead the system version. In that case we need to test the compatibility with that one, not with the system based gcc. --- gcc-clang-compatibility/test.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc-clang-compatibility/test.sh b/gcc-clang-compatibility/test.sh index e2d4b0d..3480309 100755 --- a/gcc-clang-compatibility/test.sh +++ b/gcc-clang-compatibility/test.sh @@ -2,14 +2,25 @@ tmp=$(mktemp -d) +# clang not necessarily depends on system gcc. It might depend on gcc from +# gcc-toolset-XX, in such case we need to test the compatibility with that one. +# We can get that from `clang -v` output. +TOOLSET=$(clang -v |& grep "Selected GCC installation" | grep -P -o '(dev|gcc-)toolset-[0-9]*') ||: +if [[ "x" = "x${TOOLSET}" ]]; then + GCC="g++" +else + GCC="scl enable ${TOOLSET} -- g++" + echo "Testing with g++ from ${TOOLSET}" +fi + # Build the source with GCC, link it with clang -g++ -c hello.cpp -o ${tmp}/hello.o +${GCC} -c hello.cpp -o ${tmp}/hello.o clang++ -o ${tmp}/hello ${tmp}/hello.o ${tmp}/hello | grep "Hello world" rm -rf ${tmp}/* # Build the source with clang, link it with GCC clang++ -c hello.cpp -o ${tmp}/hello.o -g++ -o ${tmp}/hello ${tmp}/hello.o +${GCC} -o ${tmp}/hello ${tmp}/hello.o ${tmp}/hello | grep "Hello world" rm -rf ${tmp}/* From 3ff5b7451d9b2206783ff0f2f02bb4f505276fb0 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 12 Jul 2023 18:51:33 +0200 Subject: [PATCH 051/178] openmp-rpm: adjustments for fedora 39 (dnf5) --- openmp-rpm/main.fmf | 11 ++++++++++- openmp-rpm/runtest.sh | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/openmp-rpm/main.fmf b/openmp-rpm/main.fmf index df4fc35..e899916 100644 --- a/openmp-rpm/main.fmf +++ b/openmp-rpm/main.fmf @@ -15,13 +15,22 @@ adjust: - because: "libomp not supported in s390x" when: arch == s390x enabled: false + continue: false - because: "Use yum in RHEL < 8" require+: - yum-utils environment+: BUILDDEP_CMD: "yum-builddep" - when: distro < rhel-8 + when: distro == rhel and distro < rhel-8 + + - because: "Use dnf5 in Fedora 39+" + require+: + - dnf5-plugins + environment+: + BUILDDEP_CMD: "dnf builddep" + continue: false + when: distro == fedora and distro >= fedora-39 - because: "Use dnf in RHEL >= 8, Fedora and CentOS" require+: diff --git a/openmp-rpm/runtest.sh b/openmp-rpm/runtest.sh index 37647fe..86ec074 100755 --- a/openmp-rpm/runtest.sh +++ b/openmp-rpm/runtest.sh @@ -3,4 +3,4 @@ set -ex ${BUILDDEP_CMD} -y test.spec -rpmbuild --define '_sourcedir .' --define '_builddir .' -bb test.spec +QA_RPATHS=$(( 0x0001 )) rpmbuild --define '_sourcedir .' --define '_builddir .' -bb test.spec 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 052/178] 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 9f63297a4ac41f3892d6ffc297f717ad3217236f Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Mon, 17 Jul 2023 15:59:35 -0300 Subject: [PATCH 053/178] Stop using --noautoremove on dnf According to the documentation, this parameter "disable removal of dependencies that are no longer used". However, there are no lld dependencies required in the test that could be impacted. The most important package is binutils, which was manually installed and shouldn't be removed automatically. If the package does so, that would be a bug. --- ld-alternative/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ld-alternative/test.sh b/ld-alternative/test.sh index 3f646bd..6202f88 100755 --- a/ld-alternative/test.sh +++ b/ld-alternative/test.sh @@ -25,6 +25,6 @@ ls -l /etc/alternatives/ld | grep ld.lld /usr/bin/ld --version | grep 'LLD' # Uninstall lld and make sure the /usr/bin/ld is reset to ld.bfd -dnf -y remove --noautoremove lld +dnf -y remove lld verify_ld_bfd From f37486b615ad7dc915ea1d36a3d921d908f3c224 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 9 Aug 2023 16:05:55 -0300 Subject: [PATCH 054/178] Ignore RC suffixes in the version string Considering the macro variables do not have the ~rcN suffix, the rpm version must be cleaned before it's used as input to validate the correct value in the macro version. --- rpmmacros/runtest.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rpmmacros/runtest.sh b/rpmmacros/runtest.sh index a1d14bb..d884849 100755 --- a/rpmmacros/runtest.sh +++ b/rpmmacros/runtest.sh @@ -19,7 +19,11 @@ echo "Contents of \"$macros_path\":" cat "$macros_path" echo -rpm_version=$(rpm -q $clang_pkg --qf "%{version}") +# When using a package based on an RC release, the rpm_version will have the +# suffix ~rcN. Meanwhile, the macro won't include it in order to allow packages +# built with an RC package to be fully supported later. +# In that case, we need to remove that prefix. +rpm_version=$(rpm -q $clang_pkg --qf "%{version}" | sed 's/~.*//') macro_version=$(rpm --eval "%{clang_version}") if [[ "$rpm_version" != "$macro_version" ]]; then From c9cf4400a6009bc58165a86d8d4547a355aec841 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 9 Aug 2023 16:07:41 -0300 Subject: [PATCH 055/178] Remove reference to %{clang_resource_dir_readonly} This macro has been removed in LLVM 17.0.0. --- rpmmacros/runtest.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/rpmmacros/runtest.sh b/rpmmacros/runtest.sh index d884849..658dc0d 100755 --- a/rpmmacros/runtest.sh +++ b/rpmmacros/runtest.sh @@ -34,14 +34,8 @@ if [[ "$rpm_version" != "$macro_version" ]]; then fi resource_dir=$(rpm --eval "%{clang_resource_dir}") -resource_dir_readonly=$(rpm --eval "%{clang_resource_dir_readonly}") if [[ ! -d "$resource_dir" ]]; then echo "Could not find \"$resource_dir\"" exit 1 fi - -if [[ ! -d "$resource_dir_readonly" ]]; then - echo "Could not find \"$resource_dir_readonly\"" - exit 1 -fi From ffe7fa64b236cecb86f977e68f42586806559e95 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 9 Aug 2023 19:08:51 -0300 Subject: [PATCH 056/178] Update lldb output in LLVM 17.0 There have been a few changes that require to modify the regexes used in lldb-std-vector-prettyprint and in python-embedded-interpreter. --- lldb-std-vector-prettyprint/test.sh | 10 +++++++++- python-embedded-interpreter/test.sh | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lldb-std-vector-prettyprint/test.sh b/lldb-std-vector-prettyprint/test.sh index 7ca0d8e..d6740ad 100755 --- a/lldb-std-vector-prettyprint/test.sh +++ b/lldb-std-vector-prettyprint/test.sh @@ -4,8 +4,16 @@ g++ -g test.cpp lldb -b -o 'breakpoint set --file test.cpp --line 7' -o run -o 'p v' -- a.out | tee lldb.log +# Starting with LLVM 17.0, the expected output is: +# (std::vector) size=1 { +# [0] = 2 + +# In LLVM 16.0, the expected output is: +# (std::vector >) $0 = size=1 { +# [0] = 2 + test `grep \ - -e '(std::vector >) $0 = size=1 {' \ + -e '(std::vector \)\?>) \($0 = \)\?size=1 {' \ -e '\[0\] = 2' \ lldb.log \ | wc -l` -eq 2 diff --git a/python-embedded-interpreter/test.sh b/python-embedded-interpreter/test.sh index e495f58..e495c66 100755 --- a/python-embedded-interpreter/test.sh +++ b/python-embedded-interpreter/test.sh @@ -11,8 +11,8 @@ lldb -b -o 'breakpoint set --file test.cpp --line 8' \ -- a.out | tee lldb.log test `grep \ - -e '(int) $0 = 1' \ - -e '(float) $1 = 1' \ + -e '(int) \($0 = \)\?1' \ + -e '(float) \($1 = \)\?1' \ lldb.log \ | wc -l` -eq 2 From 0e8ca2a543f7670a8dbe885d6fd20abdee19eafb Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Tue, 19 Sep 2023 11:57:40 -0300 Subject: [PATCH 057/178] Add a test that checks if debug information is disabled by default In a recent change to clang 17.0.0, debug information got enabled by default by mistake. Add a test that helps to prevent that. --- rhbz_2239619/main.fmf | 25 +++++++++++++++++++++++++ rhbz_2239619/runtest.sh | 9 +++++++++ rhbz_2239619/test.c | 3 +++ 3 files changed, 37 insertions(+) create mode 100644 rhbz_2239619/main.fmf create mode 100755 rhbz_2239619/runtest.sh create mode 100644 rhbz_2239619/test.c diff --git a/rhbz_2239619/main.fmf b/rhbz_2239619/main.fmf new file mode 100644 index 0000000..e0c5e69 --- /dev/null +++ b/rhbz_2239619/main.fmf @@ -0,0 +1,25 @@ +summary: Test if debug information is disabled by default +test: "$WITH_SCL ./runtest.sh" +require: [] +framework: shell +tier: 1 +component: + - llvm-toolset + - clang + +adjust: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + when: "collection is not defined" + + # Requirements for SCL-ized LLVM + - require+: + - llvm-toolset-13.0-clang + when: "collection == llvm-toolset-13.0" + - require+: + - llvm-toolset-14.0-clang + when: "collection == llvm-toolset-14.0" + - require+: + - llvm-toolset-15.0-clang + when: "collection == llvm-toolset-15.0" diff --git a/rhbz_2239619/runtest.sh b/rhbz_2239619/runtest.sh new file mode 100755 index 0000000..4f4559b --- /dev/null +++ b/rhbz_2239619/runtest.sh @@ -0,0 +1,9 @@ +#!/bin/sh -eux + +# Ensure that compiled code does not have debug information enabled by +# default. + +if clang -S test.c -o - | grep "\.section[[:space:]]\+\.debug_info"; then + echo "Error: debug information is enabled by default!" >&2 + exit 1 +fi diff --git a/rhbz_2239619/test.c b/rhbz_2239619/test.c new file mode 100644 index 0000000..ade4548 --- /dev/null +++ b/rhbz_2239619/test.c @@ -0,0 +1,3 @@ +int main(){ + return 0; +} From ec1f44228b40dcb009ba6404cfa97ed64ff546a8 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 21 Sep 2023 16:00:41 +0200 Subject: [PATCH 058/178] 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 059/178] 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 982bb6f065c636cacf92abf8eb5e90754701fda5 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 25 Oct 2023 12:16:01 +0200 Subject: [PATCH 060/178] toolchains test: add support for snapshots testing --- toolchains/main.fmf | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/toolchains/main.fmf b/toolchains/main.fmf index b527e5c..5ce7fb6 100644 --- a/toolchains/main.fmf +++ b/toolchains/main.fmf @@ -66,5 +66,21 @@ adjust: or distro == centos because: testing against libstdc++ package in RHEL as libcxx is not shipped with RHEL + # llvm-snapshots specific adjustments. + # These are daily builds of a reduced set of the llvm components in currently + # supported Fedora releases. We remove anything that it's not supported. + # Supported components can be checked in: + # https://copr.fedorainfracloud.org/coprs/g/fedora-llvm-team/llvm-snapshots/monitor/ + - environment+: + CXXLIBS: "libstdc++" + require-: + - libcxx-devel + - libcxx-static + require+: + - libstdc++ + when: distro == fedora and snapshot is defined + because: llvm-snapshots adjustments + + # 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. From bb6d566ab8442d8462d693f339fc227f81b2600e Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Thu, 26 Oct 2023 13:57:37 -0300 Subject: [PATCH 061/178] ppc64le-long-double: Improve warnings when mock is not supported Stop printing messages from the test that runs mock as they refer to errors, causing confusion. Send all these messages to /dev/null and print our own message saying the test will be ignored. --- ppc64le-long-double/runtest-fedora.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ppc64le-long-double/runtest-fedora.sh b/ppc64le-long-double/runtest-fedora.sh index 3177313..3cfb081 100755 --- a/ppc64le-long-double/runtest-fedora.sh +++ b/ppc64le-long-double/runtest-fedora.sh @@ -24,7 +24,7 @@ run_test () { # Avoid running mock in unsupported environments, e.g. on a non-privileged # container. -if $mock_cmd -q --shell true; then +if $mock_cmd -q --shell true &> /dev/null; then $mock_cmd --install clang libcxx-devel # glibc supports both long double types, so the following should work. @@ -44,4 +44,6 @@ if $mock_cmd -q --shell true; then else run_test parse "0x1.5bf0a8b1457695355fb8ac404e8p+1" fi +else + echo "This environment does not support mock. This test will be ignored." fi From 3403ca384d032f5e234194e683ecd18668d2f788 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 14 Nov 2023 09:12:03 +0100 Subject: [PATCH 062/178] 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 ca5c810d9a07a001d9d94252dea3ed4aecc3865a Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Fri, 2 Feb 2024 10:28:45 +0100 Subject: [PATCH 063/178] Use correct DWARF version Instead of checking for DWARF4 only we now check for DWARF5 if clang is greater or equal to version 18. Only if Fedora is less than 38 we fall back to require DWARF4. The grep in the output of `llvm-dwarfdump` could potentially match other hex numbers and now only matches the version. --- use-correct-dwarf-default/.gitignore | 2 ++ .../main.fmf | 4 +-- use-correct-dwarf-default/test.sh | 26 +++++++++++++++++++ use-dwarf4-by-default/test.sh | 7 ----- 4 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 use-correct-dwarf-default/.gitignore rename {use-dwarf4-by-default => use-correct-dwarf-default}/main.fmf (87%) create mode 100755 use-correct-dwarf-default/test.sh delete mode 100755 use-dwarf4-by-default/test.sh diff --git a/use-correct-dwarf-default/.gitignore b/use-correct-dwarf-default/.gitignore new file mode 100644 index 0000000..0acf80b --- /dev/null +++ b/use-correct-dwarf-default/.gitignore @@ -0,0 +1,2 @@ +a.out +build.log \ No newline at end of file diff --git a/use-dwarf4-by-default/main.fmf b/use-correct-dwarf-default/main.fmf similarity index 87% rename from use-dwarf4-by-default/main.fmf rename to use-correct-dwarf-default/main.fmf index 3e54df0..b20851d 100644 --- a/use-dwarf4-by-default/main.fmf +++ b/use-correct-dwarf-default/main.fmf @@ -7,8 +7,8 @@ tier: 1 component: - llvm-toolset - clang -extra-summary: /tools/clang/use-dwarf4-by-default -extra-task: /tools/clang/use-dwarf4-by-default +extra-summary: /tools/clang/use-correct-dwarf-default +extra-task: /tools/clang/use-correct-dwarf-default extra-nitrate: TC#0614134 adjust: diff --git a/use-correct-dwarf-default/test.sh b/use-correct-dwarf-default/test.sh new file mode 100755 index 0000000..ac9b23a --- /dev/null +++ b/use-correct-dwarf-default/test.sh @@ -0,0 +1,26 @@ +#!/bin/sh -eux + +# Determine correct DWARF version to use. If Clang is newer or equal to version +# 18, we want to use DWARF5 except for Fedora 38 where we still want DWARF4. + +required_dwarf_version=4 + +# Get clang version +clang_version=$(rpm -q --queryformat "%{version}" clang | grep -ioP "^[0-9]+") +if [ $clang_version -ge 18 ]; then + >&2 echo "clang is greater or equal version 18"; + required_dwarf_version=5 +fi + +if [ -e /etc/fedora-release ]; then + fedora_version=$(grep -ioP "Fedora release \K[0-9]+" /etc/fedora-release) + if [ $fedora_version -le 38 ]; then + required_dwarf_version=4 + fi +fi + +echo "int main(){ return 0; }" | clang -g -v -x c - 2> build.log +# Make sure that clang is using the expected flag to use the required DWARF version +grep -q "\-dwarf-version=$required_dwarf_version" build.log +# Inspect the binary to double check expected DWARF version +llvm-dwarfdump a.out | grep -ioP "version\s*=\s*0x000$required_dwarf_version" diff --git a/use-dwarf4-by-default/test.sh b/use-dwarf4-by-default/test.sh deleted file mode 100755 index 5da8196..0000000 --- a/use-dwarf4-by-default/test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -eux - -echo "int main(){ return 0; }" | clang -g -v -x c - 2> build.log -# Make sure that clang is using the expected flag to use DWARF 4 -grep -q "\-dwarf-version=4" build.log -# Inspect the binary to double check expected DWARF version -llvm-dwarfdump a.out | grep -i version | grep 0x0004 From c1eaab43ec6502fbea4a1448e6112c6099845273 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 22 Feb 2024 13:07:30 +0100 Subject: [PATCH 064/178] Move all the tests to a dedicated directory --- {basic => tests/basic}/main.fmf | 0 {basic => tests/basic}/test.sh | 0 {gcc-compat-basic => tests/gcc-compat-basic}/main.fmf | 0 {gcc-compat-basic => tests/gcc-compat-basic}/test.sh | 0 {ld-alternative => tests/ld-alternative}/main.fmf | 0 {ld-alternative => tests/ld-alternative}/test.sh | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename {basic => tests/basic}/main.fmf (100%) rename {basic => tests/basic}/test.sh (100%) rename {gcc-compat-basic => tests/gcc-compat-basic}/main.fmf (100%) rename {gcc-compat-basic => tests/gcc-compat-basic}/test.sh (100%) rename {ld-alternative => tests/ld-alternative}/main.fmf (100%) rename {ld-alternative => tests/ld-alternative}/test.sh (100%) diff --git a/basic/main.fmf b/tests/basic/main.fmf similarity index 100% rename from basic/main.fmf rename to tests/basic/main.fmf diff --git a/basic/test.sh b/tests/basic/test.sh similarity index 100% rename from basic/test.sh rename to tests/basic/test.sh diff --git a/gcc-compat-basic/main.fmf b/tests/gcc-compat-basic/main.fmf similarity index 100% rename from gcc-compat-basic/main.fmf rename to tests/gcc-compat-basic/main.fmf diff --git a/gcc-compat-basic/test.sh b/tests/gcc-compat-basic/test.sh similarity index 100% rename from gcc-compat-basic/test.sh rename to tests/gcc-compat-basic/test.sh diff --git a/ld-alternative/main.fmf b/tests/ld-alternative/main.fmf similarity index 100% rename from ld-alternative/main.fmf rename to tests/ld-alternative/main.fmf diff --git a/ld-alternative/test.sh b/tests/ld-alternative/test.sh similarity index 100% rename from ld-alternative/test.sh rename to tests/ld-alternative/test.sh From ab620ce7f02f9be2d8a82f48e72fd07970a12e39 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 22 Feb 2024 13:11:11 +0100 Subject: [PATCH 065/178] Reorganize tests repository. * Created common configuration file (tests/main.fmf) to take advantage of fmf elasticity and inheritance. * Cleanup and simplify all tests metadata. * Remove no longer needed adjustments from plans * Support lld tests in s390x for llvm >= 18 --- build-gating-alternatives.fmf | 20 ++++-------- build-gating.fmf | 20 ++++-------- tests/basic/main.fmf | 16 +--------- tests/gcc-compat-basic/main.fmf | 29 ++---------------- tests/ld-alternative/main.fmf | 31 ++----------------- tests/main.fmf | 54 +++++++++++++++++++++++++++++++++ 6 files changed, 72 insertions(+), 98 deletions(-) create mode 100644 tests/main.fmf diff --git a/build-gating-alternatives.fmf b/build-gating-alternatives.fmf index 0d52a79..785152f 100644 --- a/build-gating-alternatives.fmf +++ b/build-gating-alternatives.fmf @@ -19,22 +19,14 @@ adjust: and trigger != build enabled: false - - because: lld is not shipped for s390x or ppc64 + - because: lld is not shipped for ppc64 enabled: false - when: arch == s390x or arch == ppc64 + when: arch == ppc64 - - 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" + - because: lld is not shipped in s390x on LLVM < 18 + enabled: false + when: > + arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 discover: - name: lld-tests diff --git a/build-gating.fmf b/build-gating.fmf index e67f5a8..6be9987 100644 --- a/build-gating.fmf +++ b/build-gating.fmf @@ -19,22 +19,14 @@ adjust: and trigger != build enabled: false - - because: lld is not shipped for s390x and ppc64 + - because: lld is not shipped for ppc64 enabled: false - when: arch == s390x or arch == ppc64 + when: arch == ppc64 - - 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" + - because: lld is not shipped in s390x on LLVM < 18 + enabled: false + when: > + arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 discover: - name: lld-tests diff --git a/tests/basic/main.fmf b/tests/basic/main.fmf index f4d96e0..65613c8 100644 --- a/tests/basic/main.fmf +++ b/tests/basic/main.fmf @@ -1,36 +1,22 @@ summary: Test lld with clang -test: "$WITH_SCL ./test.sh" -require: [] -framework: shell tier: 1 -component: - - llvm-toolset - - lld extra-summary: /tools/lld/basic extra-task: /tools/lld/basic extra-nitrate: TC#0614058 -adjust: - - because: lld is not shipped for s390x and ppc64 - enabled: false - when: arch == s390x or arch == ppc64 - +adjust+: # Common requirements when LLVM is not SCL-ized - require+: - clang - - lld when: collection is not defined # Requirements for SCL-ized LLVM - require+: - llvm-toolset-13.0-clang - - llvm-toolset-13.0-lld when: collection == llvm-toolset-13.0 - require+: - llvm-toolset-14.0-clang - - llvm-toolset-14.0-lld when: collection == llvm-toolset-14.0 - require+: - llvm-toolset-15.0-clang - - llvm-toolset-15.0-lld when: collection == llvm-toolset-15.0 diff --git a/tests/gcc-compat-basic/main.fmf b/tests/gcc-compat-basic/main.fmf index f2abfd2..97b3f9c 100644 --- a/tests/gcc-compat-basic/main.fmf +++ b/tests/gcc-compat-basic/main.fmf @@ -1,37 +1,12 @@ summary: Test lld with gcc -test: "$WITH_SCL ./test.sh" -require: +require+: - gcc -framework: shell tier: 1 -component: - - llvm-toolset - - lld extra-summary: /tools/lld/gcc-compat-basic extra-task: /tools/lld/gcc-compat-basic extra-nitrate: TC#0614059 -adjust: - - because: lld is not shipped for s390x and ppc64 - enabled: false - when: arch == s390x or arch == ppc64 - +adjust+: - because: system gcc is too old in rhel-7 enabled: false when: distro <= rhel-7 - - # Common requirements when LLVM is not SCL-ized - - require+: - - lld - when: collection is not defined - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-lld - when: collection == llvm-toolset-13.0 - - require+: - - llvm-toolset-14.0-lld - when: collection == llvm-toolset-14.0 - - require+: - - llvm-toolset-15.0-lld - when: collection == llvm-toolset-15.0 diff --git a/tests/ld-alternative/main.fmf b/tests/ld-alternative/main.fmf index 382ed4e..591d028 100644 --- a/tests/ld-alternative/main.fmf +++ b/tests/ld-alternative/main.fmf @@ -1,40 +1,15 @@ summary: Test linker switching with alternatives -test: "$WITH_SCL ./test.sh" # This test spoils the installation by removing lld, therefore it should be marked as such. -tag: +tag+: - spoils-installation -require: +require+: - binutils -framework: shell tier: 1 -component: - - llvm-toolset - - lld extra-summary: /tools/lld/ld-alternative extra-task: /tools/lld/ld-alternative extra-nitrate: TC#0614060 -adjust: - - because: lld is not shipped for s390x and ppc64 - enabled: false - when: arch == s390x or arch == ppc64 - +adjust+: - because: lld is not installed as ld alternative in rhel < 9 enabled: false when: distro < rhel-9 - - # Common requirements when LLVM is not SCL-ized - - require+: - - lld - when: collection is not defined - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-lld - when: collection == llvm-toolset-13.0 - - require+: - - llvm-toolset-14.0-lld - when: collection == llvm-toolset-14.0 - - require+: - - llvm-toolset-15.0-lld - when: collection == llvm-toolset-15.0 diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..47ffb7d --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,54 @@ +# 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 + - lld + +# 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+: + - because: lld is not shipped for ppc64 + enabled: false + when: arch == ppc64 + + - because: lld is not shipped in s390x on LLVM < 18 + enabled: false + when: > + arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 + + # Common requirements when LLVM is not SCL-ized + - require+: + - lld + 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-lld + when: collection == llvm-toolset-13.0 + + - test: scl enable llvm-toolset-14.0 -- ./test.sh + require+: + - llvm-toolset-14.0-lld + when: collection == llvm-toolset-14.0 + + - test: scl enable llvm-toolset-15.0 -- ./test.sh + require+: + - llvm-toolset-15.0-lld + when: collection == llvm-toolset-15.0 \ No newline at end of file From be641c9e9ae5aecc35a1d03b0bc28ce2e2e656a3 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 22 Feb 2024 14:03:04 +0100 Subject: [PATCH 066/178] Update README.md --- README.md | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 99 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5723d60..a833736 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,100 @@ -# lld +# LLD Tests -Tests for lld \ No newline at end of file +This repository contains tests for LLD. + +## 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 tests show /basic +/tests/basic + summary Test lld with clang + contact Jesus Checa Hidalgo + component 'llvm-toolset' and 'lld' + test ./test.sh + path /tests/basic + framework shell + manual false + require 'lld' and 'clang' + duration 5m + enabled true + result respect + tier 1 + +$ tmt -c collection=llvm-toolset-15.0 tests show /basic +/tests/basic + summary Test lld with clang + contact Jesus Checa Hidalgo + component 'llvm-toolset' and 'lld' + test scl enable llvm-toolset-15.0 -- ./test.sh + path /tests/basic + framework shell + manual false + require 'llvm-toolset-15.0-lld' and 'llvm-toolset-15.0-clang' + 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 9c62e92982e5ba23d429d8c5f2c8542cd91ee4be Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 27 Feb 2024 12:09:20 +0100 Subject: [PATCH 067/178] Move all tests to a sudbirectory --- {clang-format-diff => tests/clang-format-diff}/main.fmf | 0 {clang-format-diff => tests/clang-format-diff}/test.sh | 0 {fedora-flags => tests/fedora-flags}/hello.c | 0 {fedora-flags => tests/fedora-flags}/hello.cpp | 0 {fedora-flags => tests/fedora-flags}/main.c | 0 {fedora-flags => tests/fedora-flags}/main.cpp | 0 {fedora-flags => tests/fedora-flags}/main.fmf | 0 {fedora-flags => tests/fedora-flags}/runtest.sh | 0 .../gcc-clang-compatibility}/hello.cpp | 0 .../gcc-clang-compatibility}/main.fmf | 0 .../gcc-clang-compatibility}/test.sh | 0 {libomp => tests/libomp}/main.fmf | 0 {libomp => tests/libomp}/openmp-compile-link-test.c | 0 {libomp => tests/libomp}/runtest.sh | 0 {llvm-test-suite => tests/llvm-test-suite}/main.fmf | 0 {llvm-test-suite => tests/llvm-test-suite}/test.sh | 0 {long-double => tests/long-double}/main.fmf | 0 {long-double => tests/long-double}/runtest.sh | 0 {openmp-rpm => tests/openmp-rpm}/main.fmf | 0 {openmp-rpm => tests/openmp-rpm}/runtest.sh | 0 {openmp-rpm => tests/openmp-rpm}/test.c | 0 {openmp-rpm => tests/openmp-rpm}/test.spec | 0 {ppc64le-long-double => tests/ppc64le-long-double}/exp.c | 0 {ppc64le-long-double => tests/ppc64le-long-double}/main.fmf | 0 {ppc64le-long-double => tests/ppc64le-long-double}/parse.cpp | 0 .../ppc64le-long-double}/runtest-fedora.sh | 0 {ppc64le-long-double => tests/ppc64le-long-double}/runtest.sh | 0 {rhbz_1647130 => tests/rhbz_1647130}/main.fmf | 0 {rhbz_1647130 => tests/rhbz_1647130}/runtest.sh | 0 {rhbz_1657544 => tests/rhbz_1657544}/from_chars.cpp | 0 {rhbz_1657544 => tests/rhbz_1657544}/main.fmf | 0 {rhbz_1657544 => tests/rhbz_1657544}/runtest.sh | 0 {rhbz_2239619 => tests/rhbz_2239619}/main.fmf | 0 {rhbz_2239619 => tests/rhbz_2239619}/runtest.sh | 0 {rhbz_2239619 => tests/rhbz_2239619}/test.c | 0 {rhbz_482491 => tests/rhbz_482491}/main.fmf | 0 {rhbz_482491 => tests/rhbz_482491}/test.sh | 0 {rpmmacros => tests/rpmmacros}/main.fmf | 0 {rpmmacros => tests/rpmmacros}/runtest.sh | 0 {toolchains => tests/toolchains}/hello.c | 0 {toolchains => tests/toolchains}/hello.cpp | 0 {toolchains => tests/toolchains}/main.fmf | 0 {toolchains => tests/toolchains}/runtest.sh | 0 {ucrt64-toolchain => tests/ucrt64-toolchain}/main.fmf | 0 {ucrt64-toolchain => tests/ucrt64-toolchain}/runtest.sh | 0 {ucrt64-toolchain => tests/ucrt64-toolchain}/test.cpp | 0 .../use-correct-dwarf-default}/.gitignore | 0 .../use-correct-dwarf-default}/main.fmf | 0 .../use-correct-dwarf-default}/test.sh | 0 49 files changed, 0 insertions(+), 0 deletions(-) rename {clang-format-diff => tests/clang-format-diff}/main.fmf (100%) rename {clang-format-diff => tests/clang-format-diff}/test.sh (100%) rename {fedora-flags => tests/fedora-flags}/hello.c (100%) rename {fedora-flags => tests/fedora-flags}/hello.cpp (100%) rename {fedora-flags => tests/fedora-flags}/main.c (100%) rename {fedora-flags => tests/fedora-flags}/main.cpp (100%) rename {fedora-flags => tests/fedora-flags}/main.fmf (100%) rename {fedora-flags => tests/fedora-flags}/runtest.sh (100%) rename {gcc-clang-compatibility => tests/gcc-clang-compatibility}/hello.cpp (100%) rename {gcc-clang-compatibility => tests/gcc-clang-compatibility}/main.fmf (100%) rename {gcc-clang-compatibility => tests/gcc-clang-compatibility}/test.sh (100%) rename {libomp => tests/libomp}/main.fmf (100%) rename {libomp => tests/libomp}/openmp-compile-link-test.c (100%) rename {libomp => tests/libomp}/runtest.sh (100%) rename {llvm-test-suite => tests/llvm-test-suite}/main.fmf (100%) rename {llvm-test-suite => tests/llvm-test-suite}/test.sh (100%) rename {long-double => tests/long-double}/main.fmf (100%) rename {long-double => tests/long-double}/runtest.sh (100%) rename {openmp-rpm => tests/openmp-rpm}/main.fmf (100%) rename {openmp-rpm => tests/openmp-rpm}/runtest.sh (100%) rename {openmp-rpm => tests/openmp-rpm}/test.c (100%) rename {openmp-rpm => tests/openmp-rpm}/test.spec (100%) rename {ppc64le-long-double => tests/ppc64le-long-double}/exp.c (100%) rename {ppc64le-long-double => tests/ppc64le-long-double}/main.fmf (100%) rename {ppc64le-long-double => tests/ppc64le-long-double}/parse.cpp (100%) rename {ppc64le-long-double => tests/ppc64le-long-double}/runtest-fedora.sh (100%) rename {ppc64le-long-double => tests/ppc64le-long-double}/runtest.sh (100%) rename {rhbz_1647130 => tests/rhbz_1647130}/main.fmf (100%) rename {rhbz_1647130 => tests/rhbz_1647130}/runtest.sh (100%) rename {rhbz_1657544 => tests/rhbz_1657544}/from_chars.cpp (100%) rename {rhbz_1657544 => tests/rhbz_1657544}/main.fmf (100%) rename {rhbz_1657544 => tests/rhbz_1657544}/runtest.sh (100%) rename {rhbz_2239619 => tests/rhbz_2239619}/main.fmf (100%) rename {rhbz_2239619 => tests/rhbz_2239619}/runtest.sh (100%) rename {rhbz_2239619 => tests/rhbz_2239619}/test.c (100%) rename {rhbz_482491 => tests/rhbz_482491}/main.fmf (100%) rename {rhbz_482491 => tests/rhbz_482491}/test.sh (100%) rename {rpmmacros => tests/rpmmacros}/main.fmf (100%) rename {rpmmacros => tests/rpmmacros}/runtest.sh (100%) rename {toolchains => tests/toolchains}/hello.c (100%) rename {toolchains => tests/toolchains}/hello.cpp (100%) rename {toolchains => tests/toolchains}/main.fmf (100%) rename {toolchains => tests/toolchains}/runtest.sh (100%) rename {ucrt64-toolchain => tests/ucrt64-toolchain}/main.fmf (100%) rename {ucrt64-toolchain => tests/ucrt64-toolchain}/runtest.sh (100%) rename {ucrt64-toolchain => tests/ucrt64-toolchain}/test.cpp (100%) rename {use-correct-dwarf-default => tests/use-correct-dwarf-default}/.gitignore (100%) rename {use-correct-dwarf-default => tests/use-correct-dwarf-default}/main.fmf (100%) rename {use-correct-dwarf-default => tests/use-correct-dwarf-default}/test.sh (100%) diff --git a/clang-format-diff/main.fmf b/tests/clang-format-diff/main.fmf similarity index 100% rename from clang-format-diff/main.fmf rename to tests/clang-format-diff/main.fmf diff --git a/clang-format-diff/test.sh b/tests/clang-format-diff/test.sh similarity index 100% rename from clang-format-diff/test.sh rename to tests/clang-format-diff/test.sh diff --git a/fedora-flags/hello.c b/tests/fedora-flags/hello.c similarity index 100% rename from fedora-flags/hello.c rename to tests/fedora-flags/hello.c diff --git a/fedora-flags/hello.cpp b/tests/fedora-flags/hello.cpp similarity index 100% rename from fedora-flags/hello.cpp rename to tests/fedora-flags/hello.cpp diff --git a/fedora-flags/main.c b/tests/fedora-flags/main.c similarity index 100% rename from fedora-flags/main.c rename to tests/fedora-flags/main.c diff --git a/fedora-flags/main.cpp b/tests/fedora-flags/main.cpp similarity index 100% rename from fedora-flags/main.cpp rename to tests/fedora-flags/main.cpp diff --git a/fedora-flags/main.fmf b/tests/fedora-flags/main.fmf similarity index 100% rename from fedora-flags/main.fmf rename to tests/fedora-flags/main.fmf diff --git a/fedora-flags/runtest.sh b/tests/fedora-flags/runtest.sh similarity index 100% rename from fedora-flags/runtest.sh rename to tests/fedora-flags/runtest.sh diff --git a/gcc-clang-compatibility/hello.cpp b/tests/gcc-clang-compatibility/hello.cpp similarity index 100% rename from gcc-clang-compatibility/hello.cpp rename to tests/gcc-clang-compatibility/hello.cpp diff --git a/gcc-clang-compatibility/main.fmf b/tests/gcc-clang-compatibility/main.fmf similarity index 100% rename from gcc-clang-compatibility/main.fmf rename to tests/gcc-clang-compatibility/main.fmf diff --git a/gcc-clang-compatibility/test.sh b/tests/gcc-clang-compatibility/test.sh similarity index 100% rename from gcc-clang-compatibility/test.sh rename to tests/gcc-clang-compatibility/test.sh diff --git a/libomp/main.fmf b/tests/libomp/main.fmf similarity index 100% rename from libomp/main.fmf rename to tests/libomp/main.fmf diff --git a/libomp/openmp-compile-link-test.c b/tests/libomp/openmp-compile-link-test.c similarity index 100% rename from libomp/openmp-compile-link-test.c rename to tests/libomp/openmp-compile-link-test.c diff --git a/libomp/runtest.sh b/tests/libomp/runtest.sh similarity index 100% rename from libomp/runtest.sh rename to tests/libomp/runtest.sh diff --git a/llvm-test-suite/main.fmf b/tests/llvm-test-suite/main.fmf similarity index 100% rename from llvm-test-suite/main.fmf rename to tests/llvm-test-suite/main.fmf diff --git a/llvm-test-suite/test.sh b/tests/llvm-test-suite/test.sh similarity index 100% rename from llvm-test-suite/test.sh rename to tests/llvm-test-suite/test.sh diff --git a/long-double/main.fmf b/tests/long-double/main.fmf similarity index 100% rename from long-double/main.fmf rename to tests/long-double/main.fmf diff --git a/long-double/runtest.sh b/tests/long-double/runtest.sh similarity index 100% rename from long-double/runtest.sh rename to tests/long-double/runtest.sh diff --git a/openmp-rpm/main.fmf b/tests/openmp-rpm/main.fmf similarity index 100% rename from openmp-rpm/main.fmf rename to tests/openmp-rpm/main.fmf diff --git a/openmp-rpm/runtest.sh b/tests/openmp-rpm/runtest.sh similarity index 100% rename from openmp-rpm/runtest.sh rename to tests/openmp-rpm/runtest.sh diff --git a/openmp-rpm/test.c b/tests/openmp-rpm/test.c similarity index 100% rename from openmp-rpm/test.c rename to tests/openmp-rpm/test.c diff --git a/openmp-rpm/test.spec b/tests/openmp-rpm/test.spec similarity index 100% rename from openmp-rpm/test.spec rename to tests/openmp-rpm/test.spec diff --git a/ppc64le-long-double/exp.c b/tests/ppc64le-long-double/exp.c similarity index 100% rename from ppc64le-long-double/exp.c rename to tests/ppc64le-long-double/exp.c diff --git a/ppc64le-long-double/main.fmf b/tests/ppc64le-long-double/main.fmf similarity index 100% rename from ppc64le-long-double/main.fmf rename to tests/ppc64le-long-double/main.fmf diff --git a/ppc64le-long-double/parse.cpp b/tests/ppc64le-long-double/parse.cpp similarity index 100% rename from ppc64le-long-double/parse.cpp rename to tests/ppc64le-long-double/parse.cpp diff --git a/ppc64le-long-double/runtest-fedora.sh b/tests/ppc64le-long-double/runtest-fedora.sh similarity index 100% rename from ppc64le-long-double/runtest-fedora.sh rename to tests/ppc64le-long-double/runtest-fedora.sh diff --git a/ppc64le-long-double/runtest.sh b/tests/ppc64le-long-double/runtest.sh similarity index 100% rename from ppc64le-long-double/runtest.sh rename to tests/ppc64le-long-double/runtest.sh diff --git a/rhbz_1647130/main.fmf b/tests/rhbz_1647130/main.fmf similarity index 100% rename from rhbz_1647130/main.fmf rename to tests/rhbz_1647130/main.fmf diff --git a/rhbz_1647130/runtest.sh b/tests/rhbz_1647130/runtest.sh similarity index 100% rename from rhbz_1647130/runtest.sh rename to tests/rhbz_1647130/runtest.sh diff --git a/rhbz_1657544/from_chars.cpp b/tests/rhbz_1657544/from_chars.cpp similarity index 100% rename from rhbz_1657544/from_chars.cpp rename to tests/rhbz_1657544/from_chars.cpp diff --git a/rhbz_1657544/main.fmf b/tests/rhbz_1657544/main.fmf similarity index 100% rename from rhbz_1657544/main.fmf rename to tests/rhbz_1657544/main.fmf diff --git a/rhbz_1657544/runtest.sh b/tests/rhbz_1657544/runtest.sh similarity index 100% rename from rhbz_1657544/runtest.sh rename to tests/rhbz_1657544/runtest.sh diff --git a/rhbz_2239619/main.fmf b/tests/rhbz_2239619/main.fmf similarity index 100% rename from rhbz_2239619/main.fmf rename to tests/rhbz_2239619/main.fmf diff --git a/rhbz_2239619/runtest.sh b/tests/rhbz_2239619/runtest.sh similarity index 100% rename from rhbz_2239619/runtest.sh rename to tests/rhbz_2239619/runtest.sh diff --git a/rhbz_2239619/test.c b/tests/rhbz_2239619/test.c similarity index 100% rename from rhbz_2239619/test.c rename to tests/rhbz_2239619/test.c diff --git a/rhbz_482491/main.fmf b/tests/rhbz_482491/main.fmf similarity index 100% rename from rhbz_482491/main.fmf rename to tests/rhbz_482491/main.fmf diff --git a/rhbz_482491/test.sh b/tests/rhbz_482491/test.sh similarity index 100% rename from rhbz_482491/test.sh rename to tests/rhbz_482491/test.sh diff --git a/rpmmacros/main.fmf b/tests/rpmmacros/main.fmf similarity index 100% rename from rpmmacros/main.fmf rename to tests/rpmmacros/main.fmf diff --git a/rpmmacros/runtest.sh b/tests/rpmmacros/runtest.sh similarity index 100% rename from rpmmacros/runtest.sh rename to tests/rpmmacros/runtest.sh diff --git a/toolchains/hello.c b/tests/toolchains/hello.c similarity index 100% rename from toolchains/hello.c rename to tests/toolchains/hello.c diff --git a/toolchains/hello.cpp b/tests/toolchains/hello.cpp similarity index 100% rename from toolchains/hello.cpp rename to tests/toolchains/hello.cpp diff --git a/toolchains/main.fmf b/tests/toolchains/main.fmf similarity index 100% rename from toolchains/main.fmf rename to tests/toolchains/main.fmf diff --git a/toolchains/runtest.sh b/tests/toolchains/runtest.sh similarity index 100% rename from toolchains/runtest.sh rename to tests/toolchains/runtest.sh diff --git a/ucrt64-toolchain/main.fmf b/tests/ucrt64-toolchain/main.fmf similarity index 100% rename from ucrt64-toolchain/main.fmf rename to tests/ucrt64-toolchain/main.fmf diff --git a/ucrt64-toolchain/runtest.sh b/tests/ucrt64-toolchain/runtest.sh similarity index 100% rename from ucrt64-toolchain/runtest.sh rename to tests/ucrt64-toolchain/runtest.sh diff --git a/ucrt64-toolchain/test.cpp b/tests/ucrt64-toolchain/test.cpp similarity index 100% rename from ucrt64-toolchain/test.cpp rename to tests/ucrt64-toolchain/test.cpp diff --git a/use-correct-dwarf-default/.gitignore b/tests/use-correct-dwarf-default/.gitignore similarity index 100% rename from use-correct-dwarf-default/.gitignore rename to tests/use-correct-dwarf-default/.gitignore diff --git a/use-correct-dwarf-default/main.fmf b/tests/use-correct-dwarf-default/main.fmf similarity index 100% rename from use-correct-dwarf-default/main.fmf rename to tests/use-correct-dwarf-default/main.fmf diff --git a/use-correct-dwarf-default/test.sh b/tests/use-correct-dwarf-default/test.sh similarity index 100% rename from use-correct-dwarf-default/test.sh rename to tests/use-correct-dwarf-default/test.sh From 271a6a565d648491534408c72d46c42c91e0d4fc Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 29 Feb 2024 12:55:49 +0100 Subject: [PATCH 068/178] Reorganize plans: Create base config and reuse it from existing ones --- .../build-gating-alternatives.fmf | 25 +++------------ build-gating.fmf => plans/build-gating.fmf | 31 +++++++------------ plans/main.fmf | 21 +++++++++++++ 3 files changed, 37 insertions(+), 40 deletions(-) rename build-gating-alternatives.fmf => plans/build-gating-alternatives.fmf (59%) rename build-gating.fmf => plans/build-gating.fmf (56%) create mode 100644 plans/main.fmf diff --git a/build-gating-alternatives.fmf b/plans/build-gating-alternatives.fmf similarity index 59% rename from build-gating-alternatives.fmf rename to plans/build-gating-alternatives.fmf index 785152f..1087620 100644 --- a/build-gating-alternatives.fmf +++ b/plans/build-gating-alternatives.fmf @@ -11,29 +11,14 @@ # summary: LLD tests for build/PR gating, testing alternatives and spoiling the installation -adjust: +discover: + how: fmf + test: ld-alternative + +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: lld is not shipped for ppc64 - enabled: false - when: arch == ppc64 - - - because: lld is not shipped in s390x on LLVM < 18 - enabled: false - when: > - arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 - -discover: - - name: lld-tests - how: fmf - test: ld-alternative -execute: - how: tmt -provision: - hardware: - memory: ">= 4 GiB" diff --git a/build-gating.fmf b/plans/build-gating.fmf similarity index 56% rename from build-gating.fmf rename to plans/build-gating.fmf index 6be9987..ac2c0e3 100644 --- a/build-gating.fmf +++ b/plans/build-gating.fmf @@ -11,29 +11,20 @@ # summary: LLD tests for build/PR gating -adjust: +discover: + - name: lld-tests + how: fmf + filter: "tag:-spoils-installation" + - name: upstream-llvm-integration-testsuite + how: fmf + url: https://src.fedoraproject.org/tests/llvm.git + ref: main + test: integration-test-suite + +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: lld is not shipped for ppc64 - enabled: false - when: arch == ppc64 - - - because: lld is not shipped in s390x on LLVM < 18 - enabled: false - when: > - arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 - -discover: - - name: lld-tests - how: fmf - filter: "tag:-spoils-installation" -execute: - how: tmt -provision: - hardware: - memory: ">= 4 GiB" diff --git a/plans/main.fmf b/plans/main.fmf new file mode 100644 index 0000000..f4ec871 --- /dev/null +++ b/plans/main.fmf @@ -0,0 +1,21 @@ +# Base configuration for LLD testplans. +# All plans inherit metadata defined in this file. Hence, this file should +# contain configurations common to all environments, such as lld not being +# supported in certain architecture, or provision requirements. + +summary: LLD tests for build/PR gating +adjust: + - because: lld is not shipped in s390x on LLVM < 18 + enabled: false + when: > + arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 + + - because: lld is not shipped for ppc64 + enabled: false + when: arch == ppc64 + +execute: + how: tmt +provision: + hardware: + memory: ">= 4 GiB" From 598eead7e173bcb05a0905fc06d1444aa25f8e92 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 27 Feb 2024 13:47:37 +0100 Subject: [PATCH 069/178] Gather common metadata under a parent main.fmf Metadata common to all tests include component, contact, framework, test script and frequent required packages. Normalized script names to 'runtest.sh'. --- tests/clang-format-diff/main.fmf | 15 +++---- .../clang-format-diff/{test.sh => runtest.sh} | 0 tests/fedora-flags/main.fmf | 26 +---------- tests/gcc-clang-compatibility/main.fmf | 23 +--------- .../{test.sh => runtest.sh} | 0 tests/libomp/main.fmf | 10 +---- tests/llvm-test-suite/main.fmf | 6 +-- tests/llvm-test-suite/{test.sh => runtest.sh} | 0 tests/long-double/main.fmf | 26 +---------- tests/main.fmf | 45 +++++++++++++++++++ tests/openmp-rpm/main.fmf | 9 +--- tests/ppc64le-long-double/main.fmf | 28 ++---------- tests/rhbz_1647130/main.fmf | 12 +---- tests/rhbz_1657544/main.fmf | 23 ---------- tests/rhbz_2239619/main.fmf | 23 ---------- tests/rhbz_482491/main.fmf | 25 +---------- tests/rhbz_482491/{test.sh => runtest.sh} | 0 tests/rpmmacros/main.fmf | 6 +-- tests/toolchains/main.fmf | 12 ++--- tests/ucrt64-toolchain/main.fmf | 8 +--- tests/use-correct-dwarf-default/main.fmf | 9 +--- .../{test.sh => runtest.sh} | 0 22 files changed, 76 insertions(+), 230 deletions(-) rename tests/clang-format-diff/{test.sh => runtest.sh} (100%) rename tests/gcc-clang-compatibility/{test.sh => runtest.sh} (100%) rename tests/llvm-test-suite/{test.sh => runtest.sh} (100%) create mode 100644 tests/main.fmf rename tests/rhbz_482491/{test.sh => runtest.sh} (100%) rename tests/use-correct-dwarf-default/{test.sh => runtest.sh} (100%) diff --git a/tests/clang-format-diff/main.fmf b/tests/clang-format-diff/main.fmf index 15f4b9f..0fdeb7d 100644 --- a/tests/clang-format-diff/main.fmf +++ b/tests/clang-format-diff/main.fmf @@ -1,27 +1,22 @@ summary: clang-format-diff -test: "$WITH_SCL ./test.sh" -framework: shell tier: 1 -component: - - llvm-toolset - - clang extra-summary: /tools/clang/clang-format-diff extra-task: /tools/clang/clang-format-diff extra-nitrate: TC#0614126 -adjust: +adjust+: # Common requirements when LLVM is not SCL-ized - - require: + - require+: - clang-tools-extra when: "collection is not defined" # Requirements for SCL-ized LLVM - - require: + - require+: - llvm-toolset-13.0-clang-tools-extra when: "collection == llvm-toolset-13.0" - - require: + - require+: - llvm-toolset-14.0-clang-tools-extra when: "collection == llvm-toolset-14.0" - - require: + - require+: - llvm-toolset-15.0-clang-tools-extra when: "collection == llvm-toolset-15.0" diff --git a/tests/clang-format-diff/test.sh b/tests/clang-format-diff/runtest.sh similarity index 100% rename from tests/clang-format-diff/test.sh rename to tests/clang-format-diff/runtest.sh diff --git a/tests/fedora-flags/main.fmf b/tests/fedora-flags/main.fmf index f2ce847..5ee3879 100644 --- a/tests/fedora-flags/main.fmf +++ b/tests/fedora-flags/main.fmf @@ -1,34 +1,12 @@ summary: fedora-flags -test: "$WITH_SCL ./runtest.sh" -require: +require+: - redhat-rpm-config -framework: shell tier: 1 -component: - - llvm-toolset - - clang extra-summary: /tools/clang/fedora-flags extra-task: /tools/clang/fedora-flags extra-nitrate: TC#0614127 -adjust: - - # Common requirements when LLVM is not SCL-ized - - require+: - - clang - when: "collection is not defined" - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-clang - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-clang - when: "collection == llvm-toolset-15.0" - +adjust+: - because: s390x does not have epel repo which is required to provide rpm macros enabled: false when: >- diff --git a/tests/gcc-clang-compatibility/main.fmf b/tests/gcc-clang-compatibility/main.fmf index b880df5..6a29a8a 100644 --- a/tests/gcc-clang-compatibility/main.fmf +++ b/tests/gcc-clang-compatibility/main.fmf @@ -2,30 +2,9 @@ summary: Test that both gcc/clang compile/link compatibility. description: Build an object file with g++, link it with clang++ and viceversa, to ensure that objects compiled with one can be linked with the other. -test: "$WITH_SCL ./test.sh" -framework: shell tier: 1 -component: - - llvm-toolset - - clang extra-summary: /tools/clang/gcc-clang-compatibility extra-task: /tools/clang/gcc-clang-compatibility -require: +require+: - gcc-c++ - -adjust: - - require+: - - clang - when: collection is not defined - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-clang - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-clang - when: "collection == llvm-toolset-15.0" diff --git a/tests/gcc-clang-compatibility/test.sh b/tests/gcc-clang-compatibility/runtest.sh similarity index 100% rename from tests/gcc-clang-compatibility/test.sh rename to tests/gcc-clang-compatibility/runtest.sh diff --git a/tests/libomp/main.fmf b/tests/libomp/main.fmf index 62c7973..04d49f9 100644 --- a/tests/libomp/main.fmf +++ b/tests/libomp/main.fmf @@ -1,23 +1,17 @@ # 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 -component: - - llvm-toolset - - clang extra-summary: /tools/clang/libomp extra-task: /tools/clang/libomp extra-nitrate: TC#0614137 -require: - - clang +require+: - clang-libs - libomp - libomp-devel -adjust: +adjust+: - because: "libomp is not supported in s390x" when: arch == s390x enabled: false diff --git a/tests/llvm-test-suite/main.fmf b/tests/llvm-test-suite/main.fmf index 7d61dfb..e084bd1 100644 --- a/tests/llvm-test-suite/main.fmf +++ b/tests/llvm-test-suite/main.fmf @@ -1,16 +1,14 @@ # 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 -adjust: +adjust+: - because: "llvm-test-suite is available for Fedora, not RHEL/CentOS" when: >- distro == rhel or distro == centos enabled: false -test: "$WITH_SCL ./test.sh" - -require: +require+: - git - clang - ninja-build diff --git a/tests/llvm-test-suite/test.sh b/tests/llvm-test-suite/runtest.sh similarity index 100% rename from tests/llvm-test-suite/test.sh rename to tests/llvm-test-suite/runtest.sh diff --git a/tests/long-double/main.fmf b/tests/long-double/main.fmf index 71b2b42..21c9acb 100644 --- a/tests/long-double/main.fmf +++ b/tests/long-double/main.fmf @@ -1,33 +1,11 @@ summary: Test that gcc and clang use the same long double format -test: $WITH_SCL ./runtest.sh duration: 5m -framework: shell tier: 1 -component: - - llvm-toolset - - clang extra-summary: /tools/clang/long-double extra-task: /tools/clang/long-double extra-nitrate: TC#0614593 -adjust: - # Common requirements when LLVM is not SCL-ized - - require+: - - clang - when: "collection is not defined" +require+: + - gcc - - require+: - - gcc - when: distro != fedora - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-clang - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-clang - when: "collection == llvm-toolset-15.0" id: 4096a1bb-d2a5-4aeb-b14d-fc465c293e32 diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..9b52720 --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,45 @@ +# 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 + - clang + +# 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: ./runtest.sh + +# Commonly used keys are initialized to empty. +require: [] +link: [] +tag: [] + +adjust+: + # Common requirements when LLVM is not SCL-ized + - require+: + - clang + 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 -- ./runtest.sh + require+: + - llvm-toolset-13.0-clang + when: collection == llvm-toolset-13.0 + + - test: scl enable llvm-toolset-14.0 -- ./runtest.sh + require+: + - llvm-toolset-14.0-clang + when: collection == llvm-toolset-14.0 + + - test: scl enable llvm-toolset-15.0 -- ./runtest.sh + require+: + - llvm-toolset-15.0-clang + when: collection == llvm-toolset-15.0 diff --git a/tests/openmp-rpm/main.fmf b/tests/openmp-rpm/main.fmf index e899916..3a41ad5 100644 --- a/tests/openmp-rpm/main.fmf +++ b/tests/openmp-rpm/main.fmf @@ -1,17 +1,12 @@ summary: Test build a simple RPM package to ensure that -fopenmp works -test: "$WITH_SCL ./runtest.sh" -require: +require+: - rpm-build -framework: shell tier: 1 -component: - - llvm-toolset - - clang extra-summary: /tools/clang/openmp-rpm extra-task: /tools/clang/openmp-rpm extra-nitrate: TC#0614128 -adjust: +adjust+: - because: "libomp not supported in s390x" when: arch == s390x enabled: false diff --git a/tests/ppc64le-long-double/main.fmf b/tests/ppc64le-long-double/main.fmf index cd4e68f..9cadea0 100644 --- a/tests/ppc64le-long-double/main.fmf +++ b/tests/ppc64le-long-double/main.fmf @@ -1,21 +1,11 @@ summary: Test binary compatibility of the long double format on ppc64le -test: $WITH_SCL ./runtest.sh duration: 1h -framework: shell tier: 1 -component: - - llvm-toolset - - clang extra-summary: /tools/clang/ppc64le-long-double extra-task: /tools/clang/ppc64le-long-double extra-nitrate: TC#0614129 -adjust: - # Common requirements when LLVM is not SCL-ized - - require+: - - clang - when: "collection is not defined" - +adjust+: - because: "Fedora CI runs in x86_64 only, emulate with qemu and mock" require+: - qemu-user-static @@ -29,19 +19,9 @@ adjust: - because: "glibc in RHEL older than 9 don't support IEEE 128bit doubles" enabled: false - when: distro < rhel-9 + when: distro < rhel-9 or distro < centos-stream-9 - - require+: + - because: "The test runs natively on RHEL so get gcc to build" + require+: - gcc when: distro != fedora - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-clang - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-clang - when: "collection == llvm-toolset-15.0" diff --git a/tests/rhbz_1647130/main.fmf b/tests/rhbz_1647130/main.fmf index ea2d70d..c7252a0 100644 --- a/tests/rhbz_1647130/main.fmf +++ b/tests/rhbz_1647130/main.fmf @@ -1,32 +1,22 @@ summary: RHBZ1647130 -test: "$WITH_SCL ./runtest.sh" -require: [] -framework: shell tier: 1 -component: - - llvm-toolset - - clang extra-summary: /tools/clang/rhbz_167130 extra-task: /tools/clang/rhbz_167130 extra-nitrate: TC#0614130 -adjust: +adjust+: # Common requirements when LLVM is not SCL-ized - require+: - - clang - clang-analyzer when: "collection is not defined" # Requirements for SCL-ized LLVM - require+: - - llvm-toolset-13.0-clang - llvm-toolset-13.0-clang-analyzer when: "collection == llvm-toolset-13.0" - require+: - - llvm-toolset-14.0-clang - llvm-toolset-14.0-clang-analyzer when: "collection == llvm-toolset-14.0" - require+: - - llvm-toolset-15.0-clang - llvm-toolset-15.0-clang-analyzer when: "collection == llvm-toolset-15.0" diff --git a/tests/rhbz_1657544/main.fmf b/tests/rhbz_1657544/main.fmf index 0b6ab59..b947c0e 100644 --- a/tests/rhbz_1657544/main.fmf +++ b/tests/rhbz_1657544/main.fmf @@ -1,28 +1,5 @@ summary: RHBZ1657544 -test: "$WITH_SCL ./runtest.sh" -require: [] -framework: shell tier: 1 -component: - - llvm-toolset - - clang extra-summary: /tools/clang/rhbz_165744 extra-task: /tools/clang/rhbz_165744 extra-nitrate: TC#0614131 - -adjust: - # Common requirements when LLVM is not SCL-ized - - require+: - - clang - when: "collection is not defined" - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-clang - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-clang - when: "collection == llvm-toolset-15.0" diff --git a/tests/rhbz_2239619/main.fmf b/tests/rhbz_2239619/main.fmf index e0c5e69..dd5c972 100644 --- a/tests/rhbz_2239619/main.fmf +++ b/tests/rhbz_2239619/main.fmf @@ -1,25 +1,2 @@ summary: Test if debug information is disabled by default -test: "$WITH_SCL ./runtest.sh" -require: [] -framework: shell tier: 1 -component: - - llvm-toolset - - clang - -adjust: - # Common requirements when LLVM is not SCL-ized - - require+: - - clang - when: "collection is not defined" - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-clang - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-clang - when: "collection == llvm-toolset-15.0" diff --git a/tests/rhbz_482491/main.fmf b/tests/rhbz_482491/main.fmf index 6a3fa23..7f567a3 100644 --- a/tests/rhbz_482491/main.fmf +++ b/tests/rhbz_482491/main.fmf @@ -1,14 +1,9 @@ summary: rhbz-482491 description: | "Test that clang is able to find the right libgcc_s" -test: "$WITH_SCL ./test.sh" -require: +require+: - libgcc -framework: shell tier: 1 -component: - - llvm-toolset - - clang extra-summary: /tools/clang/rhbz_482194 extra-task: /tools/clang/rhbz_482194 extra-nitrate: TC#0614132 @@ -16,24 +11,8 @@ extra-nitrate: TC#0614132 link: - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1482491 -adjust: +adjust+: # gcc-x86_64-linux-gnu is not available in RHEL - require+: - gcc-x86_64-linux-gnu when: "distro == fedora" - - # Common requirements when LLVM is not SCL-ized - - require+: - - clang - when: "collection is not defined" - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-clang - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-clang - when: "collection == llvm-toolset-15.0" diff --git a/tests/rhbz_482491/test.sh b/tests/rhbz_482491/runtest.sh similarity index 100% rename from tests/rhbz_482491/test.sh rename to tests/rhbz_482491/runtest.sh diff --git a/tests/rpmmacros/main.fmf b/tests/rpmmacros/main.fmf index 265b158..7dc9d57 100644 --- a/tests/rpmmacros/main.fmf +++ b/tests/rpmmacros/main.fmf @@ -1,10 +1,6 @@ summary: Test if RPM macros are properly set -test: "./runtest.sh" -framework: shell tier: 1 -component: - - clang -require: +require+: - clang - clang-devel extra-summary: /tools/clang/rpmmacros diff --git a/tests/toolchains/main.fmf b/tests/toolchains/main.fmf index 5ce7fb6..ec80616 100644 --- a/tests/toolchains/main.fmf +++ b/tests/toolchains/main.fmf @@ -1,21 +1,15 @@ -# TODO REVIEW: better summary -summary: "" -test: "$WITH_SCL ./runtest.sh" -require: +summary: "Test integration between clang, compiler-rt and lld" +require+: - glibc-static - yum-utils # This require EPEL/CRB to be enabled on RHEL - libstdc++-static -framework: shell tier: 1 -component: - - llvm-toolset - - clang extra-summary: /tools/clang/toolchains extra-task: /tools/clang/toolchains extra-nitrate: TC#0614133 -adjust: +adjust+: # Common requirements when LLVM is not SCL-ized - require+: - clang diff --git a/tests/ucrt64-toolchain/main.fmf b/tests/ucrt64-toolchain/main.fmf index bd31699..18c9f22 100644 --- a/tests/ucrt64-toolchain/main.fmf +++ b/tests/ucrt64-toolchain/main.fmf @@ -1,12 +1,8 @@ summary: Test that ucrt64 toolchain is detected -test: ./runtest.sh -component: - - clang -require: - - clang +require+: - ucrt64-gcc-c++ -adjust: +adjust+: - enabled: false when: distro != fedora or distro < fedora-37 because: "The ucrt64 toolchain is only available since Fedora 37" diff --git a/tests/use-correct-dwarf-default/main.fmf b/tests/use-correct-dwarf-default/main.fmf index b20851d..da1ab93 100644 --- a/tests/use-correct-dwarf-default/main.fmf +++ b/tests/use-correct-dwarf-default/main.fmf @@ -1,17 +1,12 @@ summary: Test that clang uses DWARFv4 by default -test: "$WITH_SCL ./test.sh" -require: +require+: - libgcc -framework: shell tier: 1 -component: - - llvm-toolset - - clang extra-summary: /tools/clang/use-correct-dwarf-default extra-task: /tools/clang/use-correct-dwarf-default extra-nitrate: TC#0614134 -adjust: +adjust+: # Common requirements when LLVM is not SCL-ized - require+: - clang diff --git a/tests/use-correct-dwarf-default/test.sh b/tests/use-correct-dwarf-default/runtest.sh similarity index 100% rename from tests/use-correct-dwarf-default/test.sh rename to tests/use-correct-dwarf-default/runtest.sh From 77be13cc412ac07fc735302d64ca3d85fcc3fc55 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 29 Feb 2024 16:24:39 +0100 Subject: [PATCH 070/178] Update build-gating plan Collection adjustments no longer needed. Setup CRB in RHEL to take care of AWS/Beaker repo naming. Add discover setup for llvm-test-suite --- build-gating.fmf => plans/build-gating.fmf | 26 ++++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) rename build-gating.fmf => plans/build-gating.fmf (65%) diff --git a/build-gating.fmf b/plans/build-gating.fmf similarity index 65% rename from build-gating.fmf rename to plans/build-gating.fmf index 59192a1..419cced 100644 --- a/build-gating.fmf +++ b/plans/build-gating.fmf @@ -19,28 +19,14 @@ adjust: 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" - # Unfortunately, TMT does not support more declarative approach, we need to run commands on our own. - - because: "On RHEL, CRB must be enabled to provide rarer packages" + - because: "On RHEL-8+, CRB must be enabled to provide rarer packages" prepare+: - name: Enable CRB how: shell - script: dnf config-manager --set-enabled rhel-CRB + script: dnf config-manager --set-enabled *-CRB when: >- - distro == rhel-9 - or distro == rhel-8 + distro == rhel and distro >= rhel-8 # Unfortunately, TMT does not support more declarative approach, we need to run commands on our own. - because: "On CentOS, CRB must be enabled to provide rarer packages" @@ -55,6 +41,12 @@ discover: - name: clang-tests how: fmf filter: "tag:-not-in-default" + # TODO uncomment when https://src.fedoraproject.org/tests/llvm-test-suite/pull-request/10 is merged + # - name: llvm-test-suite + # how: fmf + # url: https://src.fedoraproject.org/tests/llvm-test-suite.git + # ref: main + # test: test-suite - name: upstream-llvm-integration-testsuite how: fmf url: https://src.fedoraproject.org/tests/llvm.git From defae036115551f9119e02669c71418ed66a7e9f Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 7 Mar 2024 09:37:32 +0100 Subject: [PATCH 071/178] Update s390x adjustments for LLVM 18 Adjust tests to reflect libomp and lld support for s390x libomp and openmp-rpm tests need to be run in s390x for LLVM>=18 toolchains test needs to install lld package and run lld commands --- tests/libomp/main.fmf | 5 +++-- tests/openmp-rpm/main.fmf | 3 ++- tests/toolchains/main.fmf | 6 ++++-- tests/toolchains/runtest.sh | 11 +++++++++-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/libomp/main.fmf b/tests/libomp/main.fmf index 04d49f9..499d11e 100644 --- a/tests/libomp/main.fmf +++ b/tests/libomp/main.fmf @@ -12,8 +12,9 @@ require+: - libomp-devel adjust+: - - because: "libomp is not supported in s390x" - when: arch == s390x + - because: "libomp is not supported in s390x in LLVM < 18" + when: > + arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 enabled: false # Dependencies in rhel-7 are handled differently: there are no recommends, diff --git a/tests/openmp-rpm/main.fmf b/tests/openmp-rpm/main.fmf index 3a41ad5..44f93a9 100644 --- a/tests/openmp-rpm/main.fmf +++ b/tests/openmp-rpm/main.fmf @@ -8,7 +8,8 @@ extra-nitrate: TC#0614128 adjust+: - because: "libomp not supported in s390x" - when: arch == s390x + when: > + arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 enabled: false continue: false diff --git a/tests/toolchains/main.fmf b/tests/toolchains/main.fmf index ec80616..c38a709 100644 --- a/tests/toolchains/main.fmf +++ b/tests/toolchains/main.fmf @@ -34,14 +34,16 @@ adjust+: - llvm-toolset-15.0-lld when: "collection == llvm-toolset-15.0" - # lld not supported in s390x or ppc64. If any lld package was added to + # lld not supported in s390x (LLVM<18) or ppc64. If any lld package was added to # requirements, remove it. - require-: - lld - llvm-toolset-13.0-lld - llvm-toolset-14.0-lld - llvm-toolset-15.0-lld - when: arch == s390x or arch == ppc64 + when: >- + arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 + or arch == ppc64 - environment+: CXXLIBS: "libc++" diff --git a/tests/toolchains/runtest.sh b/tests/toolchains/runtest.sh index 65594e6..546d809 100755 --- a/tests/toolchains/runtest.sh +++ b/tests/toolchains/runtest.sh @@ -59,6 +59,7 @@ test_toolchain() { clang --version # Repoquery is needed instead yum info for compatibility with RHEL-7 repoquery -i --installed $(rpm -qf $(which clang)) | grep ^Source +clang_version=$(rpm -q --queryformat "%{version}" clang | grep -ioP "^[0-9]+") echo "" for compiler in clang clang++; do @@ -80,8 +81,14 @@ for compiler in clang clang++; do args="$args -pthread" fi - # lld is not supported in s390x and ppc64 - if [[ "$(uname -m)" = "s390x" || "$(uname -m)" = "ppc64" ]] \ + # lld is not supported in ppc64 + if [[ "$(uname -m)" = "ppc64" ]] && [[ "$linker" = "lld" ]]; + then + continue + fi + + # lld is supported in s390x only in LLVM >= 18 + if [[ "$(uname -m)" = "s390x" ]] && [[ $clang_version -lt 18 ]] \ && [[ "$linker" = "lld" ]]; then continue From 23bd2ee6b29eca8cb7a6dc6cebf6130b50a327b2 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 7 Mar 2024 13:29:07 +0100 Subject: [PATCH 072/178] Add libomp component metadata to relevant tests --- tests/libomp/main.fmf | 2 ++ tests/openmp-rpm/main.fmf | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/libomp/main.fmf b/tests/libomp/main.fmf index 499d11e..be7284f 100644 --- a/tests/libomp/main.fmf +++ b/tests/libomp/main.fmf @@ -5,6 +5,8 @@ tier: 1 extra-summary: /tools/clang/libomp extra-task: /tools/clang/libomp extra-nitrate: TC#0614137 +component+: + - libomp require+: - clang-libs diff --git a/tests/openmp-rpm/main.fmf b/tests/openmp-rpm/main.fmf index 44f93a9..d009f3c 100644 --- a/tests/openmp-rpm/main.fmf +++ b/tests/openmp-rpm/main.fmf @@ -5,6 +5,8 @@ tier: 1 extra-summary: /tools/clang/openmp-rpm extra-task: /tools/clang/openmp-rpm extra-nitrate: TC#0614128 +component+: + - libomp adjust+: - because: "libomp not supported in s390x" From fa120530f17d1c61400bac933ca3d5e38329b6f3 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 7 Mar 2024 13:51:56 +0100 Subject: [PATCH 073/178] Move tests to subdirectory and gather common metadata in tests/main.fmf --- lldb-dwz/main.fmf | 30 ------------- python-embedded-interpreter/main.fmf | 38 ---------------- {lldb-dwz => tests/lldb-dwz}/hello.c | 0 tests/lldb-dwz/main.fmf | 8 ++++ {lldb-dwz => tests/lldb-dwz}/test.sh | 0 .../lldb-std-vector-prettyprint}/main.fmf | 10 +---- .../lldb-std-vector-prettyprint}/test.cpp | 0 .../lldb-std-vector-prettyprint}/test.sh | 0 tests/main.fmf | 45 +++++++++++++++++++ tests/python-embedded-interpreter/main.fmf | 8 ++++ .../python-embedded-interpreter}/test.cpp | 0 .../python-embedded-interpreter}/test.sh | 3 +- 12 files changed, 65 insertions(+), 77 deletions(-) delete mode 100644 lldb-dwz/main.fmf delete mode 100644 python-embedded-interpreter/main.fmf rename {lldb-dwz => tests/lldb-dwz}/hello.c (100%) create mode 100644 tests/lldb-dwz/main.fmf rename {lldb-dwz => tests/lldb-dwz}/test.sh (100%) rename {lldb-std-vector-prettyprint => tests/lldb-std-vector-prettyprint}/main.fmf (77%) rename {lldb-std-vector-prettyprint => tests/lldb-std-vector-prettyprint}/test.cpp (100%) rename {lldb-std-vector-prettyprint => tests/lldb-std-vector-prettyprint}/test.sh (100%) create mode 100644 tests/main.fmf create mode 100644 tests/python-embedded-interpreter/main.fmf rename {python-embedded-interpreter => tests/python-embedded-interpreter}/test.cpp (100%) rename {python-embedded-interpreter => tests/python-embedded-interpreter}/test.sh (84%) diff --git a/lldb-dwz/main.fmf b/lldb-dwz/main.fmf deleted file mode 100644 index 3892b15..0000000 --- a/lldb-dwz/main.fmf +++ /dev/null @@ -1,30 +0,0 @@ -summary: "Test that lldb doesn't crash with dwz debuginfo" -test: "$WITH_SCL ./test.sh" -require: - - gcc - - dwz -framework: shell -tier: 1 -component: - - llvm-toolset - - lldb -extra-summary: /tools/lldb/lldb-dwz -extra-task: /tools/lldb/lldb-dwz -extra-nitrate: TC#0614064 - -adjust: - # Common requirements when LLVM is not SCL-ized - - require+: - - lldb - when: collection is not defined - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-lldb - when: collection == llvm-toolset-13.0 - - require+: - - llvm-toolset-14.0-lldb - when: collection == llvm-toolset-14.0 - - require+: - - llvm-toolset-15.0-lldb - when: collection == llvm-toolset-15.0 diff --git a/python-embedded-interpreter/main.fmf b/python-embedded-interpreter/main.fmf deleted file mode 100644 index 97c9dfa..0000000 --- a/python-embedded-interpreter/main.fmf +++ /dev/null @@ -1,38 +0,0 @@ -summary: "Test lldb embedded interpreter (rhbz#1567262)" -description: "Ensure that lldb depends on python3-lldb" -test: "$WITH_SCL ./test.sh" -require: - - gcc-c++ -framework: shell -tier: 1 -component: - - llvm-toolset - - lldb -extra-summary: /tools/lldb/python-embedded-interpreter -extra-task: /tools/lldb/python-embedded-interpreter -extra-nitrate: TC#0614066 - -adjust: - # Common requirements when LLVM is not SCL-ized - - require+: - - lldb - environment+: - LLDB_PACKAGE: lldb - when: collection is not defined - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-lldb - environment+: - LLDB_PACKAGE: llvm-toolset-13.0-lldb - when: collection == llvm-toolset-13.0 - - require+: - - llvm-toolset-14.0-lldb - environment+: - LLDB_PACKAGE: llvm-toolset-14.0-lldb - when: collection == llvm-toolset-14.0 - - require+: - - llvm-toolset-15.0-lldb - environment+: - LLDB_PACKAGE: llvm-toolset-15.0-lldb - when: collection == llvm-toolset-15.0 diff --git a/lldb-dwz/hello.c b/tests/lldb-dwz/hello.c similarity index 100% rename from lldb-dwz/hello.c rename to tests/lldb-dwz/hello.c diff --git a/tests/lldb-dwz/main.fmf b/tests/lldb-dwz/main.fmf new file mode 100644 index 0000000..fe968c6 --- /dev/null +++ b/tests/lldb-dwz/main.fmf @@ -0,0 +1,8 @@ +summary: "Test that lldb doesn't crash with dwz debuginfo" +require+: + - gcc + - dwz +tier: 1 +extra-summary: /tools/lldb/lldb-dwz +extra-task: /tools/lldb/lldb-dwz +extra-nitrate: TC#0614064 diff --git a/lldb-dwz/test.sh b/tests/lldb-dwz/test.sh similarity index 100% rename from lldb-dwz/test.sh rename to tests/lldb-dwz/test.sh diff --git a/lldb-std-vector-prettyprint/main.fmf b/tests/lldb-std-vector-prettyprint/main.fmf similarity index 77% rename from lldb-std-vector-prettyprint/main.fmf rename to tests/lldb-std-vector-prettyprint/main.fmf index b1988ab..1d0f4c7 100644 --- a/lldb-std-vector-prettyprint/main.fmf +++ b/tests/lldb-std-vector-prettyprint/main.fmf @@ -1,18 +1,12 @@ summary: "Test lldb std::vector pretty printer" -test: "$WITH_SCL ./test.sh" -require: +require+: - gcc-c++ - - lldb -framework: shell tier: 1 -component: - - llvm-toolset - - lldb extra-summary: /tools/lldb/lldb-std-vector-prettyprint extra-task: /tools/lldb/lldb-std-vector-prettyprint extra-nitrate: TC#0614065 -adjust: +adjust+: # rhbz#2077932 rhbz#2082508 - because: "std::vector pretty printer does not work properly in RHEL<9 due to older libstdc++" enabled: false diff --git a/lldb-std-vector-prettyprint/test.cpp b/tests/lldb-std-vector-prettyprint/test.cpp similarity index 100% rename from lldb-std-vector-prettyprint/test.cpp rename to tests/lldb-std-vector-prettyprint/test.cpp diff --git a/lldb-std-vector-prettyprint/test.sh b/tests/lldb-std-vector-prettyprint/test.sh similarity index 100% rename from lldb-std-vector-prettyprint/test.sh rename to tests/lldb-std-vector-prettyprint/test.sh diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..878b5dd --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,45 @@ +# 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 + - lldb + +# 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+: + - lldb + 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-lldb + when: collection == llvm-toolset-13.0 + + - test: scl enable llvm-toolset-14.0 -- ./test.sh + require+: + - llvm-toolset-14.0-lldb + when: collection == llvm-toolset-14.0 + + - test: scl enable llvm-toolset-15.0 -- ./test.sh + require+: + - llvm-toolset-15.0-lldb + when: collection == llvm-toolset-15.0 diff --git a/tests/python-embedded-interpreter/main.fmf b/tests/python-embedded-interpreter/main.fmf new file mode 100644 index 0000000..385cc12 --- /dev/null +++ b/tests/python-embedded-interpreter/main.fmf @@ -0,0 +1,8 @@ +summary: "Test lldb embedded interpreter (rhbz#1567262)" +description: "Ensure that lldb depends on python3-lldb" +require+: + - gcc-c++ +tier: 1 +extra-summary: /tools/lldb/python-embedded-interpreter +extra-task: /tools/lldb/python-embedded-interpreter +extra-nitrate: TC#0614066 diff --git a/python-embedded-interpreter/test.cpp b/tests/python-embedded-interpreter/test.cpp similarity index 100% rename from python-embedded-interpreter/test.cpp rename to tests/python-embedded-interpreter/test.cpp diff --git a/python-embedded-interpreter/test.sh b/tests/python-embedded-interpreter/test.sh similarity index 84% rename from python-embedded-interpreter/test.sh rename to tests/python-embedded-interpreter/test.sh index e495c66..ca9e7e6 100755 --- a/python-embedded-interpreter/test.sh +++ b/tests/python-embedded-interpreter/test.sh @@ -1,6 +1,7 @@ #!/bin/sh -eux -# Verify the formal side of things, lldb should really depend on its Python bits. +# Verify the formal side of things, lldb should really depend on its Python bits +LLDB_PACKAGE=${LLDB_PACKAGE:-$(rpm -qf $(which lldb))} rpm -q --requires "$LLDB_PACKAGE" | grep python3-lldb # Sanity test From a07664eccf0ea93bdbdc0a570028cc0ce11eb722 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 7 Mar 2024 14:08:50 +0100 Subject: [PATCH 074/178] Refactor build-gating plan Move to dedicated directory. Removed no longer needed package adjustments which are now provided by the tests. Also included the integration testsuite to the plan and added the needed prepare steps for it --- build-gating.fmf | 42 ----------------------------------- plans/build-gating.fmf | 50 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 42 deletions(-) delete mode 100644 build-gating.fmf create mode 100644 plans/build-gating.fmf diff --git a/build-gating.fmf b/build-gating.fmf deleted file mode 100644 index e3a6bcf..0000000 --- a/build-gating.fmf +++ /dev/null @@ -1,42 +0,0 @@ -# -# Build/PR gating tests for LLDB -# -# 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: lldb 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 rust-toolset-1.58" - 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: lldb-tests - how: fmf -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..3068056 --- /dev/null +++ b/plans/build-gating.fmf @@ -0,0 +1,50 @@ +# +# Build/PR gating tests for LLDB +# +# 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: lldb 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: lldb-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" From c419262848c10290a6a437a667a20181a928823d Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 7 Mar 2024 14:36:13 +0100 Subject: [PATCH 075/178] build-gating: add CRB repos in prepare for RHEL/CentOS --- plans/build-gating.fmf | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plans/build-gating.fmf b/plans/build-gating.fmf index ac2c0e3..5e3a35a 100644 --- a/plans/build-gating.fmf +++ b/plans/build-gating.fmf @@ -28,3 +28,19 @@ adjust+: 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 From 6c3812f47267d2fc673c8795678a112792cc20c8 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 29 Feb 2024 18:41:58 +0100 Subject: [PATCH 076/178] 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 acbe4aee52ba6e2ee89f150eff1c4fdbf2fa0226 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 7 Mar 2024 16:35:42 +0100 Subject: [PATCH 077/178] Add documentation to README.md --- README.md | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.rst | 0 2 files changed, 99 insertions(+) create mode 100644 README.md delete mode 100644 README.rst diff --git a/README.md b/README.md new file mode 100644 index 0000000..9dc5c60 --- /dev/null +++ b/README.md @@ -0,0 +1,99 @@ +# clang tests + +This repository contains tests for clang. + +## 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 `runtest.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-38 tests show ucrt64-toolchain +/tests/ucrt64-toolchain + summary Test that ucrt64 toolchain is detected + contact Jesus Checa Hidalgo + component 'llvm-toolset' and 'clang' + test ./runtest.sh + path /tests/ucrt64-toolchain + framework shell + manual false + tty false + require 'ucrt64-gcc-c++' and 'clang' + duration 5m + enabled true + result respect + +$ tmt -c distro=rhel-9.3 tests show ucrt64-toolchain +/tests/ucrt64-toolchain + summary Test that ucrt64 toolchain is detected + contact Jesus Checa Hidalgo + component 'llvm-toolset' and 'clang' + test ./runtest.sh + path /tests/ucrt64-toolchain + framework shell + manual false + tty false + require 'ucrt64-gcc-c++' and 'clang' + duration 5m + enabled false + result respect +``` + +### 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 +``` diff --git a/README.rst b/README.rst deleted file mode 100644 index e69de29..0000000 From 443a26a24dc34947b5fe106c0b2fdd6276b75372 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 7 Mar 2024 16:50:23 +0100 Subject: [PATCH 078/178] Add documentation to README.md --- README.md | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d6f5046..dd21f0b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,104 @@ -# lldb +# lldb Tests -lldb tests \ No newline at end of file +This repository contains tests for lldb. + +## 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 python-embedded-interpreter +/tests/python-embedded-interpreter + summary Test lldb embedded interpreter (rhbz#1567262) + description Ensure that lldb depends on python3-lldb + contact Jesus Checa Hidalgo + component 'llvm-toolset' and 'lldb' + test ./test.sh + path /tests/python-embedded-interpreter + framework shell + manual false + tty false + require 'gcc-c++' and 'lldb' + duration 5m + enabled true + result respect + tier 1 + +$ tmt -c collection=llvm-toolset-15.0 tests show python-embedded-interpreter +/tests/python-embedded-interpreter + summary Test lldb embedded interpreter (rhbz#1567262) + description Ensure that lldb depends on python3-lldb + contact Jesus Checa Hidalgo + component 'llvm-toolset' and 'lldb' + test scl enable llvm-toolset-15.0 -- ./test.sh + path /tests/python-embedded-interpreter + framework shell + manual false + tty false + require 'gcc-c++' and 'llvm-toolset-15.0-lldb' + 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 fa8bc5eb0b07cd00289cfc11a3a4a3d2f3a45610 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 1 Mar 2024 14:37:44 +0100 Subject: [PATCH 079/178] 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 080/178] 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 2b4086412b62d84d3dd985aa5355b0374208691d Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 2 Apr 2024 08:15:28 +0200 Subject: [PATCH 081/178] fix readme formatting --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9dc5c60..91a6458 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ This repository contains tests for clang. 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 4a8c55b5320412f8ecff47e64fc0c67699bc50fd Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 2 Apr 2024 08:51:06 +0200 Subject: [PATCH 082/178] 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 5a88effc474b6675f8ea4ac27a790a1d6a69deb2 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 2 Apr 2024 08:55:03 +0200 Subject: [PATCH 083/178] Fix readme formatting --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a833736..43f98aa 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ This repository contains tests for LLD. 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 3e0a05df6c9da39a6e13ddbde55bdd94d4056069 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 2 Apr 2024 08:55:51 +0200 Subject: [PATCH 084/178] Fix readme formatting --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index dd21f0b..f8c9164 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ This repository contains tests for lldb. 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 0d4c50b5e0ba3022cdcc928fbc9e8d56f0355a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Mar 2024 10:51:27 +0100 Subject: [PATCH 085/178] Add test to check -pie works. --- tests/pie-rpm/.gitignore | 5 +++++ tests/pie-rpm/main.fmf | 13 +++++++++++++ tests/pie-rpm/pie.c | 6 ++++++ tests/pie-rpm/pie.spec | 37 +++++++++++++++++++++++++++++++++++++ tests/pie-rpm/runtest.sh | 27 +++++++++++++++++++++++++++ 5 files changed, 88 insertions(+) create mode 100644 tests/pie-rpm/.gitignore create mode 100644 tests/pie-rpm/main.fmf create mode 100644 tests/pie-rpm/pie.c create mode 100644 tests/pie-rpm/pie.spec create mode 100755 tests/pie-rpm/runtest.sh diff --git a/tests/pie-rpm/.gitignore b/tests/pie-rpm/.gitignore new file mode 100644 index 0000000..f9dfc4f --- /dev/null +++ b/tests/pie-rpm/.gitignore @@ -0,0 +1,5 @@ +pie +pie-static +pie-shared +pie-no-pie +pie.o diff --git a/tests/pie-rpm/main.fmf b/tests/pie-rpm/main.fmf new file mode 100644 index 0000000..c811cbb --- /dev/null +++ b/tests/pie-rpm/main.fmf @@ -0,0 +1,13 @@ +summary: Check that we build rpms with -pie +tier: 1 + +require+: + - clang + - clang-libs + - rpm-build + - glibc-static + +adjust: + - enabled: false + when: distro != fedora or distro < fedora-40 + because: "We only started doing this in Fedora 40" diff --git a/tests/pie-rpm/pie.c b/tests/pie-rpm/pie.c new file mode 100644 index 0000000..5423ce6 --- /dev/null +++ b/tests/pie-rpm/pie.c @@ -0,0 +1,6 @@ + + + +int main(int argc, char **argv) { + return 0; +} diff --git a/tests/pie-rpm/pie.spec b/tests/pie-rpm/pie.spec new file mode 100644 index 0000000..4d8b859 --- /dev/null +++ b/tests/pie-rpm/pie.spec @@ -0,0 +1,37 @@ +%global toolchain clang + +Name: pie +Version: 1 +Release: %autorelease +Summary: Check that -pie is passed. + +License: MIT +Source0: pie.c + +BuildRequires: clang + +%description +Make sure the standard configuration from redhat-rpm-config passes -pie when linking. + +%build + +LDFLAGS="${LDFLAGS} -Werror" + +clang ${CFLAGS} -c %{SOURCE0} -o %{NAME}.o + +# Regular +clang ${LDFLAGS} %{NAME}.o -o %{NAME} + +# With -shared +clang ${LDFLAGS} -shared %{NAME}.o -o %{NAME}-shared + +# With -static +clang ${LDFLAGS} -static %{NAME}.o -o %{NAME}-static + +# With -no-pie +clang ${LDFLAGS} -no-pie %{NAME}.o -o %{NAME}-no-pie + + + +%changelog +%autochangelog diff --git a/tests/pie-rpm/runtest.sh b/tests/pie-rpm/runtest.sh new file mode 100755 index 0000000..7758028 --- /dev/null +++ b/tests/pie-rpm/runtest.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -ex +set pipefail + +#${BUILDDEP_CMD} -y pie.spec + +rm -f pie{,.o} +QA_RPATHS=$(( 0x0001 )) rpmbuild -bb ./pie.spec --define '_sourcedir .' --define '_builddir .' + + if [[ "$(file ./pie)" != *"pie executable"* ]]; then + exit 1 + fi + +if [[ "$(file ./pie-shared)" == *"pie executable"* ]]; then + exit 1 +fi + +if [[ "$(file ./pie-static)" == *"pie executable"* ]]; then + exit 1 +fi + +if [[ "$(file ./pie-no-pie)" == *"pie executable"* ]]; then + exit 1 +fi + +exit 0 From f58e59b3942f6b7254f450d6ab5b934db2275d38 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Thu, 4 Apr 2024 09:20:18 -0300 Subject: [PATCH 086/178] Temporarily tag pie-rpm as not-in-default Filter out this test until redhat-rpm-config gets its side of the update. Otherwise, this will cause failures when building clang on Fedora and when running the daily snapshots. --- tests/pie-rpm/main.fmf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/pie-rpm/main.fmf b/tests/pie-rpm/main.fmf index c811cbb..9aa23e3 100644 --- a/tests/pie-rpm/main.fmf +++ b/tests/pie-rpm/main.fmf @@ -7,7 +7,11 @@ require+: - rpm-build - glibc-static -adjust: +# TODO: Untag this test when redhat-rpm-config is modified. +# See: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/291 +tag: not-in-default + +adjust+: - enabled: false when: distro != fedora or distro < fedora-40 because: "We only started doing this in Fedora 40" 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 087/178] 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 020d712305283a84c7a5ad66480396e1bc22ec46 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Mon, 15 Apr 2024 13:00:15 -0300 Subject: [PATCH 088/178] Run ppc64le-long-double natively on snapshot executions Snapshot builds are able to test natively on ppc64le despite using Fedora. This restriction only exists when running Bodhi tests. So, let ppc64le-long-double use the same test script as RHEL. --- tests/ppc64le-long-double/main.fmf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ppc64le-long-double/main.fmf b/tests/ppc64le-long-double/main.fmf index 9cadea0..c17e9b7 100644 --- a/tests/ppc64le-long-double/main.fmf +++ b/tests/ppc64le-long-double/main.fmf @@ -11,7 +11,7 @@ adjust+: - qemu-user-static - mock test: ./runtest-fedora.sh - when: distro == fedora and arch == x86_64 + when: distro == fedora and arch == x86_64 and snapshot is not defined continue: false - enabled: false @@ -24,4 +24,4 @@ adjust+: - because: "The test runs natively on RHEL so get gcc to build" require+: - gcc - when: distro != fedora + when: distro != fedora or snapshot is defined From 487364d65bb9ee06e52aa4d805055195fb42ed72 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 15 Apr 2024 16:26:20 +0200 Subject: [PATCH 089/178] Fix wrong relevancy for libomp tests libomp is supported in s390x only in Fedora, and if LLVM is 18 or newer For libomp installed from fedora repos this means Fedora >= 40, for LLVM snapshots it's enabled always. --- tests/libomp/main.fmf | 12 +++++++++--- tests/openmp-rpm/main.fmf | 11 ++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tests/libomp/main.fmf b/tests/libomp/main.fmf index be7284f..ccd2300 100644 --- a/tests/libomp/main.fmf +++ b/tests/libomp/main.fmf @@ -14,10 +14,16 @@ require+: - libomp-devel adjust+: - - because: "libomp is not supported in s390x in LLVM < 18" - when: > - arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 + # Right now libomp in s390x is supported only in LLVM >= 18 in Fedora + # TODO until tmt allows to use custom adjusted contexts we need to do this + # indirect adjustment using the distro version. + - when: arch == s390x and distro < fedora-40 and snapshot is not defined enabled: false + continue: false + + - when: arch == s390x and distro != fedora + enabled: false + continue: false # Dependencies in rhel-7 are handled differently: there are no recommends, # only requires. diff --git a/tests/openmp-rpm/main.fmf b/tests/openmp-rpm/main.fmf index d009f3c..8443b21 100644 --- a/tests/openmp-rpm/main.fmf +++ b/tests/openmp-rpm/main.fmf @@ -9,9 +9,14 @@ component+: - libomp adjust+: - - because: "libomp not supported in s390x" - when: > - arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 + # Right now libomp in s390x is supported only in LLVM >= 18 in Fedora + # TODO until tmt allows to use custom adjusted contexts we need to do this + # indirect adjustment using the distro version. + - when: arch == s390x and distro < fedora-40 and snapshot is not defined + enabled: false + continue: false + + - when: arch == s390x and distro != fedora enabled: false continue: false From 84b1265f72888efcb9683788f1c78455ac0cf005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 15 Apr 2024 10:23:08 +0200 Subject: [PATCH 090/178] Add more pie-rpm tests Make sure we also get the expected behavior when _pre_pending additional flags to $LDFLAGS --- tests/pie-rpm/pie.spec | 10 ++++++---- tests/pie-rpm/runtest.sh | 23 ++++++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/tests/pie-rpm/pie.spec b/tests/pie-rpm/pie.spec index 4d8b859..5d2913d 100644 --- a/tests/pie-rpm/pie.spec +++ b/tests/pie-rpm/pie.spec @@ -23,14 +23,16 @@ clang ${CFLAGS} -c %{SOURCE0} -o %{NAME}.o clang ${LDFLAGS} %{NAME}.o -o %{NAME} # With -shared -clang ${LDFLAGS} -shared %{NAME}.o -o %{NAME}-shared +clang ${LDFLAGS} -shared %{NAME}.o -o %{NAME}-shared-pre +clang -shared ${LDFLAGS} %{NAME}.o -o %{NAME}-shared-post # With -static -clang ${LDFLAGS} -static %{NAME}.o -o %{NAME}-static +clang ${LDFLAGS} -static %{NAME}.o -o %{NAME}-static-pre +clang -static ${LDFLAGS} %{NAME}.o -o %{NAME}-static-post # With -no-pie -clang ${LDFLAGS} -no-pie %{NAME}.o -o %{NAME}-no-pie - +clang ${LDFLAGS} -no-pie %{NAME}.o -o %{NAME}-no-pie-pre +clang -no-pie ${LDFLAGS} %{NAME}.o -o %{NAME}-no-pie-post %changelog diff --git a/tests/pie-rpm/runtest.sh b/tests/pie-rpm/runtest.sh index 7758028..3ce2f91 100755 --- a/tests/pie-rpm/runtest.sh +++ b/tests/pie-rpm/runtest.sh @@ -8,19 +8,28 @@ set pipefail rm -f pie{,.o} QA_RPATHS=$(( 0x0001 )) rpmbuild -bb ./pie.spec --define '_sourcedir .' --define '_builddir .' - if [[ "$(file ./pie)" != *"pie executable"* ]]; then - exit 1 - fi - -if [[ "$(file ./pie-shared)" == *"pie executable"* ]]; then +if [[ "$(file ./pie)" != *"pie executable"* ]]; then exit 1 fi -if [[ "$(file ./pie-static)" == *"pie executable"* ]]; then +if [[ "$(file ./pie-shared-pre)" == *"pie executable"* ]]; then + exit 1 +fi +if [[ "$(file ./pie-shared-post)" == *"pie executable"* ]]; then exit 1 fi -if [[ "$(file ./pie-no-pie)" == *"pie executable"* ]]; then +if [[ "$(file ./pie-static-pre)" == *"pie executable"* ]]; then + exit 1 +fi +if [[ "$(file ./pie-static-post)" == *"pie executable"* ]]; then + exit 1 +fi + +if [[ "$(file ./pie-no-pie-pre)" == *"pie executable"* ]]; then + exit 1 +fi +if [[ "$(file ./pie-no-pie-post)" == *"pie executable"* ]]; then exit 1 fi From 6e7caab25c343059aa4abb52c03bb37b2b15bfc6 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 25 Apr 2024 11:29:35 +0200 Subject: [PATCH 091/178] 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 b3c624504cefc4e5e66b635b50433b84d7972895 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 12 Apr 2024 12:46:39 +0200 Subject: [PATCH 092/178] libomp: remove hardcoded clang package Query the clang nvr checking which package provides the clang binary instead querying directly for "clang" package. Add also support for running the test with compat packages (clang17, clang16) --- tests/libomp/runtest.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/libomp/runtest.sh b/tests/libomp/runtest.sh index 2f3b9a5..dfe811f 100755 --- a/tests/libomp/runtest.sh +++ b/tests/libomp/runtest.sh @@ -2,17 +2,22 @@ set -exo pipefail -CLANG_VERSION=$(rpm --queryformat="%{version}" -q clang.$(uname -m)) -LIBOMP_DEPENDENCIES="libomp libomp-devel" +CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang))) + +# For compat packages, we want to check if there's a package suffix: clang17 instead clang for example +PKG_SUFFIX=${CLANG_PKG#clang} +CLANG_NVR=$(rpm -q $CLANG_PKG) +CLANG_VERSION=$(rpm --queryformat="%{version}" -q $CLANG_NVR) +LIBOMP_DEPENDENCIES="libomp${PKG_SUFFIX} libomp${PKG_SUFFIX}-devel" # Ensure clang depends on the correct clang-libs version -rpm -q --requires clang | grep "clang-libs.* = ${CLANG_VERSION}" +rpm -q --requires ${CLANG_NVR} | grep "${CLANG_PKG}-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 -q --recommends clang${PKG_SUFFIX}-libs | grep "${lomp_dep}.* = ${CLANG_VERSION}" [[ "$(rpm --queryformat="%{version}" -q ${lomp_dep}.$(uname -m))" == "${CLANG_VERSION}" ]] done From 0f16004a0a185e52ce3462def8cb38d75b0a7498 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 12 Apr 2024 16:47:38 +0200 Subject: [PATCH 093/178] openmp-rpm: Do not run dnf builddep tmt should take care of any dependencies required by the test. Letting the test call dnf and install packages can break the environment and cause invalid results in subsequent tests, specially when testing compat packages. --- tests/openmp-rpm/main.fmf | 27 ++++++--------------------- tests/openmp-rpm/runtest.sh | 4 +++- tests/openmp-rpm/test.spec | 6 ++++-- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/tests/openmp-rpm/main.fmf b/tests/openmp-rpm/main.fmf index 8443b21..0bd8f48 100644 --- a/tests/openmp-rpm/main.fmf +++ b/tests/openmp-rpm/main.fmf @@ -20,35 +20,20 @@ adjust+: enabled: false continue: false - - because: "Use yum in RHEL < 8" - require+: - - yum-utils - environment+: - BUILDDEP_CMD: "yum-builddep" - when: distro == rhel and distro < rhel-8 - - - because: "Use dnf5 in Fedora 39+" - require+: - - dnf5-plugins - environment+: - BUILDDEP_CMD: "dnf builddep" - continue: false - when: distro == fedora and distro >= fedora-39 - - - 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 + - require+: + - libomp + when: collection is not defined # Requirements for SCL-ized LLVM - require+: - llvm-toolset-13.0-build + - llvm-toolset-13.0-libomp when: "collection == llvm-toolset-13.0" - require+: - llvm-toolset-14.0-build + - llvm-toolset-14.0-libomp when: "collection == llvm-toolset-14.0" - require+: - llvm-toolset-15.0-build + - llvm-toolset-15.0-libomp when: "collection == llvm-toolset-15.0" diff --git a/tests/openmp-rpm/runtest.sh b/tests/openmp-rpm/runtest.sh index 86ec074..61eb313 100755 --- a/tests/openmp-rpm/runtest.sh +++ b/tests/openmp-rpm/runtest.sh @@ -2,5 +2,7 @@ set -ex -${BUILDDEP_CMD} -y test.spec +# Do not run dnf builddep here. TMT should take care of any packages needed to +# run the test. If the rpmbuild fails due to missing packages, then fmf metadata +# needs to be fixed. QA_RPATHS=$(( 0x0001 )) rpmbuild --define '_sourcedir .' --define '_builddir .' -bb test.spec diff --git a/tests/openmp-rpm/test.spec b/tests/openmp-rpm/test.spec index e317a6a..1fbb256 100644 --- a/tests/openmp-rpm/test.spec +++ b/tests/openmp-rpm/test.spec @@ -7,8 +7,10 @@ Release: 1 Summary: Test package for checking that RPM packages using -fopenmp build correctly License: MIT -BuildRequires: %{?scl_prefix}clang -BuildRequires: %{?scl_prefix}libomp +# Do not set buildrequires, tmt should cover any requirements to build. +# If not, tmt test metadata must be updated. +# BuildRequires: %{?scl_prefix}clang +# BuildRequires: %{?scl_prefix}libomp Source0: test.c From 0297643810d88c61e74dd65d567116a9e26cbe22 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 12 Apr 2024 16:50:33 +0200 Subject: [PATCH 094/178] remove hardcoded clang package when calling rpm command Use the clang command to locate the correct clang package name instead of hardcoding "clang" in the test. This is needed for the test to work with compat packages which are named differently. --- tests/rpmmacros/runtest.sh | 2 +- tests/toolchains/runtest.sh | 5 +++-- tests/use-correct-dwarf-default/runtest.sh | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/rpmmacros/runtest.sh b/tests/rpmmacros/runtest.sh index 658dc0d..99295c3 100755 --- a/tests/rpmmacros/runtest.sh +++ b/tests/rpmmacros/runtest.sh @@ -1,6 +1,6 @@ #!/bin/sh -eux -clang_pkg=${1:-"clang"} +clang_pkg=${1:-"$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang)))"} macros_path="/usr/lib/rpm/macros.d/macros.clang" set pipefail diff --git a/tests/toolchains/runtest.sh b/tests/toolchains/runtest.sh index 546d809..0d1a3e5 100755 --- a/tests/toolchains/runtest.sh +++ b/tests/toolchains/runtest.sh @@ -57,9 +57,10 @@ test_toolchain() { } clang --version +CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang))) # Repoquery is needed instead yum info for compatibility with RHEL-7 -repoquery -i --installed $(rpm -qf $(which clang)) | grep ^Source -clang_version=$(rpm -q --queryformat "%{version}" clang | grep -ioP "^[0-9]+") +repoquery -i --installed $CLANG_PKG | grep ^Source +clang_version=$(rpm -q --queryformat "%{version}" $CLANG_PKG | grep -ioP "^[0-9]+") echo "" for compiler in clang clang++; do diff --git a/tests/use-correct-dwarf-default/runtest.sh b/tests/use-correct-dwarf-default/runtest.sh index ac9b23a..9918462 100755 --- a/tests/use-correct-dwarf-default/runtest.sh +++ b/tests/use-correct-dwarf-default/runtest.sh @@ -6,7 +6,8 @@ required_dwarf_version=4 # Get clang version -clang_version=$(rpm -q --queryformat "%{version}" clang | grep -ioP "^[0-9]+") +CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang))) +clang_version=$(rpm -q --queryformat "%{version}" $CLANG_PKG | grep -ioP "^[0-9]+") if [ $clang_version -ge 18 ]; then >&2 echo "clang is greater or equal version 18"; required_dwarf_version=5 From 3449426c91126f2c09a0b298c4e88f5706916b80 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 12 Apr 2024 17:04:11 +0200 Subject: [PATCH 095/178] Remove redundant clang requires --- tests/pie-rpm/main.fmf | 1 - tests/rpmmacros/main.fmf | 1 - tests/toolchains/main.fmf | 1 - tests/use-correct-dwarf-default/main.fmf | 1 - 4 files changed, 4 deletions(-) diff --git a/tests/pie-rpm/main.fmf b/tests/pie-rpm/main.fmf index 9aa23e3..0a35fb6 100644 --- a/tests/pie-rpm/main.fmf +++ b/tests/pie-rpm/main.fmf @@ -2,7 +2,6 @@ summary: Check that we build rpms with -pie tier: 1 require+: - - clang - clang-libs - rpm-build - glibc-static diff --git a/tests/rpmmacros/main.fmf b/tests/rpmmacros/main.fmf index 7dc9d57..05c3245 100644 --- a/tests/rpmmacros/main.fmf +++ b/tests/rpmmacros/main.fmf @@ -1,7 +1,6 @@ summary: Test if RPM macros are properly set tier: 1 require+: - - clang - clang-devel extra-summary: /tools/clang/rpmmacros extra-task: /tools/clang/rpmmacros diff --git a/tests/toolchains/main.fmf b/tests/toolchains/main.fmf index c38a709..20bfdcb 100644 --- a/tests/toolchains/main.fmf +++ b/tests/toolchains/main.fmf @@ -12,7 +12,6 @@ extra-nitrate: TC#0614133 adjust+: # Common requirements when LLVM is not SCL-ized - require+: - - clang - compiler-rt - lld when: "collection is not defined" diff --git a/tests/use-correct-dwarf-default/main.fmf b/tests/use-correct-dwarf-default/main.fmf index da1ab93..3dcde07 100644 --- a/tests/use-correct-dwarf-default/main.fmf +++ b/tests/use-correct-dwarf-default/main.fmf @@ -9,7 +9,6 @@ extra-nitrate: TC#0614134 adjust+: # Common requirements when LLVM is not SCL-ized - require+: - - clang - llvm when: "collection is not defined" From 5e5ec124255d68af0905ce85ac32def45be3dae2 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Fri, 3 May 2024 14:52:15 +0200 Subject: [PATCH 096/178] 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 ++++++++++++++++ tests/rhbz_1647130/runtest.sh | 1 - tests/use-correct-dwarf-default/.gitignore | 2 +- 4 files changed, 31 insertions(+), 2 deletions(-) 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 91a6458..af7c5f9 100644 --- a/README.md +++ b/README.md @@ -99,3 +99,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. diff --git a/tests/rhbz_1647130/runtest.sh b/tests/rhbz_1647130/runtest.sh index ab515c7..6898f78 100755 --- a/tests/rhbz_1647130/runtest.sh +++ b/tests/rhbz_1647130/runtest.sh @@ -7,4 +7,3 @@ tmp_dir=`mktemp -d` echo 'int main(int argc, char*argv[]) { while(argc--) new int(); return 0; }' > $tmp_cpp scan-build -o $tmp_dir clang++ -c $tmp_cpp -o /dev/null (scan-view --no-browser $tmp_dir/* & WPID=$! && sleep 10s && kill $WPID) - diff --git a/tests/use-correct-dwarf-default/.gitignore b/tests/use-correct-dwarf-default/.gitignore index 0acf80b..6a1fffa 100644 --- a/tests/use-correct-dwarf-default/.gitignore +++ b/tests/use-correct-dwarf-default/.gitignore @@ -1,2 +1,2 @@ a.out -build.log \ No newline at end of file +build.log From f3053280b2b44bd36c8c5986c3580379e2f54569 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Fri, 3 May 2024 15:19:59 +0200 Subject: [PATCH 097/178] 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 4359d2901335b26a927cda11be6b6a016eed283a Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Fri, 3 May 2024 14:58:53 +0200 Subject: [PATCH 098/178] 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 ++++++++++++++++ tests/main.fmf | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) 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 43f98aa..7dbb32a 100644 --- a/README.md +++ b/README.md @@ -100,3 +100,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. diff --git a/tests/main.fmf b/tests/main.fmf index 47ffb7d..153c1f0 100644 --- a/tests/main.fmf +++ b/tests/main.fmf @@ -51,4 +51,4 @@ adjust+: - test: scl enable llvm-toolset-15.0 -- ./test.sh require+: - llvm-toolset-15.0-lld - when: collection == llvm-toolset-15.0 \ No newline at end of file + when: collection == llvm-toolset-15.0 From 3d9db8ae3585b4231c52c05e17d7be9de9adc661 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 20 Mar 2024 20:04:07 +0100 Subject: [PATCH 099/178] Create kernel-ark rebuild test This commit adds a new test that rebuilds kernel-ark with clang to ensure that we do not break the upstream builds. This is a squashed commit of the following: PoC for kernel-ark build test and plan kernel-ark: create virtual test and run all build configurations Created configurations for lto/non-lto and base/debug, adding proper relevancies. Test script parametrized with environment variables so it can be reused by all these configs. Fix relevancy for debug/non-lto build Fix dependency install logic Final cleanups Make kernel-ark-build plan to be run only if triggered manually Rename kernel-ark plan to avoid naming confusions with the test Add documentation for kernel-ark test --- README.md | 28 ++++++++++++ plans/kernel-ark-gating.fmf | 18 ++++++++ tests/kernel-ark-build/main.fmf | 52 ++++++++++++++++++++++ tests/kernel-ark-build/runtest.sh | 71 +++++++++++++++++++++++++++++++ 4 files changed, 169 insertions(+) create mode 100644 plans/kernel-ark-gating.fmf create mode 100644 tests/kernel-ark-build/main.fmf create mode 100755 tests/kernel-ark-build/runtest.sh diff --git a/README.md b/README.md index af7c5f9..ccf75d3 100644 --- a/README.md +++ b/README.md @@ -115,3 +115,31 @@ Please install `pre-commit` using `pip install pre-commit` as described 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. + +## Test specific documentation + +### kernel-ark-rebuild +The `kernel-ark-rebuild` test is a special test that we use to ensure that clang, +llvm, and lld builds do not break [Always Ready Kernel]( +https://gitlab.com/cki-project/kernel-ark) builds, which are done in Fedora +Rawhide. This is a virtual test comprised of 4 tests corresponding to different +build configurations for the kernel: + +* base +* base/lto +* debug +* debug/lto + +Due to this, this test is not regularly run on PRs opened in tests/clang, as +running the 4 tests can take about 6 hours. Instead, if you modify the test +you are expected to run it on your own and provide the results in the Pull +Request. A specific tmt test plan named `kernel-ark-gating.fmf` is provided for +that. It can be run using Testing Farm with this command: +``` +testing-farm request -c initiator=human -c distro=fedora-rawhide -c arch= \ + --compose Fedora-Rawhide --git-url --git-ref \ + --plan kernel-ark-gating +``` +You need an [API key](https://docs.testing-farm.io/Testing%20Farm/0.1/onboarding.html) +to be able to use Testing Farm. If you don't have on, please ask for help running +the test when opening a Pull Request. diff --git a/plans/kernel-ark-gating.fmf b/plans/kernel-ark-gating.fmf new file mode 100644 index 0000000..9b4d6ea --- /dev/null +++ b/plans/kernel-ark-gating.fmf @@ -0,0 +1,18 @@ +summary: Build latest kernel-ark with clang using different build configurations +discover: + how: fmf + test: kernel-ark-build +execute: + how: tmt +provision: + hardware: + memory: ">=16 GiB" + cpu: + cores: ">=8" + +# We do not want to run this test on every pull request done to tests/clang. +# Only allow to run manually when the test is really modified to prevent +# using too much time and resources in non-related pull requests. +adjust: + - when: initiator is not defined or initiator != human + enabled: false diff --git a/tests/kernel-ark-build/main.fmf b/tests/kernel-ark-build/main.fmf new file mode 100644 index 0000000..ea036d8 --- /dev/null +++ b/tests/kernel-ark-build/main.fmf @@ -0,0 +1,52 @@ +summary: Build kernel-ark with clang +framework: beakerlib +component+: + - llvm + - lld +# CKI pipelines times out after 5h. 4h is safe for us. +duration: 4h +tier: 1 +require+: + - git + - make + - gcc + - flex + - bison + - bzip2 + - rpm-build +adjust+: + - when: distro is not defined or distro != fedora-rawhide + enabled: false + because: Only meaninful in Rawhide +link+: + - verifies: https://issues.redhat.com/browse/LLVM-72 +tag+: + - not-in-default + +/base: + summary+: " (base/non-LTO)" + +/debug: + summary+: " (debug/non-LTO)" + environment+: + ENABLE_DEBUG: 1 + adjust+: + - enabled: false + when: arch != x86_64 and arch != aarch64 + +/base-lto: + summary+: " (base/LTO)" + environment+: + ENABLE_LTO: 1 + adjust+: + - enabled: false + when: arch != x86_64 and arch != aarch64 + +/debug-lto: + summary+: " (debug/LTO)" + environment+: + ENABLE_LTO: 1 + ENABLE_DEBUG: 1 + adjust+: + - enabled: false + when: arch != x86_64 and arch != aarch64 diff --git a/tests/kernel-ark-build/runtest.sh b/tests/kernel-ark-build/runtest.sh new file mode 100755 index 0000000..48ef4eb --- /dev/null +++ b/tests/kernel-ark-build/runtest.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +## General configuration variables. Can be overriden via environment +# Kernel branch to build. Typically ark-latest or os-build. +KERNEL_BRANCH=${KERNEL_BRANCH:-"ark-latest"} +KERNEL_GIT_URL=${KERNEL_GIT_URL:-"https://gitlab.com/cki-project/kernel-ark.git"} + +# Environment variables to configure the kernel build: +# * ENABLE_LTO: If set, it will build kernel-ark with clang_lto. +# * ENABLE_DEBUG: If set, it will build kernel-ark in debug mode. +CLANG_MODE=${ENABLE_LTO:+"--with clang_lto"} +CLANG_MODE=${CLANG_MODE:-"--with clang"} +# Build mode, base or debug +BUILD_MODE=${ENABLE_DEBUG:+"--with debug --without base"} +BUILD_MODE=${BUILD_MODE:-"--with base --without debug"} + +rlJournalStart + rlPhaseStartSetup + rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" + rlRun "pushd $tmp" + rlRun "set -o pipefail" + rlLog "Disable updates-testing" + rlRun "dnf config-manager --set-disabled updates-testing" + rlPhaseEnd + + rlPhaseStartTest + # TODO It would be fantastic to find out a way to shallow clone without + # breaking the dist-get-buildreqs and dist-srpm make targets, because + # a complete clone takes about 5GiB and a LOT of time... + rlLog "Cloning kernel" + rlRun "git clone --branch ${KERNEL_BRANCH} ${KERNEL_GIT_URL}" + rlRun 'cd kernel-ark' + + rlLog "Gathering and installing missing build requirements" + rlRun "make dist-get-buildreqs > make-buildreqs.log" + rlFileSubmit make-buildreqs.log + if grep 'Missing dependencies:' make-buildreqs.log; then + rlRun "KERNEL_BUILDREQS=\"$(sed -n 's/Missing dependencies://p' make-buildreqs.log)\"" + rlRun 'dnf install -y ${KERNEL_BUILDREQS} > install-buildreqs.log 2>&1' + rlFileSubmit install-buildreqs.log + elif grep 'PASS:' make-buildreqs.log; then + rlLog "All dependencies were already installed" + else + rlLogWarning "Error getting dependencies, the build might fail" + rlRun "cat make-buildreqs.log" + fi + + rlLog "Generating srpm" + rlRun 'make dist-srpm > dist-srpm.log 2>&1' + rlRun 'KERNEL_SRPM=$(find . -name kernel-*.src.rpm)' + rlFileSubmit dist-srpm.log + + # Prepare the flags to be passed to rpmbuild depending on the configuration + BUILD_FLAGS="--target $(uname -m) --with up --with toolchain_clang " + BUILD_FLAGS+="--without trace --without arm64_16k --without arm64_64k " + BUILD_FLAGS+="--without realtime --without zfcpdump " + BUILD_FLAGS+="${CLANG_MODE} ${BUILD_MODE}" + + rlLog "Building kernel (branch $KERNEL_BRANCH)" + rlRun "rpmbuild ${BUILD_FLAGS} --rebuild ${KERNEL_SRPM} > build.log 2>&1" + rlFileSubmit build.log + + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $tmp" 0 "Remove tmp directory" + rlPhaseEnd +rlJournalEnd From be814a631018815de8c325ac09231cfa581996f6 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 10 May 2024 09:02:04 +0200 Subject: [PATCH 100/178] 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 af1c69a51d2e6216475ebaaf8fe84b509048b8cd Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 23 May 2024 09:03:19 +0200 Subject: [PATCH 101/178] kernel-ark-build: Improve logging and fix disable updates-testing repo dnf5 is the default pkg manager in rawhide and config-manager command has different interface. Falling back to dnf-3. Added lld and llvm-devel as explicit requirements in test metadata Added extra logging of which packages (NVRs) where installed by tmt and the amount of cpus and memory the running system has. --- tests/kernel-ark-build/main.fmf | 2 ++ tests/kernel-ark-build/runtest.sh | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/kernel-ark-build/main.fmf b/tests/kernel-ark-build/main.fmf index ea036d8..149eca2 100644 --- a/tests/kernel-ark-build/main.fmf +++ b/tests/kernel-ark-build/main.fmf @@ -7,6 +7,8 @@ component+: duration: 4h tier: 1 require+: + - llvm-devel + - lld - git - make - gcc diff --git a/tests/kernel-ark-build/runtest.sh b/tests/kernel-ark-build/runtest.sh index 48ef4eb..7342048 100755 --- a/tests/kernel-ark-build/runtest.sh +++ b/tests/kernel-ark-build/runtest.sh @@ -16,13 +16,36 @@ CLANG_MODE=${CLANG_MODE:-"--with clang"} BUILD_MODE=${ENABLE_DEBUG:+"--with debug --without base"} BUILD_MODE=${BUILD_MODE:-"--with base --without debug"} +function logTmtRequiredPackages(){ + # Get the expected packages from TMT metadata requires + if [[ ! -e $TMT_TEST_METADATA ]]; then + rlLogWarning "${FUNCNAME[0]}: No TMT_TEST_METADATA file found. Run the test from tmt" + return + fi + TMT_REQUIRES=$(rlGetYAMLdeps) + rlLog "# Installed packages:" + rlLog "#----------------------------#" + for pkg in $TMT_REQUIRES; do + rlAssertRpm $pkg + done; + rlLog "#----------------------------#" + +} + rlJournalStart rlPhaseStartSetup + # Log system mem/cpus and packages installed by tmt + rlRun "nproc" + rlRun "free -h" + logTmtRequiredPackages + rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" rlRun "pushd $tmp" rlRun "set -o pipefail" - rlLog "Disable updates-testing" - rlRun "dnf config-manager --set-disabled updates-testing" + if rlIsFedora; then + rlLog "Disable updates-testing" + rlRun "dnf-3 config-manager --set-disabled updates-testing" + fi rlPhaseEnd rlPhaseStartTest From f74147908610aad010b3da459e8970a13f4156f5 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 30 May 2024 12:03:40 +0200 Subject: [PATCH 102/178] openmp-rpm: make the test compatible with rpm 4.20+ --- tests/openmp-rpm/runtest.sh | 2 +- tests/openmp-rpm/test.spec | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/openmp-rpm/runtest.sh b/tests/openmp-rpm/runtest.sh index 61eb313..7f4606a 100755 --- a/tests/openmp-rpm/runtest.sh +++ b/tests/openmp-rpm/runtest.sh @@ -5,4 +5,4 @@ set -ex # Do not run dnf builddep here. TMT should take care of any packages needed to # run the test. If the rpmbuild fails due to missing packages, then fmf metadata # needs to be fixed. -QA_RPATHS=$(( 0x0001 )) rpmbuild --define '_sourcedir .' --define '_builddir .' -bb test.spec +QA_RPATHS=$(( 0x0001 )) rpmbuild --define "_sourcedir $PWD" -bb test.spec diff --git a/tests/openmp-rpm/test.spec b/tests/openmp-rpm/test.spec index 1fbb256..8a3ae3c 100644 --- a/tests/openmp-rpm/test.spec +++ b/tests/openmp-rpm/test.spec @@ -14,6 +14,8 @@ License: MIT Source0: test.c +%global debug_package %{nil} + %description clang was adding RUNPATH to binaries that use OpenMP, and since RUNPATH is prohibited in Fedora builds, this was causing packages using clang From ca2401025f3269d17bff9868bb4726bdab6b6d60 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 30 May 2024 10:16:15 +0300 Subject: [PATCH 103/178] Make the pie-rpm test spec self-contained and work with any rpm version Move the dummy source inline to %prep and checks from runtest.sh into %check, to take advantage of rpm facilities instead of fighting them, and now we can just run this anywhere at all without any cumbersome override defines and any rpm version. --- tests/pie-rpm/pie.c | 6 ------ tests/pie-rpm/pie.spec | 36 ++++++++++++++++++++++++++++++++++-- tests/pie-rpm/runtest.sh | 29 +---------------------------- 3 files changed, 35 insertions(+), 36 deletions(-) delete mode 100644 tests/pie-rpm/pie.c diff --git a/tests/pie-rpm/pie.c b/tests/pie-rpm/pie.c deleted file mode 100644 index 5423ce6..0000000 --- a/tests/pie-rpm/pie.c +++ /dev/null @@ -1,6 +0,0 @@ - - - -int main(int argc, char **argv) { - return 0; -} diff --git a/tests/pie-rpm/pie.spec b/tests/pie-rpm/pie.spec index 5d2913d..abb473e 100644 --- a/tests/pie-rpm/pie.spec +++ b/tests/pie-rpm/pie.spec @@ -6,18 +6,25 @@ Release: %autorelease Summary: Check that -pie is passed. License: MIT -Source0: pie.c BuildRequires: clang %description Make sure the standard configuration from redhat-rpm-config passes -pie when linking. +%prep +%setup -c -T +cat << EOF > pie.c +int main(int argc, char **argv) { + return 0; +} +EOF + %build LDFLAGS="${LDFLAGS} -Werror" -clang ${CFLAGS} -c %{SOURCE0} -o %{NAME}.o +clang ${CFLAGS} -c pie.c -o %{NAME}.o # Regular clang ${LDFLAGS} %{NAME}.o -o %{NAME} @@ -34,6 +41,31 @@ clang -static ${LDFLAGS} %{NAME}.o -o %{NAME}-static-post clang ${LDFLAGS} -no-pie %{NAME}.o -o %{NAME}-no-pie-pre clang -no-pie ${LDFLAGS} %{NAME}.o -o %{NAME}-no-pie-post +%check +if [[ "$(file ./pie)" != *"pie executable"* ]]; then + exit 1 +fi + +if [[ "$(file ./pie-shared-pre)" == *"pie executable"* ]]; then + exit 1 +fi +if [[ "$(file ./pie-shared-post)" == *"pie executable"* ]]; then + exit 1 +fi + +if [[ "$(file ./pie-static-pre)" == *"pie executable"* ]]; then + exit 1 +fi +if [[ "$(file ./pie-static-post)" == *"pie executable"* ]]; then + exit 1 +fi + +if [[ "$(file ./pie-no-pie-pre)" == *"pie executable"* ]]; then + exit 1 +fi +if [[ "$(file ./pie-no-pie-post)" == *"pie executable"* ]]; then + exit 1 +fi %changelog %autochangelog diff --git a/tests/pie-rpm/runtest.sh b/tests/pie-rpm/runtest.sh index 3ce2f91..a8bdafc 100755 --- a/tests/pie-rpm/runtest.sh +++ b/tests/pie-rpm/runtest.sh @@ -5,32 +5,5 @@ set pipefail #${BUILDDEP_CMD} -y pie.spec -rm -f pie{,.o} -QA_RPATHS=$(( 0x0001 )) rpmbuild -bb ./pie.spec --define '_sourcedir .' --define '_builddir .' +QA_RPATHS=$(( 0x0001 )) rpmbuild -bb ./pie.spec -if [[ "$(file ./pie)" != *"pie executable"* ]]; then - exit 1 -fi - -if [[ "$(file ./pie-shared-pre)" == *"pie executable"* ]]; then - exit 1 -fi -if [[ "$(file ./pie-shared-post)" == *"pie executable"* ]]; then - exit 1 -fi - -if [[ "$(file ./pie-static-pre)" == *"pie executable"* ]]; then - exit 1 -fi -if [[ "$(file ./pie-static-post)" == *"pie executable"* ]]; then - exit 1 -fi - -if [[ "$(file ./pie-no-pie-pre)" == *"pie executable"* ]]; then - exit 1 -fi -if [[ "$(file ./pie-no-pie-post)" == *"pie executable"* ]]; then - exit 1 -fi - -exit 0 From e5e8b03b9f98df12adce3f3a49a34d37706c3919 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 30 May 2024 11:21:04 +0300 Subject: [PATCH 104/178] Add missing glibc-static build dependency to pie-rpm test --- tests/pie-rpm/pie.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pie-rpm/pie.spec b/tests/pie-rpm/pie.spec index abb473e..3ed6aaa 100644 --- a/tests/pie-rpm/pie.spec +++ b/tests/pie-rpm/pie.spec @@ -7,7 +7,7 @@ Summary: Check that -pie is passed. License: MIT -BuildRequires: clang +BuildRequires: clang glibc-static %description Make sure the standard configuration from redhat-rpm-config passes -pie when linking. From 7ab65858ab6258b9fbbdc248134d1fc1f39f6fcf Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 30 May 2024 07:50:49 +0200 Subject: [PATCH 105/178] toolchains: Set lld package for rhel 8.10 modules llvm-toolset module is being updated to 18 in rhel 8.10 and we need to test newly added lld there. Set it as recommend for now as we still have LLVM 17 in default rhel8 stream --- tests/toolchains/main.fmf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/toolchains/main.fmf b/tests/toolchains/main.fmf index 20bfdcb..a0ed9f0 100644 --- a/tests/toolchains/main.fmf +++ b/tests/toolchains/main.fmf @@ -44,6 +44,14 @@ adjust+: arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 or arch == ppc64 + # LLVM is getting updated to 18 in rhel 8.10 which adds lld for s390x, but we + # still have LLVM 17 in AppStream. Install lld if it's available, leave it out + # if not. The test will (correctly) fail if we lld is missing in LLVM 18. + # TODO once LLVM 18 is in the default module stream we can set this a require: + - recommend+: + - lld + when: arch == s390x and distro == rhel-8.10 + - environment+: CXXLIBS: "libc++" require+: From 33597822114caf1a24ec1b7dba012769280d8ecb Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 6 Jun 2024 08:30:12 +0200 Subject: [PATCH 106/178] toolchains: ensure that tmt requires lld when testing snapshots --- tests/toolchains/main.fmf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/toolchains/main.fmf b/tests/toolchains/main.fmf index a0ed9f0..8715c60 100644 --- a/tests/toolchains/main.fmf +++ b/tests/toolchains/main.fmf @@ -81,6 +81,8 @@ adjust+: - libcxx-static require+: - libstdc++ + # All archs support lld in snapshots, ensure it's required + - lld when: distro == fedora and snapshot is defined because: llvm-snapshots adjustments From 5100dc7cf029c3862567f2ce08f1a5c590c4761b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 7 Jun 2024 09:08:12 +0200 Subject: [PATCH 107/178] Perform llvm-snapshot adjustment for rhel as well We need to install lld for snapshots on rhel as well. --- tests/toolchains/main.fmf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/toolchains/main.fmf b/tests/toolchains/main.fmf index 8715c60..ad049dc 100644 --- a/tests/toolchains/main.fmf +++ b/tests/toolchains/main.fmf @@ -83,7 +83,7 @@ adjust+: - libstdc++ # All archs support lld in snapshots, ensure it's required - lld - when: distro == fedora and snapshot is defined + when: snapshot is defined because: llvm-snapshots adjustments From dade06cfdd09e14ebd04b8ffc61909228ec8fc9d Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 10 Jun 2024 11:39:04 +0200 Subject: [PATCH 108/178] use-correct-dwarf-default: Update test * The default version is now 5. If clang version is older than 18 then fall back to version 4. * Added optional env var to overwrite required dwarf version. * Updated fmf metadata to use dwarf4 in distros that don't support v5 * Fedora 38 is EOL, removed dead code. --- tests/use-correct-dwarf-default/main.fmf | 4 ++++ tests/use-correct-dwarf-default/runtest.sh | 21 +++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/tests/use-correct-dwarf-default/main.fmf b/tests/use-correct-dwarf-default/main.fmf index 3dcde07..ed39bd9 100644 --- a/tests/use-correct-dwarf-default/main.fmf +++ b/tests/use-correct-dwarf-default/main.fmf @@ -25,3 +25,7 @@ adjust+: - llvm-toolset-15.0-clang - llvm-toolset-15.0-llvm when: "collection == llvm-toolset-15.0" + + - environment+: + DWARF_VERSION: 4 + when: distro < rhel-10 or distro < centos-stream-10 diff --git a/tests/use-correct-dwarf-default/runtest.sh b/tests/use-correct-dwarf-default/runtest.sh index 9918462..926658e 100755 --- a/tests/use-correct-dwarf-default/runtest.sh +++ b/tests/use-correct-dwarf-default/runtest.sh @@ -1,23 +1,16 @@ #!/bin/sh -eux -# Determine correct DWARF version to use. If Clang is newer or equal to version -# 18, we want to use DWARF5 except for Fedora 38 where we still want DWARF4. - -required_dwarf_version=4 +# Determine correct DWARF version to use. Defaults to version 5, but older +# distros might need to use version 4, which can be configured using the +# DWARF_VERSION env var +required_dwarf_version=${DWARF_VERSION:-5} # Get clang version CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang))) clang_version=$(rpm -q --queryformat "%{version}" $CLANG_PKG | grep -ioP "^[0-9]+") -if [ $clang_version -ge 18 ]; then - >&2 echo "clang is greater or equal version 18"; - required_dwarf_version=5 -fi - -if [ -e /etc/fedora-release ]; then - fedora_version=$(grep -ioP "Fedora release \K[0-9]+" /etc/fedora-release) - if [ $fedora_version -le 38 ]; then - required_dwarf_version=4 - fi +if [ $clang_version -lt 18 ]; then + >&2 echo "clang is older than version 18"; + required_dwarf_version=4 fi echo "int main(){ return 0; }" | clang -g -v -x c - 2> build.log From 06436d11ba96e85aae188ddce1ffa16b29ddcf22 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 10 Jun 2024 11:44:30 +0200 Subject: [PATCH 109/178] Revert "use-correct-dwarf-default: Update test" This reverts commit dade06cfdd09e14ebd04b8ffc61909228ec8fc9d. --- tests/use-correct-dwarf-default/main.fmf | 4 ---- tests/use-correct-dwarf-default/runtest.sh | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/use-correct-dwarf-default/main.fmf b/tests/use-correct-dwarf-default/main.fmf index ed39bd9..3dcde07 100644 --- a/tests/use-correct-dwarf-default/main.fmf +++ b/tests/use-correct-dwarf-default/main.fmf @@ -25,7 +25,3 @@ adjust+: - llvm-toolset-15.0-clang - llvm-toolset-15.0-llvm when: "collection == llvm-toolset-15.0" - - - environment+: - DWARF_VERSION: 4 - when: distro < rhel-10 or distro < centos-stream-10 diff --git a/tests/use-correct-dwarf-default/runtest.sh b/tests/use-correct-dwarf-default/runtest.sh index 926658e..9918462 100755 --- a/tests/use-correct-dwarf-default/runtest.sh +++ b/tests/use-correct-dwarf-default/runtest.sh @@ -1,16 +1,23 @@ #!/bin/sh -eux -# Determine correct DWARF version to use. Defaults to version 5, but older -# distros might need to use version 4, which can be configured using the -# DWARF_VERSION env var -required_dwarf_version=${DWARF_VERSION:-5} +# Determine correct DWARF version to use. If Clang is newer or equal to version +# 18, we want to use DWARF5 except for Fedora 38 where we still want DWARF4. + +required_dwarf_version=4 # Get clang version CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang))) clang_version=$(rpm -q --queryformat "%{version}" $CLANG_PKG | grep -ioP "^[0-9]+") -if [ $clang_version -lt 18 ]; then - >&2 echo "clang is older than version 18"; - required_dwarf_version=4 +if [ $clang_version -ge 18 ]; then + >&2 echo "clang is greater or equal version 18"; + required_dwarf_version=5 +fi + +if [ -e /etc/fedora-release ]; then + fedora_version=$(grep -ioP "Fedora release \K[0-9]+" /etc/fedora-release) + if [ $fedora_version -le 38 ]; then + required_dwarf_version=4 + fi fi echo "int main(){ return 0; }" | clang -g -v -x c - 2> build.log From 2b2e06a7e1b25528c3a6a200a7d99f99312dc1a9 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 10 Jun 2024 11:39:04 +0200 Subject: [PATCH 110/178] use-correct-dwarf-default: Update test * The default version is now 5. If clang version is older than 18 then fall back to version 4. * Added optional env var to overwrite required dwarf version. * Updated fmf metadata to use dwarf4 in distros that don't support v5 * Fedora 38 is EOL, removed dead code. --- tests/use-correct-dwarf-default/main.fmf | 4 ++++ tests/use-correct-dwarf-default/runtest.sh | 21 +++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/tests/use-correct-dwarf-default/main.fmf b/tests/use-correct-dwarf-default/main.fmf index 3dcde07..ed39bd9 100644 --- a/tests/use-correct-dwarf-default/main.fmf +++ b/tests/use-correct-dwarf-default/main.fmf @@ -25,3 +25,7 @@ adjust+: - llvm-toolset-15.0-clang - llvm-toolset-15.0-llvm when: "collection == llvm-toolset-15.0" + + - environment+: + DWARF_VERSION: 4 + when: distro < rhel-10 or distro < centos-stream-10 diff --git a/tests/use-correct-dwarf-default/runtest.sh b/tests/use-correct-dwarf-default/runtest.sh index 9918462..926658e 100755 --- a/tests/use-correct-dwarf-default/runtest.sh +++ b/tests/use-correct-dwarf-default/runtest.sh @@ -1,23 +1,16 @@ #!/bin/sh -eux -# Determine correct DWARF version to use. If Clang is newer or equal to version -# 18, we want to use DWARF5 except for Fedora 38 where we still want DWARF4. - -required_dwarf_version=4 +# Determine correct DWARF version to use. Defaults to version 5, but older +# distros might need to use version 4, which can be configured using the +# DWARF_VERSION env var +required_dwarf_version=${DWARF_VERSION:-5} # Get clang version CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang))) clang_version=$(rpm -q --queryformat "%{version}" $CLANG_PKG | grep -ioP "^[0-9]+") -if [ $clang_version -ge 18 ]; then - >&2 echo "clang is greater or equal version 18"; - required_dwarf_version=5 -fi - -if [ -e /etc/fedora-release ]; then - fedora_version=$(grep -ioP "Fedora release \K[0-9]+" /etc/fedora-release) - if [ $fedora_version -le 38 ]; then - required_dwarf_version=4 - fi +if [ $clang_version -lt 18 ]; then + >&2 echo "clang is older than version 18"; + required_dwarf_version=4 fi echo "int main(){ return 0; }" | clang -g -v -x c - 2> build.log From 2554ce3aa35bd17dcebf671aca962762f157b568 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 1 Jul 2024 12:36:20 +0200 Subject: [PATCH 111/178] Adjust test and plan relevancy for rhel 8.10 --- plans/main.fmf | 5 +++-- tests/main.fmf | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plans/main.fmf b/plans/main.fmf index f4ec871..8d7e7d1 100644 --- a/plans/main.fmf +++ b/plans/main.fmf @@ -7,8 +7,9 @@ summary: LLD tests for build/PR gating adjust: - because: lld is not shipped in s390x on LLVM < 18 enabled: false - when: > - arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 + when: arch == s390x and distro < rhel-8.10, fedora-40, centos-stream-9 + - enabled: false + when: arch == s390x and distro == rhel-9 and distro < rhel-9.5 - because: lld is not shipped for ppc64 enabled: false diff --git a/tests/main.fmf b/tests/main.fmf index 153c1f0..fb4e6a1 100644 --- a/tests/main.fmf +++ b/tests/main.fmf @@ -28,8 +28,9 @@ adjust+: - because: lld is not shipped in s390x on LLVM < 18 enabled: false - when: > - arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 + when: arch == s390x and distro < rhel-8.10, fedora-40, centos-stream-9 + - enabled: false + when: arch == s390x and distro == rhel-9 and distro < rhel-9.5 # Common requirements when LLVM is not SCL-ized - require+: From 07526ca7fa11d89daa1f710dfd167ea965aec151 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Wed, 3 Jul 2024 15:36:11 +0200 Subject: [PATCH 112/178] For snapshots on RHEL we want to check for DWARF5 --- tests/use-correct-dwarf-default/main.fmf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/use-correct-dwarf-default/main.fmf b/tests/use-correct-dwarf-default/main.fmf index ed39bd9..bdd5ce1 100644 --- a/tests/use-correct-dwarf-default/main.fmf +++ b/tests/use-correct-dwarf-default/main.fmf @@ -28,4 +28,4 @@ adjust+: - environment+: DWARF_VERSION: 4 - when: distro < rhel-10 or distro < centos-stream-10 + when: distro < rhel-10,centos-stream-10 and snapshot is not defined From 9080b2716a6da5641db5150f5641c2e94f26e844 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 17 Jul 2024 12:55:17 +0200 Subject: [PATCH 113/178] Update test relevancy for compat packages llvm-test-suite and rpmmacros tests disabled for compat packages --- tests/llvm-test-suite/main.fmf | 4 ++++ tests/rpmmacros/main.fmf | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/tests/llvm-test-suite/main.fmf b/tests/llvm-test-suite/main.fmf index e084bd1..9deb601 100644 --- a/tests/llvm-test-suite/main.fmf +++ b/tests/llvm-test-suite/main.fmf @@ -8,6 +8,10 @@ adjust+: or distro == centos enabled: false + - because: "llvm test suite not built for compat packages" + enabled: false + when: compat is defined + require+: - git - clang diff --git a/tests/rpmmacros/main.fmf b/tests/rpmmacros/main.fmf index 05c3245..45e3ded 100644 --- a/tests/rpmmacros/main.fmf +++ b/tests/rpmmacros/main.fmf @@ -4,3 +4,12 @@ require+: - clang-devel extra-summary: /tools/clang/rpmmacros extra-task: /tools/clang/rpmmacros + +adjust+: + # From spec file: + # File in the macros file for other packages to use. We are not doing this + # in the compat package, because the version macros would conflict with + # eachother if both clang and the clang compat package were installed together. + - because: "macros.clang is not added to compat packages" + enabled: false + when: compat is defined From c45fd5b63164c473fc95a6ca9d82b30f80f8a6cb Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 17 Jul 2024 13:37:32 +0200 Subject: [PATCH 114/178] Update relevancy for compat packages rust-sanity disabled, rust always uses latest llvm binutils-plugin-ar not relevant, llvm-libs compat does not install the symlink to LLVMgold.so --- tests/binutils-plugin-ar/main.fmf | 4 ++++ tests/rust-sanity/main.fmf | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/binutils-plugin-ar/main.fmf b/tests/binutils-plugin-ar/main.fmf index ef8a698..9d67528 100644 --- a/tests/binutils-plugin-ar/main.fmf +++ b/tests/binutils-plugin-ar/main.fmf @@ -14,4 +14,8 @@ adjust+: enabled: false when: distro == rhel-7 + - because: compat llvm-libs does not install LLVMgold.so in bfd-plugins dir + enabled: false + when: compat is defined + extra-nitrate: TC#0614092 diff --git a/tests/rust-sanity/main.fmf b/tests/rust-sanity/main.fmf index 6ed580a..0466d93 100644 --- a/tests/rust-sanity/main.fmf +++ b/tests/rust-sanity/main.fmf @@ -21,6 +21,10 @@ adjust+: - rust when: "collection is not defined" + - because: "Rust uses latest llvm version, compat packages irrelevant here" + enabled: false + when: compat is defined + # Requirements for SCL-ized LLVM - require+: - rust-toolset-1.58-cargo From bf7e2faa36dfe6e15e5e0bbdb3ebbc92eed2d6b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 22 May 2024 12:05:09 +0200 Subject: [PATCH 115/178] Enable pie-rpm test by default --- tests/pie-rpm/main.fmf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/pie-rpm/main.fmf b/tests/pie-rpm/main.fmf index 0a35fb6..1b276b9 100644 --- a/tests/pie-rpm/main.fmf +++ b/tests/pie-rpm/main.fmf @@ -6,10 +6,6 @@ require+: - rpm-build - glibc-static -# TODO: Untag this test when redhat-rpm-config is modified. -# See: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/291 -tag: not-in-default - adjust+: - enabled: false when: distro != fedora or distro < fedora-40 From 71a2b1c3bfc0b1908f057783c2c0f98849be6f37 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 16 Jul 2024 08:36:56 +0200 Subject: [PATCH 116/178] Refactor kernel-ark build test for caching and git clone retry This commit mitigates test failures due to git unreliability and improves test time over test reruns using cached SRPMs. - Added CACHE_DIR_BASE, KERNEL_SRPM_PATTERN and KERNEL SRPM variables. - Implemented checkCache() to look for an existing SRPM in the cache and install its build dependencies. - Implemented cloneKernelTree() for cloning the kernel-ark repo with retries. - Implemented generateSRPM() to handle all operations required to generate an SRPM and cache it. - Updated main test phase to utilize caching and SRPM generation functions. --- tests/kernel-ark-build/runtest.sh | 162 +++++++++++++++++++++++------- 1 file changed, 124 insertions(+), 38 deletions(-) diff --git a/tests/kernel-ark-build/runtest.sh b/tests/kernel-ark-build/runtest.sh index 7342048..f9b217f 100755 --- a/tests/kernel-ark-build/runtest.sh +++ b/tests/kernel-ark-build/runtest.sh @@ -2,11 +2,17 @@ # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k . /usr/share/beakerlib/beakerlib.sh || exit 1 -## General configuration variables. Can be overriden via environment +## General configuration variables. Can be overridden via environment # Kernel branch to build. Typically ark-latest or os-build. KERNEL_BRANCH=${KERNEL_BRANCH:-"ark-latest"} KERNEL_GIT_URL=${KERNEL_GIT_URL:-"https://gitlab.com/cki-project/kernel-ark.git"} +## Helper variables to handle cached/generated SRPM +CACHE_DIR_BASE="/var/tmp/kernel-" +KERNEL_SRPM_PATTERN="kernel-*.src.rpm" +# Path to the kernel SRPM to build. +KERNEL_SRPM="" + # Environment variables to configure the kernel build: # * ENABLE_LTO: If set, it will build kernel-ark with clang_lto. # * ENABLE_DEBUG: If set, it will build kernel-ark in debug mode. @@ -16,8 +22,8 @@ CLANG_MODE=${CLANG_MODE:-"--with clang"} BUILD_MODE=${ENABLE_DEBUG:+"--with debug --without base"} BUILD_MODE=${BUILD_MODE:-"--with base --without debug"} -function logTmtRequiredPackages(){ - # Get the expected packages from TMT metadata requires +# Log installed packages required by TMT +logTmtRequiredPackages() { if [[ ! -e $TMT_TEST_METADATA ]]; then rlLogWarning "${FUNCNAME[0]}: No TMT_TEST_METADATA file found. Run the test from tmt" return @@ -26,15 +32,109 @@ function logTmtRequiredPackages(){ rlLog "# Installed packages:" rlLog "#----------------------------#" for pkg in $TMT_REQUIRES; do - rlAssertRpm $pkg - done; + rlAssertRpm "$pkg" + done rlLog "#----------------------------#" +} +# Check if a previous test run created a kernel SRPM for the latest commit +# If found, the abspath is stored in KERNEL_SRPM global variable +# Returns 0 if srpm found, 1 otherwise. +checkCache() { + local commit_hash + local cache_dir + local cached_srpm + + commit_hash=$(git ls-remote "${KERNEL_GIT_URL}" "${KERNEL_BRANCH}" | awk '{print $1}') + rlLog "Latest commit for ${KERNEL_BRANCH} branch: $commit_hash" + + cache_dir="${CACHE_DIR_BASE}${commit_hash}/" + if [[ -d "$cache_dir" ]]; then + cached_srpm=$(find "$cache_dir" -name "${KERNEL_SRPM_PATTERN}") + if [[ -n "$cached_srpm" ]]; then + rlLog "Found cached SRPM: $cached_srpm" + rlRun "dnf builddep -y $cached_srpm > install-buildreqs.log 2>&1" + rlFileSubmit install-buildreqs.log + KERNEL_SRPM="$cached_srpm" + return 0 + fi + fi + rlLog "Cached kernel SRPM not found" + return 1 +} + +# Attempts to clone the kernel-ark tree in the CWD, at most 3 times. +# Returns 0 on success, 1 otherwise +cloneKernelTree() { + local retries=3 + local delay=10 + + rlLog "Cloning kernel" + while [[ $retries -gt 0 ]]; do + rlRun "git clone -q --branch ${KERNEL_BRANCH} ${KERNEL_GIT_URL}" 0-255 + retcode=$? + if [[ $retcode -eq 0 ]]; then + return 0 + else + retries=$((retries - 1)) + rlLog "Clone failed, wait ${delay}s and retry ($retries retries left)" + sleep $delay + fi + done + return $retcode +} + +# In a kernel-ark repository, do all the operations needed to generate an SRPM +# If the kernel is generated return the abspath in KERNEL_SRPM global variable +# Returns 0 on success, 1 otherwise +generateSRPM() { + local generated_srpm + local commit_hash + local cache_dir + + if ! cloneKernelTree; then + rlFail "Failed to clone kernel tree" + return 1 + fi + + rlRun "pushd kernel-ark" + rlLog "Gathering and installing missing build requirements" + rlRun "make dist-get-buildreqs > make-buildreqs.log 2>&1" + rlFileSubmit make-buildreqs.log + if grep -q 'Missing dependencies:' make-buildreqs.log; then + rlRun "KERNEL_BUILDREQS=\"$(sed -n 's/Missing dependencies://p' make-buildreqs.log)\"" + rlRun 'dnf install -y ${KERNEL_BUILDREQS} > install-buildreqs.log 2>&1' + rlFileSubmit install-buildreqs.log + elif grep 'PASS:' make-buildreqs.log; then + rlLog "All dependencies were already installed" + else + rlLogWarning "Error getting dependencies, the build might fail" + rlRun "cat make-buildreqs.log" + fi + + rlLog "Generating SRPM" + rlRun "make dist-srpm > dist-srpm.log 2>&1" + rlFileSubmit dist-srpm.log + + generated_srpm=$(find "$(pwd)" -name "$KERNEL_SRPM_PATTERN") + if [[ -e "$generated_srpm" ]]; then + rlLog "Caching generated SRPM" + commit_hash=$(git rev-parse HEAD) + cache_dir="${CACHE_DIR_BASE}${commit_hash}/" + rlRun "mkdir -p $cache_dir" + rlRun "cp $generated_srpm $cache_dir" + KERNEL_SRPM="$generated_srpm" + rlRun "popd" + return 0 + else + rlLogWarning "Failed to generate SRPM" + rlRun "popd" + return 1 + fi } rlJournalStart rlPhaseStartSetup - # Log system mem/cpus and packages installed by tmt rlRun "nproc" rlRun "free -h" logTmtRequiredPackages @@ -49,42 +149,28 @@ rlJournalStart rlPhaseEnd rlPhaseStartTest - # TODO It would be fantastic to find out a way to shallow clone without - # breaking the dist-get-buildreqs and dist-srpm make targets, because - # a complete clone takes about 5GiB and a LOT of time... - rlLog "Cloning kernel" - rlRun "git clone --branch ${KERNEL_BRANCH} ${KERNEL_GIT_URL}" - rlRun 'cd kernel-ark' - - rlLog "Gathering and installing missing build requirements" - rlRun "make dist-get-buildreqs > make-buildreqs.log" - rlFileSubmit make-buildreqs.log - if grep 'Missing dependencies:' make-buildreqs.log; then - rlRun "KERNEL_BUILDREQS=\"$(sed -n 's/Missing dependencies://p' make-buildreqs.log)\"" - rlRun 'dnf install -y ${KERNEL_BUILDREQS} > install-buildreqs.log 2>&1' - rlFileSubmit install-buildreqs.log - elif grep 'PASS:' make-buildreqs.log; then - rlLog "All dependencies were already installed" + # Check if kernel package was generated by a previous test run + # and generate a new one if it wasn't + checkCache + if [[ -e "$KERNEL_SRPM" ]]; then + rlLog "Using cached kernel SRPM: $KERNEL_SRPM" else - rlLogWarning "Error getting dependencies, the build might fail" - rlRun "cat make-buildreqs.log" + rlLog "No kernel SRPM found, generating new SRPM" + generateSRPM fi - rlLog "Generating srpm" - rlRun 'make dist-srpm > dist-srpm.log 2>&1' - rlRun 'KERNEL_SRPM=$(find . -name kernel-*.src.rpm)' - rlFileSubmit dist-srpm.log - - # Prepare the flags to be passed to rpmbuild depending on the configuration - BUILD_FLAGS="--target $(uname -m) --with up --with toolchain_clang " - BUILD_FLAGS+="--without trace --without arm64_16k --without arm64_64k " - BUILD_FLAGS+="--without realtime --without zfcpdump " - BUILD_FLAGS+="${CLANG_MODE} ${BUILD_MODE}" - - rlLog "Building kernel (branch $KERNEL_BRANCH)" - rlRun "rpmbuild ${BUILD_FLAGS} --rebuild ${KERNEL_SRPM} > build.log 2>&1" - rlFileSubmit build.log + if [[ -e "$KERNEL_SRPM" ]]; then + BUILD_FLAGS="--target $(uname -m) --with up --with toolchain_clang " + BUILD_FLAGS+="--without trace --without arm64_16k --without arm64_64k " + BUILD_FLAGS+="--without realtime --without zfcpdump " + BUILD_FLAGS+="${CLANG_MODE} ${BUILD_MODE}" + rlLog "Building kernel (branch $KERNEL_BRANCH)" + rlRun "rpmbuild ${BUILD_FLAGS} --rebuild ${KERNEL_SRPM} > build.log 2>&1" + rlFileSubmit build.log + else + rlFail "Kernel SRPM not found, finishing test" + fi rlPhaseEnd rlPhaseStartCleanup From c8d36d768f6f3855e4bda740ab11393675414686 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 5 Aug 2024 09:10:14 +0200 Subject: [PATCH 117/178] Shell static analysis Add pre-commit hook for static analysis on shell scripts (shellcheck) Fixed lots of issues flagged by shellcheck. --- .pre-commit-config.yaml | 7 +++++++ tests/build-compat/test.sh | 4 ++-- tests/crash-with-fzero-args-used-regs/test.sh | 1 + tests/find-package-llvm/main.fmf | 2 +- tests/find-package-llvm/test.sh | 1 + tests/integration-test-suite/test.sh | 3 ++- tests/libllvm-size/test.sh | 2 +- tests/s390x-asm-unsupported-pc-relative-addr/test.sh | 4 ++-- tests/shlibs-cet-support/test.sh | 6 +++--- tests/versioned-llvm-config/test.sh | 2 +- 10 files changed, 21 insertions(+), 11 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/build-compat/test.sh b/tests/build-compat/test.sh index 04a97b2..f4d6031 100755 --- a/tests/build-compat/test.sh +++ b/tests/build-compat/test.sh @@ -4,8 +4,8 @@ dnf download --disablerepo=* --enablerepo=test-llvm --source llvm # The src.rpm is available in the directory the test run from. set +e -mock --resultdir=. --old-chroot --with compat_build --rebuild *.src.rpm -if [ $? -ne 0 ]; then +if ! mock --resultdir=. --old-chroot --with compat_build --rebuild ./*.src.rpm; +then cat root.log cat build.log exit 1 diff --git a/tests/crash-with-fzero-args-used-regs/test.sh b/tests/crash-with-fzero-args-used-regs/test.sh index acc2b18..957b837 100755 --- a/tests/crash-with-fzero-args-used-regs/test.sh +++ b/tests/crash-with-fzero-args-used-regs/test.sh @@ -4,6 +4,7 @@ rlJournalStart rlPhaseStartSetup + declare tmp rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" rlRun "cp reproducer.c $tmp" rlRun "pushd $tmp" diff --git a/tests/find-package-llvm/main.fmf b/tests/find-package-llvm/main.fmf index a1fd340..6482d73 100644 --- a/tests/find-package-llvm/main.fmf +++ b/tests/find-package-llvm/main.fmf @@ -1,4 +1,4 @@ -summary: Find LLVM package with CMake +summary: Find LLVM package with CMake. description: | Find LLVM package with CMake. This is to guarantee that building the packages together (aka "big-merge") but only installing them partially (e.g. llvm diff --git a/tests/find-package-llvm/test.sh b/tests/find-package-llvm/test.sh index 3a89157..47adb4d 100755 --- a/tests/find-package-llvm/test.sh +++ b/tests/find-package-llvm/test.sh @@ -5,6 +5,7 @@ rlJournalStart rlPhaseStartSetup rlRun "set -o pipefail" + declare loc_old loc_new tmp_dir rlRun "loc_old=$(which clang-tblgen)" rlRun "loc_new=$(mktemp)" rlRun "tmp_dir=$(mktemp -d -p /var/tmp)" diff --git a/tests/integration-test-suite/test.sh b/tests/integration-test-suite/test.sh index 2e44d64..95598a0 100755 --- a/tests/integration-test-suite/test.sh +++ b/tests/integration-test-suite/test.sh @@ -21,7 +21,7 @@ function logTmtRequiredPackages(){ rlLog "# Installed packages:" rlLog "#----------------------------#" for pkg in $TMT_REQUIRES; do - rlAssertRpm $pkg + rlAssertRpm "$pkg" done; rlLog "#----------------------------#" @@ -31,6 +31,7 @@ rlJournalStart rlPhaseStartSetup logTmtRequiredPackages + declare TmpDir rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" rlRun "pushd $TmpDir" rlPhaseEnd diff --git a/tests/libllvm-size/test.sh b/tests/libllvm-size/test.sh index 7ca1f61..f7f43ab 100755 --- a/tests/libllvm-size/test.sh +++ b/tests/libllvm-size/test.sh @@ -7,4 +7,4 @@ # is less than 500MB to ensure it was successfully stripped. # https://bugzilla.redhat.com/show_bug.cgi?id=1793250 -test $(stat -L -c %s $LIBLLVM_PATH) -lt 524288000 +test "$(stat -L -c %s "$LIBLLVM_PATH")" -lt 524288000 diff --git a/tests/s390x-asm-unsupported-pc-relative-addr/test.sh b/tests/s390x-asm-unsupported-pc-relative-addr/test.sh index 604e932..7ee5791 100755 --- a/tests/s390x-asm-unsupported-pc-relative-addr/test.sh +++ b/tests/s390x-asm-unsupported-pc-relative-addr/test.sh @@ -1,6 +1,6 @@ -#!/bin/sh -ux +#!/bin/bash -eux -cd $(mktemp -d) +cd "$(mktemp -d)" # This asm has an invalid PC relative address. echo "start: la %r2,_end-start(%r2)" > test.S # clang should fail to build and inform properly about the issue. diff --git a/tests/shlibs-cet-support/test.sh b/tests/shlibs-cet-support/test.sh index e935ad3..b86e85a 100755 --- a/tests/shlibs-cet-support/test.sh +++ b/tests/shlibs-cet-support/test.sh @@ -1,9 +1,9 @@ -#!/bin/sh -eux +#!/bin/bash -eux -cd $(mktemp -d) +cd "$(mktemp -d)" for lib in $(rpm -ql llvm-libs | grep -E '\.so(\..+)?$'); do [[ -L $lib ]] && continue # Skip symlinks - readelf -n $lib > notes.log + readelf -n "$lib" > notes.log grep -q "SHSTK" notes.log grep -q "IBT" notes.log done diff --git a/tests/versioned-llvm-config/test.sh b/tests/versioned-llvm-config/test.sh index cfe72cf..2ad4d9f 100755 --- a/tests/versioned-llvm-config/test.sh +++ b/tests/versioned-llvm-config/test.sh @@ -2,4 +2,4 @@ major=$(llvm-config --version | cut -d '.' -f1) -llvm-config-$major --version +llvm-config-"$major" --version From cda9761d2e9853bf34aa566dfb028e31fc2d0226 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 5 Aug 2024 09:15:19 +0200 Subject: [PATCH 118/178] Shell static analysis Add pre-commit hook for static analysis on shell scripts (shellcheck) Fixed lots of issues flagged by shellcheck. --- .pre-commit-config.yaml | 7 +++++ tests/fedora-flags/runtest.sh | 7 +++-- tests/gcc-clang-compatibility/runtest.sh | 20 ++++++------ tests/kernel-ark-build/runtest.sh | 16 ++++++++-- tests/libomp/runtest.sh | 12 +++---- tests/long-double/runtest.sh | 2 +- tests/ppc64le-long-double/runtest-fedora.sh | 9 +++--- tests/ppc64le-long-double/runtest.sh | 9 ++---- tests/rhbz_1647130/runtest.sh | 14 ++++----- tests/rpmmacros/runtest.sh | 8 ++--- tests/toolchains/runtest.sh | 35 ++++++++++----------- tests/ucrt64-toolchain/runtest.sh | 2 +- tests/use-correct-dwarf-default/runtest.sh | 8 ++--- 13 files changed, 80 insertions(+), 69 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/fedora-flags/runtest.sh b/tests/fedora-flags/runtest.sh index 96d1cc8..04698e7 100755 --- a/tests/fedora-flags/runtest.sh +++ b/tests/fedora-flags/runtest.sh @@ -1,10 +1,11 @@ #!/bin/bash +# shellcheck disable=SC2086 set -ex pipefail -cflags=`rpm -D '%toolchain clang' -E %{build_cflags}` -cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}` -ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}` +cflags=$(rpm -D '%toolchain clang' -E '%{build_cflags}') +cxxflags=$(rpm -D '%toolchain clang' -E '%{build_cxxflags}') +ldflags=$(rpm -D '%toolchain clang' -E '%{build_ldflags}') # Test a c program diff --git a/tests/gcc-clang-compatibility/runtest.sh b/tests/gcc-clang-compatibility/runtest.sh index 3480309..504713d 100755 --- a/tests/gcc-clang-compatibility/runtest.sh +++ b/tests/gcc-clang-compatibility/runtest.sh @@ -1,4 +1,4 @@ -#!/bin/sh -eux +#!/bin/bash -eux tmp=$(mktemp -d) @@ -6,7 +6,7 @@ tmp=$(mktemp -d) # gcc-toolset-XX, in such case we need to test the compatibility with that one. # We can get that from `clang -v` output. TOOLSET=$(clang -v |& grep "Selected GCC installation" | grep -P -o '(dev|gcc-)toolset-[0-9]*') ||: -if [[ "x" = "x${TOOLSET}" ]]; then +if [[ "" = "${TOOLSET}" ]]; then GCC="g++" else GCC="scl enable ${TOOLSET} -- g++" @@ -14,13 +14,13 @@ else fi # Build the source with GCC, link it with clang -${GCC} -c hello.cpp -o ${tmp}/hello.o -clang++ -o ${tmp}/hello ${tmp}/hello.o -${tmp}/hello | grep "Hello world" -rm -rf ${tmp}/* +${GCC} -c hello.cpp -o "${tmp}/hello.o" +clang++ -o "${tmp}"/hello "${tmp}/hello.o" +"${tmp}/hello" | grep "Hello world" +rm -rf "${tmp:?}"/* # Build the source with clang, link it with GCC -clang++ -c hello.cpp -o ${tmp}/hello.o -${GCC} -o ${tmp}/hello ${tmp}/hello.o -${tmp}/hello | grep "Hello world" -rm -rf ${tmp}/* +clang++ -c hello.cpp -o "${tmp}/hello.o" +${GCC} -o "${tmp}"/hello "${tmp}/hello.o" +"${tmp}/hello" | grep "Hello world" +rm -rf "${tmp:?}"/* diff --git a/tests/kernel-ark-build/runtest.sh b/tests/kernel-ark-build/runtest.sh index f9b217f..db04d4a 100755 --- a/tests/kernel-ark-build/runtest.sh +++ b/tests/kernel-ark-build/runtest.sh @@ -81,7 +81,7 @@ cloneKernelTree() { sleep $delay fi done - return $retcode + return "$retcode" } # In a kernel-ark repository, do all the operations needed to generate an SRPM @@ -102,8 +102,17 @@ generateSRPM() { rlRun "make dist-get-buildreqs > make-buildreqs.log 2>&1" rlFileSubmit make-buildreqs.log if grep -q 'Missing dependencies:' make-buildreqs.log; then - rlRun "KERNEL_BUILDREQS=\"$(sed -n 's/Missing dependencies://p' make-buildreqs.log)\"" - rlRun 'dnf install -y ${KERNEL_BUILDREQS} > install-buildreqs.log 2>&1' + # Getting the build requirements is quite tricky as it might contain + # not only package names but also "provides" perl(ExtUtils::Embed) which + # can break the dnf command if not escaped properly. The safest way is + # to create an array which contains each req as argument, then pass the + # array to dnf. Bash will later pass each element properly quoted. + # rlRun can also easily break the command due to special characters + # so we don't use it here. + read -ra KERNEL_BUILDREQS <<< "$(sed -n 's/Missing dependencies://p' make-buildreqs.log)" + rlLog "Installing dependencies: ${KERNEL_BUILDREQS[*]}" + dnf install -y "${KERNEL_BUILDREQS[@]}" > install-buildreqs.log 2>&1 || \ + rlFail "$(cat install-buildreqs.log)" rlFileSubmit install-buildreqs.log elif grep 'PASS:' make-buildreqs.log; then rlLog "All dependencies were already installed" @@ -139,6 +148,7 @@ rlJournalStart rlRun "free -h" logTmtRequiredPackages + declare tmp rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" rlRun "pushd $tmp" rlRun "set -o pipefail" diff --git a/tests/libomp/runtest.sh b/tests/libomp/runtest.sh index dfe811f..934b96b 100755 --- a/tests/libomp/runtest.sh +++ b/tests/libomp/runtest.sh @@ -2,23 +2,23 @@ set -exo pipefail -CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang))) +CLANG_PKG=$(rpm -qf --queryformat '%{name}' "$(readlink -f "$(type -p clang)")") # For compat packages, we want to check if there's a package suffix: clang17 instead clang for example PKG_SUFFIX=${CLANG_PKG#clang} -CLANG_NVR=$(rpm -q $CLANG_PKG) -CLANG_VERSION=$(rpm --queryformat="%{version}" -q $CLANG_NVR) +CLANG_NVR=$(rpm -q "$CLANG_PKG") +CLANG_VERSION=$(rpm --queryformat="%{version}" -q "$CLANG_NVR") LIBOMP_DEPENDENCIES="libomp${PKG_SUFFIX} libomp${PKG_SUFFIX}-devel" # Ensure clang depends on the correct clang-libs version -rpm -q --requires ${CLANG_NVR} | grep "${CLANG_PKG}-libs.* = ${CLANG_VERSION}" +rpm -q --requires "$CLANG_NVR" | grep "${CLANG_PKG}-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${PKG_SUFFIX}-libs | grep "${lomp_dep}.* = ${CLANG_VERSION}" - [[ "$(rpm --queryformat="%{version}" -q ${lomp_dep}.$(uname -m))" == "${CLANG_VERSION}" ]] + rpm -q --recommends "clang${PKG_SUFFIX}-libs" | grep "${lomp_dep}.* = ${CLANG_VERSION}" + [[ "$(rpm --queryformat="%{version}" -q "${lomp_dep}"."$(uname -m)")" == "${CLANG_VERSION}" ]] done # Perform a sanity test to ensure everything works as expected diff --git a/tests/long-double/runtest.sh b/tests/long-double/runtest.sh index d69e2c3..68b6aaa 100755 --- a/tests/long-double/runtest.sh +++ b/tests/long-double/runtest.sh @@ -1,4 +1,4 @@ -set -e +#!/bin/bash -e # Use __LDBL_MANT_DIG__ as a way to distinguish between long double formats. # While this is not guaranteed to change for all formats, it provides a diff --git a/tests/ppc64le-long-double/runtest-fedora.sh b/tests/ppc64le-long-double/runtest-fedora.sh index 3cfb081..84dbee7 100755 --- a/tests/ppc64le-long-double/runtest-fedora.sh +++ b/tests/ppc64le-long-double/runtest-fedora.sh @@ -1,8 +1,7 @@ -set -e +#!/bin/bash -e -fedora_release=`rpm -E %{fedora}` +fedora_release=$(rpm -E "%{fedora}") mock_root=fedora-$fedora_release-ppc64le -triple=ppc64le-redhat-linux mock_cmd="mock -r $mock_root --isolation=simple" @@ -12,10 +11,10 @@ run_test () { echo "Running $test_name" echo "Expected output: $expected" - actual=$($mock_cmd -q --shell ./$test_name) + actual=$($mock_cmd -q --shell "./$test_name") echo "Actual output: $actual" - if [[ x$expected == x$actual ]]; then + if [[ "$expected" == "$actual" ]]; then return 0; else return 1; diff --git a/tests/ppc64le-long-double/runtest.sh b/tests/ppc64le-long-double/runtest.sh index be357d5..ec3a1c6 100755 --- a/tests/ppc64le-long-double/runtest.sh +++ b/tests/ppc64le-long-double/runtest.sh @@ -1,7 +1,4 @@ -set -e - -triple=ppc64le-redhat-linux - +#!/bin/bash -e run_test () { test_name=$1 @@ -9,10 +6,10 @@ run_test () { echo "Running $test_name" echo "Expected output: $expected" - actual=$(./$test_name) + actual=$("./$test_name") echo "Actual output: $actual" - if [[ x$expected == x$actual ]]; then + if [[ "$expected" == "$actual" ]]; then return 0; else return 1; diff --git a/tests/rhbz_1647130/runtest.sh b/tests/rhbz_1647130/runtest.sh index 6898f78..1b8b6db 100755 --- a/tests/rhbz_1647130/runtest.sh +++ b/tests/rhbz_1647130/runtest.sh @@ -1,9 +1,7 @@ -#!/bin/sh -set -e -set -x +#!/bin/bash -ex -tmp_cpp=`mktemp -t XXXXX.cpp` -tmp_dir=`mktemp -d` -echo 'int main(int argc, char*argv[]) { while(argc--) new int(); return 0; }' > $tmp_cpp -scan-build -o $tmp_dir clang++ -c $tmp_cpp -o /dev/null -(scan-view --no-browser $tmp_dir/* & WPID=$! && sleep 10s && kill $WPID) +tmp_cpp=$(mktemp -t XXXXX.cpp) +tmp_dir=$(mktemp -d) +echo 'int main(int argc, char*argv[]) { while(argc--) new int(); return 0; }' > "$tmp_cpp" +scan-build -o "$tmp_dir" clang++ -c "$tmp_cpp" -o /dev/null +(scan-view --no-browser "$tmp_dir"/* & WPID=$! && sleep 10s && kill $WPID) diff --git a/tests/rpmmacros/runtest.sh b/tests/rpmmacros/runtest.sh index 99295c3..02cd4a5 100755 --- a/tests/rpmmacros/runtest.sh +++ b/tests/rpmmacros/runtest.sh @@ -1,11 +1,11 @@ -#!/bin/sh -eux +#!/bin/bash -eux -clang_pkg=${1:-"$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang)))"} +clang_pkg=${1:-"$(rpm -qf --queryformat '%{name}' "$(readlink -f "$(type -p clang)")")"} macros_path="/usr/lib/rpm/macros.d/macros.clang" set pipefail -if ! rpm -q $clang_pkg > /dev/null; then +if ! rpm -q "$clang_pkg" > /dev/null; then echo "Could not find package $clang_pkg" exit 1 fi @@ -23,7 +23,7 @@ echo # suffix ~rcN. Meanwhile, the macro won't include it in order to allow packages # built with an RC package to be fully supported later. # In that case, we need to remove that prefix. -rpm_version=$(rpm -q $clang_pkg --qf "%{version}" | sed 's/~.*//') +rpm_version=$(rpm -q "$clang_pkg" --qf "%{version}" | sed 's/~.*//') macro_version=$(rpm --eval "%{clang_version}") if [[ "$rpm_version" != "$macro_version" ]]; then diff --git a/tests/toolchains/runtest.sh b/tests/toolchains/runtest.sh index 0d1a3e5..d1d9298 100755 --- a/tests/toolchains/runtest.sh +++ b/tests/toolchains/runtest.sh @@ -1,4 +1,4 @@ -#!/bin/sh -eux +#!/bin/bash -eu set pipefail @@ -12,41 +12,40 @@ status=0 test_toolchain() { - toolchain=$@ + toolchain=("$@") args="" - while [ $# -gt 0 ]; do - case $1 in + for arg in "${toolchain[@]}"; do + case "$arg" in clang) - compiler=$1 + compiler=$arg src=hello.c ;; clang++) - compiler=$1 + compiler=$arg src=hello.cpp ;; compiler-rt) - args="$args -rtlib=$1" + args="$args -rtlib=$arg" ;; libc++) - args="$args -stdlib=$1" + args="$args -stdlib=$arg" ;; libstdc++) - args="$args -stdlib=$1" + args="$args -stdlib=$arg" ;; lld) - args="$args -fuse-ld=$1" + args="$args -fuse-ld=$arg" ;; *) - args="$args $1" + args="$args $arg" ;; esac - shift done cmd="$compiler $args $src" rm -f a.out - echo "* $toolchain" + echo "* ${toolchain[*]}" echo " command: $cmd" if $cmd && ./a.out | grep -q 'Hello World'; then echo " PASS" @@ -57,17 +56,17 @@ test_toolchain() { } clang --version -CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang))) +CLANG_PKG=$(rpm -qf --queryformat '%{name}' "$(readlink -f "$(type -p clang)")") # Repoquery is needed instead yum info for compatibility with RHEL-7 -repoquery -i --installed $CLANG_PKG | grep ^Source -clang_version=$(rpm -q --queryformat "%{version}" $CLANG_PKG | grep -ioP "^[0-9]+") +repoquery -i --installed "$CLANG_PKG" | grep ^Source +clang_version=$(rpm -q --queryformat "%{version}" "$CLANG_PKG" | grep -ioP "^[0-9]+") echo "" for compiler in clang clang++; do for rtlib in "" compiler-rt; do for linker in "" lld; do for cxxlib in "" $CXXLIBS; do - if [ "$compiler" = "clang" -a -n "$cxxlib" ]; then + if [[ "$compiler" = "clang" && -n "$cxxlib" ]]; then continue fi for args in "" -static; do @@ -100,7 +99,7 @@ for compiler in clang clang++; do continue fi - test_toolchain $compiler $rtlib $linker $cxxlib $args + test_toolchain "$compiler" "$rtlib" "$linker" "$cxxlib" "$args" done done done diff --git a/tests/ucrt64-toolchain/runtest.sh b/tests/ucrt64-toolchain/runtest.sh index 2b3f166..9c8d5fe 100755 --- a/tests/ucrt64-toolchain/runtest.sh +++ b/tests/ucrt64-toolchain/runtest.sh @@ -1,4 +1,4 @@ -set -eux +#!/bin/bash -eux clang++ --target=x86_64-windows-gnu test.cpp file a.exe | grep "PE32+ executable (console) x86-64, for MS Windows" diff --git a/tests/use-correct-dwarf-default/runtest.sh b/tests/use-correct-dwarf-default/runtest.sh index 926658e..47e5a30 100755 --- a/tests/use-correct-dwarf-default/runtest.sh +++ b/tests/use-correct-dwarf-default/runtest.sh @@ -1,4 +1,4 @@ -#!/bin/sh -eux +#!/bin/bash -eux # Determine correct DWARF version to use. Defaults to version 5, but older # distros might need to use version 4, which can be configured using the @@ -6,9 +6,9 @@ required_dwarf_version=${DWARF_VERSION:-5} # Get clang version -CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang))) -clang_version=$(rpm -q --queryformat "%{version}" $CLANG_PKG | grep -ioP "^[0-9]+") -if [ $clang_version -lt 18 ]; then +CLANG_PKG=$(rpm -qf --queryformat '%{name}' "$(readlink -f "$(type -p clang)")") +clang_version=$(rpm -q --queryformat "%{version}" "$CLANG_PKG" | grep -ioP "^[0-9]+") +if [ "$clang_version" -lt 18 ]; then >&2 echo "clang is older than version 18"; required_dwarf_version=4 fi From 85fc2de3962b64fecbf60a3eaf931cd5de1ae7c0 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 5 Aug 2024 09:16:47 +0200 Subject: [PATCH 119/178] 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 From a9a9883a6066e01d8cc3da1b68099b5f91f6a754 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 5 Aug 2024 09:34:31 +0200 Subject: [PATCH 120/178] 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/ld-alternative/test.sh | 8 ++++---- 2 files changed, 11 insertions(+), 4 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/ld-alternative/test.sh b/tests/ld-alternative/test.sh index 6202f88..258acdb 100755 --- a/tests/ld-alternative/test.sh +++ b/tests/ld-alternative/test.sh @@ -1,11 +1,11 @@ -#!/bin/sh -eux +#!/bin/bash -eux # This test assumes lld is already installed. -function verify_ld_bfd { +verify_ld_bfd (){ # Verify that /usr/bin/ld points to ld.bfd. - ls -l /etc/alternatives/ld | grep ld.bfd + [[ $(readlink -f /etc/alternatives/ld) == *"ld.bfd" ]] # Run ld and verify it invokes ld.bfd /usr/bin/ld --version | grep 'GNU ld' @@ -19,7 +19,7 @@ verify_ld_bfd update-alternatives --set ld /usr/bin/ld.lld # Verify that /usr/bin/ld points to lld -ls -l /etc/alternatives/ld | grep ld.lld +[[ $(readlink -f /etc/alternatives/ld) == *"ld.lld" ]] # Run ld and verify it invokes lld /usr/bin/ld --version | grep 'LLD' From d69918d2f8d144d87e7a4bcfdfccf72241f64b7e Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 5 Aug 2024 09:45:45 +0200 Subject: [PATCH 121/178] Add pre-commit config Add pre-commit hooks for trailing whitespaces and newline at file end Add pre-commit hook for tmt linting Add pre-commit hook for static analysis on shell scripts (shellcheck) Fixed issues flagged by shellcheck. --- .pre-commit-config.yaml | 21 +++++++++++++++++++++ tests/lldb-std-vector-prettyprint/test.sh | 5 +++-- tests/python-embedded-interpreter/test.sh | 7 ++++--- 3 files changed, 28 insertions(+), 5 deletions(-) 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..2e27e78 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +# 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 + +- 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/lldb-std-vector-prettyprint/test.sh b/tests/lldb-std-vector-prettyprint/test.sh index d6740ad..9a58e17 100755 --- a/tests/lldb-std-vector-prettyprint/test.sh +++ b/tests/lldb-std-vector-prettyprint/test.sh @@ -12,10 +12,11 @@ lldb -b -o 'breakpoint set --file test.cpp --line 7' -o run -o 'p v' -- a.out | # (std::vector >) $0 = size=1 { # [0] = 2 -test `grep \ +# shellcheck disable=SC2016 +test "$(grep -c \ -e '(std::vector \)\?>) \($0 = \)\?size=1 {' \ -e '\[0\] = 2' \ lldb.log \ - | wc -l` -eq 2 + )" -eq 2 rm lldb.log diff --git a/tests/python-embedded-interpreter/test.sh b/tests/python-embedded-interpreter/test.sh index ca9e7e6..eef7ebb 100755 --- a/tests/python-embedded-interpreter/test.sh +++ b/tests/python-embedded-interpreter/test.sh @@ -1,7 +1,7 @@ #!/bin/sh -eux # Verify the formal side of things, lldb should really depend on its Python bits -LLDB_PACKAGE=${LLDB_PACKAGE:-$(rpm -qf $(which lldb))} +LLDB_PACKAGE=${LLDB_PACKAGE:-$(rpm -qf "$(which lldb)")} rpm -q --requires "$LLDB_PACKAGE" | grep python3-lldb # Sanity test @@ -11,10 +11,11 @@ lldb -b -o 'breakpoint set --file test.cpp --line 8' \ -o run -o 'p i' -o 'p f'\ -- a.out | tee lldb.log -test `grep \ +# shellcheck disable=SC2016 +test "$(grep -c \ -e '(int) \($0 = \)\?1' \ -e '(float) \($1 = \)\?1' \ lldb.log \ - | wc -l` -eq 2 + )" -eq 2 rm lldb.log From 8e5e183f85f809b4319396bba8f888633e43a98d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 9 Aug 2024 09:36:50 +0200 Subject: [PATCH 122/178] Allow python3.12-lldb in test --- tests/python-embedded-interpreter/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/python-embedded-interpreter/test.sh b/tests/python-embedded-interpreter/test.sh index eef7ebb..ca16589 100755 --- a/tests/python-embedded-interpreter/test.sh +++ b/tests/python-embedded-interpreter/test.sh @@ -2,7 +2,7 @@ # Verify the formal side of things, lldb should really depend on its Python bits LLDB_PACKAGE=${LLDB_PACKAGE:-$(rpm -qf "$(which lldb)")} -rpm -q --requires "$LLDB_PACKAGE" | grep python3-lldb +rpm -q --requires "$LLDB_PACKAGE" | grep "python3\(\.12\)\?-lldb" # Sanity test g++ -g test.cpp From 8f44f59b6f0d99951644bb6f5af071bae448851c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 12 Aug 2024 14:31:16 +0200 Subject: [PATCH 123/178] Use python3.12-lit for RHEL 8 snapshots Also disable snapshots.fmf on rhel, because we reuse the main rhel.fmf for snapshots in that case. snapshots.fmf is the replacement for fedora.fmf only. --- tests/integration-test-suite/rhel.fmf | 8 ++++++++ tests/integration-test-suite/snapshots.fmf | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/integration-test-suite/rhel.fmf b/tests/integration-test-suite/rhel.fmf index 253a1d5..121b538 100644 --- a/tests/integration-test-suite/rhel.fmf +++ b/tests/integration-test-suite/rhel.fmf @@ -36,3 +36,11 @@ adjust+: - require-: - libomp-devel when: arch == s390x + + # RHEL 8 snapshots use python3.12 + - require-: + - python3-lit + when: distro == rhel-8 and snapshot is defined + - require+: + - python3.12-lit + when: distro == rhel-8 and snapshot is defined diff --git a/tests/integration-test-suite/snapshots.fmf b/tests/integration-test-suite/snapshots.fmf index 3909ef4..2758b87 100644 --- a/tests/integration-test-suite/snapshots.fmf +++ b/tests/integration-test-suite/snapshots.fmf @@ -24,5 +24,5 @@ environment+: adjust+: - enabled: false - when: snapshot is not defined + when: snapshot is not defined or distro == rhel continue: false From a2b93f39c8982ce91d10b29f8aaabebe4e68d7d7 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 14 Oct 2024 10:06:13 +0200 Subject: [PATCH 124/178] ld-alternative: Update check on alternatives/ld symlink Before LLD 19 /usr/bin/ld.lld was a file, and now it's a symlink to /usr/bin/lld. Hence, /etc/alternative/ld symlink now resolves to /usr/bin/lld, breaking our check and raising false positives. Updating the expression to match "lld" only fixes the issue. --- tests/ld-alternative/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ld-alternative/test.sh b/tests/ld-alternative/test.sh index 258acdb..b244ad1 100755 --- a/tests/ld-alternative/test.sh +++ b/tests/ld-alternative/test.sh @@ -19,7 +19,7 @@ verify_ld_bfd update-alternatives --set ld /usr/bin/ld.lld # Verify that /usr/bin/ld points to lld -[[ $(readlink -f /etc/alternatives/ld) == *"ld.lld" ]] +[[ $(readlink -f /etc/alternatives/ld) == *"lld" ]] # Run ld and verify it invokes lld /usr/bin/ld --version | grep 'LLD' From 336e421c1ae285b27938dc94f6793bf158b102ba Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Tue, 12 Nov 2024 10:26:23 -0300 Subject: [PATCH 125/178] Add an extra step in order to debug disk usage Recent executions of this test on llvm-snapshots have been failing on due to exhaustion of disk space. Print the disk usage at the end of the execution in order to help debug this issue. --- tests/integration-test-suite/test.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/integration-test-suite/test.sh b/tests/integration-test-suite/test.sh index 95598a0..47a7823 100755 --- a/tests/integration-test-suite/test.sh +++ b/tests/integration-test-suite/test.sh @@ -52,6 +52,11 @@ rlJournalStart rlPhaseEnd rlPhaseStartCleanup + # Some steps of this test have been failing due to not having enough + # disk space. Print the disk usage at the end in order to help debugging which + # partition is full. + rlRun "df -h -t btrfs -t ext4 -t tmpfs -t xfs" 0 "Debug disk usage in overall" + rlRun "du -h -d1 $TmpDir" 0 "Debug disk usage by this test" rlRun "popd" rlRun "rm -rf $TmpDir" 0 "Removing tmp directory" rlPhaseEnd From c140bdf103ff140adc3efca43d5a0fa19bf649b1 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 13 Nov 2024 16:30:58 -0300 Subject: [PATCH 126/178] rhbz_1647130: Remove tmp_dir at the end Guarantee the temporary directory is removed after the execution of this test. --- tests/rhbz_1647130/runtest.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/rhbz_1647130/runtest.sh b/tests/rhbz_1647130/runtest.sh index 1b8b6db..39f8a90 100755 --- a/tests/rhbz_1647130/runtest.sh +++ b/tests/rhbz_1647130/runtest.sh @@ -5,3 +5,4 @@ tmp_dir=$(mktemp -d) echo 'int main(int argc, char*argv[]) { while(argc--) new int(); return 0; }' > "$tmp_cpp" scan-build -o "$tmp_dir" clang++ -c "$tmp_cpp" -o /dev/null (scan-view --no-browser "$tmp_dir"/* & WPID=$! && sleep 10s && kill $WPID) +rm -rf "$tmp_cpp" "$tmp_dir" From de1663d7a93e3878dfd82b902a84f1f32b989f6e Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Thu, 14 Nov 2024 09:38:58 -0300 Subject: [PATCH 127/178] Remove temporary files Ensure s390x-asm-unsupported-pc-relative-addr and shlibs-cet-support remove temporary files after a successful execution. --- tests/s390x-asm-unsupported-pc-relative-addr/test.sh | 6 +++++- tests/shlibs-cet-support/test.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/s390x-asm-unsupported-pc-relative-addr/test.sh b/tests/s390x-asm-unsupported-pc-relative-addr/test.sh index 7ee5791..d081313 100755 --- a/tests/s390x-asm-unsupported-pc-relative-addr/test.sh +++ b/tests/s390x-asm-unsupported-pc-relative-addr/test.sh @@ -1,8 +1,12 @@ #!/bin/bash -eux -cd "$(mktemp -d)" +tmp=$(mktemp -d) +pushd "$tmp" # This asm has an invalid PC relative address. echo "start: la %r2,_end-start(%r2)" > test.S # clang should fail to build and inform properly about the issue. clang -c -o test.o test.S |& tee clang.output ||: grep -q "Unsupported PC-relative address" clang.output +popd +# On failure, the script will abort and tmp won't be removed. +rm -rf "$tmp" diff --git a/tests/shlibs-cet-support/test.sh b/tests/shlibs-cet-support/test.sh index b86e85a..55684e4 100755 --- a/tests/shlibs-cet-support/test.sh +++ b/tests/shlibs-cet-support/test.sh @@ -1,9 +1,13 @@ #!/bin/bash -eux -cd "$(mktemp -d)" +tmp=$(mktemp -d) +pushd "$tmp" for lib in $(rpm -ql llvm-libs | grep -E '\.so(\..+)?$'); do [[ -L $lib ]] && continue # Skip symlinks readelf -n "$lib" > notes.log grep -q "SHSTK" notes.log grep -q "IBT" notes.log done +popd +# On failure, the script will abort and tmp won't be removed. +rm -rf "$tmp" From 7b5681ac951880ba2d267917ddd06dab60f9e48e Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Thu, 14 Nov 2024 09:39:56 -0300 Subject: [PATCH 128/178] Collect further information about disk usage Continuing the investigation that started with commit 336e421c1ae28, restrict the information collected on the /tmp partition because we got a confirmation this partition is getting full. Also, collect more details about which directories and files in /tmp are consuming all disk space. --- tests/integration-test-suite/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration-test-suite/test.sh b/tests/integration-test-suite/test.sh index 47a7823..061bead 100755 --- a/tests/integration-test-suite/test.sh +++ b/tests/integration-test-suite/test.sh @@ -55,8 +55,8 @@ rlJournalStart # Some steps of this test have been failing due to not having enough # disk space. Print the disk usage at the end in order to help debugging which # partition is full. - rlRun "df -h -t btrfs -t ext4 -t tmpfs -t xfs" 0 "Debug disk usage in overall" - rlRun "du -h -d1 $TmpDir" 0 "Debug disk usage by this test" + rlRun "df -h /tmp" 0 "Debug disk usage in overall" + rlRun "du -h -d1 /tmp" 0 "Debug disk usage after this test" rlRun "popd" rlRun "rm -rf $TmpDir" 0 "Removing tmp directory" rlPhaseEnd From 4d92417571de2fbbf1a13bd89c096586d91a6127 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 17 Apr 2024 14:38:54 +0200 Subject: [PATCH 129/178] libllvm-size: test that libLLVM contains no debug sections --- tests/libllvm-size/test.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/libllvm-size/test.sh b/tests/libllvm-size/test.sh index f7f43ab..fdc575a 100755 --- a/tests/libllvm-size/test.sh +++ b/tests/libllvm-size/test.sh @@ -1,4 +1,4 @@ -#!/bin/sh -eux +#!/bin/bash -eux # There is a bug in the build process when it runs out of disk space # while stripping binaries, which causes the strip to fail, but does @@ -8,3 +8,6 @@ # https://bugzilla.redhat.com/show_bug.cgi?id=1793250 test "$(stat -L -c %s "$LIBLLVM_PATH")" -lt 524288000 + +# Ensure libLLVM has no debug info +[[ $(llvm-readelf -S "$LIBLLVM_PATH" | grep -c '\.debug') -eq 0 ]] From 47cc23d2bb6724abe29426b1c5f85f93014d4399 Mon Sep 17 00:00:00 2001 From: Edjunior Machado Date: Wed, 27 Nov 2024 16:04:02 +0100 Subject: [PATCH 130/178] Expect python3.12-lit on RHEL 8 builds Drop conditional on snapshots. --- tests/integration-test-suite/rhel.fmf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration-test-suite/rhel.fmf b/tests/integration-test-suite/rhel.fmf index 121b538..e519f3f 100644 --- a/tests/integration-test-suite/rhel.fmf +++ b/tests/integration-test-suite/rhel.fmf @@ -37,10 +37,10 @@ adjust+: - libomp-devel when: arch == s390x - # RHEL 8 snapshots use python3.12 + # RHEL 8 use python3.12 - require-: - python3-lit - when: distro == rhel-8 and snapshot is defined + when: distro == rhel-8 - require+: - python3.12-lit - when: distro == rhel-8 and snapshot is defined + when: distro == rhel-8 From b69c51a4a0ebf3f31340928a04d37b44cc352d0c Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Tue, 3 Dec 2024 10:28:59 -0300 Subject: [PATCH 131/178] Revert commits related to debugging disk usage The problem has been fixed and this troubleshooting code is not needed anymore. This reverts commits 7b5681ac951880ba2d267917ddd06dab60f9e48e and 336e421c1ae285b27938dc94f6793bf158b102ba. --- tests/integration-test-suite/test.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/integration-test-suite/test.sh b/tests/integration-test-suite/test.sh index 061bead..95598a0 100755 --- a/tests/integration-test-suite/test.sh +++ b/tests/integration-test-suite/test.sh @@ -52,11 +52,6 @@ rlJournalStart rlPhaseEnd rlPhaseStartCleanup - # Some steps of this test have been failing due to not having enough - # disk space. Print the disk usage at the end in order to help debugging which - # partition is full. - rlRun "df -h /tmp" 0 "Debug disk usage in overall" - rlRun "du -h -d1 /tmp" 0 "Debug disk usage after this test" rlRun "popd" rlRun "rm -rf $TmpDir" 0 "Removing tmp directory" rlPhaseEnd From 0abd69aae93ef25f8e1a4ec256804f3c3a800851 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 12 Dec 2024 14:49:38 +0100 Subject: [PATCH 132/178] Add test to check zstd support is present and works --- tests/zstd-support/main.fmf | 16 +++++++ tests/zstd-support/test.c | 83 +++++++++++++++++++++++++++++++++++++ tests/zstd-support/test.sh | 38 +++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 tests/zstd-support/main.fmf create mode 100644 tests/zstd-support/test.c create mode 100755 tests/zstd-support/test.sh diff --git a/tests/zstd-support/main.fmf b/tests/zstd-support/main.fmf new file mode 100644 index 0000000..97ae12e --- /dev/null +++ b/tests/zstd-support/main.fmf @@ -0,0 +1,16 @@ +summary: Test that llvm ZSTD support works +duration: 2m +tier: 1 +framework: beakerlib +require+: + - lld + - binutils +adjust+: + - when: distro < fedora-41, rhel-8.10, rhel-9.6, rhel-10.0 + enabled: false + because: ZSTD is enabled only in LLVM 19 and newer +link+: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2321848 + - verifies: https://issues.redhat.com/browse/RHEL-70329 + - verifies: https://issues.redhat.com/browse/RHEL-70328 + - verifies: https://issues.redhat.com/browse/RHEL-70325 diff --git a/tests/zstd-support/test.c b/tests/zstd-support/test.c new file mode 100644 index 0000000..169d8c5 --- /dev/null +++ b/tests/zstd-support/test.c @@ -0,0 +1,83 @@ +/* + * This test contains several variables functions and structures that will + * generate a substantial debug sections that are big enough for the compiler + * to trigger the compression on them. + */ + +#include +#include +#include + +// Define a large structure with multiple fields +struct BigStruct { + int id; + char name[50]; + double value; + char description[200]; +}; + +// Function to populate the structure +void populate_struct(struct BigStruct *bs, int id, const char *name, double value, const char *description) { + bs->id = id; + strncpy(bs->name, name, sizeof(bs->name) - 1); + bs->name[sizeof(bs->name) - 1] = '\0'; + bs->value = value; + strncpy(bs->description, description, sizeof(bs->description) - 1); + bs->description[sizeof(bs->description) - 1] = '\0'; +} + +// A function with lots of local variables to increase debug information +void complex_function(int a, double b) { + int x = a * 2; + int y = a + x; + double z = b / 2.0; + char buffer[100]; + + sprintf(buffer, "Intermediate values: x=%d, y=%d, z=%f", x, y, z); + printf("%s\n", buffer); + + // Some additional local variables + float temp = (float)(x * y * z); + int array[10]; + for (int i = 0; i < 10; i++) { + array[i] = i * (int)temp; + } + + for (int i = 0; i < 10; i++) { + printf("array[%d] = %d\n", i, array[i]); + } +} + +// Recursive function to generate debug info for function calls +int factorial(int n) { + if (n <= 1) return 1; + return n * factorial(n - 1); +} + +// Function to generate large arrays +void generate_large_array() { + int large_array[1000]; + for (int i = 0; i < 1000; i++) { + large_array[i] = i * i; + } + printf("Large array generated.\n"); +} + +int main() { + // Work with structures + struct BigStruct bs; + populate_struct(&bs, 1, "Test Struct", 123.456, "This is a test description to generate more debug information."); + printf("Struct values: id=%d, name=%s, value=%f, description=%s\n", bs.id, bs.name, bs.value, bs.description); + + // Call complex function + complex_function(42, 3.14); + + // Call recursive function + int fact = factorial(5); + printf("Factorial of 5 is %d\n", fact); + + // Generate a large array + generate_large_array(); + + return 0; +} diff --git a/tests/zstd-support/test.sh b/tests/zstd-support/test.sh new file mode 100755 index 0000000..06fdbd1 --- /dev/null +++ b/tests/zstd-support/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + declare tmp + rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" + rlRun "cp test.c $tmp" + rlRun "pushd $tmp" + rlPhaseEnd + + rlPhaseStartTest + # Compress debug sections with compiler + rlRun "clang -c -g -gz=zstd test.c -o test.o" + rlRun "readelf -t test.o | grep -q ZSTD" + + # Compress debug sections with linker (lld) + rlRun "clang -fuse-ld=lld -g -gz=zstd test.c -o test" + rlRun "readelf -t test | grep -q ZSTD" + + # Decompress with llvm-objcopy + rlRun "llvm-objcopy --decompress-debug-sections test test.decomp" + rlRun "readelf -t test.decomp | grep -q ZSTD" 1 + + # Compress with llvm-objcopy + rlRun "clang -c -g test.c -o test.nocomp" + rlRun "llvm-objcopy --compress-debug-sections=zstd test.nocomp test.comp" + rlRun "readelf -t test.nocomp | grep -q ZSTD" 1 + rlRun "readelf -t test.comp | grep -q ZSTD" + + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $tmp" 0 "Remove tmp directory" + rlPhaseEnd +rlJournalEnd From 25257b851bd5cfa7ebafedf67c2343b4860e693c Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 17 Dec 2024 14:20:01 +0100 Subject: [PATCH 133/178] zstd-support: Fix adjust condition for distros. Make the condition more specific to each distro Y stream, as specifying several comma-separated distros is prone to fail in tmt. --- tests/zstd-support/main.fmf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/zstd-support/main.fmf b/tests/zstd-support/main.fmf index 97ae12e..b1be7bf 100644 --- a/tests/zstd-support/main.fmf +++ b/tests/zstd-support/main.fmf @@ -6,7 +6,9 @@ require+: - lld - binutils adjust+: - - when: distro < fedora-41, rhel-8.10, rhel-9.6, rhel-10.0 + - when: distro == fedora and distro < fedora-41 or + distro == rhel-8 and distro < rhel-8.10 or + distro == rhel-9 and distro < rhel-9.6 enabled: false because: ZSTD is enabled only in LLVM 19 and newer link+: From 40fef0bd32e4fe799928f307a3a43cc4ccd87095 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 18 Dec 2024 09:56:01 +0100 Subject: [PATCH 134/178] zstd-support: replace readelf with llvm-readelf In some RHEL distros, the system binutils is too old and readelf will not print ZSTD in the section details. --- tests/zstd-support/main.fmf | 1 - tests/zstd-support/test.sh | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/zstd-support/main.fmf b/tests/zstd-support/main.fmf index b1be7bf..519afc4 100644 --- a/tests/zstd-support/main.fmf +++ b/tests/zstd-support/main.fmf @@ -4,7 +4,6 @@ tier: 1 framework: beakerlib require+: - lld - - binutils adjust+: - when: distro == fedora and distro < fedora-41 or distro == rhel-8 and distro < rhel-8.10 or diff --git a/tests/zstd-support/test.sh b/tests/zstd-support/test.sh index 06fdbd1..778b634 100755 --- a/tests/zstd-support/test.sh +++ b/tests/zstd-support/test.sh @@ -13,21 +13,21 @@ rlJournalStart rlPhaseStartTest # Compress debug sections with compiler rlRun "clang -c -g -gz=zstd test.c -o test.o" - rlRun "readelf -t test.o | grep -q ZSTD" + rlRun "llvm-readelf -t test.o | grep -q ZSTD" # Compress debug sections with linker (lld) rlRun "clang -fuse-ld=lld -g -gz=zstd test.c -o test" - rlRun "readelf -t test | grep -q ZSTD" + rlRun "llvm-readelf -t test | grep -q ZSTD" # Decompress with llvm-objcopy rlRun "llvm-objcopy --decompress-debug-sections test test.decomp" - rlRun "readelf -t test.decomp | grep -q ZSTD" 1 + rlRun "llvm-readelf -t test.decomp | grep -q ZSTD" 1 # Compress with llvm-objcopy rlRun "clang -c -g test.c -o test.nocomp" rlRun "llvm-objcopy --compress-debug-sections=zstd test.nocomp test.comp" - rlRun "readelf -t test.nocomp | grep -q ZSTD" 1 - rlRun "readelf -t test.comp | grep -q ZSTD" + rlRun "llvm-readelf -t test.nocomp | grep -q ZSTD" 1 + rlRun "llvm-readelf -t test.comp | grep -q ZSTD" rlPhaseEnd From 9fbc967ffdbd1877f7b580a90c41f44abf3aabc9 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 20 Dec 2024 15:07:50 +0100 Subject: [PATCH 135/178] Rename test scripts Clang test scripts were named "runtest.sh". Rename them as "test.sh" for consistency with the rest of the repo. --- tests/clang-format-diff/{runtest.sh => test.sh} | 0 tests/fedora-flags/{runtest.sh => test.sh} | 0 tests/gcc-clang-compatibility/{runtest.sh => test.sh} | 0 tests/kernel-ark-build/{runtest.sh => test.sh} | 0 tests/libomp/{runtest.sh => test.sh} | 0 tests/llvm-test-suite/{runtest.sh => test.sh} | 0 tests/long-double/{runtest.sh => test.sh} | 0 tests/openmp-rpm/{runtest.sh => test.sh} | 0 tests/pie-rpm/{runtest.sh => test.sh} | 1 - tests/ppc64le-long-double/{runtest.sh => test.sh} | 0 tests/rhbz_1647130/{runtest.sh => test.sh} | 0 tests/rhbz_1657544/{runtest.sh => test.sh} | 0 tests/rhbz_2239619/{runtest.sh => test.sh} | 0 tests/rhbz_482491/{runtest.sh => test.sh} | 0 tests/rpmmacros/{runtest.sh => test.sh} | 0 tests/toolchains/{runtest.sh => test.sh} | 0 tests/ucrt64-toolchain/{runtest.sh => test.sh} | 0 tests/use-correct-dwarf-default/{runtest.sh => test.sh} | 0 18 files changed, 1 deletion(-) rename tests/clang-format-diff/{runtest.sh => test.sh} (100%) rename tests/fedora-flags/{runtest.sh => test.sh} (100%) rename tests/gcc-clang-compatibility/{runtest.sh => test.sh} (100%) rename tests/kernel-ark-build/{runtest.sh => test.sh} (100%) rename tests/libomp/{runtest.sh => test.sh} (100%) rename tests/llvm-test-suite/{runtest.sh => test.sh} (100%) rename tests/long-double/{runtest.sh => test.sh} (100%) rename tests/openmp-rpm/{runtest.sh => test.sh} (100%) rename tests/pie-rpm/{runtest.sh => test.sh} (99%) rename tests/ppc64le-long-double/{runtest.sh => test.sh} (100%) rename tests/rhbz_1647130/{runtest.sh => test.sh} (100%) rename tests/rhbz_1657544/{runtest.sh => test.sh} (100%) rename tests/rhbz_2239619/{runtest.sh => test.sh} (100%) rename tests/rhbz_482491/{runtest.sh => test.sh} (100%) rename tests/rpmmacros/{runtest.sh => test.sh} (100%) rename tests/toolchains/{runtest.sh => test.sh} (100%) rename tests/ucrt64-toolchain/{runtest.sh => test.sh} (100%) rename tests/use-correct-dwarf-default/{runtest.sh => test.sh} (100%) diff --git a/tests/clang-format-diff/runtest.sh b/tests/clang-format-diff/test.sh similarity index 100% rename from tests/clang-format-diff/runtest.sh rename to tests/clang-format-diff/test.sh diff --git a/tests/fedora-flags/runtest.sh b/tests/fedora-flags/test.sh similarity index 100% rename from tests/fedora-flags/runtest.sh rename to tests/fedora-flags/test.sh diff --git a/tests/gcc-clang-compatibility/runtest.sh b/tests/gcc-clang-compatibility/test.sh similarity index 100% rename from tests/gcc-clang-compatibility/runtest.sh rename to tests/gcc-clang-compatibility/test.sh diff --git a/tests/kernel-ark-build/runtest.sh b/tests/kernel-ark-build/test.sh similarity index 100% rename from tests/kernel-ark-build/runtest.sh rename to tests/kernel-ark-build/test.sh diff --git a/tests/libomp/runtest.sh b/tests/libomp/test.sh similarity index 100% rename from tests/libomp/runtest.sh rename to tests/libomp/test.sh diff --git a/tests/llvm-test-suite/runtest.sh b/tests/llvm-test-suite/test.sh similarity index 100% rename from tests/llvm-test-suite/runtest.sh rename to tests/llvm-test-suite/test.sh diff --git a/tests/long-double/runtest.sh b/tests/long-double/test.sh similarity index 100% rename from tests/long-double/runtest.sh rename to tests/long-double/test.sh diff --git a/tests/openmp-rpm/runtest.sh b/tests/openmp-rpm/test.sh similarity index 100% rename from tests/openmp-rpm/runtest.sh rename to tests/openmp-rpm/test.sh diff --git a/tests/pie-rpm/runtest.sh b/tests/pie-rpm/test.sh similarity index 99% rename from tests/pie-rpm/runtest.sh rename to tests/pie-rpm/test.sh index a8bdafc..408b1eb 100755 --- a/tests/pie-rpm/runtest.sh +++ b/tests/pie-rpm/test.sh @@ -6,4 +6,3 @@ set pipefail #${BUILDDEP_CMD} -y pie.spec QA_RPATHS=$(( 0x0001 )) rpmbuild -bb ./pie.spec - diff --git a/tests/ppc64le-long-double/runtest.sh b/tests/ppc64le-long-double/test.sh similarity index 100% rename from tests/ppc64le-long-double/runtest.sh rename to tests/ppc64le-long-double/test.sh diff --git a/tests/rhbz_1647130/runtest.sh b/tests/rhbz_1647130/test.sh similarity index 100% rename from tests/rhbz_1647130/runtest.sh rename to tests/rhbz_1647130/test.sh diff --git a/tests/rhbz_1657544/runtest.sh b/tests/rhbz_1657544/test.sh similarity index 100% rename from tests/rhbz_1657544/runtest.sh rename to tests/rhbz_1657544/test.sh diff --git a/tests/rhbz_2239619/runtest.sh b/tests/rhbz_2239619/test.sh similarity index 100% rename from tests/rhbz_2239619/runtest.sh rename to tests/rhbz_2239619/test.sh diff --git a/tests/rhbz_482491/runtest.sh b/tests/rhbz_482491/test.sh similarity index 100% rename from tests/rhbz_482491/runtest.sh rename to tests/rhbz_482491/test.sh diff --git a/tests/rpmmacros/runtest.sh b/tests/rpmmacros/test.sh similarity index 100% rename from tests/rpmmacros/runtest.sh rename to tests/rpmmacros/test.sh diff --git a/tests/toolchains/runtest.sh b/tests/toolchains/test.sh similarity index 100% rename from tests/toolchains/runtest.sh rename to tests/toolchains/test.sh diff --git a/tests/ucrt64-toolchain/runtest.sh b/tests/ucrt64-toolchain/test.sh similarity index 100% rename from tests/ucrt64-toolchain/runtest.sh rename to tests/ucrt64-toolchain/test.sh diff --git a/tests/use-correct-dwarf-default/runtest.sh b/tests/use-correct-dwarf-default/test.sh similarity index 100% rename from tests/use-correct-dwarf-default/runtest.sh rename to tests/use-correct-dwarf-default/test.sh From b7d140d50eb5f43952866b8aaf8282abac61645f Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 20 Dec 2024 17:10:08 +0100 Subject: [PATCH 136/178] Group lld tests in a directory lld metadata adjustments are tricky and makes sense to group the tests together to avoid as much duplicity as possible from a maintainability point of view --- tests/{ => lld}/basic/main.fmf | 0 tests/{ => lld}/basic/test.sh | 0 tests/{ => lld}/gcc-compat-basic/main.fmf | 0 tests/{ => lld}/gcc-compat-basic/test.sh | 0 tests/{ => lld}/ld-alternative/main.fmf | 0 tests/{ => lld}/ld-alternative/test.sh | 0 tests/lld/main.fmf | 34 +++++++++++++++++++++++ 7 files changed, 34 insertions(+) rename tests/{ => lld}/basic/main.fmf (100%) rename tests/{ => lld}/basic/test.sh (100%) rename tests/{ => lld}/gcc-compat-basic/main.fmf (100%) rename tests/{ => lld}/gcc-compat-basic/test.sh (100%) rename tests/{ => lld}/ld-alternative/main.fmf (100%) rename tests/{ => lld}/ld-alternative/test.sh (100%) create mode 100644 tests/lld/main.fmf diff --git a/tests/basic/main.fmf b/tests/lld/basic/main.fmf similarity index 100% rename from tests/basic/main.fmf rename to tests/lld/basic/main.fmf diff --git a/tests/basic/test.sh b/tests/lld/basic/test.sh similarity index 100% rename from tests/basic/test.sh rename to tests/lld/basic/test.sh diff --git a/tests/gcc-compat-basic/main.fmf b/tests/lld/gcc-compat-basic/main.fmf similarity index 100% rename from tests/gcc-compat-basic/main.fmf rename to tests/lld/gcc-compat-basic/main.fmf diff --git a/tests/gcc-compat-basic/test.sh b/tests/lld/gcc-compat-basic/test.sh similarity index 100% rename from tests/gcc-compat-basic/test.sh rename to tests/lld/gcc-compat-basic/test.sh diff --git a/tests/ld-alternative/main.fmf b/tests/lld/ld-alternative/main.fmf similarity index 100% rename from tests/ld-alternative/main.fmf rename to tests/lld/ld-alternative/main.fmf diff --git a/tests/ld-alternative/test.sh b/tests/lld/ld-alternative/test.sh similarity index 100% rename from tests/ld-alternative/test.sh rename to tests/lld/ld-alternative/test.sh diff --git a/tests/lld/main.fmf b/tests/lld/main.fmf new file mode 100644 index 0000000..e948f96 --- /dev/null +++ b/tests/lld/main.fmf @@ -0,0 +1,34 @@ +# Common adjustments for lld tests + +adjust+: + - because: lld is not shipped for ppc64 + enabled: false + when: arch == ppc64 + + - because: lld is not shipped in s390x on LLVM < 18 + enabled: false + when: arch == s390x and distro < rhel-8.10, fedora-40, centos-stream-9 + - enabled: false + when: arch == s390x and distro == rhel-9 and distro < rhel-9.5 + + # Common requirements when LLVM is not SCL-ized + - require+: + - lld + 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-lld + when: collection == llvm-toolset-13.0 + + - test: scl enable llvm-toolset-14.0 -- ./test.sh + require+: + - llvm-toolset-14.0-lld + when: collection == llvm-toolset-14.0 + + - test: scl enable llvm-toolset-15.0 -- ./test.sh + require+: + - llvm-toolset-15.0-lld + when: collection == llvm-toolset-15.0 From bbc0f57af47e21adf2375e9b827eb57c1892f5c0 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 8 Jan 2025 13:26:59 +0100 Subject: [PATCH 137/178] Group lldb tests in a subdirectory --- tests/{ => lldb}/lldb-dwz/hello.c | 0 tests/{ => lldb}/lldb-dwz/main.fmf | 1 + tests/{ => lldb}/lldb-dwz/test.sh | 0 tests/{ => lldb}/lldb-std-vector-prettyprint/main.fmf | 1 + tests/{ => lldb}/lldb-std-vector-prettyprint/test.cpp | 0 tests/{ => lldb}/lldb-std-vector-prettyprint/test.sh | 0 tests/{ => lldb}/python-embedded-interpreter/main.fmf | 1 + tests/{ => lldb}/python-embedded-interpreter/test.cpp | 0 tests/{ => lldb}/python-embedded-interpreter/test.sh | 0 9 files changed, 3 insertions(+) rename tests/{ => lldb}/lldb-dwz/hello.c (100%) rename tests/{ => lldb}/lldb-dwz/main.fmf (95%) rename tests/{ => lldb}/lldb-dwz/test.sh (100%) rename tests/{ => lldb}/lldb-std-vector-prettyprint/main.fmf (97%) rename tests/{ => lldb}/lldb-std-vector-prettyprint/test.cpp (100%) rename tests/{ => lldb}/lldb-std-vector-prettyprint/test.sh (100%) rename tests/{ => lldb}/python-embedded-interpreter/main.fmf (96%) rename tests/{ => lldb}/python-embedded-interpreter/test.cpp (100%) rename tests/{ => lldb}/python-embedded-interpreter/test.sh (100%) diff --git a/tests/lldb-dwz/hello.c b/tests/lldb/lldb-dwz/hello.c similarity index 100% rename from tests/lldb-dwz/hello.c rename to tests/lldb/lldb-dwz/hello.c diff --git a/tests/lldb-dwz/main.fmf b/tests/lldb/lldb-dwz/main.fmf similarity index 95% rename from tests/lldb-dwz/main.fmf rename to tests/lldb/lldb-dwz/main.fmf index fe968c6..732bfac 100644 --- a/tests/lldb-dwz/main.fmf +++ b/tests/lldb/lldb-dwz/main.fmf @@ -1,5 +1,6 @@ summary: "Test that lldb doesn't crash with dwz debuginfo" require+: + - lldb - gcc - dwz tier: 1 diff --git a/tests/lldb-dwz/test.sh b/tests/lldb/lldb-dwz/test.sh similarity index 100% rename from tests/lldb-dwz/test.sh rename to tests/lldb/lldb-dwz/test.sh diff --git a/tests/lldb-std-vector-prettyprint/main.fmf b/tests/lldb/lldb-std-vector-prettyprint/main.fmf similarity index 97% rename from tests/lldb-std-vector-prettyprint/main.fmf rename to tests/lldb/lldb-std-vector-prettyprint/main.fmf index 1d0f4c7..6217942 100644 --- a/tests/lldb-std-vector-prettyprint/main.fmf +++ b/tests/lldb/lldb-std-vector-prettyprint/main.fmf @@ -1,5 +1,6 @@ summary: "Test lldb std::vector pretty printer" require+: + - lldb - gcc-c++ tier: 1 extra-summary: /tools/lldb/lldb-std-vector-prettyprint diff --git a/tests/lldb-std-vector-prettyprint/test.cpp b/tests/lldb/lldb-std-vector-prettyprint/test.cpp similarity index 100% rename from tests/lldb-std-vector-prettyprint/test.cpp rename to tests/lldb/lldb-std-vector-prettyprint/test.cpp diff --git a/tests/lldb-std-vector-prettyprint/test.sh b/tests/lldb/lldb-std-vector-prettyprint/test.sh similarity index 100% rename from tests/lldb-std-vector-prettyprint/test.sh rename to tests/lldb/lldb-std-vector-prettyprint/test.sh diff --git a/tests/python-embedded-interpreter/main.fmf b/tests/lldb/python-embedded-interpreter/main.fmf similarity index 96% rename from tests/python-embedded-interpreter/main.fmf rename to tests/lldb/python-embedded-interpreter/main.fmf index 385cc12..109c7ae 100644 --- a/tests/python-embedded-interpreter/main.fmf +++ b/tests/lldb/python-embedded-interpreter/main.fmf @@ -1,6 +1,7 @@ summary: "Test lldb embedded interpreter (rhbz#1567262)" description: "Ensure that lldb depends on python3-lldb" require+: + - lldb - gcc-c++ tier: 1 extra-summary: /tools/lldb/python-embedded-interpreter diff --git a/tests/python-embedded-interpreter/test.cpp b/tests/lldb/python-embedded-interpreter/test.cpp similarity index 100% rename from tests/python-embedded-interpreter/test.cpp rename to tests/lldb/python-embedded-interpreter/test.cpp diff --git a/tests/python-embedded-interpreter/test.sh b/tests/lldb/python-embedded-interpreter/test.sh similarity index 100% rename from tests/python-embedded-interpreter/test.sh rename to tests/lldb/python-embedded-interpreter/test.sh From c5c7ff94a30aa728901cf89a57d76b7f808edfd3 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 9 Jan 2025 09:17:38 +0100 Subject: [PATCH 138/178] Fix missing "execute" in ld-alternatives testplan. --- plans/build-gating-alternatives.fmf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plans/build-gating-alternatives.fmf b/plans/build-gating-alternatives.fmf index 435e7f2..fc720f5 100644 --- a/plans/build-gating-alternatives.fmf +++ b/plans/build-gating-alternatives.fmf @@ -14,6 +14,8 @@ summary: LLD tests for build/PR gating, testing alternatives and spoiling the in discover: how: fmf test: ld-alternative +execute: + how: tmt adjust+: - because: "Plan to be ran when either executed locally, or executed by CI system to gate a build or PR." From 3ee1395888ed94ee666dd124f51b6ba02e421682 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 9 Jan 2025 10:46:49 +0100 Subject: [PATCH 139/178] Add sanity test for python-lit --- tests/python-lit-sanity/main.fmf | 16 ++++++++++++++++ tests/python-lit-sanity/test.sh | 3 +++ 2 files changed, 19 insertions(+) create mode 100644 tests/python-lit-sanity/main.fmf create mode 100755 tests/python-lit-sanity/test.sh diff --git a/tests/python-lit-sanity/main.fmf b/tests/python-lit-sanity/main.fmf new file mode 100644 index 0000000..43a877b --- /dev/null +++ b/tests/python-lit-sanity/main.fmf @@ -0,0 +1,16 @@ +summary: Trivial sanity test for python-lit +component: + - llvm-toolset + - python-lit +require+: + - python3-lit +tier: 1 + +adjust+: + # RHEL 8 use python3.12 + - require-: + - python3-lit + when: distro == rhel-8 + - require+: + - python3.12-lit + when: distro == rhel-8 diff --git a/tests/python-lit-sanity/test.sh b/tests/python-lit-sanity/test.sh new file mode 100755 index 0000000..a8aad72 --- /dev/null +++ b/tests/python-lit-sanity/test.sh @@ -0,0 +1,3 @@ +#! /bin/sh -eux + +lit --version From 7b47ede5cd168598b587e0f9dd49b2d8d3aa2e62 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 13 Jan 2025 17:14:48 +0100 Subject: [PATCH 140/178] Fix for build-gating.fmf Exclude tests tagged with "not-in-default" from discovery. --- plans/build-gating.fmf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plans/build-gating.fmf b/plans/build-gating.fmf index 647e3b2..fba5944 100644 --- a/plans/build-gating.fmf +++ b/plans/build-gating.fmf @@ -39,7 +39,7 @@ adjust: discover: - name: llvm-tests how: fmf - filter: "tag:-spoils-installation" + filter: "tag:-spoils-installation & tag:-not-in-default" execute: how: tmt provision: From 023ec1ee03a1678ed916efc857afb7693c81e651 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 6 Feb 2025 10:09:24 +0100 Subject: [PATCH 141/178] Update ucrt test for new file output After a recent file update, the output is now: > a.exe: PE32+ executable for MS Windows 5.02 (console), x86-64, 18 sections Adjust the grep to match both the old and new output. I think the key parts are that it's a "PE32+ executable" for x86-64. --- tests/ucrt64-toolchain/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ucrt64-toolchain/test.sh b/tests/ucrt64-toolchain/test.sh index 9c8d5fe..c9d0946 100755 --- a/tests/ucrt64-toolchain/test.sh +++ b/tests/ucrt64-toolchain/test.sh @@ -1,4 +1,4 @@ #!/bin/bash -eux clang++ --target=x86_64-windows-gnu test.cpp -file a.exe | grep "PE32+ executable (console) x86-64, for MS Windows" +file a.exe | grep "PE32+ executable.*x86-64" From cce3cc4dde75812eca6f78b730c5178742e53017 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 12 Feb 2025 12:46:33 +0100 Subject: [PATCH 142/178] Merge fedora and snapshot configs for integration-test-suite Now that snapshots also include libcxx and mlir, we can use the normal fedora configuration. Also drop the conditions for fedora versions older than 40, which are no longer supported. --- tests/integration-test-suite/fedora.fmf | 21 +++------------- tests/integration-test-suite/snapshots.fmf | 28 ---------------------- 2 files changed, 3 insertions(+), 46 deletions(-) delete mode 100644 tests/integration-test-suite/snapshots.fmf diff --git a/tests/integration-test-suite/fedora.fmf b/tests/integration-test-suite/fedora.fmf index dd97be6..abc8928 100644 --- a/tests/integration-test-suite/fedora.fmf +++ b/tests/integration-test-suite/fedora.fmf @@ -1,6 +1,5 @@ -# Fedora system repos package testing. -# This setup is meant to be used with packages in system repos, not with -# compat packages, or snapshots. +# Fedora package testing. +# This setup is meant to be used with non-compat packages. require+: - cmake @@ -21,19 +20,5 @@ require+: adjust+: - enabled: false - when: distro != fedora or snapshot is defined or compat is defined + when: distro != fedora or compat is defined continue: false - - # libomp and lld are supported in s390x for LLVM >= 18. Until tmt provides - # a way to provide custom contexts, we need to filter out by distro versions. - - require-: - - lld - - libomp-devel - when: arch == s390x and distro < fedora-40 - - # libunwind is not built for s390x in LLVM < 17 - - require-: - - llvm-libunwind-devel - environment+: - NO_LIBUNWIND: true - when: arch == s390x and distro < fedora-39 diff --git a/tests/integration-test-suite/snapshots.fmf b/tests/integration-test-suite/snapshots.fmf deleted file mode 100644 index 2758b87..0000000 --- a/tests/integration-test-suite/snapshots.fmf +++ /dev/null @@ -1,28 +0,0 @@ -# llvm-snapshots specific setup. -# These are daily builds (latest upstream sources) of a reduced set of the llvm -# components in currently supported Fedora releases. -# Supported components can be checked in: -# https://copr.fedorainfracloud.org/coprs/g/fedora-llvm-team/llvm-snapshots/monitor/ - -require+: - - cmake - - clang - - clang-analyzer - - clang-devel - - clang-tools-extra - - compiler-rt - - lld - - lldb - - libomp-devel - - llvm-devel - - python3-lit - -environment+: - NO_LIBCXX: true - NO_STATIC_LIBCXX: true - NO_LIBUNWIND: true - -adjust+: - - enabled: false - when: snapshot is not defined or distro == rhel - continue: false From d2c29f2096a6d2dcc2cc90635287727352f91dc0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 14 Feb 2025 09:34:52 +0100 Subject: [PATCH 143/178] Disable mlir in integration test suite for snapshots + f40 This is a fixup for https://src.fedoraproject.org/tests/llvm/pull-request/44. I forgot that we only ship mlir in snapshots starting with fedora 41. --- tests/integration-test-suite/fedora.fmf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/integration-test-suite/fedora.fmf b/tests/integration-test-suite/fedora.fmf index abc8928..2862860 100644 --- a/tests/integration-test-suite/fedora.fmf +++ b/tests/integration-test-suite/fedora.fmf @@ -22,3 +22,8 @@ adjust+: - enabled: false when: distro != fedora or compat is defined continue: false + + # We only ship mlir in snapshots for fedora 41 and newer. + - require-: + - mlir-devel + when: snapshot is defined and distro < fedora-41 From d40ca8022a3c5f0e491faeabf3f8fddf0a0d080b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 11 Feb 2025 10:08:54 +0100 Subject: [PATCH 144/178] Add sanity test for llvm-bolt Test that instrumentation and optimization don't generate errors, to prevent issues like https://bugzilla.redhat.com/show_bug.cgi?id=2344830. --- tests/bolt-sanity/main.fmf | 15 +++++++++++++++ tests/bolt-sanity/test.sh | 8 ++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/bolt-sanity/main.fmf create mode 100755 tests/bolt-sanity/test.sh diff --git a/tests/bolt-sanity/main.fmf b/tests/bolt-sanity/main.fmf new file mode 100644 index 0000000..82ec55e --- /dev/null +++ b/tests/bolt-sanity/main.fmf @@ -0,0 +1,15 @@ +summary: Sanity check that llvm-bolt works +tier: 1 + +adjust+: + - because: "llvm-bolt is available for Fedora, not RHEL/CentOS" + when: distro != fedora + enabled: false + + - because: "We only ship llvm-bolt in snapshots for fedora 41 and newer" + when: snapshot is defined and distro < fedora-41 + enabled: false + +require+: + - llvm-bolt + - clang diff --git a/tests/bolt-sanity/test.sh b/tests/bolt-sanity/test.sh new file mode 100755 index 0000000..f698911 --- /dev/null +++ b/tests/bolt-sanity/test.sh @@ -0,0 +1,8 @@ +#!/bin/sh -eux + +echo "int main() { return 0; }" > test.c +clang -Wl,--emit-relocs test.c +llvm-bolt a.out -instrument -o a.instrumented.out +./a.instrumented.out +llvm-bolt a.out -data /tmp/prof.fdata -o a.bolt.out +./a.bolt.out From 03356db82df6ab67c33020db0377b7f3bd3493c7 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 18 Feb 2025 12:25:50 +0100 Subject: [PATCH 145/178] Only run bolt test on x86_64 and aarch64 --- tests/bolt-sanity/main.fmf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/bolt-sanity/main.fmf b/tests/bolt-sanity/main.fmf index 82ec55e..04a54da 100644 --- a/tests/bolt-sanity/main.fmf +++ b/tests/bolt-sanity/main.fmf @@ -10,6 +10,10 @@ adjust+: when: snapshot is defined and distro < fedora-41 enabled: false + - because: "llvm-bolt only supports x86_64 and aarch64" + when: arch != x86_64 and arch != aarch64 + enabled: false + require+: - llvm-bolt - clang From 3e6d2aa917da96976f7e6f9129aec1efc3e6da7d Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 19 Feb 2025 10:30:13 +0100 Subject: [PATCH 146/178] Disable bolt-sanity in compat testing --- tests/bolt-sanity/main.fmf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/bolt-sanity/main.fmf b/tests/bolt-sanity/main.fmf index 04a54da..a4e69e8 100644 --- a/tests/bolt-sanity/main.fmf +++ b/tests/bolt-sanity/main.fmf @@ -14,6 +14,10 @@ adjust+: when: arch != x86_64 and arch != aarch64 enabled: false + - because: "llvm-bolt not shipped in compat packages" + when: compat is defined + enabled: false + require+: - llvm-bolt - clang From f2b09a5e6247c3981231be59048c86257ea98c2f Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 18 Feb 2025 12:26:38 +0100 Subject: [PATCH 147/178] Remove legacy TCMS metadata --- tests/binutils-plugin-ar/main.fmf | 4 ---- tests/build-compat/main.fmf | 3 --- tests/clang-format-diff/main.fmf | 3 --- tests/fedora-flags/main.fmf | 3 --- tests/gcc-clang-compatibility/main.fmf | 2 -- tests/integration-test-suite/main.fmf | 4 ---- tests/libllvm-size/main.fmf | 3 --- tests/libomp/main.fmf | 3 --- tests/lld/basic/main.fmf | 3 --- tests/lld/gcc-compat-basic/main.fmf | 3 --- tests/lld/ld-alternative/main.fmf | 3 --- tests/lldb/lldb-dwz/main.fmf | 3 --- tests/lldb/lldb-std-vector-prettyprint/main.fmf | 3 --- tests/lldb/python-embedded-interpreter/main.fmf | 3 --- tests/llvm-config/main.fmf | 3 --- tests/long-double/main.fmf | 3 --- tests/openmp-rpm/main.fmf | 3 --- tests/ppc64le-long-double/main.fmf | 3 --- tests/rhbz_1647130/main.fmf | 3 --- tests/rhbz_1657544/main.fmf | 3 --- tests/rhbz_482491/main.fmf | 3 --- tests/rpmmacros/main.fmf | 2 -- tests/rust-sanity/main.fmf | 4 ---- tests/sanity/main.fmf | 3 --- tests/toolchains/main.fmf | 3 --- tests/use-correct-dwarf-default/main.fmf | 3 --- tests/versioned-llvm-config/main.fmf | 3 --- 27 files changed, 82 deletions(-) diff --git a/tests/binutils-plugin-ar/main.fmf b/tests/binutils-plugin-ar/main.fmf index 9d67528..7d9a2a5 100644 --- a/tests/binutils-plugin-ar/main.fmf +++ b/tests/binutils-plugin-ar/main.fmf @@ -4,8 +4,6 @@ duration: 1m require+: - binutils tier: 1 -extra-summary: /tools/llvm/binutils-plugin-ar -extra-task: /tools/llvm/binutils-plugin-ar adjust+: # This will not work in RHEL-7. Check for further information: @@ -17,5 +15,3 @@ adjust+: - because: compat llvm-libs does not install LLVMgold.so in bfd-plugins dir enabled: false when: compat is defined - -extra-nitrate: TC#0614092 diff --git a/tests/build-compat/main.fmf b/tests/build-compat/main.fmf index d6d07b1..125f307 100644 --- a/tests/build-compat/main.fmf +++ b/tests/build-compat/main.fmf @@ -5,6 +5,3 @@ framework: shell component: - llvm-toolset - llvm -extra-summary: /tools/llvm/build-compat -extra-task: /tools/llvm/build-compat -extra-nitrate: TC#0614093 diff --git a/tests/clang-format-diff/main.fmf b/tests/clang-format-diff/main.fmf index 0fdeb7d..555dfe1 100644 --- a/tests/clang-format-diff/main.fmf +++ b/tests/clang-format-diff/main.fmf @@ -1,8 +1,5 @@ summary: clang-format-diff tier: 1 -extra-summary: /tools/clang/clang-format-diff -extra-task: /tools/clang/clang-format-diff -extra-nitrate: TC#0614126 adjust+: # Common requirements when LLVM is not SCL-ized diff --git a/tests/fedora-flags/main.fmf b/tests/fedora-flags/main.fmf index 5ee3879..436049d 100644 --- a/tests/fedora-flags/main.fmf +++ b/tests/fedora-flags/main.fmf @@ -2,9 +2,6 @@ summary: fedora-flags require+: - redhat-rpm-config tier: 1 -extra-summary: /tools/clang/fedora-flags -extra-task: /tools/clang/fedora-flags -extra-nitrate: TC#0614127 adjust+: - because: s390x does not have epel repo which is required to provide rpm macros diff --git a/tests/gcc-clang-compatibility/main.fmf b/tests/gcc-clang-compatibility/main.fmf index 6a29a8a..eb9b1f9 100644 --- a/tests/gcc-clang-compatibility/main.fmf +++ b/tests/gcc-clang-compatibility/main.fmf @@ -3,8 +3,6 @@ description: Build an object file with g++, link it with clang++ and viceversa, to ensure that objects compiled with one can be linked with the other. tier: 1 -extra-summary: /tools/clang/gcc-clang-compatibility -extra-task: /tools/clang/gcc-clang-compatibility require+: - gcc-c++ diff --git a/tests/integration-test-suite/main.fmf b/tests/integration-test-suite/main.fmf index 2f8a32e..8656400 100644 --- a/tests/integration-test-suite/main.fmf +++ b/tests/integration-test-suite/main.fmf @@ -11,8 +11,6 @@ component+: - compiler-rt - python3-lit - libomp -extra-summary: /tools/llvm/integration-test-suite -extra-task: /tools/llvm/integration-test-suite require+: - git @@ -31,5 +29,3 @@ recommend+: # was part of binutils (e.g RHEL 8), or in distros where gold is deprecated # (e.g. future Fedoras) - binutils-gold - -extra-nitrate: TC#0614094 diff --git a/tests/libllvm-size/main.fmf b/tests/libllvm-size/main.fmf index ac33d73..34fa8c1 100644 --- a/tests/libllvm-size/main.fmf +++ b/tests/libllvm-size/main.fmf @@ -1,8 +1,6 @@ summary: Check that libLLVM.so has been properly stripped tier: 1 duration: 1m -extra-summary: /tools/llvm/libllvm-size -extra-task: /tools/llvm/libllvm-size environment: LIBLLVM_PATH: /usr/lib64/libLLVM.so @@ -22,4 +20,3 @@ adjust+: environment+: LIBLLVM_PATH: /opt/rh/llvm-toolset-15.0/root/usr/lib64/libLLVM.so when: "collection == llvm-toolset-15.0" -extra-nitrate: TC#0614095 diff --git a/tests/libomp/main.fmf b/tests/libomp/main.fmf index ccd2300..c503044 100644 --- a/tests/libomp/main.fmf +++ b/tests/libomp/main.fmf @@ -2,9 +2,6 @@ # libomp packages, and is able to use openmp headers and libraries summary: test clang can find libomp header and libraries tier: 1 -extra-summary: /tools/clang/libomp -extra-task: /tools/clang/libomp -extra-nitrate: TC#0614137 component+: - libomp diff --git a/tests/lld/basic/main.fmf b/tests/lld/basic/main.fmf index 65613c8..17ad52f 100644 --- a/tests/lld/basic/main.fmf +++ b/tests/lld/basic/main.fmf @@ -1,8 +1,5 @@ summary: Test lld with clang tier: 1 -extra-summary: /tools/lld/basic -extra-task: /tools/lld/basic -extra-nitrate: TC#0614058 adjust+: # Common requirements when LLVM is not SCL-ized diff --git a/tests/lld/gcc-compat-basic/main.fmf b/tests/lld/gcc-compat-basic/main.fmf index 97b3f9c..2cd3a2b 100644 --- a/tests/lld/gcc-compat-basic/main.fmf +++ b/tests/lld/gcc-compat-basic/main.fmf @@ -2,9 +2,6 @@ summary: Test lld with gcc require+: - gcc tier: 1 -extra-summary: /tools/lld/gcc-compat-basic -extra-task: /tools/lld/gcc-compat-basic -extra-nitrate: TC#0614059 adjust+: - because: system gcc is too old in rhel-7 diff --git a/tests/lld/ld-alternative/main.fmf b/tests/lld/ld-alternative/main.fmf index 591d028..83d4f8f 100644 --- a/tests/lld/ld-alternative/main.fmf +++ b/tests/lld/ld-alternative/main.fmf @@ -5,9 +5,6 @@ tag+: require+: - binutils tier: 1 -extra-summary: /tools/lld/ld-alternative -extra-task: /tools/lld/ld-alternative -extra-nitrate: TC#0614060 adjust+: - because: lld is not installed as ld alternative in rhel < 9 diff --git a/tests/lldb/lldb-dwz/main.fmf b/tests/lldb/lldb-dwz/main.fmf index 732bfac..bb9de73 100644 --- a/tests/lldb/lldb-dwz/main.fmf +++ b/tests/lldb/lldb-dwz/main.fmf @@ -4,6 +4,3 @@ require+: - gcc - dwz tier: 1 -extra-summary: /tools/lldb/lldb-dwz -extra-task: /tools/lldb/lldb-dwz -extra-nitrate: TC#0614064 diff --git a/tests/lldb/lldb-std-vector-prettyprint/main.fmf b/tests/lldb/lldb-std-vector-prettyprint/main.fmf index 6217942..8d4be6f 100644 --- a/tests/lldb/lldb-std-vector-prettyprint/main.fmf +++ b/tests/lldb/lldb-std-vector-prettyprint/main.fmf @@ -3,9 +3,6 @@ require+: - lldb - gcc-c++ tier: 1 -extra-summary: /tools/lldb/lldb-std-vector-prettyprint -extra-task: /tools/lldb/lldb-std-vector-prettyprint -extra-nitrate: TC#0614065 adjust+: # rhbz#2077932 rhbz#2082508 diff --git a/tests/lldb/python-embedded-interpreter/main.fmf b/tests/lldb/python-embedded-interpreter/main.fmf index 109c7ae..c14fe99 100644 --- a/tests/lldb/python-embedded-interpreter/main.fmf +++ b/tests/lldb/python-embedded-interpreter/main.fmf @@ -4,6 +4,3 @@ require+: - lldb - gcc-c++ tier: 1 -extra-summary: /tools/lldb/python-embedded-interpreter -extra-task: /tools/lldb/python-embedded-interpreter -extra-nitrate: TC#0614066 diff --git a/tests/llvm-config/main.fmf b/tests/llvm-config/main.fmf index ea107c5..f76a9e6 100644 --- a/tests/llvm-config/main.fmf +++ b/tests/llvm-config/main.fmf @@ -1,6 +1,3 @@ summary: Make sure llvm-config symlink is properly set up tier: 1 duration: 1m -extra-summary: /tools/llvm/llvm-config -extra-task: /tools/llvm/llvm-config -extra-nitrate: TC#0614096 diff --git a/tests/long-double/main.fmf b/tests/long-double/main.fmf index 21c9acb..32e4263 100644 --- a/tests/long-double/main.fmf +++ b/tests/long-double/main.fmf @@ -1,9 +1,6 @@ summary: Test that gcc and clang use the same long double format duration: 5m tier: 1 -extra-summary: /tools/clang/long-double -extra-task: /tools/clang/long-double -extra-nitrate: TC#0614593 require+: - gcc diff --git a/tests/openmp-rpm/main.fmf b/tests/openmp-rpm/main.fmf index 0bd8f48..54a206d 100644 --- a/tests/openmp-rpm/main.fmf +++ b/tests/openmp-rpm/main.fmf @@ -2,9 +2,6 @@ summary: Test build a simple RPM package to ensure that -fopenmp works require+: - rpm-build tier: 1 -extra-summary: /tools/clang/openmp-rpm -extra-task: /tools/clang/openmp-rpm -extra-nitrate: TC#0614128 component+: - libomp diff --git a/tests/ppc64le-long-double/main.fmf b/tests/ppc64le-long-double/main.fmf index c17e9b7..5c01c66 100644 --- a/tests/ppc64le-long-double/main.fmf +++ b/tests/ppc64le-long-double/main.fmf @@ -1,9 +1,6 @@ summary: Test binary compatibility of the long double format on ppc64le duration: 1h tier: 1 -extra-summary: /tools/clang/ppc64le-long-double -extra-task: /tools/clang/ppc64le-long-double -extra-nitrate: TC#0614129 adjust+: - because: "Fedora CI runs in x86_64 only, emulate with qemu and mock" diff --git a/tests/rhbz_1647130/main.fmf b/tests/rhbz_1647130/main.fmf index c7252a0..595bf94 100644 --- a/tests/rhbz_1647130/main.fmf +++ b/tests/rhbz_1647130/main.fmf @@ -1,8 +1,5 @@ summary: RHBZ1647130 tier: 1 -extra-summary: /tools/clang/rhbz_167130 -extra-task: /tools/clang/rhbz_167130 -extra-nitrate: TC#0614130 adjust+: # Common requirements when LLVM is not SCL-ized diff --git a/tests/rhbz_1657544/main.fmf b/tests/rhbz_1657544/main.fmf index b947c0e..2aabac2 100644 --- a/tests/rhbz_1657544/main.fmf +++ b/tests/rhbz_1657544/main.fmf @@ -1,5 +1,2 @@ summary: RHBZ1657544 tier: 1 -extra-summary: /tools/clang/rhbz_165744 -extra-task: /tools/clang/rhbz_165744 -extra-nitrate: TC#0614131 diff --git a/tests/rhbz_482491/main.fmf b/tests/rhbz_482491/main.fmf index 7f567a3..c0d524b 100644 --- a/tests/rhbz_482491/main.fmf +++ b/tests/rhbz_482491/main.fmf @@ -4,9 +4,6 @@ description: | require+: - libgcc tier: 1 -extra-summary: /tools/clang/rhbz_482194 -extra-task: /tools/clang/rhbz_482194 -extra-nitrate: TC#0614132 link: - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1482491 diff --git a/tests/rpmmacros/main.fmf b/tests/rpmmacros/main.fmf index 45e3ded..d7a1f48 100644 --- a/tests/rpmmacros/main.fmf +++ b/tests/rpmmacros/main.fmf @@ -2,8 +2,6 @@ summary: Test if RPM macros are properly set tier: 1 require+: - clang-devel -extra-summary: /tools/clang/rpmmacros -extra-task: /tools/clang/rpmmacros adjust+: # From spec file: diff --git a/tests/rust-sanity/main.fmf b/tests/rust-sanity/main.fmf index 0466d93..57bf792 100644 --- a/tests/rust-sanity/main.fmf +++ b/tests/rust-sanity/main.fmf @@ -1,7 +1,5 @@ summary: Test basic cargo usage tier: 1 -extra-summary: /tools/llvm/rust-sanity -extra-task: /tools/llvm/rust-sanity adjust+: # Common requirements when LLVM is not SCL-ized @@ -41,5 +39,3 @@ adjust+: - rust-toolset-1.66-rust when: "collection == llvm-toolset-15.0" test: scl enable rust-toolset-1.66 -- ./test.sh - -extra-nitrate: TC#0614098 diff --git a/tests/sanity/main.fmf b/tests/sanity/main.fmf index 03ea1be..9019369 100644 --- a/tests/sanity/main.fmf +++ b/tests/sanity/main.fmf @@ -1,5 +1,2 @@ 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/tests/toolchains/main.fmf b/tests/toolchains/main.fmf index ad049dc..18417f7 100644 --- a/tests/toolchains/main.fmf +++ b/tests/toolchains/main.fmf @@ -5,9 +5,6 @@ require+: # This require EPEL/CRB to be enabled on RHEL - libstdc++-static tier: 1 -extra-summary: /tools/clang/toolchains -extra-task: /tools/clang/toolchains -extra-nitrate: TC#0614133 adjust+: # Common requirements when LLVM is not SCL-ized diff --git a/tests/use-correct-dwarf-default/main.fmf b/tests/use-correct-dwarf-default/main.fmf index bdd5ce1..f7c543e 100644 --- a/tests/use-correct-dwarf-default/main.fmf +++ b/tests/use-correct-dwarf-default/main.fmf @@ -2,9 +2,6 @@ summary: Test that clang uses DWARFv4 by default require+: - libgcc tier: 1 -extra-summary: /tools/clang/use-correct-dwarf-default -extra-task: /tools/clang/use-correct-dwarf-default -extra-nitrate: TC#0614134 adjust+: # Common requirements when LLVM is not SCL-ized diff --git a/tests/versioned-llvm-config/main.fmf b/tests/versioned-llvm-config/main.fmf index 3a40552..1db1703 100644 --- a/tests/versioned-llvm-config/main.fmf +++ b/tests/versioned-llvm-config/main.fmf @@ -1,6 +1,3 @@ summary: Make sure the versioned llvm-config symlink is properly set up tier: 1 duration: 1m -extra-summary: /tools/llvm/versioned-llvm-config -extra-task: /tools/llvm/versioned-llvm-config -extra-nitrate: TC#0614099 From 38d826adb5f603b4913a9eb19e2bc6bc03596a81 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 18 Feb 2025 16:17:52 +0100 Subject: [PATCH 148/178] Deprecate DevTools collection metadata Latest devtools (containing llvm-toolset-15.0) has been EOL since May 2024 and all that metadata is now dead code. --- plans/build-gating-alternatives.fmf | 1 - plans/build-gating.fmf | 1 - tests/clang-format-diff/main.fmf | 18 +----- tests/find-package-llvm/main.fmf | 3 - tests/integration-test-suite/devtools.fmf | 70 ----------------------- tests/integration-test-suite/rhel.fmf | 2 +- tests/libllvm-size/main.fmf | 16 ------ tests/lld/basic/main.fmf | 18 +----- tests/lld/main.fmf | 24 +------- tests/main.fmf | 40 ++----------- tests/openmp-rpm/main.fmf | 19 +----- tests/rhbz_1647130/main.fmf | 18 +----- tests/rust-sanity/main.fmf | 38 ++---------- tests/toolchains/main.fmf | 28 +-------- tests/use-correct-dwarf-default/main.fmf | 20 +------ 15 files changed, 22 insertions(+), 294 deletions(-) delete mode 100644 tests/integration-test-suite/devtools.fmf diff --git a/plans/build-gating-alternatives.fmf b/plans/build-gating-alternatives.fmf index fc720f5..3264a70 100644 --- a/plans/build-gating-alternatives.fmf +++ b/plans/build-gating-alternatives.fmf @@ -7,7 +7,6 @@ # * Centos 9 stream (ursine packages) # * RHEL-9 (ursine packages) # * RHEL-8 (Red Hat module) -# * RHEL-7 (software collection) # summary: LLD tests for build/PR gating, testing alternatives and spoiling the installation diff --git a/plans/build-gating.fmf b/plans/build-gating.fmf index fba5944..09ae36d 100644 --- a/plans/build-gating.fmf +++ b/plans/build-gating.fmf @@ -7,7 +7,6 @@ # * Centos 9 stream (ursine packages) # * RHEL-9 (ursine packages) # * RHEL-8 (Red Hat module) -# * RHEL-7 (software collection) # summary: LLVM tests for build/PR gating diff --git a/tests/clang-format-diff/main.fmf b/tests/clang-format-diff/main.fmf index 555dfe1..79cb086 100644 --- a/tests/clang-format-diff/main.fmf +++ b/tests/clang-format-diff/main.fmf @@ -1,19 +1,5 @@ summary: clang-format-diff tier: 1 -adjust+: - # Common requirements when LLVM is not SCL-ized - - require+: - - clang-tools-extra - when: "collection is not defined" - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang-tools-extra - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-clang-tools-extra - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-clang-tools-extra - when: "collection == llvm-toolset-15.0" +require+: + - clang-tools-extra diff --git a/tests/find-package-llvm/main.fmf b/tests/find-package-llvm/main.fmf index 6482d73..bb6be98 100644 --- a/tests/find-package-llvm/main.fmf +++ b/tests/find-package-llvm/main.fmf @@ -20,6 +20,3 @@ require+: - llvm-devel - clang - clang-devel -adjust+: - - enabled: false - when: collection is defined diff --git a/tests/integration-test-suite/devtools.fmf b/tests/integration-test-suite/devtools.fmf deleted file mode 100644 index 40d76dc..0000000 --- a/tests/integration-test-suite/devtools.fmf +++ /dev/null @@ -1,70 +0,0 @@ -# DevTools collections settings. - -environment+: - NO_LIBCXX: true - NO_STATIC_LIBCXX: true - NO_LIBUNWIND: true - -adjust+: - - enabled: false - when: collection is not defined - continue: false - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-cmake - - llvm-toolset-13.0-clang - - llvm-toolset-13.0-clang-analyzer - - llvm-toolset-13.0-clang-devel - - llvm-toolset-13.0-clang-tools-extra - - llvm-toolset-13.0-compiler-rt - - llvm-toolset-13.0-lld - - llvm-toolset-13.0-lldb - - llvm-toolset-13.0-libomp-devel - - llvm-toolset-13.0-llvm-devel - - llvm-toolset-13.0-python3-lit - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-cmake - - llvm-toolset-14.0-clang - - llvm-toolset-14.0-clang-analyzer - - llvm-toolset-14.0-clang-devel - - llvm-toolset-14.0-clang-tools-extra - - llvm-toolset-14.0-compiler-rt - - llvm-toolset-14.0-lld - - llvm-toolset-14.0-lldb - - llvm-toolset-14.0-libomp-devel - - llvm-toolset-14.0-llvm-devel - - llvm-toolset-14.0-python3-lit - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-cmake - - llvm-toolset-15.0-clang - - llvm-toolset-15.0-clang-analyzer - - llvm-toolset-15.0-clang-devel - - llvm-toolset-15.0-clang-tools-extra - - llvm-toolset-15.0-compiler-rt - - llvm-toolset-15.0-lld - - llvm-toolset-15.0-lldb - - llvm-toolset-15.0-libomp-devel - - llvm-toolset-15.0-llvm-devel - - llvm-toolset-15.0-python3-lit - when: "collection == llvm-toolset-15.0" - - # lld not supported in s390x or ppc64. If any lld package was added to - # requirements, remove it. - - require-: - - llvm-toolset-13.0-lld - - llvm-toolset-14.0-lld - - llvm-toolset-15.0-lld - when: >- - collection is defined and arch == s390x - or arch == ppc64 - - # libomp not supported in s390x. If any libomp-devel package was added to - # requirements, remove it. - - require-: - - llvm-toolset-13.0-libomp-devel - - llvm-toolset-14.0-libomp-devel - - llvm-toolset-15.0-libomp-devel - when: collection is defined and arch == s390x diff --git a/tests/integration-test-suite/rhel.fmf b/tests/integration-test-suite/rhel.fmf index e519f3f..1753bf2 100644 --- a/tests/integration-test-suite/rhel.fmf +++ b/tests/integration-test-suite/rhel.fmf @@ -20,7 +20,7 @@ environment+: adjust+: - enabled: false - when: distro != rhel and distro != centos or collection is defined + when: distro != rhel and distro != centos continue: false # lld is supported in s390x for LLVM >= 18. Until tmt provides diff --git a/tests/libllvm-size/main.fmf b/tests/libllvm-size/main.fmf index 34fa8c1..7ca6945 100644 --- a/tests/libllvm-size/main.fmf +++ b/tests/libllvm-size/main.fmf @@ -4,19 +4,3 @@ duration: 1m environment: LIBLLVM_PATH: /usr/lib64/libLLVM.so -adjust+: - - - because: "With SCL-ized LLVM, library path is different" - environment+: - LIBLLVM_PATH: /opt/rh/llvm-toolset-13.0/root/usr/lib64/libLLVM.so - when: "collection == llvm-toolset-13.0" - - - because: "With SCL-ized LLVM, library path is different" - environment+: - LIBLLVM_PATH: /opt/rh/llvm-toolset-14.0/root/usr/lib64/libLLVM.so - when: "collection == llvm-toolset-14.0" - - - because: "With SCL-ized LLVM, library path is different" - environment+: - LIBLLVM_PATH: /opt/rh/llvm-toolset-15.0/root/usr/lib64/libLLVM.so - when: "collection == llvm-toolset-15.0" diff --git a/tests/lld/basic/main.fmf b/tests/lld/basic/main.fmf index 17ad52f..21cbeec 100644 --- a/tests/lld/basic/main.fmf +++ b/tests/lld/basic/main.fmf @@ -1,19 +1,5 @@ summary: Test lld with clang tier: 1 -adjust+: - # Common requirements when LLVM is not SCL-ized - - require+: - - clang - when: collection is not defined - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang - when: collection == llvm-toolset-13.0 - - require+: - - llvm-toolset-14.0-clang - when: collection == llvm-toolset-14.0 - - require+: - - llvm-toolset-15.0-clang - when: collection == llvm-toolset-15.0 +require+: + - clang diff --git a/tests/lld/main.fmf b/tests/lld/main.fmf index e948f96..823bb7a 100644 --- a/tests/lld/main.fmf +++ b/tests/lld/main.fmf @@ -1,4 +1,6 @@ # Common adjustments for lld tests +require+: + - lld adjust+: - because: lld is not shipped for ppc64 @@ -10,25 +12,3 @@ adjust+: when: arch == s390x and distro < rhel-8.10, fedora-40, centos-stream-9 - enabled: false when: arch == s390x and distro == rhel-9 and distro < rhel-9.5 - - # Common requirements when LLVM is not SCL-ized - - require+: - - lld - 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-lld - when: collection == llvm-toolset-13.0 - - - test: scl enable llvm-toolset-14.0 -- ./test.sh - require+: - - llvm-toolset-14.0-lld - when: collection == llvm-toolset-14.0 - - - test: scl enable llvm-toolset-15.0 -- ./test.sh - require+: - - llvm-toolset-15.0-lld - when: collection == llvm-toolset-15.0 diff --git a/tests/main.fmf b/tests/main.fmf index b4e0424..0cc2e73 100644 --- a/tests/main.fmf +++ b/tests/main.fmf @@ -17,41 +17,11 @@ framework: shell test: ./test.sh # Commonly used keys are initialized to empty. -require: [] link: [] tag: [] -adjust+: - # Common requirements when LLVM is not SCL-ized - - require+: - - llvm - - llvm-libs - - llvm-devel - - clang - 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-llvm - - llvm-toolset-13.0-llvm-libs - - llvm-toolset-13.0-llvm-devel - - llvm-toolset-13.0-clang - when: collection == llvm-toolset-13.0 - - - test: scl enable llvm-toolset-14.0 -- ./test.sh - require+: - - llvm-toolset-14.0-llvm - - llvm-toolset-14.0-llvm-libs - - llvm-toolset-14.0-llvm-devel - - llvm-toolset-14.0-clang - when: collection == llvm-toolset-14.0 - - - test: scl enable llvm-toolset-15.0 -- ./test.sh - require+: - - llvm-toolset-15.0-llvm - - llvm-toolset-15.0-llvm-libs - - llvm-toolset-15.0-llvm-devel - - llvm-toolset-15.0-clang - when: collection == llvm-toolset-15.0 +require+: + - llvm + - llvm-libs + - llvm-devel + - clang diff --git a/tests/openmp-rpm/main.fmf b/tests/openmp-rpm/main.fmf index 54a206d..bbe6346 100644 --- a/tests/openmp-rpm/main.fmf +++ b/tests/openmp-rpm/main.fmf @@ -1,6 +1,7 @@ summary: Test build a simple RPM package to ensure that -fopenmp works require+: - rpm-build + - libomp tier: 1 component+: - libomp @@ -16,21 +17,3 @@ adjust+: - when: arch == s390x and distro != fedora enabled: false continue: false - - - require+: - - libomp - when: collection is not defined - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-build - - llvm-toolset-13.0-libomp - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-build - - llvm-toolset-14.0-libomp - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-build - - llvm-toolset-15.0-libomp - when: "collection == llvm-toolset-15.0" diff --git a/tests/rhbz_1647130/main.fmf b/tests/rhbz_1647130/main.fmf index 595bf94..921251e 100644 --- a/tests/rhbz_1647130/main.fmf +++ b/tests/rhbz_1647130/main.fmf @@ -1,19 +1,5 @@ summary: RHBZ1647130 tier: 1 -adjust+: - # Common requirements when LLVM is not SCL-ized - - require+: - - clang-analyzer - when: "collection is not defined" - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang-analyzer - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-clang-analyzer - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-clang-analyzer - when: "collection == llvm-toolset-15.0" +require+: + - clang-analyzer diff --git a/tests/rust-sanity/main.fmf b/tests/rust-sanity/main.fmf index 57bf792..5711b2a 100644 --- a/tests/rust-sanity/main.fmf +++ b/tests/rust-sanity/main.fmf @@ -1,41 +1,11 @@ summary: Test basic cargo usage tier: 1 +require: + - cargo + - rust + adjust+: - # Common requirements when LLVM is not SCL-ized - - require+: - # Required for rust and possibly other dependant packages - # - # NOTE #1: drop the requirement once the transitional period between releases is gone - # and llvm-compat is no longer a) needed, and b) part of the build. - # - # NOTE #2: keep it the first requirement. Depending on the order of requirements, placing it somewhere - # else in the list may lead to harness uninstalling and re-installing LLVM packages. That a) would be - # a waste of time, b) could potentially hide issues, leading to testing unexpected NVRs. - # - # - llvm-compat - - - cargo - - rust - when: "collection is not defined" - - because: "Rust uses latest llvm version, compat packages irrelevant here" enabled: false when: compat is defined - - # Requirements for SCL-ized LLVM - - require+: - - rust-toolset-1.58-cargo - - rust-toolset-1.58-rust - when: "collection == llvm-toolset-13.0" - test: scl enable rust-toolset-1.58 -- ./test.sh - - require+: - - rust-toolset-1.62-cargo - - rust-toolset-1.62-rust - when: "collection == llvm-toolset-14.0" - test: scl enable rust-toolset-1.62 -- ./test.sh - - require+: - - rust-toolset-1.66-cargo - - rust-toolset-1.66-rust - when: "collection == llvm-toolset-15.0" - test: scl enable rust-toolset-1.66 -- ./test.sh diff --git a/tests/toolchains/main.fmf b/tests/toolchains/main.fmf index 18417f7..72fc4d8 100644 --- a/tests/toolchains/main.fmf +++ b/tests/toolchains/main.fmf @@ -4,39 +4,15 @@ require+: - yum-utils # This require EPEL/CRB to be enabled on RHEL - libstdc++-static + - compiler-rt + - lld tier: 1 adjust+: - # Common requirements when LLVM is not SCL-ized - - require+: - - compiler-rt - - lld - 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-lld - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-clang - - llvm-toolset-14.0-compiler-rt - - llvm-toolset-14.0-lld - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-clang - - llvm-toolset-15.0-compiler-rt - - llvm-toolset-15.0-lld - when: "collection == llvm-toolset-15.0" - # lld not supported in s390x (LLVM<18) or ppc64. If any lld package was added to # requirements, remove it. - require-: - lld - - llvm-toolset-13.0-lld - - llvm-toolset-14.0-lld - - llvm-toolset-15.0-lld when: >- arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 or arch == ppc64 diff --git a/tests/use-correct-dwarf-default/main.fmf b/tests/use-correct-dwarf-default/main.fmf index f7c543e..dd8394a 100644 --- a/tests/use-correct-dwarf-default/main.fmf +++ b/tests/use-correct-dwarf-default/main.fmf @@ -1,28 +1,10 @@ summary: Test that clang uses DWARFv4 by default require+: - libgcc + - llvm tier: 1 adjust+: - # Common requirements when LLVM is not SCL-ized - - require+: - - llvm - when: "collection is not defined" - - # Requirements for SCL-ized LLVM - - require+: - - llvm-toolset-13.0-clang - - llvm-toolset-13.0-llvm - when: "collection == llvm-toolset-13.0" - - require+: - - llvm-toolset-14.0-clang - - llvm-toolset-14.0-llvm - when: "collection == llvm-toolset-14.0" - - require+: - - llvm-toolset-15.0-clang - - llvm-toolset-15.0-llvm - when: "collection == llvm-toolset-15.0" - - environment+: DWARF_VERSION: 4 when: distro < rhel-10,centos-stream-10 and snapshot is not defined From 91290fc5b1ab1a4cd7b7ff694e780b4cd488c9e3 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 19 Feb 2025 16:00:18 +0100 Subject: [PATCH 149/178] Compat package testing adjustments * No i686 pkgs, disable cross-compile-i686 * No python pkgs, disable lldb python interpreter tests, and ensure lldbNN does not depend on python-lldb * Force integration testsuite to run libomp tests. * Do not check buildrequires in pie-rpm so the spec builds with clangNN --- tests/cross-compile-i686/main.fmf | 4 ++++ tests/integration-test-suite/compat.fmf | 1 + tests/lldb/lldb-std-vector-prettyprint/main.fmf | 4 ++++ tests/lldb/python-embedded-interpreter/main.fmf | 4 ++++ tests/pie-rpm/test.sh | 2 +- 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/cross-compile-i686/main.fmf b/tests/cross-compile-i686/main.fmf index 3863a8c..c384848 100644 --- a/tests/cross-compile-i686/main.fmf +++ b/tests/cross-compile-i686/main.fmf @@ -20,3 +20,7 @@ adjust+: - enabled: false because: "compiler-rt.i686 may not be available in snapshot builds when x86_64 tests are executed" when: snapshot is defined + + - enabled: false + because: "compat packages are not configured for multilib" + when: compat is defined diff --git a/tests/integration-test-suite/compat.fmf b/tests/integration-test-suite/compat.fmf index 6d976d3..ebe0966 100644 --- a/tests/integration-test-suite/compat.fmf +++ b/tests/integration-test-suite/compat.fmf @@ -17,6 +17,7 @@ environment+: NO_LIBCXX: true NO_STATIC_LIBCXX: true NO_LIBUNWIND: true + LIBOMP: true adjust+: - enabled: false diff --git a/tests/lldb/lldb-std-vector-prettyprint/main.fmf b/tests/lldb/lldb-std-vector-prettyprint/main.fmf index 8d4be6f..2850fdd 100644 --- a/tests/lldb/lldb-std-vector-prettyprint/main.fmf +++ b/tests/lldb/lldb-std-vector-prettyprint/main.fmf @@ -9,3 +9,7 @@ adjust+: - because: "std::vector pretty printer does not work properly in RHEL<9 due to older libstdc++" enabled: false when: distro < rhel-9 + + - because: "Python packages not shipped in compat packages, hence no prettyprinter" + when: compat is defined + enabled: false diff --git a/tests/lldb/python-embedded-interpreter/main.fmf b/tests/lldb/python-embedded-interpreter/main.fmf index c14fe99..adb54a7 100644 --- a/tests/lldb/python-embedded-interpreter/main.fmf +++ b/tests/lldb/python-embedded-interpreter/main.fmf @@ -4,3 +4,7 @@ require+: - lldb - gcc-c++ tier: 1 +adjust+: + - because: "Python pkgs not shipped in compat, lldb should NOT depend on python3-lldb" + result: xfail + when: compat is defined diff --git a/tests/pie-rpm/test.sh b/tests/pie-rpm/test.sh index 408b1eb..5af2487 100755 --- a/tests/pie-rpm/test.sh +++ b/tests/pie-rpm/test.sh @@ -5,4 +5,4 @@ set pipefail #${BUILDDEP_CMD} -y pie.spec -QA_RPATHS=$(( 0x0001 )) rpmbuild -bb ./pie.spec +QA_RPATHS=$(( 0x0001 )) rpmbuild -bb --nodeps ./pie.spec From 5f75e69cbd8cdeed499c8a411ac44bf2812c6d62 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 20 Feb 2025 09:19:52 +0100 Subject: [PATCH 150/178] libllvm-size: Add compat package support Detect libLLVM path using llvm-config to make the script reusable with compat packages. --- tests/libllvm-size/main.fmf | 4 ++-- tests/libllvm-size/test.sh | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/libllvm-size/main.fmf b/tests/libllvm-size/main.fmf index 7ca6945..cd36335 100644 --- a/tests/libllvm-size/main.fmf +++ b/tests/libllvm-size/main.fmf @@ -2,5 +2,5 @@ summary: Check that libLLVM.so has been properly stripped tier: 1 duration: 1m -environment: - LIBLLVM_PATH: /usr/lib64/libLLVM.so +require+: + - llvm-devel diff --git a/tests/libllvm-size/test.sh b/tests/libllvm-size/test.sh index fdc575a..1b31ec6 100755 --- a/tests/libllvm-size/test.sh +++ b/tests/libllvm-size/test.sh @@ -1,5 +1,10 @@ #!/bin/bash -eux +# Retrieve libLLVM path if not set via environment variable. This is necessary +# to make the test flexible enough to use it with both compat and unversioned +# packages. +LIBLLVM_PATH=${LIBLLVM_PATH:-"$(llvm-config --libfiles)"} + # There is a bug in the build process when it runs out of disk space # while stripping binaries, which causes the strip to fail, but does # not fail the build. This results in a libLLVM.so that is over 2GB From d48991f42ab65ad987470520acd8e00260497de6 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Wed, 26 Feb 2025 15:21:11 +0100 Subject: [PATCH 151/178] Add test for cmake imported targets This test will ensure that all the exported targets (imported from the user's perspective) from the clang and llvm find_package() are shipped and are part of a dependency of the package which provides the find_package. --- .../CMakeLists.txt | 32 +++++++++ tests/cmake-imported-targets-llvm/main.fmf | 11 +++ tests/cmake-imported-targets-llvm/test.sh | 68 +++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 tests/cmake-imported-targets-llvm/CMakeLists.txt create mode 100644 tests/cmake-imported-targets-llvm/main.fmf create mode 100755 tests/cmake-imported-targets-llvm/test.sh diff --git a/tests/cmake-imported-targets-llvm/CMakeLists.txt b/tests/cmake-imported-targets-llvm/CMakeLists.txt new file mode 100644 index 0000000..1d6257a --- /dev/null +++ b/tests/cmake-imported-targets-llvm/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.20.0) +project(SimpleProject) + +# Find LLVM package and save all the imported targets into a list. +find_package(LLVM REQUIRED CONFIG) +get_property(LLVMImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS) + +# Find Clang package and save all the imported targets into a list. As Clang's +# find_package depends on LLVM - it calls find_package(LLVM) internally - this +# implicitly import all the LLVM targets too, so we have to filter these out +# with the previous list. +find_package(Clang REQUIRED CONFIG) +get_property(ClangImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS) +list(REMOVE_ITEM ClangImportedTargets ${LLVMImportedTargets}) + +# Filter out targets imported from internal find_package such as FFI, LibEdit, ZLIB, etc +# These might or might not be installed in the user's system. These are prefixed +# with "::" (e.g. LibEdit::LibEdit). +list(FILTER LLVMImportedTargets EXCLUDE REGEX "::") + +# For all imported targets by LLVM get the location of the object and dump It +# to an output.txt file. The test script will parse it later. +foreach(target IN LISTS LLVMImportedTargets) + get_target_property(tgt_loc ${target} LOCATION) + file(APPEND ${CMAKE_BINARY_DIR}/llvm_targets.txt "${tgt_loc}\n") +endforeach() + +# Do the same operation with Clang imported targets +foreach(target IN LISTS ClangImportedTargets) + get_target_property(tgt_loc ${target} LOCATION) + file(APPEND ${CMAKE_BINARY_DIR}/clang_targets.txt "${tgt_loc}\n") +endforeach() diff --git a/tests/cmake-imported-targets-llvm/main.fmf b/tests/cmake-imported-targets-llvm/main.fmf new file mode 100644 index 0000000..3cf2c7c --- /dev/null +++ b/tests/cmake-imported-targets-llvm/main.fmf @@ -0,0 +1,11 @@ +summary: Test LLVM and Clang's find_package imported targets +description: | + This test ensures that all the exported targets provided by LLVM and Clang's + find_package are really present in the system, and are provided by a either + llvm/clang-devel package or a package is directly dependent on them. +framework: beakerlib +tier: 1 +require+: + - cmake + - llvm-devel + - clang-devel diff --git a/tests/cmake-imported-targets-llvm/test.sh b/tests/cmake-imported-targets-llvm/test.sh new file mode 100755 index 0000000..b9ad45b --- /dev/null +++ b/tests/cmake-imported-targets-llvm/test.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +. /usr/share/beakerlib/beakerlib.sh || exit 1 + + +rlJournalStart + rlPhaseStartSetup + rlRun "set -o pipefail" + declare LLVM_DEVEL CLANG_DEVEL src_dir tmp_dir + # Guess the name of the -devel packages. This is needed to make the test + # agnostic to versioned/unversioned packages. This should work equally + # for llvm19-devel or llvm-devel. + rlRun "LLVM_DEVEL=$(rpm -qf --qf '%{name}-devel' "$(which llc)")" + rlRun "CLANG_DEVEL=$(rpm -qf --qf '%{name}-devel' "$(which clang)")" + rlRun "tmp_dir=$(mktemp -d -p /var/tmp)" + rlRun "src_dir=$(pwd)" + + # Gather rpms required *explicitly* by the currently installed + # llvm-devel and clang-devel. We'll consider each package dependent on + # itself. + for pkg in $LLVM_DEVEL $CLANG_DEVEL; do + dependencies=$(rpm -q --requires "$pkg" | cut -d ' ' -f 1 ) + { + for req in $dependencies; do + rpm -q --whatprovides "$req" + done + } | sort -u > "${tmp_dir}/${pkg}-dependencies.txt" + rpm -q "$pkg" >> "${tmp_dir}/${pkg}-dependencies.txt" + done + + rlRun "pushd $tmp_dir" + rlPhaseEnd + + rlPhaseStartTest + # The CMakeLists.txt will produce two text files named llvm_targets.txt + # and clang_targets.txt, which contains the locations of all the + # libraries and executables exported (imported from user's persective) + # as targets. + rlRun "cmake $src_dir" + + # llvm-devel must be a dependency of clang-devel, as ClangConfig.cmake + # depends on LLVMConfig.cmake. + rlAssertGrep "$LLVM_DEVEL" "${tmp_dir}/clang-devel-dependencies.txt" + + # For each imported target file, check who provides it and if the provider + # is in the dependency list (or is the package itself). + # Do not use rlAssertGrep, it will report hundreds of PASS lines making + # the log unnecessarily big. + rlLog "Parsing LLVM imported targets" + while IFS= read -r importedFile; do + if ! grep -q "$(rpm -qf "${importedFile}")" "${tmp_dir}/${LLVM_DEVEL}-dependencies.txt"; then + rlFail "${importedFile} is imported as a CMake target by ${LLVM_DEVEL}, but it's not part of any of its required packages." + fi + done < llvm_targets.txt + rlLog "Parsing Clang imported targets" + while IFS= read -r importedFile; do + if ! grep -q "$(rpm -qf "${importedFile}")" "${tmp_dir}/${CLANG_DEVEL}-dependencies.txt"; then + rlFail "${importedFile} is imported as a CMake target by ${CLANG_DEVEL}, but it's not part of any of its required packages." + fi + done < clang_targets.txt + + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -rf $tmp_dir" 0 "Remove temporary directory: $tmp_dir" + rlPhaseEnd +rlJournalEnd From 7dfda355f996c433c7e2e572000ffce4decf7d4a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 6 Mar 2025 14:14:54 +0100 Subject: [PATCH 152/178] Fix cmake-imported-targets-llvm test for compat packages We should be looking for clangNN-devel-dependencies.txt instead of clang-devel-dependencies.txt in that case. --- tests/cmake-imported-targets-llvm/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cmake-imported-targets-llvm/test.sh b/tests/cmake-imported-targets-llvm/test.sh index b9ad45b..a6d7468 100755 --- a/tests/cmake-imported-targets-llvm/test.sh +++ b/tests/cmake-imported-targets-llvm/test.sh @@ -40,7 +40,7 @@ rlJournalStart # llvm-devel must be a dependency of clang-devel, as ClangConfig.cmake # depends on LLVMConfig.cmake. - rlAssertGrep "$LLVM_DEVEL" "${tmp_dir}/clang-devel-dependencies.txt" + rlAssertGrep "$LLVM_DEVEL" "${tmp_dir}/${CLANG_DEVEL}-dependencies.txt" # For each imported target file, check who provides it and if the provider # is in the dependency list (or is the package itself). From ed30e923ccd37a1874601a30c4275ad7fcc44895 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 6 Mar 2025 16:33:50 +0100 Subject: [PATCH 153/178] Skip installing weak dependencies in kernel-ark-build test --- tests/kernel-ark-build/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kernel-ark-build/test.sh b/tests/kernel-ark-build/test.sh index db04d4a..c892af6 100755 --- a/tests/kernel-ark-build/test.sh +++ b/tests/kernel-ark-build/test.sh @@ -111,7 +111,7 @@ generateSRPM() { # so we don't use it here. read -ra KERNEL_BUILDREQS <<< "$(sed -n 's/Missing dependencies://p' make-buildreqs.log)" rlLog "Installing dependencies: ${KERNEL_BUILDREQS[*]}" - dnf install -y "${KERNEL_BUILDREQS[@]}" > install-buildreqs.log 2>&1 || \ + dnf install --setopt=install_weak_deps=False -y "${KERNEL_BUILDREQS[@]}" > install-buildreqs.log 2>&1 || \ rlFail "$(cat install-buildreqs.log)" rlFileSubmit install-buildreqs.log elif grep 'PASS:' make-buildreqs.log; then From 7baa9af2dae57d29833ddef548b20c12d50e8fd8 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Tue, 3 Jun 2025 17:26:09 -0300 Subject: [PATCH 154/178] Require package which We started to see TF failures on c10s because which was not installed. Ensure the package is installed in order to avoid these errors. --- tests/cmake-imported-targets-llvm/main.fmf | 1 + tests/lldb/python-embedded-interpreter/main.fmf | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/cmake-imported-targets-llvm/main.fmf b/tests/cmake-imported-targets-llvm/main.fmf index 3cf2c7c..7fcda06 100644 --- a/tests/cmake-imported-targets-llvm/main.fmf +++ b/tests/cmake-imported-targets-llvm/main.fmf @@ -9,3 +9,4 @@ require+: - cmake - llvm-devel - clang-devel + - which diff --git a/tests/lldb/python-embedded-interpreter/main.fmf b/tests/lldb/python-embedded-interpreter/main.fmf index adb54a7..277434b 100644 --- a/tests/lldb/python-embedded-interpreter/main.fmf +++ b/tests/lldb/python-embedded-interpreter/main.fmf @@ -3,6 +3,7 @@ description: "Ensure that lldb depends on python3-lldb" require+: - lldb - gcc-c++ + - which tier: 1 adjust+: - because: "Python pkgs not shipped in compat, lldb should NOT depend on python3-lldb" From 6018ff44fcb742e91d90bdbb1dfad088d4638487 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 8 Jul 2025 14:43:33 +0200 Subject: [PATCH 155/178] Add test for multilib installation Make sure that llvm-devel and llvm-devel.i686 can be installed at the same time. --- tests/multilib-install/main.fmf | 26 ++++++++++++++++++++++++++ tests/multilib-install/test.sh | 5 +++++ tests/shlibs-cet-support/test.sh | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/multilib-install/main.fmf create mode 100755 tests/multilib-install/test.sh diff --git a/tests/multilib-install/main.fmf b/tests/multilib-install/main.fmf new file mode 100644 index 0000000..d57b079 --- /dev/null +++ b/tests/multilib-install/main.fmf @@ -0,0 +1,26 @@ +summary: Make sure that multilib installation works +tier: 1 + +require+: + - llvm-devel + - llvm-devel.i686 + +link: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2365079 + +adjust+: + - enabled: false + because: "Test applicable only on x86_64 arch" + when: arch != x86_64 + + - enabled: false + because: "i686 packages may not be available in snapshot builds when x86_64 tests are executed" + when: snapshot is defined + + - enabled: false + because: "compat packages are not compatible with multilib" + when: compat is defined + + - enabled: false + because: "i686 not supported in RHEL-10 and newer" + when: distro >= rhel-10 or distro >= centos-stream-10 diff --git a/tests/multilib-install/test.sh b/tests/multilib-install/test.sh new file mode 100755 index 0000000..48b7808 --- /dev/null +++ b/tests/multilib-install/test.sh @@ -0,0 +1,5 @@ +#!/bin/sh -eux + +# For now just check that installation works. +rpm -q llvm-devel.x86_64 +rpm -q llvm-devel.i686 diff --git a/tests/shlibs-cet-support/test.sh b/tests/shlibs-cet-support/test.sh index 55684e4..28eb98e 100755 --- a/tests/shlibs-cet-support/test.sh +++ b/tests/shlibs-cet-support/test.sh @@ -2,7 +2,7 @@ tmp=$(mktemp -d) pushd "$tmp" -for lib in $(rpm -ql llvm-libs | grep -E '\.so(\..+)?$'); do +for lib in $(rpm -ql llvm-libs.x86_64 | grep -E '\.so(\..+)?$'); do [[ -L $lib ]] && continue # Skip symlinks readelf -n "$lib" > notes.log grep -q "SHSTK" notes.log From 4f6d64864395b159ee2ac9ded1aec3adfaba0957 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 9 Jul 2025 12:48:06 +0200 Subject: [PATCH 156/178] Add test for use of lldb inside venv For https://bugzilla.redhat.com/show_bug.cgi?id=2361538. --- .../lldb/python-embedded-interpreter/test.sh | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/tests/lldb/python-embedded-interpreter/test.sh b/tests/lldb/python-embedded-interpreter/test.sh index ca16589..25bd177 100755 --- a/tests/lldb/python-embedded-interpreter/test.sh +++ b/tests/lldb/python-embedded-interpreter/test.sh @@ -7,15 +7,24 @@ rpm -q --requires "$LLDB_PACKAGE" | grep "python3\(\.12\)\?-lldb" # Sanity test g++ -g test.cpp -lldb -b -o 'breakpoint set --file test.cpp --line 8' \ - -o run -o 'p i' -o 'p f'\ - -- a.out | tee lldb.log +run_test() { + lldb -b -o 'breakpoint set --file test.cpp --line 8' \ + -o run -o 'p i' -o 'p f'\ + -- a.out | tee lldb.log -# shellcheck disable=SC2016 -test "$(grep -c \ - -e '(int) \($0 = \)\?1' \ - -e '(float) \($1 = \)\?1' \ - lldb.log \ - )" -eq 2 + # shellcheck disable=SC2016 + test "$(grep -c \ + -e '(int) \($0 = \)\?1' \ + -e '(float) \($1 = \)\?1' \ + lldb.log \ + )" -eq 2 -rm lldb.log + rm lldb.log +} + +run_test + +# Now try again inside virtualenv +python -m venv venv +source ./venv/bin/activate +run_test From f2da47a2ca7565d2f2be4b4f35b49be6acae6c0f Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 5 Aug 2025 10:13:07 +0200 Subject: [PATCH 157/178] Use python3 instead of python This is necessary on RHEL 8. --- tests/lldb/python-embedded-interpreter/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lldb/python-embedded-interpreter/test.sh b/tests/lldb/python-embedded-interpreter/test.sh index 25bd177..2f76df0 100755 --- a/tests/lldb/python-embedded-interpreter/test.sh +++ b/tests/lldb/python-embedded-interpreter/test.sh @@ -25,6 +25,6 @@ run_test() { run_test # Now try again inside virtualenv -python -m venv venv +python3 -m venv venv source ./venv/bin/activate run_test From 8309550db604ff5ce8241ce46b314c595b74406d Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 6 Aug 2025 16:46:53 -0300 Subject: [PATCH 158/178] llvm-test-suite: Move script to this repository Move a script from https://src.fedoraproject.org/rpms/llvm-test-suite to here. With this change, network access and git are not required. Adds cmake to the list of required package as this was missing before. --- tests/llvm-test-suite/main.fmf | 2 +- tests/llvm-test-suite/test.sh | 121 +++++++++++++++++++++++++++++++-- 2 files changed, 117 insertions(+), 6 deletions(-) diff --git a/tests/llvm-test-suite/main.fmf b/tests/llvm-test-suite/main.fmf index 9deb601..d4d005a 100644 --- a/tests/llvm-test-suite/main.fmf +++ b/tests/llvm-test-suite/main.fmf @@ -13,8 +13,8 @@ adjust+: when: compat is defined require+: - - git - clang + - cmake - ninja-build - llvm-test-suite duration: 1h diff --git a/tests/llvm-test-suite/test.sh b/tests/llvm-test-suite/test.sh index 85418bc..0dbb599 100755 --- a/tests/llvm-test-suite/test.sh +++ b/tests/llvm-test-suite/test.sh @@ -1,7 +1,118 @@ -#!/bin/sh -eux +#!/bin/bash -# TODO: tmt does not support a remote git repo as a requirement, one has to clone it "manually". +usage() { + echo "usage `basename $0` [OPTIONS]" + echo " --threads NUM The number of threads to use for running tests." + echo " --testsuite-dir DIR Directory containing the test-suite source." + echo " --compiler [gcc|clang] The compiler to test." +} -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 +cc="clang" +cxx="clang++" +testsuite_dir="/usr/share/llvm-test-suite/" +thread_args="" + +while [ $# -gt 0 ]; do + case $1 in + --threads) + shift + threads="$1" + ;; + --testsuite-dir) + shift + testsuire_dir="$1" + ;; + --compiler) + shift + compiler="$1" + case $compiler in + clang) + cc="clang" + cxx="clang++" + ;; + gcc) + cc="gcc" + cxx="g++" + ;; + *) + echo "unknown compiler: $1" + exit 1 + ;; + esac + ;; + * ) + echo "unknown option: $1" + echo "" + usage + exit 1 + ;; + esac + shift +done + +if [ -n "$threads" ]; then + thread_args_ninja="-j$threads" + thread_args_lit="j$threads" +fi + +set -xe + +# This test consumes almost 2GiB. This space may not be available on /tmp on +# all servers. We need to guarantee that physical disk is used in order to +# avoid spurious failures. +tmpdir=$(mktemp -d -p /var/tmp llvm-test-suite.XXXXXXXXXX) +pushd $tmpdir + +cmake -G Ninja $testsuite_dir \ + -DCMAKE_C_COMPILER=$cc \ + -DCMAKE_CXX_COMPILER=$cxx \ + -DTEST_SUITE_LIT_FLAGS="-sv$thread_args_lit" + +if ! ninja $thread_args_ninja check ; then + # The following code helps with troubleshooting an issue with miniFE. + # Collect more information about the OS and server that reproduced the + # issue. + # https://github.com/fedora-llvm-team/llvm-snapshots/issues/874 + mdir=$tmpdir/MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE + + if [[ ! -e $mdir/miniFE ]]; then + # If this executable does not exist, assume the test failed due to another + # reason. + exit 1 + fi + + uname -a + lscpu + + ldd $mdir/miniFE + readelf -hSlW $mdir/miniFE + + readelf -Ws --demangle \ + $mdir/miniFE \ + | grep -E 'Symbol table|Ndx Name|cg_solve' + + objdump --disassemble=_ZN6miniFE8cg_solveINS_9CSRMatrixIdiiEENS_6VectorIdiiEENS_14matvec_overlapIS2_S4_EEEEvRT_RKT0_RS9_T1_NS7_16LocalOrdinalTypeERNS_10TypeTraitsINS7_10ScalarTypeEE14magnitude_typeERSE_SJ_Pd \ + $mdir/miniFE + + objdump --disassemble=_ZN6miniFE8cg_solveINS_9CSRMatrixIdiiEENS_6VectorIdiiEENS_10matvec_stdIS2_S4_EEEEvRT_RKT0_RS9_T1_NS7_16LocalOrdinalTypeERNS_10TypeTraitsINS7_10ScalarTypeEE14magnitude_typeERSE_SJ_Pd \ + $mdir/miniFE + + $tmpdir/tools/timeit-target --timeout 7200 --limit-core 0 --limit-cpu 7200 \ + --limit-file-size 209715200 --limit-rss-size 838860800 \ + --append-exitstatus \ + --redirect-output $mdir/Output/miniFE.test.out \ + --redirect-input /dev/null \ + --chdir $mdir \ + --summary $mdir/Output/miniFE.test.time \ + $mdir/miniFE \ + -nx 64 -ny 64 -nz 64 + $tmpdir/tools/fpcmp-target \ + $mdir/Output/miniFE.test.out \ + $mdir/miniFE.reference_output + + exit 1 +fi + +popd +# Remove temporary files in case of success. +rm -rf $tmpdir From a84cc4e933948ea053daeb349f2359cf32870509 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Thu, 7 Aug 2025 09:55:14 -0300 Subject: [PATCH 159/178] llvm-test-suite: Remove argument handling This script is called from tmt, which does not pass any arguments. --- tests/llvm-test-suite/test.sh | 55 ++--------------------------------- 1 file changed, 2 insertions(+), 53 deletions(-) diff --git a/tests/llvm-test-suite/test.sh b/tests/llvm-test-suite/test.sh index 0dbb599..1f7b9b7 100755 --- a/tests/llvm-test-suite/test.sh +++ b/tests/llvm-test-suite/test.sh @@ -1,59 +1,8 @@ #!/bin/bash -usage() { - echo "usage `basename $0` [OPTIONS]" - echo " --threads NUM The number of threads to use for running tests." - echo " --testsuite-dir DIR Directory containing the test-suite source." - echo " --compiler [gcc|clang] The compiler to test." -} - cc="clang" cxx="clang++" testsuite_dir="/usr/share/llvm-test-suite/" -thread_args="" - -while [ $# -gt 0 ]; do - case $1 in - --threads) - shift - threads="$1" - ;; - --testsuite-dir) - shift - testsuire_dir="$1" - ;; - --compiler) - shift - compiler="$1" - case $compiler in - clang) - cc="clang" - cxx="clang++" - ;; - gcc) - cc="gcc" - cxx="g++" - ;; - *) - echo "unknown compiler: $1" - exit 1 - ;; - esac - ;; - * ) - echo "unknown option: $1" - echo "" - usage - exit 1 - ;; - esac - shift -done - -if [ -n "$threads" ]; then - thread_args_ninja="-j$threads" - thread_args_lit="j$threads" -fi set -xe @@ -66,9 +15,9 @@ pushd $tmpdir cmake -G Ninja $testsuite_dir \ -DCMAKE_C_COMPILER=$cc \ -DCMAKE_CXX_COMPILER=$cxx \ - -DTEST_SUITE_LIT_FLAGS="-sv$thread_args_lit" + -DTEST_SUITE_LIT_FLAGS="-sv" -if ! ninja $thread_args_ninja check ; then +if ! ninja check ; then # The following code helps with troubleshooting an issue with miniFE. # Collect more information about the OS and server that reproduced the # issue. From a7f0d01a639ee865ea9206d39a936a328645ca34 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 6 Aug 2025 14:05:40 -0300 Subject: [PATCH 160/178] Add abi-test-suite Move the test from https://src.fedoraproject.org/tests/llvm-test-suite to here. Apply the following changes: 1. Rename runtest.sh to test.sh. 2. Enable the test. --- tests/abi-test-suite/main.fmf | 7 ++++++ tests/abi-test-suite/test.sh | 47 +++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 tests/abi-test-suite/main.fmf create mode 100755 tests/abi-test-suite/test.sh diff --git a/tests/abi-test-suite/main.fmf b/tests/abi-test-suite/main.fmf new file mode 100644 index 0000000..410207f --- /dev/null +++ b/tests/abi-test-suite/main.fmf @@ -0,0 +1,7 @@ +summary: Run ABI tests from llvm-test-suite package +duration: 1h + +adjust+: + - because: ABI testsuite only supported in x86* + enabled: false + when: arch != x86_64 diff --git a/tests/abi-test-suite/test.sh b/tests/abi-test-suite/test.sh new file mode 100755 index 0000000..91785c5 --- /dev/null +++ b/tests/abi-test-suite/test.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +usage() { + echo "usage `basename $0` [OPTIONS]" + echo " --threads NUM The number of threads to use for running tests." + echo " --testsuite-dir DIR Directory containing the test-suite source." + echo " --compiler [gcc|clang] The compiler to test." +} + +testsuite_dir="/usr/share/llvm-test-suite/" +compiler="clang" +thread_args="" + +while [ $# -gt 0 ]; do + case $1 in + --threads) + shift + threads="$1" + ;; + --testsuite-dir) + shift + testsuire_dir="$1" + ;; + --compiler) + shift + compiler="$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) +cp -r $testsuite_dir/ABI-Testsuite . +cd ABI-Testsuite +python3 linux-x86.py $compiler test -v $thread_args From d342d3c08b6e461b9f0b3e9c8fd3444b8fd49ecb Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 6 Aug 2025 14:37:49 -0300 Subject: [PATCH 161/178] abi-test-suite: Add improvements 1. Ensure the required packages are listed. 2. Ignore running this test on RHEL/CentOS because the llvm-test-suite package is not available there. 3. Ignore running this test for compat packages. 4. Remove treatment of parameters from the script because this will always be called from tmt without parameters. 5. Remove temporary directory. --- tests/abi-test-suite/main.fmf | 15 ++++++++++++ tests/abi-test-suite/test.sh | 43 ++++------------------------------- 2 files changed, 20 insertions(+), 38 deletions(-) diff --git a/tests/abi-test-suite/main.fmf b/tests/abi-test-suite/main.fmf index 410207f..aa2eaa5 100644 --- a/tests/abi-test-suite/main.fmf +++ b/tests/abi-test-suite/main.fmf @@ -2,6 +2,21 @@ summary: Run ABI tests from llvm-test-suite package duration: 1h adjust+: + - because: "llvm-test-suite is available for Fedora, not RHEL/CentOS" + when: >- + distro == rhel + or distro == centos + enabled: false + - because: ABI testsuite only supported in x86* enabled: false when: arch != x86_64 + + - because: "llvm test suite not built for compat packages" + enabled: false + when: compat is defined + +require+: + - clang + - llvm-test-suite + - python3 diff --git a/tests/abi-test-suite/test.sh b/tests/abi-test-suite/test.sh index 91785c5..ea2528b 100755 --- a/tests/abi-test-suite/test.sh +++ b/tests/abi-test-suite/test.sh @@ -1,47 +1,14 @@ #!/bin/bash -usage() { - echo "usage `basename $0` [OPTIONS]" - echo " --threads NUM The number of threads to use for running tests." - echo " --testsuite-dir DIR Directory containing the test-suite source." - echo " --compiler [gcc|clang] The compiler to test." -} - testsuite_dir="/usr/share/llvm-test-suite/" compiler="clang" -thread_args="" - -while [ $# -gt 0 ]; do - case $1 in - --threads) - shift - threads="$1" - ;; - --testsuite-dir) - shift - testsuire_dir="$1" - ;; - --compiler) - shift - compiler="$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) +tmpdir=$(mktemp -d -p /var/tmp) +pushd "$tmpdir" cp -r $testsuite_dir/ABI-Testsuite . cd ABI-Testsuite -python3 linux-x86.py $compiler test -v $thread_args +python3 linux-x86.py $compiler test -v +popd +rm -rf "$tmpdir" From 961500a660a436a933c1994db815da9426850519 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Thu, 28 Aug 2025 13:33:31 +0200 Subject: [PATCH 162/178] pie-rpm: update relevancy Remove fedora related relevancy as versions not supporting pie are already EOL Added RHEL/CentOS relevancy. --- tests/pie-rpm/main.fmf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/pie-rpm/main.fmf b/tests/pie-rpm/main.fmf index 1b276b9..1f64033 100644 --- a/tests/pie-rpm/main.fmf +++ b/tests/pie-rpm/main.fmf @@ -8,5 +8,5 @@ require+: adjust+: - enabled: false - when: distro != fedora or distro < fedora-40 - because: "We only started doing this in Fedora 40" + when: distro < rhel-10 or distro < centos-stream-10 + because: "Default linking with pie only in CentOS/RHEL 10 and newer" From e4d1e99d30fcdca987b62bfe0e992ab2c7e26b4d Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 1 Sep 2025 14:34:02 +0200 Subject: [PATCH 163/178] Comprehensive review of TMT metadata * Test tag review: add fedora-only and multilib, removed spoils-installation for being a duplicate of not-in-default * Remove outdiated architecture and distribution adjustment rules. * Further simplification of adjust rules by using major version comparison (~<) (https://fmf.readthedocs.io/en/stable/context.html#major-version) * Add bugzilla links and descriptions to some tests * Improve README by documenting all context dimensions used and test tags. --- README.md | 22 +++++++++++++++++--- plans/build-gating-alternatives.fmf | 8 ++----- plans/build-gating.fmf | 2 +- tests/abi-test-suite/main.fmf | 3 +++ tests/bolt-sanity/main.fmf | 3 +++ tests/broken-symlinks/main.fmf | 8 +------ tests/clang-format-diff/main.fmf | 3 +++ tests/cross-compile-i686/main.fmf | 4 ++++ tests/fedora-flags/main.fmf | 14 +------------ tests/find-package-llvm/main.fmf | 5 +++++ tests/integration-test-suite/rhel.fmf | 8 +++---- tests/kernel-ark-build/main.fmf | 1 + tests/libomp/main.fmf | 12 ++--------- tests/lld/gcc-compat-basic/main.fmf | 5 ----- tests/lld/ld-alternative/main.fmf | 4 ++-- tests/lld/main.fmf | 8 ++----- tests/llvm-test-suite/main.fmf | 4 +++- tests/multilib-install/main.fmf | 3 +++ tests/openmp-rpm/main.fmf | 7 ++----- tests/{rhbz_482491 => rhbz_1482491}/main.fmf | 2 +- tests/{rhbz_482491 => rhbz_1482491}/test.sh | 0 tests/rhbz_1647130/main.fmf | 1 + tests/rhbz_1657544/main.fmf | 5 +++++ tests/rhbz_2239619/main.fmf | 3 +++ tests/toolchains/main.fmf | 20 ++---------------- tests/ucrt64-toolchain/main.fmf | 10 +++++++-- tests/zstd-support/main.fmf | 4 +--- 27 files changed, 82 insertions(+), 87 deletions(-) rename tests/{rhbz_482491 => rhbz_1482491}/main.fmf (93%) rename tests/{rhbz_482491 => rhbz_1482491}/test.sh (100%) diff --git a/README.md b/README.md index 75c5153..03ea64f 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,13 @@ 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) +* `distro`: The distribution version running the tests (e.g. `rhel-9.6`, + `fedora-42`, `centos-stream-10`) +* `arch`: The hardware architecture of the host running the tests (e.g. `aarch64`, +`s390x`, `x86_64`) +* `compat`: Indicates a run for fedora compat-versioned packages (e.g. `llvm18`) +* `snapshot`: Indicates a run for [llvm snapshots]( + https://github.com/fedora-llvm-team/llvm-snapshots) copr build. To run the tests: ```bash @@ -93,6 +97,18 @@ tier: 1 # - sometag ``` +### Test Tags + +The following tags are used to control which tests are included or excluded in +TMT plans. Please be cautious when adding or removing these tags, as they are +used by plans in multiple repositories. + +* `fedora-only`: The test applies to Fedora distros only. +* `not-in-default`: Excludes the test from the default test plan. This is useful + for resource-intensive tests that are better suited for a dedicated test plan + or could potentially break the test system. +* `multilib`: Requires 32-bit (i686) package dependencies. + ### Avoid common errors using pre-commit This project uses [`pre-commit`](https://pre-commit.com/) diff --git a/plans/build-gating-alternatives.fmf b/plans/build-gating-alternatives.fmf index 3264a70..d4dda12 100644 --- a/plans/build-gating-alternatives.fmf +++ b/plans/build-gating-alternatives.fmf @@ -26,10 +26,6 @@ adjust+: - because: lld is not shipped in s390x on LLVM < 18 enabled: false - when: arch == s390x and distro < rhel-8.10, fedora-40, centos-stream-9 + when: arch == s390x and distro ~< rhel-8.10 - enabled: false - when: arch == s390x and distro == rhel-9 and distro < rhel-9.5 - - - because: lld is not shipped for ppc64 - enabled: false - when: arch == ppc64 + when: arch == s390x and distro ~< rhel-9.5 diff --git a/plans/build-gating.fmf b/plans/build-gating.fmf index 09ae36d..f3e801c 100644 --- a/plans/build-gating.fmf +++ b/plans/build-gating.fmf @@ -38,7 +38,7 @@ adjust: discover: - name: llvm-tests how: fmf - filter: "tag:-spoils-installation & tag:-not-in-default" + filter: "tag:-not-in-default" execute: how: tmt provision: diff --git a/tests/abi-test-suite/main.fmf b/tests/abi-test-suite/main.fmf index aa2eaa5..7f8c442 100644 --- a/tests/abi-test-suite/main.fmf +++ b/tests/abi-test-suite/main.fmf @@ -1,6 +1,9 @@ summary: Run ABI tests from llvm-test-suite package duration: 1h +tag+: + - fedora-only + adjust+: - because: "llvm-test-suite is available for Fedora, not RHEL/CentOS" when: >- diff --git a/tests/bolt-sanity/main.fmf b/tests/bolt-sanity/main.fmf index a4e69e8..5637470 100644 --- a/tests/bolt-sanity/main.fmf +++ b/tests/bolt-sanity/main.fmf @@ -1,6 +1,9 @@ summary: Sanity check that llvm-bolt works tier: 1 +tag+: + - fedora-only + adjust+: - because: "llvm-bolt is available for Fedora, not RHEL/CentOS" when: distro != fedora diff --git a/tests/broken-symlinks/main.fmf b/tests/broken-symlinks/main.fmf index ddb3fe5..44b0978 100644 --- a/tests/broken-symlinks/main.fmf +++ b/tests/broken-symlinks/main.fmf @@ -14,10 +14,4 @@ adjust+: # There are no plans to backport that, so we disable the test # in distros where LLVM < 17. - enabled: false - 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 + when: distro ~<= rhel-9.3 diff --git a/tests/clang-format-diff/main.fmf b/tests/clang-format-diff/main.fmf index 79cb086..87f15c5 100644 --- a/tests/clang-format-diff/main.fmf +++ b/tests/clang-format-diff/main.fmf @@ -1,5 +1,8 @@ summary: clang-format-diff tier: 1 +link+: + verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1939018 + require+: - clang-tools-extra diff --git a/tests/cross-compile-i686/main.fmf b/tests/cross-compile-i686/main.fmf index c384848..ea915ec 100644 --- a/tests/cross-compile-i686/main.fmf +++ b/tests/cross-compile-i686/main.fmf @@ -4,6 +4,10 @@ description: > proper directory tier: 1 +tag+: + - multilib + - fedora-only + require+: - compiler-rt.i686 - glibc-devel.i686 diff --git a/tests/fedora-flags/main.fmf b/tests/fedora-flags/main.fmf index 436049d..16a0b0a 100644 --- a/tests/fedora-flags/main.fmf +++ b/tests/fedora-flags/main.fmf @@ -1,17 +1,5 @@ summary: fedora-flags +description: Build sample C/C++ code with default system flags from redhat-rpm-config require+: - redhat-rpm-config tier: 1 - -adjust+: - - because: s390x does not have epel repo which is required to provide rpm macros - enabled: false - when: >- - distro == rhel-7 - and arch == s390x - - # Note: this needs epel-release repo to be available - - because: "To enable rpm macros not available by default (e.g. build_cflags), epel-rpm-macros is needed" - require+: - - epel-rpm-macros - when: distro == rhel-7 diff --git a/tests/find-package-llvm/main.fmf b/tests/find-package-llvm/main.fmf index bb6be98..e39c326 100644 --- a/tests/find-package-llvm/main.fmf +++ b/tests/find-package-llvm/main.fmf @@ -20,3 +20,8 @@ require+: - llvm-devel - clang - clang-devel + +adjust+: + - enabled: false + when: deploymentmode == image + because: "/usr is readonly in imagemode systems" diff --git a/tests/integration-test-suite/rhel.fmf b/tests/integration-test-suite/rhel.fmf index 1753bf2..229b698 100644 --- a/tests/integration-test-suite/rhel.fmf +++ b/tests/integration-test-suite/rhel.fmf @@ -27,15 +27,15 @@ adjust+: # a way to provide custom contexts, we need to filter out by distro versions. - require-: - lld - when: arch == s390x and distro < rhel-8.10, centos-stream-9 + when: arch == s390x and distro < rhel-8.10 - require-: - lld - when: arch == s390x and distro == rhel-9 and distro < rhel-9.5 + when: arch == s390x and distro ~< rhel-9.5 - # libomp is not supported in s390x in RHEL. + # libomp is not supported in s390x in RHEL... Until LLVM 19 - require-: - libomp-devel - when: arch == s390x + when: arch == s390x and distro ~< rhel-9.6.0 # RHEL 8 use python3.12 - require-: diff --git a/tests/kernel-ark-build/main.fmf b/tests/kernel-ark-build/main.fmf index 149eca2..b1c5561 100644 --- a/tests/kernel-ark-build/main.fmf +++ b/tests/kernel-ark-build/main.fmf @@ -24,6 +24,7 @@ link+: - verifies: https://issues.redhat.com/browse/LLVM-72 tag+: - not-in-default + - fedora-only /base: summary+: " (base/non-LTO)" diff --git a/tests/libomp/main.fmf b/tests/libomp/main.fmf index c503044..21a37fd 100644 --- a/tests/libomp/main.fmf +++ b/tests/libomp/main.fmf @@ -12,17 +12,9 @@ require+: adjust+: # Right now libomp in s390x is supported only in LLVM >= 18 in Fedora + # And in LLVM >= 19 in CentOS/RHEL # TODO until tmt allows to use custom adjusted contexts we need to do this # indirect adjustment using the distro version. - - when: arch == s390x and distro < fedora-40 and snapshot is not defined + - when: arch == s390x and distro ~< rhel-9.6.0 enabled: false continue: false - - - when: arch == s390x and distro != fedora - enabled: false - continue: false - - # Dependencies in rhel-7 are handled differently: there are no recommends, - # only requires. - - when: distro <= rhel-7 - enabled: false diff --git a/tests/lld/gcc-compat-basic/main.fmf b/tests/lld/gcc-compat-basic/main.fmf index 2cd3a2b..2d79ca3 100644 --- a/tests/lld/gcc-compat-basic/main.fmf +++ b/tests/lld/gcc-compat-basic/main.fmf @@ -2,8 +2,3 @@ summary: Test lld with gcc require+: - gcc tier: 1 - -adjust+: - - because: system gcc is too old in rhel-7 - enabled: false - when: distro <= rhel-7 diff --git a/tests/lld/ld-alternative/main.fmf b/tests/lld/ld-alternative/main.fmf index 83d4f8f..7c3da93 100644 --- a/tests/lld/ld-alternative/main.fmf +++ b/tests/lld/ld-alternative/main.fmf @@ -1,7 +1,7 @@ summary: Test linker switching with alternatives -# This test spoils the installation by removing lld, therefore it should be marked as such. +# This test spoils the installation by removing lld. tag+: - - spoils-installation + - not-in-default require+: - binutils tier: 1 diff --git a/tests/lld/main.fmf b/tests/lld/main.fmf index 823bb7a..a3f50ad 100644 --- a/tests/lld/main.fmf +++ b/tests/lld/main.fmf @@ -3,12 +3,8 @@ require+: - lld adjust+: - - because: lld is not shipped for ppc64 - enabled: false - when: arch == ppc64 - - because: lld is not shipped in s390x on LLVM < 18 enabled: false - when: arch == s390x and distro < rhel-8.10, fedora-40, centos-stream-9 + when: arch == s390x and distro < rhel-8.10 - enabled: false - when: arch == s390x and distro == rhel-9 and distro < rhel-9.5 + when: arch == s390x and distro ~< rhel-9.5 diff --git a/tests/llvm-test-suite/main.fmf b/tests/llvm-test-suite/main.fmf index d4d005a..a665eb9 100644 --- a/tests/llvm-test-suite/main.fmf +++ b/tests/llvm-test-suite/main.fmf @@ -1,6 +1,8 @@ -# 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 +tag+: + - fedora-only + adjust+: - because: "llvm-test-suite is available for Fedora, not RHEL/CentOS" when: >- diff --git a/tests/multilib-install/main.fmf b/tests/multilib-install/main.fmf index d57b079..3cc2cdd 100644 --- a/tests/multilib-install/main.fmf +++ b/tests/multilib-install/main.fmf @@ -1,6 +1,9 @@ summary: Make sure that multilib installation works tier: 1 +tag+: + - multilib + require+: - llvm-devel - llvm-devel.i686 diff --git a/tests/openmp-rpm/main.fmf b/tests/openmp-rpm/main.fmf index bbe6346..69674a4 100644 --- a/tests/openmp-rpm/main.fmf +++ b/tests/openmp-rpm/main.fmf @@ -8,12 +8,9 @@ component+: adjust+: # Right now libomp in s390x is supported only in LLVM >= 18 in Fedora + # And in LLVM >= 19 in CentOS/RHEL # TODO until tmt allows to use custom adjusted contexts we need to do this # indirect adjustment using the distro version. - - when: arch == s390x and distro < fedora-40 and snapshot is not defined - enabled: false - continue: false - - - when: arch == s390x and distro != fedora + - when: arch == s390x and distro ~< rhel-9.6.0 enabled: false continue: false diff --git a/tests/rhbz_482491/main.fmf b/tests/rhbz_1482491/main.fmf similarity index 93% rename from tests/rhbz_482491/main.fmf rename to tests/rhbz_1482491/main.fmf index c0d524b..bc67898 100644 --- a/tests/rhbz_482491/main.fmf +++ b/tests/rhbz_1482491/main.fmf @@ -1,4 +1,4 @@ -summary: rhbz-482491 +summary: rhbz-1482491 description: | "Test that clang is able to find the right libgcc_s" require+: diff --git a/tests/rhbz_482491/test.sh b/tests/rhbz_1482491/test.sh similarity index 100% rename from tests/rhbz_482491/test.sh rename to tests/rhbz_1482491/test.sh diff --git a/tests/rhbz_1647130/main.fmf b/tests/rhbz_1647130/main.fmf index 921251e..a8cf420 100644 --- a/tests/rhbz_1647130/main.fmf +++ b/tests/rhbz_1647130/main.fmf @@ -1,4 +1,5 @@ summary: RHBZ1647130 +description: Test that scan-build and scan-view can run without aborting tier: 1 require+: diff --git a/tests/rhbz_1657544/main.fmf b/tests/rhbz_1657544/main.fmf index 2aabac2..074daa5 100644 --- a/tests/rhbz_1657544/main.fmf +++ b/tests/rhbz_1657544/main.fmf @@ -1,2 +1,7 @@ summary: RHBZ1657544 +description: | + Test that clang++ does not use the symbol __muloti4 tier: 1 + +link+: + resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1657544 diff --git a/tests/rhbz_2239619/main.fmf b/tests/rhbz_2239619/main.fmf index dd5c972..f406092 100644 --- a/tests/rhbz_2239619/main.fmf +++ b/tests/rhbz_2239619/main.fmf @@ -1,2 +1,5 @@ summary: Test if debug information is disabled by default tier: 1 + +link+: + verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2239619 diff --git a/tests/toolchains/main.fmf b/tests/toolchains/main.fmf index 72fc4d8..dc38125 100644 --- a/tests/toolchains/main.fmf +++ b/tests/toolchains/main.fmf @@ -13,17 +13,7 @@ adjust+: # requirements, remove it. - require-: - lld - when: >- - arch == s390x and distro < rhel-9, rhel-9.5, fedora-40, centos-stream-9 - or arch == ppc64 - - # LLVM is getting updated to 18 in rhel 8.10 which adds lld for s390x, but we - # still have LLVM 17 in AppStream. Install lld if it's available, leave it out - # if not. The test will (correctly) fail if we lld is missing in LLVM 18. - # TODO once LLVM 18 is in the default module stream we can set this a require: - - recommend+: - - lld - when: arch == s390x and distro == rhel-8.10 + when: arch == s390x and distro ~< rhel-9.5 - environment+: CXXLIBS: "libc++" @@ -37,9 +27,7 @@ adjust+: CXXLIBS: "libstdc++" require+: - libstdc++ - when: >- - distro == rhel - or distro == centos + when: distro == rhel, centos because: testing against libstdc++ package in RHEL as libcxx is not shipped with RHEL # llvm-snapshots specific adjustments. @@ -58,7 +46,3 @@ adjust+: - lld when: snapshot is defined because: llvm-snapshots adjustments - - -# 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. diff --git a/tests/ucrt64-toolchain/main.fmf b/tests/ucrt64-toolchain/main.fmf index 18c9f22..2e5e4d2 100644 --- a/tests/ucrt64-toolchain/main.fmf +++ b/tests/ucrt64-toolchain/main.fmf @@ -2,7 +2,13 @@ summary: Test that ucrt64 toolchain is detected require+: - ucrt64-gcc-c++ +tag+: + - fedora-only + +link+: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2152220 + adjust+: - enabled: false - when: distro != fedora or distro < fedora-37 - because: "The ucrt64 toolchain is only available since Fedora 37" + when: distro != fedora + because: "The ucrt64 toolchain is only available in Fedora" diff --git a/tests/zstd-support/main.fmf b/tests/zstd-support/main.fmf index 519afc4..2d92c29 100644 --- a/tests/zstd-support/main.fmf +++ b/tests/zstd-support/main.fmf @@ -5,9 +5,7 @@ framework: beakerlib require+: - lld adjust+: - - when: distro == fedora and distro < fedora-41 or - distro == rhel-8 and distro < rhel-8.10 or - distro == rhel-9 and distro < rhel-9.6 + - when: distro ~< rhel-8.10, rhel-9.6 enabled: false because: ZSTD is enabled only in LLVM 19 and newer link+: From 03f0cdd92675e014b4c1b20620fdd55b04e9534f Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Thu, 13 Nov 2025 11:45:51 -0300 Subject: [PATCH 164/178] Remove troubleshooting code from llvm-test-suite Sometime this code was added in order to help troubleshoot an issue with miniFE. It hasn't helped and it's causing issues when reporting issues in Github because this is generating a too long output. --- tests/llvm-test-suite/test.sh | 45 +---------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/tests/llvm-test-suite/test.sh b/tests/llvm-test-suite/test.sh index 1f7b9b7..697f2cf 100755 --- a/tests/llvm-test-suite/test.sh +++ b/tests/llvm-test-suite/test.sh @@ -17,50 +17,7 @@ cmake -G Ninja $testsuite_dir \ -DCMAKE_CXX_COMPILER=$cxx \ -DTEST_SUITE_LIT_FLAGS="-sv" -if ! ninja check ; then - # The following code helps with troubleshooting an issue with miniFE. - # Collect more information about the OS and server that reproduced the - # issue. - # https://github.com/fedora-llvm-team/llvm-snapshots/issues/874 - mdir=$tmpdir/MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE - - if [[ ! -e $mdir/miniFE ]]; then - # If this executable does not exist, assume the test failed due to another - # reason. - exit 1 - fi - - uname -a - lscpu - - ldd $mdir/miniFE - readelf -hSlW $mdir/miniFE - - readelf -Ws --demangle \ - $mdir/miniFE \ - | grep -E 'Symbol table|Ndx Name|cg_solve' - - objdump --disassemble=_ZN6miniFE8cg_solveINS_9CSRMatrixIdiiEENS_6VectorIdiiEENS_14matvec_overlapIS2_S4_EEEEvRT_RKT0_RS9_T1_NS7_16LocalOrdinalTypeERNS_10TypeTraitsINS7_10ScalarTypeEE14magnitude_typeERSE_SJ_Pd \ - $mdir/miniFE - - objdump --disassemble=_ZN6miniFE8cg_solveINS_9CSRMatrixIdiiEENS_6VectorIdiiEENS_10matvec_stdIS2_S4_EEEEvRT_RKT0_RS9_T1_NS7_16LocalOrdinalTypeERNS_10TypeTraitsINS7_10ScalarTypeEE14magnitude_typeERSE_SJ_Pd \ - $mdir/miniFE - - $tmpdir/tools/timeit-target --timeout 7200 --limit-core 0 --limit-cpu 7200 \ - --limit-file-size 209715200 --limit-rss-size 838860800 \ - --append-exitstatus \ - --redirect-output $mdir/Output/miniFE.test.out \ - --redirect-input /dev/null \ - --chdir $mdir \ - --summary $mdir/Output/miniFE.test.time \ - $mdir/miniFE \ - -nx 64 -ny 64 -nz 64 - $tmpdir/tools/fpcmp-target \ - $mdir/Output/miniFE.test.out \ - $mdir/miniFE.reference_output - - exit 1 -fi +ninja check popd # Remove temporary files in case of success. From dc54daea6fc2c9ed211db73c3071f04de20c584d Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 19 Nov 2025 10:04:34 -0300 Subject: [PATCH 165/178] gcc-clang-compatibility: Use the new gcc-toolset-xx-env command GTS 15 is shifting way from scl and provides a new command called gcc-toolset-xx-env in order to setup its environment. --- tests/gcc-clang-compatibility/test.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/gcc-clang-compatibility/test.sh b/tests/gcc-clang-compatibility/test.sh index 504713d..17fd0b1 100755 --- a/tests/gcc-clang-compatibility/test.sh +++ b/tests/gcc-clang-compatibility/test.sh @@ -9,8 +9,15 @@ TOOLSET=$(clang -v |& grep "Selected GCC installation" | grep -P -o '(dev|gcc-)t if [[ "" = "${TOOLSET}" ]]; then GCC="g++" else - GCC="scl enable ${TOOLSET} -- g++" - echo "Testing with g++ from ${TOOLSET}" + # GTS 15 started to shift away from scl in favor of the + # gcc-toolset-xx-env command. + if command -v "${TOOLSET}-env" &>/dev/null; then + GCC="${TOOLSET}-env -- g++" + echo "Testing with g++ from ${TOOLSET} using ${TOOLSET}-env" + else + GCC="scl enable ${TOOLSET} -- g++" + echo "Testing with g++ from ${TOOLSET}" + fi fi # Build the source with GCC, link it with clang From 140490cb767320657eea28f65a3ad797e955b051 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 30 Jan 2026 10:04:32 +0100 Subject: [PATCH 166/178] lldb-dwz: Don't check for unsupported DW_FORM values in lldb 23+ LLDB 23 adds support for DW_FORM GNU_ref_alt and GNU_strp_alt. Since this is supported unconditionally (don't depend on any config dependent on the distro or the maintainer) we will set a check for the lldb version in the script, rather than overcomplicating the metadata. --- tests/lldb/lldb-dwz/test.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/lldb/lldb-dwz/test.sh b/tests/lldb/lldb-dwz/test.sh index 0050155..ad9ad0c 100755 --- a/tests/lldb/lldb-dwz/test.sh +++ b/tests/lldb/lldb-dwz/test.sh @@ -1,4 +1,4 @@ -#!/bin/sh -eux +#!/bin/bash -eux gcc -gdwarf-4 -o hello1 hello.c # Copy the binary so we can create a common file for duplicated debuginfo @@ -7,8 +7,13 @@ cp hello1 hello2 dwz hello1 hello2 -m hello.common lldb -b -o 'b main' -o 'run --usage' -o c -- hello1 2>&1 | tee lldb.log -# lldb should report "unsupported DW_FORM values: 0x1f20 0x1f21", yet shouldn't crash -grep "unsupported DW_FORM values" lldb.log +# Until LLVM 23, DW_FORM GNU_ref_alt and GNU_strp_alt are unsupported. +# In that case, lldb should report "unsupported DW_FORM values: 0x1f20 0x1f21" +# as a warning, and continue the execution without any crash. Support added in: +# https://github.com/llvm/llvm-project/commit/16149ca93227d0d26a2f7387e95ad30971e99f43 +if [[ "$(rpm -q --qf "%{version}" lldb | cut -d. -f1)" -lt "23" ]] ; then + grep "unsupported DW_FORM values" lldb.log +fi grep "stop reason = breakpoint" lldb.log # Ensure the process ends successfully (no crashes) grep -E "Process [0-9]+ exited with status = 0" lldb.log From 4c4d9b3bc5e92407affd201a6a567453997b9c45 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Fri, 30 Jan 2026 15:07:30 -0300 Subject: [PATCH 167/178] rhbz_1482491: Ignore false-positive from find Find returns failure when it isn't able to access all subdirectories, causing a false-positive. Avoid that by redirecting error messages to /dev/null and counting the amount of files found. --- tests/rhbz_1482491/test.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/rhbz_1482491/test.sh b/tests/rhbz_1482491/test.sh index 2360238..11e1e35 100755 --- a/tests/rhbz_1482491/test.sh +++ b/tests/rhbz_1482491/test.sh @@ -1,3 +1,10 @@ -#!/bin/sh -eux +#!/bin/bash -eux -find /usr -name 'libgcc_s.so*' && echo "int main(){}" | clang -v -x c - +n=$(find /usr -name 'libgcc_s.so*' 2>/dev/null | wc -l) + +if [[ $n -lt 1 ]]; then + echo "Error: could not find libgcc_s.so" + exit 1 +fi + +echo "int main(){}" | clang -v -x c - From 4f4c834e22e2fbe109065ed59ba2391535b8b07e Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 25 Feb 2026 15:56:30 -0300 Subject: [PATCH 168/178] lldb-dwz: Be compatible with compat packages Avoid running rpm against package names because they change when we test a compat package. Use the executable path instead because PATH gets modified when testing compat packages. --- tests/lldb/lldb-dwz/test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/lldb/lldb-dwz/test.sh b/tests/lldb/lldb-dwz/test.sh index ad9ad0c..5fe8508 100755 --- a/tests/lldb/lldb-dwz/test.sh +++ b/tests/lldb/lldb-dwz/test.sh @@ -7,11 +7,12 @@ cp hello1 hello2 dwz hello1 hello2 -m hello.common lldb -b -o 'b main' -o 'run --usage' -o c -- hello1 2>&1 | tee lldb.log +exe=$(command -v lldb) # Until LLVM 23, DW_FORM GNU_ref_alt and GNU_strp_alt are unsupported. # In that case, lldb should report "unsupported DW_FORM values: 0x1f20 0x1f21" # as a warning, and continue the execution without any crash. Support added in: # https://github.com/llvm/llvm-project/commit/16149ca93227d0d26a2f7387e95ad30971e99f43 -if [[ "$(rpm -q --qf "%{version}" lldb | cut -d. -f1)" -lt "23" ]] ; then +if [[ "$(rpm -q --qf "%{version}" -f $exe | cut -d. -f1)" -lt "23" ]] ; then grep "unsupported DW_FORM values" lldb.log fi grep "stop reason = breakpoint" lldb.log From b5095271a15e5d7f673b2c8bdf977c0a2ed0f9c8 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Fri, 6 Mar 2026 09:23:03 +0100 Subject: [PATCH 169/178] kernel-ark-build: add dnf-plugins-core to requires Some systems don't have it installed by default causing an error during the setup phase. --- tests/kernel-ark-build/main.fmf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/kernel-ark-build/main.fmf b/tests/kernel-ark-build/main.fmf index b1c5561..b130a72 100644 --- a/tests/kernel-ark-build/main.fmf +++ b/tests/kernel-ark-build/main.fmf @@ -16,6 +16,7 @@ require+: - bison - bzip2 - rpm-build + - dnf-plugins-core adjust+: - when: distro is not defined or distro != fedora-rawhide enabled: false From 6df13a6c103da12490db9c4ea95d37c8d6373f0c Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Fri, 6 Mar 2026 11:30:59 -0300 Subject: [PATCH 170/178] kernel-ark: Use dnf5 when available Prefer to use dnf5, when it's available on the system. Fallback to dnf-3 otherwise. This fixes a warning on Testing Farm that might be interpreted as failure. --- tests/kernel-ark-build/test.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/kernel-ark-build/test.sh b/tests/kernel-ark-build/test.sh index c892af6..41fc04a 100755 --- a/tests/kernel-ark-build/test.sh +++ b/tests/kernel-ark-build/test.sh @@ -154,7 +154,11 @@ rlJournalStart rlRun "set -o pipefail" if rlIsFedora; then rlLog "Disable updates-testing" - rlRun "dnf-3 config-manager --set-disabled updates-testing" + if command -v dnf5; then + rlRun "dnf5 config-manager setopt updates-testing.enabled=0" + else + rlRun "dnf-3 config-manager --set-disabled updates-testing" + fi fi rlPhaseEnd From 18972ea7adb87c1cfdad9af7c4e47614a8e2567c Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 1 Apr 2026 12:18:56 -0300 Subject: [PATCH 171/178] llvm-test-suite: Enable verbose mode This helps to investigate build issues affecting the tests by allowing us to see which flags are passed to the compiler. --- tests/llvm-test-suite/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/llvm-test-suite/test.sh b/tests/llvm-test-suite/test.sh index 697f2cf..babdf0e 100755 --- a/tests/llvm-test-suite/test.sh +++ b/tests/llvm-test-suite/test.sh @@ -17,7 +17,7 @@ cmake -G Ninja $testsuite_dir \ -DCMAKE_CXX_COMPILER=$cxx \ -DTEST_SUITE_LIT_FLAGS="-sv" -ninja check +ninja -v check popd # Remove temporary files in case of success. From f57ec3b76cd465bd981e8c27139309862dedb055 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Tue, 28 Apr 2026 15:14:33 -0300 Subject: [PATCH 172/178] kernel-ark-build: Disable LTO tests Both base-lto and debug-lto tests have been failing since Linux upstream added a new config option. This is requiring us to waive test results whenever we have a new build on Rawhide. The issue is being tracked at: https://gitlab.com/cki-project/kernel-ark/-/issues/191 The kernel-ark team disabled these tests in their infrastructure and believe that fixing them is not a priority at the moment. Considering that our goal with kernel-ark-build is to track build issues caused by LLVM changes before the kernel team see them, we should keep our tests identical to them. In other words: we should disable both LTO tests. --- tests/kernel-ark-build/main.fmf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/kernel-ark-build/main.fmf b/tests/kernel-ark-build/main.fmf index b130a72..1dfca50 100644 --- a/tests/kernel-ark-build/main.fmf +++ b/tests/kernel-ark-build/main.fmf @@ -44,7 +44,9 @@ tag+: ENABLE_LTO: 1 adjust+: - enabled: false - when: arch != x86_64 and arch != aarch64 + # Disable this test until + # https://gitlab.com/cki-project/kernel-ark/-/issues/191 gets fixed. + # when: arch != x86_64 and arch != aarch64 /debug-lto: summary+: " (debug/LTO)" @@ -53,4 +55,6 @@ tag+: ENABLE_DEBUG: 1 adjust+: - enabled: false - when: arch != x86_64 and arch != aarch64 + # Disable this test until + # https://gitlab.com/cki-project/kernel-ark/-/issues/191 gets fixed. + # when: arch != x86_64 and arch != aarch64 From 48d9d59fc67c495327fce54b0cbebefca183f2b2 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 3 Jun 2026 13:26:27 -0300 Subject: [PATCH 173/178] Add a new test for flang Build and run 2 simple Fortran programs using flang in order to guarantee we have a flang that does the most basic tasks. --- tests/flang/hello.f | 3 +++ tests/flang/main.fmf | 20 ++++++++++++++++++++ tests/flang/sin.f90 | 5 +++++ tests/flang/test.sh | 13 +++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 tests/flang/hello.f create mode 100644 tests/flang/main.fmf create mode 100644 tests/flang/sin.f90 create mode 100755 tests/flang/test.sh diff --git a/tests/flang/hello.f b/tests/flang/hello.f new file mode 100644 index 0000000..e32b35a --- /dev/null +++ b/tests/flang/hello.f @@ -0,0 +1,3 @@ + PROGRAM HELLO + PRINT '(A)', 'Hello, world' + END diff --git a/tests/flang/main.fmf b/tests/flang/main.fmf new file mode 100644 index 0000000..85895d6 --- /dev/null +++ b/tests/flang/main.fmf @@ -0,0 +1,20 @@ +summary: Run simple tests for flang + +tag+: + - fedora-only + +adjust+: + - because: "flang is available for Fedora, not RHEL/CentOS" + when: >- + distro == rhel + or distro == centos + enabled: false + + - because: "flang is not built for compat packages" + enabled: false + when: compat is defined + +require+: + - flang + - llvm-devel +duration: 1h diff --git a/tests/flang/sin.f90 b/tests/flang/sin.f90 new file mode 100644 index 0000000..ba091b0 --- /dev/null +++ b/tests/flang/sin.f90 @@ -0,0 +1,5 @@ +program sin + real :: pi + pi = 4*atan(1.0) + print *, sin(pi/2) +end program diff --git a/tests/flang/test.sh b/tests/flang/test.sh new file mode 100755 index 0000000..6b29663 --- /dev/null +++ b/tests/flang/test.sh @@ -0,0 +1,13 @@ +#!/usr/bin/bash +# Compile and run simple Fortran programs in order to evaluate if Flang is +# minimally funcional. + +set -e + +flang hello.f -o hello +./hello | grep -q "Hello, world" +rm hello + +flang sin.f90 -o sin +./sin | grep -q "1." +rm sin From 6f3ff93a5f01bc9f334752a205d149a94627bfd4 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 24 Jun 2026 14:29:53 +0200 Subject: [PATCH 174/178] Remove checks for Fedora < 41 These Fedora versions are no longer maintained, so remove related conditionals. --- tests/bolt-sanity/main.fmf | 4 ---- tests/integration-test-suite/fedora.fmf | 5 ----- 2 files changed, 9 deletions(-) diff --git a/tests/bolt-sanity/main.fmf b/tests/bolt-sanity/main.fmf index 5637470..464c42f 100644 --- a/tests/bolt-sanity/main.fmf +++ b/tests/bolt-sanity/main.fmf @@ -9,10 +9,6 @@ adjust+: when: distro != fedora enabled: false - - because: "We only ship llvm-bolt in snapshots for fedora 41 and newer" - when: snapshot is defined and distro < fedora-41 - enabled: false - - because: "llvm-bolt only supports x86_64 and aarch64" when: arch != x86_64 and arch != aarch64 enabled: false diff --git a/tests/integration-test-suite/fedora.fmf b/tests/integration-test-suite/fedora.fmf index 2862860..abc8928 100644 --- a/tests/integration-test-suite/fedora.fmf +++ b/tests/integration-test-suite/fedora.fmf @@ -22,8 +22,3 @@ adjust+: - enabled: false when: distro != fedora or compat is defined continue: false - - # We only ship mlir in snapshots for fedora 41 and newer. - - require-: - - mlir-devel - when: snapshot is defined and distro < fedora-41 From 3fd65b9990e5e94472121a2ffb1a1d66ac4276eb Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 24 Jun 2026 14:27:26 +0200 Subject: [PATCH 175/178] Only run flang test on Fedora >= 44 In Fedora 43 flang is a separate package. This causes errors when installing packages during snapshot tmt test runs on f43. --- tests/flang/main.fmf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/flang/main.fmf b/tests/flang/main.fmf index 85895d6..1bfa42b 100644 --- a/tests/flang/main.fmf +++ b/tests/flang/main.fmf @@ -10,6 +10,10 @@ adjust+: or distro == centos enabled: false + - because: "flang is only part of llvm since Fedora 44" + when: snapshot is defined and distro < fedora-44 + enabled: false + - because: "flang is not built for compat packages" enabled: false when: compat is defined From 61dd89e40794bb2600f2eb609b9b7a7a867698b0 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Thu, 23 Jul 2026 11:41:19 -0300 Subject: [PATCH 176/178] flang: Fix linking phase on older distros Ensure libgcc is installed in order to prevent the following error: /usr/bin/ld: cannot find -lgcc_s: No such file or directory This is usually pre-installed because it's a requirement for dnf, but dnf is not guaranteed to be installed in all scenarios. --- tests/flang/main.fmf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/flang/main.fmf b/tests/flang/main.fmf index 1bfa42b..80ef755 100644 --- a/tests/flang/main.fmf +++ b/tests/flang/main.fmf @@ -21,4 +21,5 @@ adjust+: require+: - flang - llvm-devel + - libgcc duration: 1h From ce3e5b6a0d1779bf99d90cae9b173af2db440612 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Thu, 20 Aug 2026 14:19:20 -0300 Subject: [PATCH 177/178] Revert "kernel-ark-build: Disable LTO tests" This reverts commit f57ec3b76cd465bd981e8c27139309862dedb055 because the original issue has been fixed. --- tests/kernel-ark-build/main.fmf | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/kernel-ark-build/main.fmf b/tests/kernel-ark-build/main.fmf index 1dfca50..b130a72 100644 --- a/tests/kernel-ark-build/main.fmf +++ b/tests/kernel-ark-build/main.fmf @@ -44,9 +44,7 @@ tag+: ENABLE_LTO: 1 adjust+: - enabled: false - # Disable this test until - # https://gitlab.com/cki-project/kernel-ark/-/issues/191 gets fixed. - # when: arch != x86_64 and arch != aarch64 + when: arch != x86_64 and arch != aarch64 /debug-lto: summary+: " (debug/LTO)" @@ -55,6 +53,4 @@ tag+: ENABLE_DEBUG: 1 adjust+: - enabled: false - # Disable this test until - # https://gitlab.com/cki-project/kernel-ark/-/issues/191 gets fixed. - # when: arch != x86_64 and arch != aarch64 + when: arch != x86_64 and arch != aarch64 From 8421b022736598f00232c7b7bcafaa830302ac90 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Mon, 24 Aug 2026 20:41:34 -0300 Subject: [PATCH 178/178] integration-test-suite: Disable gold tests on RHEL 11 gold's build has been disabled on ELN/RHEL 11. Get prepared for this change. https://src.fedoraproject.org/rpms/binutils/c/ddb3cb864e8689fe53f8accd61def4403ff94aee --- tests/integration-test-suite/rhel.fmf | 4 ++++ tests/integration-test-suite/test.sh | 1 + 2 files changed, 5 insertions(+) diff --git a/tests/integration-test-suite/rhel.fmf b/tests/integration-test-suite/rhel.fmf index 229b698..0036df4 100644 --- a/tests/integration-test-suite/rhel.fmf +++ b/tests/integration-test-suite/rhel.fmf @@ -44,3 +44,7 @@ adjust+: - require+: - python3.12-lit when: distro == rhel-8 + + - environment+: + NO_GOLD: true + when: distro >= rhel-11 diff --git a/tests/integration-test-suite/test.sh b/tests/integration-test-suite/test.sh index 95598a0..fb78aa7 100755 --- a/tests/integration-test-suite/test.sh +++ b/tests/integration-test-suite/test.sh @@ -43,6 +43,7 @@ rlJournalStart rlRun "mkdir _build && cd _build" CONFIG_CMD="cmake .." + CONFIG_CMD+="${NO_GOLD:+ -DENABLE_GOLD_TESTS=OFF}" CONFIG_CMD+="${NO_LIBCXX:+ -DENABLE_LIBCXX=OFF}" CONFIG_CMD+="${NO_STATIC_LIBCXX:+ -DENABLE_STATIC_LIBCXX=OFF}" CONFIG_CMD+="${NO_LIBUNWIND:+ -DENABLE_LIBUNWIND=OFF}"