From 604b1841b5b18f618e4c1e53f1d16eafaece9138 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Fri, 16 Apr 2021 19:13:27 +0200 Subject: [PATCH] Avoid mixing STI and FMF tests Related: https://pagure.io/fedora-ci/general/issue/206 Also, drop unneeded legacy Makefile's and PURPOSE files, and explicitly require gcc.rpm, which is not installed on the CI workers by default any more it seems. --- tests/Regression/identify/Makefile | 71 ----------------- tests/Regression/identify/PURPOSE | 3 - .../lto-preprocessor-options/Makefile | 64 --------------- .../lto-preprocessor-options/PURPOSE | 3 - .../lto-preprocessor-options/main.fmf | 1 + .../lto-preprocessor-options/runtest.sh | 5 +- tests/Regression/testsuite/Makefile | 78 ------------------- tests/Regression/testsuite/PURPOSE | 3 - tests/Regression/testsuite/main.fmf | 1 + tests/Sanity/gcc-fedora-flags/hello.c | 5 ++ tests/Sanity/gcc-fedora-flags/hello.cpp | 5 ++ tests/Sanity/gcc-fedora-flags/main.c | 6 ++ tests/Sanity/gcc-fedora-flags/main.cpp | 6 ++ tests/Sanity/gcc-fedora-flags/main.fmf | 17 ++++ tests/Sanity/gcc-fedora-flags/runtest.sh | 38 +++++++++ tests/Sanity/smoke/Makefile | 59 -------------- tests/Sanity/smoke/PURPOSE | 3 - tests/Sanity/smoke/main.fmf | 1 + tests/tests.yml | 17 ---- 19 files changed, 84 insertions(+), 302 deletions(-) delete mode 100644 tests/Regression/identify/Makefile delete mode 100644 tests/Regression/identify/PURPOSE delete mode 100644 tests/Regression/lto-preprocessor-options/Makefile delete mode 100644 tests/Regression/lto-preprocessor-options/PURPOSE delete mode 100644 tests/Regression/testsuite/Makefile delete mode 100644 tests/Regression/testsuite/PURPOSE create mode 100644 tests/Sanity/gcc-fedora-flags/hello.c create mode 100644 tests/Sanity/gcc-fedora-flags/hello.cpp create mode 100644 tests/Sanity/gcc-fedora-flags/main.c create mode 100644 tests/Sanity/gcc-fedora-flags/main.cpp create mode 100644 tests/Sanity/gcc-fedora-flags/main.fmf create mode 100755 tests/Sanity/gcc-fedora-flags/runtest.sh delete mode 100644 tests/Sanity/smoke/Makefile delete mode 100644 tests/Sanity/smoke/PURPOSE delete mode 100644 tests/tests.yml diff --git a/tests/Regression/identify/Makefile b/tests/Regression/identify/Makefile deleted file mode 100644 index f62f325..0000000 --- a/tests/Regression/identify/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/annobin/Regression/identify -# Description: identify -# Author: Martin Cermak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2019 Red Hat, Inc. -# -# 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, see http://www.gnu.org/licenses/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -export TEST=/tools/annobin/Regression/identify -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE - -.PHONY: all install download clean - -run: $(FILES) build - ./runtest.sh - -build: $(BUILT_FILES) - test -x runtest.sh || chmod a+x runtest.sh - -clean: - rm -f *~ $(BUILT_FILES) - -requires = annobin - -# https://mojo.redhat.com/docs/DOC-1072127 -dtsver = $(shell seq -s, 10 11) -dtsreq = $(shell echo {dev,gcc-}toolset-{$(dtsver)}{,-annocheck}) - - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @echo "Owner: Martin Cermak " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: identify" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 48h" >> $(METADATA) - @echo "RunFor: annobin" >> $(METADATA) - $(foreach package, $(requires) $(dtsreq), \ - echo "Requires: $(package)" >> $(METADATA); \ - ) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Regression/identify/PURPOSE b/tests/Regression/identify/PURPOSE deleted file mode 100644 index 3471618..0000000 --- a/tests/Regression/identify/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /tools/annobin/Regression/identify -Description: identify -Author: Martin Cermak diff --git a/tests/Regression/lto-preprocessor-options/Makefile b/tests/Regression/lto-preprocessor-options/Makefile deleted file mode 100644 index 777e9de..0000000 --- a/tests/Regression/lto-preprocessor-options/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/annobin/Regression/lto-preprocessor-options -# Description: lto-preprocessor-options -# Author: Martin Cermak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2020 Red Hat, Inc. -# -# 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, see http://www.gnu.org/licenses/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -export TEST=/tools/annobin/Regression/lto-preprocessor-options -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE - -.PHONY: all install download clean - -run: $(FILES) build - ./runtest.sh - -build: $(BUILT_FILES) - test -x runtest.sh || chmod a+x runtest.sh - -clean: - rm -f *~ $(BUILT_FILES) - - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @echo "Owner: Martin Cermak " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: lto-preprocessor-options" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 48h" >> $(METADATA) - @echo "RunFor: annobin" >> $(METADATA) - @echo "Requires: annobin annobin-annocheck redhat-rpm-config" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Bug: 1743635" >> $(METADATA) - @echo "Releases: -RHEL4 -RHEL6 -RHEL7 -RHELClient5 -RHELServer5" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Regression/lto-preprocessor-options/PURPOSE b/tests/Regression/lto-preprocessor-options/PURPOSE deleted file mode 100644 index c595c5e..0000000 --- a/tests/Regression/lto-preprocessor-options/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /tools/annobin/Regression/lto-preprocessor-options -Description: lto-preprocessor-options -Author: Martin Cermak diff --git a/tests/Regression/lto-preprocessor-options/main.fmf b/tests/Regression/lto-preprocessor-options/main.fmf index e76679d..03e6b88 100644 --- a/tests/Regression/lto-preprocessor-options/main.fmf +++ b/tests/Regression/lto-preprocessor-options/main.fmf @@ -7,6 +7,7 @@ component: test: ./runtest.sh framework: beakerlib recommend: +- gcc - annobin - annobin-annocheck - redhat-rpm-config diff --git a/tests/Regression/lto-preprocessor-options/runtest.sh b/tests/Regression/lto-preprocessor-options/runtest.sh index 315169d..7c54481 100755 --- a/tests/Regression/lto-preprocessor-options/runtest.sh +++ b/tests/Regression/lto-preprocessor-options/runtest.sh @@ -33,7 +33,10 @@ PACKAGE="annobin" rlJournalStart rlPhaseStartTest b=`mktemp` - rlRun "echo 'int main (void) { return 0; }' | gcc -xc -o $b `rpm --eval "%build_cflags %build_ldflags"` -flto - " + rlRun "rpm -q redhat-rpm-config" + rlRun "cflags=\"$(rpm --eval '%build_cflags')\"" + rlRun "ldflags=\"$(rpm --eval '%build_ldflags')\"" + rlRun "echo 'int main (void) { return 0; }' | gcc -xc -o $b $cflags $ldflags -flto - " rlRun "annocheck -v $b" rm $b rlPhaseEnd diff --git a/tests/Regression/testsuite/Makefile b/tests/Regression/testsuite/Makefile deleted file mode 100644 index 94a9500..0000000 --- a/tests/Regression/testsuite/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/annobin/Regression/testsuite -# Description: testsuite -# Author: Martin Cermak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2018 Red Hat, Inc. -# -# 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, see http://www.gnu.org/licenses/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -export TEST=/tools/annobin/Regression/testsuite -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE - -.PHONY: all install download clean - -run: $(FILES) build - ./runtest.sh - -build: $(BUILT_FILES) - test -x runtest.sh || chmod a+x runtest.sh - -clean: - rm -f *~ $(BUILT_FILES) - -requires = annobin binutils-devel gcc-c++ elfutils elfutils-devel make rpm-build \ -rpm-devel gcc-plugin-devel yum yum-utils bzip2-devel - -# https://mojo.redhat.com/docs/DOC-1072127 -dtsver = $(shell seq -s, 9 11) -dtsreq = $(shell echo {dev,gcc-}toolset-{$(dtsver)}-{build,elfutils{,-devel},gcc{,-c++,-plugin-devel},binutils{,-devel},annobin{,-annocheck}}) - - -installdeps: - yum -y install $(requires) - -showdeps: - echo $(requires) - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @echo "Owner: Martin Cermak " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: testsuite" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 48h" >> $(METADATA) - @echo "RunFor: annobin" >> $(METADATA) - $(foreach package, $(requires) $(dtsreq), \ - echo "Requires: $(package)" >> $(METADATA); \ - ) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Regression/testsuite/PURPOSE b/tests/Regression/testsuite/PURPOSE deleted file mode 100644 index d639443..0000000 --- a/tests/Regression/testsuite/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /tools/annobin/Regression/testsuite -Description: testsuite -Author: Martin Cermak diff --git a/tests/Regression/testsuite/main.fmf b/tests/Regression/testsuite/main.fmf index 78271da..7352f78 100644 --- a/tests/Regression/testsuite/main.fmf +++ b/tests/Regression/testsuite/main.fmf @@ -22,6 +22,7 @@ recommend: - dnf - yum-utils - bzip2-devel +- rpm-build duration: 48h extra-summary: /tools/annobin/Regression/testsuite extra-task: /tools/annobin/Regression/testsuite diff --git a/tests/Sanity/gcc-fedora-flags/hello.c b/tests/Sanity/gcc-fedora-flags/hello.c new file mode 100644 index 0000000..51b259b --- /dev/null +++ b/tests/Sanity/gcc-fedora-flags/hello.c @@ -0,0 +1,5 @@ +#include + +void hello() { + printf("Hello World\n"); +} diff --git a/tests/Sanity/gcc-fedora-flags/hello.cpp b/tests/Sanity/gcc-fedora-flags/hello.cpp new file mode 100644 index 0000000..400612b --- /dev/null +++ b/tests/Sanity/gcc-fedora-flags/hello.cpp @@ -0,0 +1,5 @@ +#include + +void hello() { + std::cout << "Hello World\n"; +} diff --git a/tests/Sanity/gcc-fedora-flags/main.c b/tests/Sanity/gcc-fedora-flags/main.c new file mode 100644 index 0000000..1a3455d --- /dev/null +++ b/tests/Sanity/gcc-fedora-flags/main.c @@ -0,0 +1,6 @@ +void hello(); + +int main(int argc, char **argv) { + hello(); + return 0; +} diff --git a/tests/Sanity/gcc-fedora-flags/main.cpp b/tests/Sanity/gcc-fedora-flags/main.cpp new file mode 100644 index 0000000..1a3455d --- /dev/null +++ b/tests/Sanity/gcc-fedora-flags/main.cpp @@ -0,0 +1,6 @@ +void hello(); + +int main(int argc, char **argv) { + hello(); + return 0; +} diff --git a/tests/Sanity/gcc-fedora-flags/main.fmf b/tests/Sanity/gcc-fedora-flags/main.fmf new file mode 100644 index 0000000..f053025 --- /dev/null +++ b/tests/Sanity/gcc-fedora-flags/main.fmf @@ -0,0 +1,17 @@ +summary: gcc-fedora-flags +description: '' +contact: +- Tom Stellard +component: +- annobin +test: ./runtest.sh +framework: beakerlib +recommend: +- gcc +- gcc-c++ +- annobin +- annobin-annocheck +- redhat-rpm-config +duration: 1h +extra-summary: /tools/annobin/Sanity/gcc-fedora-flags +extra-task: /tools/annobin/Sanity/gcc-fedora-flags diff --git a/tests/Sanity/gcc-fedora-flags/runtest.sh b/tests/Sanity/gcc-fedora-flags/runtest.sh new file mode 100755 index 0000000..13da313 --- /dev/null +++ b/tests/Sanity/gcc-fedora-flags/runtest.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +set -x + +default_cflags=`rpm -E %{build_cflags}` +default_cxxflags=`rpm -E %{build_cxxflags}` +default_ldflags=`rpm -E %{build_ldflags}` + +cflags=`rpm -D '%toolchain gcc' -E %{build_cflags}` +cxxflags=`rpm -D '%toolchain gcc' -E %{build_cxxflags}` +ldflags=`rpm -D '%toolchain gcc' -E %{build_ldflags}` + +set +x + +rlJournalStart +rlPhaseStartTest + rlRun "test \"$default_cflags\" = \"$cflags\"" + rlRun "test \"$default_cxxflags\" = \"$cxxflags\"" + rlRun "test \"$default_ldflags\" = \"$ldflags\"" + + rlRun "gcc $cflags -o hello.o -c hello.c" + rlRun "annocheck hello.o" + rlRun "gcc $cflags -o main.o -c main.c" + rlRun "gcc $ldflags -o hello main.o hello.o" + rlRun "annocheck hello" + rlRun "./hello | grep \"Hello World\"" + + rlRun "g++ $cxxflags -o hello-cpp.o -c hello.cpp" + rlRun "annocheck hello-cpp.o" + rlRun "g++ $cxxflags -o main-cpp.o -c main.cpp" + rlRun "g++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o" + rlRun "annocheck hello-cpp" + rlRun "./hello-cpp | grep \"Hello World\"" +rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Sanity/smoke/Makefile b/tests/Sanity/smoke/Makefile deleted file mode 100644 index 0ed8978..0000000 --- a/tests/Sanity/smoke/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/annobin/Sanity/smoke -# Description: smoke test for annobin plugin -# Author: Martin Cermak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2019 Red Hat, Inc. -# -# 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, see http://www.gnu.org/licenses/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -export TEST=/tools/annobin/Sanity/smoke -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE - -.PHONY: all install download clean - -run: $(FILES) build - ./runtest.sh - -build: $(BUILT_FILES) - test -x runtest.sh || chmod a+x runtest.sh - -clean: - rm -f *~ $(BUILT_FILES) - - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @echo "Owner: Martin Cermak " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: smoke test for annobin plugin" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 48h" >> $(METADATA) - @echo "License: GPL" >> $(METADATA) - @echo "RunFor: annobin" >> $(METADATA) - @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Sanity/smoke/PURPOSE b/tests/Sanity/smoke/PURPOSE deleted file mode 100644 index ad364a5..0000000 --- a/tests/Sanity/smoke/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /tools/annobin/Sanity/smoke -Description: smoke test for annobin plugin -Author: Martin Cermak diff --git a/tests/Sanity/smoke/main.fmf b/tests/Sanity/smoke/main.fmf index 5c30808..49d2862 100644 --- a/tests/Sanity/smoke/main.fmf +++ b/tests/Sanity/smoke/main.fmf @@ -8,6 +8,7 @@ test: ./runtest.sh framework: beakerlib recommend: - man-db +- gcc - annobin - annobin-annocheck duration: 48h diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index 0cb592f..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,17 +0,0 @@ -- hosts: localhost - roles: - - role: standard-test-basic - tags: - - classic - required_packages: - # gcc-fedora-flags - - rpm - - redhat-rpm-config - - gcc - - gcc-c++ - - annobin-annocheck - repositories: - - repo: https://src.fedoraproject.org/rpms/redhat-rpm-config.git - dest: redhat-rpm-config - tests: - - redhat-rpm-config/tests/gcc-fedora-flags