From 7df44b0c3bc654a10a166bd3f465cc0aad0aa427 Mon Sep 17 00:00:00 2001 From: Jan Kurik Date: Thu, 15 Dec 2022 15:42:06 +0100 Subject: [PATCH] Cleanup of gating tests Removed all the obsolete Makefile's rlFileSubmit commands now run only on RHEL Cleanup of fixed paths in tests replaced with paths relative to pcp.env setting Removed usage of deprecated egrep/fgrep --- tests/Library/pcpcommon/Makefile | 65 -------- .../pcpcommon}/bl/s390x | 0 tests/Library/pcpcommon/lib.sh | 157 ++++++++++++++---- tests/Library/pcpcommon/main.fmf | 16 -- tests/Library/pcpcommon/runtest.sh | 55 ------ .../Sanity/SASL-authentication-check/Makefile | 64 ------- .../SASL-authentication-check/runtest.sh | 8 +- tests/Sanity/pcp-python-compliance/Makefile | 63 ------- tests/Sanity/pcp-services/Makefile | 64 ------- tests/Sanity/pcp-services/main.fmf | 3 +- tests/Sanity/pcp-services/runtest.sh | 24 ++- tests/Sanity/pcp-testsuite-sanity/Makefile | 72 -------- tests/Sanity/pcp-testsuite-sanity/main.fmf | 2 - tests/Sanity/pcp-testsuite-sanity/runtest.sh | 47 +----- tests/Sanity/rpm-config-files/Makefile | 68 -------- tests/Sanity/rpm-config-files/runtest.sh | 3 +- .../Makefile | 65 -------- tests/Sanity/verify-systemd-units/Makefile | 63 ------- tests/Sanity/writeable-suid-guid/Makefile | 65 -------- tests/Sanity/writeable-suid-guid/main.fmf | 2 +- tests/Sanity/writeable-suid-guid/runtest.sh | 7 + 21 files changed, 167 insertions(+), 746 deletions(-) delete mode 100644 tests/Library/pcpcommon/Makefile rename tests/{Sanity/pcp-testsuite-sanity => Library/pcpcommon}/bl/s390x (100%) delete mode 100644 tests/Library/pcpcommon/main.fmf delete mode 100755 tests/Library/pcpcommon/runtest.sh delete mode 100644 tests/Sanity/SASL-authentication-check/Makefile delete mode 100644 tests/Sanity/pcp-python-compliance/Makefile delete mode 100644 tests/Sanity/pcp-services/Makefile delete mode 100644 tests/Sanity/pcp-testsuite-sanity/Makefile delete mode 100644 tests/Sanity/rpm-config-files/Makefile delete mode 100644 tests/Sanity/shared-libraries-need-symbol-versioning/Makefile delete mode 100644 tests/Sanity/verify-systemd-units/Makefile delete mode 100644 tests/Sanity/writeable-suid-guid/Makefile diff --git a/tests/Library/pcpcommon/Makefile b/tests/Library/pcpcommon/Makefile deleted file mode 100644 index cb2c8a2..0000000 --- a/tests/Library/pcpcommon/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/pcp/Library/pcpcommon -# Description: Common functions for PCP tests -# Author: Milos Prchlik -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 Red Hat, Inc. All rights reserved. -# -# This copyrighted material is made available to anyone wishing -# to use, modify, copy, or redistribute it subject to the terms -# and conditions of the GNU General Public License version 2. -# -# 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. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -export TEST=/CoreOS/pcp/Library/pcpcommon -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) lib.sh Makefile runtest.sh - -.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: Common functions for PCP tests" >> $(METADATA) - @echo "Provides: library(pcp/pcpcommon)" >> $(METADATA) - @echo "Type: Library" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: pcp" >> $(METADATA) - @echo "Requires: pcp pcp-testsuite" >> $(METADATA) - @echo "Releases: -RedHatEnterpriseLinux3 -RedHatEnterpriseLinux4 -RedHatEnterpriseLinuxClient5 -RedHatEnterpriseLinuxServer5" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Sanity/pcp-testsuite-sanity/bl/s390x b/tests/Library/pcpcommon/bl/s390x similarity index 100% rename from tests/Sanity/pcp-testsuite-sanity/bl/s390x rename to tests/Library/pcpcommon/bl/s390x diff --git a/tests/Library/pcpcommon/lib.sh b/tests/Library/pcpcommon/lib.sh index 14ce5cc..b9187ea 100755 --- a/tests/Library/pcpcommon/lib.sh +++ b/tests/Library/pcpcommon/lib.sh @@ -1,12 +1,11 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# lib.sh of /CoreOS/pcp/Library/pcpcommon # Description: Common functions for PCP tests -# Author: Milos Prchlik +# Author: Jan Kuřík # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# Copyright (c) 2013-2022 Red Hat, Inc. All rights reserved. # # This copyrighted material is made available to anyone wishing # to use, modify, copy, or redistribute it subject to the terms @@ -28,7 +27,7 @@ . /usr/share/beakerlib/beakerlib.sh -PACKAGES="pcp" +PACKAGE="pcp" pcpcommon_TESTDIR="$(pwd)" @@ -40,12 +39,13 @@ done pcpcommon_PCP_VAR_DIR=${pcpcommon_PCP_VAR_DIR:-/var/lib/pcp} pcpcommon_PCP_PMDAS_DIR=${pcpcommon_PCP_PMDAS_DIR:-${pcpcommon_PCP_VAR_DIR}/pmdas} -pcpcommon_PCP_PMCDCONF_PATH=${pcpcommon_PCP_PMCDCONF_PATH:-/etc/pcp/pmcd/pmcd.conf} +pcpcommon_PCP_ETC_DIR=${pcpcommon_PCP_ETC_DIR:-/etc} +pcpcommon_PCP_PMCDCONF_PATH=${pcpcommon_PCP_PMCDCONF_PATH:-/${pcpcommon_PCP_ETC_DIR}/pcp/pmcd/pmcd.conf} pcpcommon_PCP_LOG_DIR=${pcpcommon_PCP_LOG_DIR:-/var/log/pcp} pcpcommon_TESTSUITE_DIR=${pcpcommon_TESTSUITE_DIR:-${pcpcommon_PCP_VAR_DIR}/testsuite} pcpcommon_TESTSUITE_USER="${pcpcommon_TESTSUITE_USER:-pcpqa}" -pcpcommon_TESTSUITE_USER_HOME=$(getent passwd ${pcpcommon_TESTSUITE_USER} \ - | awk -F : '{print $6}') +IFS=: read __x __x __x __x __x pcpcommon_TESTSUITE_USER_HOME __x \ + < <(getent passwd ${pcpcommon_TESTSUITE_USER}) pcpcommon_TESTSUITE_USER_HOME="${pcpcommon_TESTSUITE_USER_HOME:-/home/${pcpcommon_TESTSUITE_USER}}" pcpcommon_REAL_TESTSUITE_USER="${pcpcommon_TESTSUITE_USER}" @@ -63,8 +63,9 @@ function map_metric() { } function _pcpcommon_pmda_bpftrace_setup() { - rlFileBackup --namespace pcpcommon_pcpqa "${pcpcommon_PCP_PMDAS_DIR}/bpftrace" - if rlIsRHEL '>8.2'; then + rlFileBackup --clean --missing-ok --namespace pcpcommon_pcpqa \ + "${pcpcommon_PCP_PMDAS_DIR}/bpftrace" + if rlIsRHEL '>8.2' || rlIsFedora || rlIsCentOS; then rlRun "sed -i \ -e 's/^enabled =.*\$/enabled = true/g' \ -e 's/^auth_enabled =.*\$/auth_enabled = false/g' \ @@ -76,6 +77,98 @@ function _pcpcommon_pmda_bpftrace_setup() { fi } +function _pcpcommon_apply_bl() { + local bl="${1}" + local tc + + if [[ ! -r "${bl}" ]] ; then + rlLogDebug "No BL ${bl} found" + return 1 + fi + rlLog "Applying BL $(basename ${bl})" + while read tc; do + rlRun "sed -i '/^${tc} /d' ${pcpcommon_TESTSUITE_DIR}/group" + done < "${bl}" + + return 0 +} + +_pcpcommon_bl_applied= +function pcpcommon_testsuite_bl() { + local blfile="${1}" + local arch="$(arch)" + local id + local version_id + local major + local minor + local micro + local bl + local _blseq + local blseq + local libdir + + if [[ -n "${blfile}" ]]; then + if [[ -d "${blfile}" ]]; then + # The BL is a directory with BL files + libdir="${blfile}" + elif [[ -r "${blfile}" ]]; then + # The BL is a file with already listed TC numbers to be removed + libdir= + else + # Unknown BL + rlLogWarn "Unknown ${blfile} when applying BL" + return 1 + fi + else + libdir="$(readlink -f $(dirname ${BASH_SOURCE}))" + fi + + rlRun "rlFileBackup --namespace bl '${pcpcommon_TESTSUITE_DIR}/group'" + _pcpcommon_bl_applied="Yes" + + if [[ -n "${libdir}" ]]; then + # Get all the variables we need + read id version_id < <( \ + . /etc/os-release && \ + echo ${ID} ${VERSION_ID} || \ + echo rhel 6.10 \ + ) + IFS='.,-_ ' read major minor micro <<< "${version_id}" + + _blseq="${id} ${id}-${major}" + [[ -n "${minor}" ]] && _blseq="${_blseq} ${id}-${major}.${minor}" + [[ -n "${micro}" ]] && _blseq="${_blseq} ${id}-${major}.${minor}.${micro}" + + IFS='.,-_ ' read major minor micro < <(rpm -q --qf '%{version}' ${PACKAGE}) + _blseq="${_blseq} ${PACKAGE}" + [[ -n "${major}" ]] && _blseq="${_blseq} ${PACKAGE}-${major}" + [[ -n "${minor}" ]] && _blseq="${_blseq} ${PACKAGE}-${major}.${minor}" + [[ -n "${micro}" ]] && _blseq="${_blseq} ${PACKAGE}-${major}.${minor}.${micro}" + + for bl in ${_blseq}; do + blseq="${blseq} ${bl} ${bl}.${arch}" + done + + for bl in ${arch} ${blseq}; do + rlLogInfo "Looking for BL list ${bl}" + rlLogInfo " ... ${libdir}/bl/${bl}" + if [[ -r "${libdir}/bl/${bl}" ]]; then + apply_bl "${libdir}/bl/${bl}" + fi + done + else + rlLogInfo "Applying BL list ${blfile}" + apply_bl "${blfile}" || return 1 + fi + + return 0 +} + +pcpcommon_testsuite_bl_restore() { + [[ -n "${_pcpcommon_bl_applied}" ]] && rlFileRestore --namespace bl + _pcpcommon_bl_applied= +} + pcpcommon_PCPQA_CREATED= pcpcommon_PCPQA_SETUP= function pcpcommon_testsuite_user() { @@ -83,8 +176,8 @@ function pcpcommon_testsuite_user() { [[ -n "${pcpcommon_PCPQA_SETUP}" ]] && return 0 pcpcommon_PCPQA_SETUP="done" - rlFileBackup --clean --namespace pcpcommon_pcpqa --missing-ok \ - "${pcpcommon_TESTSUITE_USER_HOME}" + #rlFileBackup --clean --namespace pcpcommon_pcpqa --missing-ok \ + # "${pcpcommon_TESTSUITE_USER_HOME}" if ! rlRun "id ${pcpcommon_TESTSUITE_USER}" 0,1; then rlRun "useradd -d ${pcpcommon_TESTSUITE_USER_HOME} -m \ -s /bin/bash -U ${pcpcommon_TESTSUITE_USER}" @@ -200,9 +293,10 @@ function pcpcommon_log_system_info() { which nft &> /dev/null && \ nft list ruleset &> ${pcpcommon_TMP}/nftables - # Upload everything - tar czf ${pcpcommon_TAR} -C ${pcpcommon_TMP} $(cd ${pcpcommon_TMP} && ls -1) - rlFileSubmit "${pcpcommon_TAR}" "system.info.tar.gz" + if rlIsRHEL; then # Upload everything + tar czf ${pcpcommon_TAR} -C ${pcpcommon_TMP} $(cd ${pcpcommon_TMP} && ls -1) + rlFileSubmit "${pcpcommon_TAR}" "system.info.tar.gz" + fi # Cleanup rm -rf ${pcpcommon_TMP} ${pcpcommon_TAR} @@ -219,30 +313,36 @@ function pcpcommon_test () { if rlRun "pushd ${pcpcommon_TESTSUITE_DIR}"; then rlRun -s "su -l -s /bin/bash -c 'cd ${pcpcommon_TESTSUITE_DIR} && \ ./check ${params}' ${pcpcommon_REAL_TESTSUITE_USER}" - rlFileSubmit "${rlRun_LOG}" "check.log" + rlIsRHEL && rlFileSubmit "${rlRun_LOG}" "check.log" local _test_results="${rlRun_LOG}" - if ! rlRun "egrep 'Passed all [[:digit:]]+ tests' ${_test_results}" 0 \ + if ! rlRun "grep -E 'Passed (all)* *[[:digit:]]+ tests' ${_test_results}" 0 \ "Assert all testcases passed"; then local _tmp_dir=$(mktemp -d) local _tmp_tar=$(mktemp /tmp/XXXXXXXX.tar.gz) local failid - local failids="$(egrep 'Failures: ' ${_test_results} | cut -d' ' -f2-)" + local failids="$(grep -E 'Failures: ' ${_test_results} | cut -d' ' -f2-)" if [[ -n "${failids}" ]]; then - for failid in ${failids}; do - rlFail "TC $failid failed" - rlRun "cp ${failid}.out ${_tmp_dir}/" - rlRun "cp ${failid}.out.bad ${_tmp_dir}/" - done - tar czf ${_tmp_tar} -C ${_tmp_dir} $(cd ${_tmp_dir} && ls -1) - rlFileSubmit "${_tmp_tar}" "failed.tests.tar.gz" + if rlIsRHEL; then + for failid in ${failids}; do + rlFail "TC $failid failed" + rlRun "cp ${failid}.out ${_tmp_dir}/" + rlRun "cp ${failid}.out.bad ${_tmp_dir}/" + done + tar czf ${_tmp_tar} -C ${_tmp_dir} $(cd ${_tmp_dir} && ls -1) + rlFileSubmit "${_tmp_tar}" "failed.tests.tar.gz" + else + for failid in ${failids}; do + rlFail "TC $failid failed" + done + fi fi rm -rf ${_tmp_tar} ${_tmp_dir} ret=1 fi - if rlRun -s "egrep 'Not run: [[:digit:]]+' ${_test_results}" 0,1; then + if rlRun -s "grep -E 'Not run: [[:digit:]]+' ${_test_results}" 0,1; then rlLogWarning "$(cat ${rlRun_LOG})" fi @@ -255,6 +355,7 @@ function pcpcommon_test () { function pcpcommon_cleanup () { # Cleanup everything related to pcpqa pcpcommon_testsuite_user_cleanup + pcpcommon_testsuite_bl_restore rlFileRestore --namespace pcpcommon_init return $? @@ -301,7 +402,7 @@ function pcpcommon_pmda_install () { "${metrics}" || ret=1 rlAssertNotGrep "Try again. Information not currently available" \ "${metrics}" || ret=1 - rlFileSubmit "${metrics}" "pmda.${pmda}.metrics.log" + rlIsRHEL && rlFileSubmit "${metrics}" "pmda.${pmda}.metrics.log" fi rlRun "popd" else @@ -346,7 +447,7 @@ function pcpcommon_pmda_check_log () { fi rlAssertNotGrep "${errstr}" ${logf} -Ei || result=1 - rlFileSubmit "${logf}" + rlIsRHEL && rlFileSubmit "${logf}" return ${result} } @@ -356,7 +457,7 @@ function pcpcommon_pmda_tests () { local addparam="$2" local testgroup="pmda.${pmda}" - if rlRun "grep -q ${testgroup} ${pcpcommon_PCP_VAR_DIR}/testsuite/group" 0,1; then + if rlRun "grep -q ${testgroup} ${pcpcommon_TESTSUITE_DIR}/group" 0,1; then pcpcommon_test "000 -g ${testgroup} ${addparam}" pcpcommon_pmda_check_log ${pmda} else diff --git a/tests/Library/pcpcommon/main.fmf b/tests/Library/pcpcommon/main.fmf deleted file mode 100644 index b474b79..0000000 --- a/tests/Library/pcpcommon/main.fmf +++ /dev/null @@ -1,16 +0,0 @@ -summary: Common functions for PCP tests -contact: -- Jan Kuřík -component: -- pcp -test: ./runtest.sh -framework: beakerlib -recommend: -- pcp -- pcp-testsuite -duration: 15m -adjust: - - enabled: false - continue: false -extra-summary: /CoreOS/pcp/Library/pcpcommon -extra-task: /CoreOS/pcp/Library/pcpcommon diff --git a/tests/Library/pcpcommon/runtest.sh b/tests/Library/pcpcommon/runtest.sh deleted file mode 100755 index 8dd1d40..0000000 --- a/tests/Library/pcpcommon/runtest.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/pcp/Library/pcpcommon -# Description: Common functions for PCP tests -# 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 -. ../../Library/pcpcommon/lib.sh || exit 1 - -PACKAGE="pcp" - -rlJournalStart - rlPhaseStartTest - rlRun "pcpcommonLibraryLoaded" - - rlServiceStart pmcd - rlServiceStart pmlogger - rlServiceStart pmproxy - rlServiceStart pmie - - err=0 - pmda=bash - rlRun "pcpcommon_test -g sanity" || err=1 - rlRun "pcpcommon_pmda_install ${pmda}" || err=1 - rlRun "pcpcommon_pmda_tests ${pmda}" || err=1 - rlRun "pcpcommon_pmda_remove ${pmda}" || err=1 - rlRun "pcpcommon_cleanup" - - [[ ${err} -ne 0 ]] && \ - rlRun "pcpcommon_log_system_info" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/Sanity/SASL-authentication-check/Makefile b/tests/Sanity/SASL-authentication-check/Makefile deleted file mode 100644 index ee4b210..0000000 --- a/tests/Sanity/SASL-authentication-check/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/pcp/Sanity/SASL-authentication-check -# Description: A basic test of SASL authentication -# 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/pcp/Sanity/SASL-authentication-check -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: A basic test of SASL authentication" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: pcp" >> $(METADATA) - @echo "Requires: pcp cyrus-sasl-md5 cyrus-sasl-scram" >> $(METADATA) - @echo "Requires: cyrus-sasl-lib" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Releases: -RHEL4 -RHEL6 -RHELClient5 -RHELServer5 -RHEL7" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Sanity/SASL-authentication-check/runtest.sh b/tests/Sanity/SASL-authentication-check/runtest.sh index 65c4866..08567db 100755 --- a/tests/Sanity/SASL-authentication-check/runtest.sh +++ b/tests/Sanity/SASL-authentication-check/runtest.sh @@ -62,11 +62,13 @@ for HASH in ${HASHES}; do rlServiceStart "pmcd" rlRun "sleep 3" 0 "Give pmcd some time to start" - rlRun -s "pminfo -f -h 'pcp://127.0.0.1?username=${METRICUSER}&password=${METRICUSERPW}' disk.dev.read" - rlFileSubmit "${rlRun_LOG}" "pminfo.output" + rlRun -s "pminfo -f -h \ + 'pcp://127.0.0.1?username=${METRICUSER}&password=${METRICUSERPW}' \ + disk.dev.read" + rlIsRHEL && rlFileSubmit "${rlRun_LOG}" "pminfo.output" rlAssertNotGrep "user not found" "${rlRun_LOG}" rlAssertGrep ".*inst .*value .*" "${rlRun_LOG}" -E - rlFileSubmit "/var/log/pcp/pmcd/pmcd.log" + rlIsRHEL && rlFileSubmit "/var/log/pcp/pmcd/pmcd.log" rlPhaseEnd done diff --git a/tests/Sanity/pcp-python-compliance/Makefile b/tests/Sanity/pcp-python-compliance/Makefile deleted file mode 100644 index 17cc220..0000000 --- a/tests/Sanity/pcp-python-compliance/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/pcp/Sanity/pcp-python-compliance -# Description: Check for a compliance with Fedora Packaging Guidelines -# 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/pcp/Sanity/pcp-python-compliance -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: Check for a compliance with Fedora Packaging Guidelines" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: pcp" >> $(METADATA) - @echo "Requires: python3-pcp python-pcp" >> $(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/Sanity/pcp-services/Makefile b/tests/Sanity/pcp-services/Makefile deleted file mode 100644 index 6ee7a1f..0000000 --- a/tests/Sanity/pcp-services/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/pcp/Sanity/pcp-services -# Description: Test of pcp services -# Author: Jan Kuřík -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2021 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/pcp/Sanity/pcp-services -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: Test for BZ#1944150 (Job for pmlogger.service failed because the)" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: pcp" >> $(METADATA) - @echo "Requires: pcp pcp-zeroconf" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Bug: 1998491 1929556 1944150" >> $(METADATA) - @echo "Releases: -RHEL4 -RHEL6 -RHELClient5 -RHELServer5" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Sanity/pcp-services/main.fmf b/tests/Sanity/pcp-services/main.fmf index b18dd91..1fe246c 100644 --- a/tests/Sanity/pcp-services/main.fmf +++ b/tests/Sanity/pcp-services/main.fmf @@ -1,4 +1,4 @@ -summary: Test for BZ#1944150 (Job for pmlogger.service failed because the) +summary: Test if PCP services are starting/stopping gracefully description: | Bug summary: Job for pmlogger.service failed because the service did not take the steps required by its unit configuration. Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1944150 @@ -10,6 +10,7 @@ framework: beakerlib recommend: - pcp - pcp-zeroconf +- redis duration: 15m extra-summary: /tools/pcp/Sanity/pcp-services extra-task: /tools/pcp/Sanity/pcp-services diff --git a/tests/Sanity/pcp-services/runtest.sh b/tests/Sanity/pcp-services/runtest.sh index 781a400..fccee38 100755 --- a/tests/Sanity/pcp-services/runtest.sh +++ b/tests/Sanity/pcp-services/runtest.sh @@ -29,7 +29,7 @@ . /usr/share/beakerlib/beakerlib.sh || exit 1 PACKAGE="pcp" -PCPSERVICES="pmlogger pmie pmproxy pmcd" +PCPSERVICES="pmcd pmlogger pmproxy pmie" TOUT="90" # Timeout to wait for a service to start / stop function service_action() { @@ -59,20 +59,31 @@ function service_action() { rlJournalStart rlPhaseStartSetup rlAssertRpm $PACKAGE + rlServiceStart redis rlRun "systemctl --no-pager stop ${PCPSERVICES}" 0-255 + + # First stop all the services in reverse order + for s in $(echo ${PCPSERVICES} | tr ' ' '\n' | tac | tr '\n' ' '); do + # All services should be stopped + service_action ${s} inactive + rlRun "killall --signal SIGTERM ${s}" 0-255 + done + for s in $(echo ${PCPSERVICES} | tr ' ' '\n' | tac | tr '\n' ' '); do + rlRun "killall --signal SIGKILL ${s}" 0-255 + done + rlPhaseEnd rlPhaseStartTest - for s in ${PCPSERVICES}; do - # All services should be stopped - service_action ${s} inactive - done - + # Start all the services for s in ${PCPSERVICES}; do # Start a service and check it runs rlRun "systemctl start --no-pager ${s}" service_action ${s} active + done + # Stop all the services in reverse order + for s in $(echo ${PCPSERVICES} | tr ' ' '\n' | tac | tr '\n' ' '); do # Stop a service and check it is stopped rlRun "systemctl stop --no-pager ${s}" service_action ${s} inactive @@ -80,6 +91,7 @@ rlJournalStart rlPhaseEnd rlPhaseStartCleanup + rlServiceRestore rlPhaseEnd rlJournalPrintText rlJournalEnd diff --git a/tests/Sanity/pcp-testsuite-sanity/Makefile b/tests/Sanity/pcp-testsuite-sanity/Makefile deleted file mode 100644 index d1a9f85..0000000 --- a/tests/Sanity/pcp-testsuite-sanity/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/pcp/Sanity/pcp-testsuite-sanity -# Description: pcp testing by upstream testsuite -# Author: Jan Kuřík -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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/pcp/Sanity/pcp-testsuite-sanity -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE bl - -.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: pcp testing by upstream testsuite" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 4h" >> $(METADATA) - @echo "RunFor: pcp" >> $(METADATA) - @echo "Requires: pcp time" >> $(METADATA) - @echo "Requires: sudo procps-ng avahi bzip2 pcp-pmda-cisco" >> $(METADATA) - @echo "Requires: coreutils pcp-pmda-news perl-PCP-LogImport" >> $(METADATA) - @echo "Requires: perl-PCP-LogSummary python-pcp gcc" >> $(METADATA) - @echo "Requires: redhat-rpm-config perl-PCP-LogSummary" >> $(METADATA) - @echo "Requires: libuv libuv-devel" >> $(METADATA) - @echo "Requires: /usr/bin/netstat pcp-testsuite" >> $(METADATA) - #@echo "Requires: library(pcp/pcpcommon)" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) - @echo "Bug: 1760750" >> $(METADATA) - #@echo "RhtsRequires: library(pcp/pcpcommon)" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Sanity/pcp-testsuite-sanity/main.fmf b/tests/Sanity/pcp-testsuite-sanity/main.fmf index 6adf5ed..62618b6 100644 --- a/tests/Sanity/pcp-testsuite-sanity/main.fmf +++ b/tests/Sanity/pcp-testsuite-sanity/main.fmf @@ -27,5 +27,3 @@ recommend: - /usr/bin/netstat - pcp-testsuite duration: 4h -extra-summary: /tools/pcp/Sanity/pcp-testsuite-sanity -extra-task: /tools/pcp/Sanity/pcp-testsuite-sanity diff --git a/tests/Sanity/pcp-testsuite-sanity/runtest.sh b/tests/Sanity/pcp-testsuite-sanity/runtest.sh index 0a07f08..4ee914a 100755 --- a/tests/Sanity/pcp-testsuite-sanity/runtest.sh +++ b/tests/Sanity/pcp-testsuite-sanity/runtest.sh @@ -8,7 +8,7 @@ # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Copyright (c) 2018 Red Hat, Inc. +# Copyright (c) 2018-2022 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 @@ -45,7 +45,7 @@ function apply_bl() { fi rlLog "Applying BL $(basename ${bl})" while read tc; do - rlRun "sed -i '/^${tc} /d' /var/lib/pcp/testsuite/group" + rlRun "sed -i '/^${tc} /d' ${pcpcommon_TESTSUITE_DIR}/group" done < "${bl}" return @@ -55,52 +55,13 @@ rlJournalStart rlPhaseStartSetup rlShowRunningKernel rlAssertRpm "${PACKAGE}" - rlFileBackup --clean --missing-ok /etc/pcp /etc/pcp.conf /etc/pcp.env \ - /etc/sysconfig/pmcd /etc/sysconfig/pmie_timers /etc/sysconfig/pmlogger \ - /etc/sysconfig/pmlogger_timers /etc/sysconfig/pmproxy /var/lib/pcp/config - rlRun "TmpDir=\$(mktemp -d)" rlRun "pcpcommonLibraryLoaded" - rlPhaseEnd - - rlPhaseStartSetup "PCP restart" + rlRun "pcpcommon_testsuite_bl" rlRun "rlServiceStart pmcd pmlogger" 0-255 rlRun "rlServiceEnable pmcd pmlogger" 0-255 rlRun "sleep 30" 0 "Give services some time to fully start" rlPhaseEnd - rlPhaseStartSetup "BL listing" - # Get all the variables we need - read ID VERSION_ID < <( - . /etc/os-release && \ - echo ${ID} ${VERSION_ID} || \ - echo rhel 6.10 - ) - IFS='.,-_ ' read MAJOR MINOR MICRO <<< "${VERSION_ID}" - ARCH=$(arch) - - _BLSEQ="${ID} ${ID}-${MAJOR}" - [[ -n "${MINOR}" ]] && _BLSEQ="${BLSEQ} ${ID}-${MAJOR}.${MINOR}" - [[ -n "${MICRO}" ]] && _BLSEQ="${BLSEQ} ${ID}-${MAJOR}.${MINOR}.${MICRO}" - - IFS='.,-_ ' read MAJOR MINOR MICRO < <(rpm -q --qf '%{version}' ${PACKAGE}) - _BLSEQ="${BLSEQ} ${PACKAGE}" - [[ -n "${MAJOR}" ]] && _BLSEQ="${BLSEQ} ${PACKAGE}-${MAJOR}" - [[ -n "${MINOR}" ]] && _BLSEQ="${BLSEQ} ${PACKAGE}-${MAJOR}.${MINOR}" - [[ -n "${MICRO}" ]] && _BLSEQ="${BLSEQ} ${PACKAGE}-${MAJOR}.${MINOR}.${MICRO}" - - BLSEQ= - for bl in ${_BLSEQ}; do - BLSEQ="${BLSEQ} ${bl} ${bl}.${ARCH}" - done - - for bl in ${BLSEQ}; do - rlLog "Looking for BL list ${bl}" - if [[ -r "${TCWD}/bl/${bl}" ]]; then - apply_bl "${TCWD}/bl/${bl}" - fi - done - rlPhaseEnd - rlPhaseStartTest "run testsuite" rlRun "pcpcommon_test -g sanity" || rlRun "pcpcommon_log_system_info" rlPhaseEnd @@ -108,8 +69,6 @@ rlJournalStart rlPhaseStartCleanup rlRun "pcpcommon_cleanup" rlRun "rlServiceRestore" 0-255 - rlRun "rm -r $TmpDir" - rlFileRestore rlPhaseEnd rlJournalPrintText rlJournalEnd diff --git a/tests/Sanity/rpm-config-files/Makefile b/tests/Sanity/rpm-config-files/Makefile deleted file mode 100644 index e2fa1b6..0000000 --- a/tests/Sanity/rpm-config-files/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/pcp/Sanity/rpm-config-files -# Description: Verification of rpm config files -# 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/pcp/Sanity/rpm-config-files -export TESTVERSION=1.0 -export TEST_GIT_REF ?= main -export TEST_GIT_URL ?= https://src.fedoraproject.org/rpms/pcp.git -export TEST_GIT_PATH ?= tests/Sanity/rpm-config-files -export TEST_GIT_SCRIPT ?= ./runtest.sh -export GIT_SSL_NO_VERIFY=true - - -BUILT_FILES= - -FILES=$(METADATA) Makefile PURPOSE runtest.sh - -.PHONY: all install download clean - -run: $(FILES) - chmod +x ./runtest.sh - ./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: Verification of rpm config files" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 30m" >> $(METADATA) - @echo "RunFor: pcp" >> $(METADATA) - @echo "Requires: pcp rpm-build" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Bug: 1963938 1964253" >> $(METADATA) - @echo "Releases: -RHEL4 -RHEL6 -RHELClient5 -RHELServer5 -RHEL7" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Sanity/rpm-config-files/runtest.sh b/tests/Sanity/rpm-config-files/runtest.sh index c36848f..8dd72c1 100755 --- a/tests/Sanity/rpm-config-files/runtest.sh +++ b/tests/Sanity/rpm-config-files/runtest.sh @@ -41,7 +41,8 @@ rlJournalStart SOURCEPKG=$(rpm -q --qf '%{name}-%{version}-%{release}.src.rpm' ${PACKAGE}) rlAssertExists "${T}/${SOURCEPKG}" rlRun "rpm -D '_topdir ${T}' -i ${T}/${SOURCEPKG}" - rlRun "RPMS=\$(rpm -q --qf '%{name}\n' --specfile ${T}/SPECS/${PACKAGE}.spec | \ + rlRun "RPMS=\$(rpm -q --qf '%{name}\n' \ + --specfile ${T}/SPECS/${PACKAGE}.spec | \ grep -v -e '-debuginfo' -e '-debugsource' | tr '\n' ' ')" rlPhaseEnd diff --git a/tests/Sanity/shared-libraries-need-symbol-versioning/Makefile b/tests/Sanity/shared-libraries-need-symbol-versioning/Makefile deleted file mode 100644 index 7a281b5..0000000 --- a/tests/Sanity/shared-libraries-need-symbol-versioning/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/pcp/Sanity/shared-libraries-need-symbol-versioning -# Description: A check for presence of version symbols -# Author: Milos Prchlik , Jan Kuřík -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2014-2021 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing -# to use, modify, copy, or redistribute it subject to the terms -# and conditions of the GNU General Public License version 2. -# -# 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. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -export TEST=/tools/pcp/Sanity/shared-libraries-need-symbol-versioning -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: A check for presence of version symbols" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: pcp" >> $(METADATA) - @echo "Requires: pcp pcp-libs binutils" >> $(METADATA) - @echo "Releases: -RHEL4 -RHEL6 -RHELClient5 -RHELServer5" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Bug: 1037771" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Sanity/verify-systemd-units/Makefile b/tests/Sanity/verify-systemd-units/Makefile deleted file mode 100644 index a078135..0000000 --- a/tests/Sanity/verify-systemd-units/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/pcp/Sanity/verify-systemd-units -# Description: Verification of systemd unit files -# 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/pcp/Sanity/verify-systemd-units -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: Verification of systemd unit files" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 5m" >> $(METADATA) - @echo "RunFor: pcp" >> $(METADATA) - @echo "Requires: avahi pcp-manager pcp pcp-zeroconf" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Releases: -RHEL4 -RHEL6 -RHELClient5 -RHELServer5" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Sanity/writeable-suid-guid/Makefile b/tests/Sanity/writeable-suid-guid/Makefile deleted file mode 100644 index dcdad71..0000000 --- a/tests/Sanity/writeable-suid-guid/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/pcp/Sanity/writeable-suid-guid -# Description: Test for BZ#1025583 (pcp creates a world writeable directory) -# Author: Milos Prchlik , Jan Kuřík -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2014-2021 Red Hat, Inc. -# -# This copyrighted material is made available to anyone wishing -# to use, modify, copy, or redistribute it subject to the terms -# and conditions of the GNU General Public License version 2. -# -# 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. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -export TEST=/tools/pcp/Sanity/writeable-suid-guid -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: Test for BZ#1025583 (pcp creates a world writeable directory)" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: pcp" >> $(METADATA) - @echo "Requires: pcp pcp-testsuite" >> $(METADATA) - @echo "Releases: -RHEL4 -RHEL6 -RHELClient5 -RHELServer5" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Bug: 1025583" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Sanity/writeable-suid-guid/main.fmf b/tests/Sanity/writeable-suid-guid/main.fmf index 059c78a..69bae82 100644 --- a/tests/Sanity/writeable-suid-guid/main.fmf +++ b/tests/Sanity/writeable-suid-guid/main.fmf @@ -1,4 +1,4 @@ -summary: Test for BZ#1025583 (pcp creates a world writeable directory) +summary: Test if PCP packages do not create world writeable or suid or guid files description: | Bug summary: pcp creates a world writeable directory /var/lib/pcp/tmp Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1025583 diff --git a/tests/Sanity/writeable-suid-guid/runtest.sh b/tests/Sanity/writeable-suid-guid/runtest.sh index 609d2e4..1bbfbb4 100755 --- a/tests/Sanity/writeable-suid-guid/runtest.sh +++ b/tests/Sanity/writeable-suid-guid/runtest.sh @@ -28,10 +28,17 @@ # Include Beaker environment . /usr/share/beakerlib/beakerlib.sh || exit 1 +. ../../Library/pcpcommon/lib.sh || exit 1 PACKAGE="pcp" DIRS="/var/lib/pcp /usr/include/pcp /etc/pcp /usr/libexec/pcp /var/log/pcp \ /usr/share/pcp /usr/share/doc/pcp" +DIRS="${pcpcommon_PCP_VAR_DIR} ${pcpcommon_PCP_INC_DIR} ${pcpcommon_PCP_SYSCONF_DIR} \ + /usr/libexec/pcp ${pcpcommon_PCP_BINADM_DIR} ${pcpcommon_PCP_LIBADM_DIR} \ + ${pcpcommon_PCP_PMDASADM_DIR} ${pcpcommon_PCP_RC_DIR} ${pcpcommon_PCP_LOG_DIR} \ + ${pcpcommon_PCP_SHARE_DIR} ${pcpcommon_PCP_DOC_DIR} ${pcpcommon_PCP_DEMOS_DIR} \ + ${pcpcommon_PCP_HTML_DIR} ${pcpcommon_PCP_HTML_DIR} /usr/share/doc/pcp-doc \ + " rlJournalStart rlPhaseStartSetup