From ce2a2d575fdd9ac6432276d23e3aa054282e241f Mon Sep 17 00:00:00 2001 From: Jan Kurik Date: Wed, 27 Mar 2024 08:20:35 +0100 Subject: [PATCH] Redirection of tests from rpms to tests repo --- ci.fmf | 1 + plans/gating.fmf | 2 +- tests/README | 2 - tests/Sanity/licence-check/epel.repo | 30 ---------- tests/Sanity/licence-check/main.fmf | 17 ------ tests/Sanity/licence-check/test.sh | 62 --------------------- tests/Sanity/main.fmf | 3 - tests/Sanity/sanity-test/Makefile | 64 ---------------------- tests/Sanity/sanity-test/PURPOSE | 5 -- tests/Sanity/sanity-test/main.fmf | 13 ----- tests/Sanity/sanity-test/runtest.sh | 82 ---------------------------- 11 files changed, 2 insertions(+), 279 deletions(-) delete mode 100644 tests/README delete mode 100644 tests/Sanity/licence-check/epel.repo delete mode 100644 tests/Sanity/licence-check/main.fmf delete mode 100755 tests/Sanity/licence-check/test.sh delete mode 100644 tests/Sanity/main.fmf delete mode 100644 tests/Sanity/sanity-test/Makefile delete mode 100644 tests/Sanity/sanity-test/PURPOSE delete mode 100644 tests/Sanity/sanity-test/main.fmf delete mode 100755 tests/Sanity/sanity-test/runtest.sh diff --git a/ci.fmf b/ci.fmf index c5aa0e0..24f8837 100644 --- a/ci.fmf +++ b/ci.fmf @@ -1 +1,2 @@ +--- resultsdb-testcase: separate diff --git a/plans/gating.fmf b/plans/gating.fmf index d68074c..0b4f9ec 100644 --- a/plans/gating.fmf +++ b/plans/gating.fmf @@ -2,6 +2,6 @@ summary: CI Gating Plan discover: how: fmf filter: tag:gating - url: https://src.fedoraproject.org/rpms/chan + url: https://src.fedoraproject.org/tests/chan execute: how: tmt diff --git a/tests/README b/tests/README deleted file mode 100644 index 9ad59d4..0000000 --- a/tests/README +++ /dev/null @@ -1,2 +0,0 @@ -The test's Makefiles are not used in Fedora CI infrastructure. But are kept here -for backward compatibility with traditional beakerlib test harness in RHEL. diff --git a/tests/Sanity/licence-check/epel.repo b/tests/Sanity/licence-check/epel.repo deleted file mode 100644 index d52a962..0000000 --- a/tests/Sanity/licence-check/epel.repo +++ /dev/null @@ -1,30 +0,0 @@ -[epel] -name=Extra Packages for Enterprise Linux $releasever - $basearch -# It is much more secure to use the metalink, but if you wish to use a local mirror -# place its address here. -#baseurl=https://download.example/pub/epel/$releasever/Everything/$basearch/ -metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir -enabled = 0 -gpgcheck=1 -countme=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever - -[epel-debuginfo] -name=Extra Packages for Enterprise Linux $releasever - $basearch - Debug -# It is much more secure to use the metalink, but if you wish to use a local mirror -# place its address here. -#baseurl=https://download.example/pub/epel/$releasever/Everything/$basearch/debug/ -metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-$releasever&arch=$basearch&infra=$infra&content=$contentdir -enabled=0 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever -gpgcheck=1 - -[epel-source] -name=Extra Packages for Enterprise Linux $releasever - $basearch - Source -# It is much more secure to use the metalink, but if you wish to use a local mirror -# place its address here. -#baseurl=https://download.example/pub/epel/$releasever/Everything/source/tree/ -metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-$releasever&arch=$basearch&infra=$infra&content=$contentdir -enabled=0 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever -gpgcheck=1 diff --git a/tests/Sanity/licence-check/main.fmf b/tests/Sanity/licence-check/main.fmf deleted file mode 100644 index ef63d3f..0000000 --- a/tests/Sanity/licence-check/main.fmf +++ /dev/null @@ -1,17 +0,0 @@ -summary: Chek for used licenses in packages -test: ./test.sh -link: - - relates: https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_1 - - relates: https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_2 -recommend: -- chan -- rpm-build -- license-validate -duration: 15m -tag: - - gating -enabled: true -adjust: - - enabled: false - continue: false - when: distro < rhel-10 diff --git a/tests/Sanity/licence-check/test.sh b/tests/Sanity/licence-check/test.sh deleted file mode 100755 index 7c0452a..0000000 --- a/tests/Sanity/licence-check/test.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE=chan -TCWD="$(pwd)" - -rlJournalStart - rlPhaseStartSetup - rlRun "tmp=\$(mktemp -d /var/tmp/XXXXXXXXXXXXX)" 0 "Create tmp directory" - rlRun "pushd $tmp" - rlRun "set -o pipefail" - - # Ensure we have license tools available - EPELREPO= - if ! which license-fedora2spdx &>/dev/null; then - YUMPARAM= - if rlIsRHEL || rlIsCentOS; then - EPELREPO="/etc/yum.repos.d/$(basename ${tmp})" - rlRun "cp ${TCWD}/epel.repo ${EPELREPO}" - YUMPARAM="--enablerepo=epel" - else - rlDie "Can not find license-validate tool" - fi - rlRun "yum install -y ${YUMPARAM} license-validate" \ - || rlDie "Failed to install license-validate tool" - fi - - # Get list of rpms - rlFetchSrcForInstalled --quiet "${PACKAGE}" || \ - rlDie 'Can not get source package of ${PACKAGE} .... giving up...' - SOURCEPKG=$(rpm -q --qf '%{name}-%{version}-%{release}.src.rpm' ${PACKAGE}) - rlAssertExists "${tmp}/${SOURCEPKG}" - rlRun "rpm -D '_topdir ${tmp}' -i ${tmp}/${SOURCEPKG}" - rlRun "LICENSES=\"\$(rpm -q --qf '%{license}\n' --specfile ${tmp}/SPECS/${PACKAGE}.spec\ - | sed -e 's/ and /\\n/g' -e 's/^ *//' -e 's/ *$//')\"" - rlRun "TUPLE=\"\$(rpm -q --qf '%{name} %{license}\n' \ - --specfile ${tmp}/SPECS/${PACKAGE}.spec )\"" - rlPhaseEnd - -while read l; do - rlPhaseStart FAIL "License check of ${l}" - retcode= - rlRun -s "license-validate '${l}'" || retcode=Fail - # Report affected packages - if [[ -n "${retcode}" ]]; then - rlLogInfo "The following packages needs to fix the ${l} license:" - #for p in $(awk "\$0~/${l}/{print \$1;}" <<< "${TUPLE}"); do - for p in $(grep "${l}" <<< "${TUPLE}" | cut -d ' ' -f 1); do - rlLogInfo " - ${p}" - done - fi - rlPhaseEnd -done < <(sort -u <<< "${LICENSES}") - - rlPhaseStartCleanup - rlRun "popd" - rlRun "rm -r $tmp" 0 "Remove tmp directory" - rlRun "yum clean metadata" - [[ -n "${EPELREPO}" ]] && rlRun "rm -f ${EPELREPO}" - rlPhaseEnd -rlJournalEnd diff --git a/tests/Sanity/main.fmf b/tests/Sanity/main.fmf deleted file mode 100644 index 5d70b7d..0000000 --- a/tests/Sanity/main.fmf +++ /dev/null @@ -1,3 +0,0 @@ -contact: Jan Kuřík -component: chan -framework: beakerlib diff --git a/tests/Sanity/sanity-test/Makefile b/tests/Sanity/sanity-test/Makefile deleted file mode 100644 index 50da3a7..0000000 --- a/tests/Sanity/sanity-test/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/chan/Sanity/sanity-test -# Description: Sanity upstream test of chan package -# Author: Jan Kuřík -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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/chan/Sanity/sanity-test -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: Jan Kuřík " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Sanity upstream test of chan package" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: chan" >> $(METADATA) - @echo "Requires: autoconf automake chan gcc libtool rpm-build" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Bug: 1748642" >> $(METADATA) - @echo "Releases: -RHEL4 -RHEL6 -RHEL7 -RHELClient5 -RHELServer5" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Sanity/sanity-test/PURPOSE b/tests/Sanity/sanity-test/PURPOSE deleted file mode 100644 index f39e5f4..0000000 --- a/tests/Sanity/sanity-test/PURPOSE +++ /dev/null @@ -1,5 +0,0 @@ -PURPOSE of /tools/chan/Sanity/sanity-test -Description: Sanity upstream test of chan package -Author: Jan Kuřík -Bug summary: New rpm dependency (chan) needed for statsd PMDA -Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1748642 diff --git a/tests/Sanity/sanity-test/main.fmf b/tests/Sanity/sanity-test/main.fmf deleted file mode 100644 index 6ed76fa..0000000 --- a/tests/Sanity/sanity-test/main.fmf +++ /dev/null @@ -1,13 +0,0 @@ -summary: Sanity upstream test of chan package -test: ./runtest.sh -recommend: -- autoconf -- automake -- chan -- gcc -- libtool -- rpm-build -enabled: true -duration: 15m -extra-summary: /tools/chan/Sanity/sanity-test -extra-task: /tools/chan/Sanity/sanity-test diff --git a/tests/Sanity/sanity-test/runtest.sh b/tests/Sanity/sanity-test/runtest.sh deleted file mode 100755 index 867b190..0000000 --- a/tests/Sanity/sanity-test/runtest.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /tools/chan/Sanity/sanity-test -# Description: Sanity upstream test of chan package -# Author: Jan Kuřík -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# Include Beaker environment -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="chan" -BUILD_USER=${BUILD_USER:-chanbld} - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - rlPhaseEnd - - rlPhaseStartTest "Get source code and setup build environment" - rlFetchSrcForInstalled "${PACKAGE}" \ - || rlDie "Can not download SRPM of ${PACKAGE} - giving up" - rlRun "yum-builddep -y \ - $(rpm -q --qf '%{name}-%{version}-%{release}.src.rpm' ${PACKAGE}.$(arch))" \ - || rlDie "Can not install build dependencies - giving up" - rlRun "useradd -m -N $BUILD_USER" 0,9 && del="yes" - rlPhaseEnd - - rlPhaseStartTest "Build ${PACKAGE}" - rlRun "rpm -D \"_topdir ${TmpDir}\" -U \ - $(rpm -q --qf '%{name}-%{version}-%{release}.src.rpm' ${PACKAGE}.$(arch))" - rlRun "chown -R ${BUILD_USER}:users ${TmpDir}" - rlRun -s "su -c \ - 'rpmbuild -D \"_topdir ${TmpDir}\" -bc ${TmpDir}/SPECS/${PACKAGE}.spec' \ - ${BUILD_USER}" - rlFileSubmit "${rlRun_LOG}" "rpmbuild-${PACKAGE}.log" - rlPhaseEnd - - rlPhaseStartTest "Run upstream testsuite" - BDIR=$(rpm -q --qf '%{name}-%{version}' ${PACKAGE}.$(arch)) - if rlRun "pushd ${TmpDir}/BUILD/${BDIR}"; then - rlRun "rm -f .libs/libchan.so*" - rlRun "ln -s /usr/lib64/libchan.so.0 .libs/libchan.so" - rlRun "ln -s /usr/lib64/libchan.so.0 .libs/libchan.so.0" - export RPM_ARCH="$(arch)" - export RPM_PACKAGE_RELEASE="$(rpm -q --qf '%{release}' ${PACKAGE}.$(arch))" - export RPM_PACKAGE_VERSION="$(rpm -q --qf '%{version}' ${PACKAGE}.$(arch))" - export RPM_PACKAGE_NAME="$(rpm -q --qf '%{name}' ${PACKAGE}.$(arch))" - rlRun "make src/chan_test" - rlRun -s "src/chan_test" - rlAssertGrep '[0-9]+ passed' "${rlRun_LOG}" -E - rlRun "popd" - fi - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd