diff --git a/plans/gating.fmf b/plans/gating.fmf index 5ed0c31..3d44198 100644 --- a/plans/gating.fmf +++ b/plans/gating.fmf @@ -2,5 +2,6 @@ summary: CI Gating Plan discover: how: fmf filter: tag:gating + url: https://src.fedoraproject.org/tests/pcp execute: how: tmt diff --git a/tests/Library/pcpcommon/bl/s390x b/tests/Library/pcpcommon/bl/s390x deleted file mode 100644 index 290db00..0000000 --- a/tests/Library/pcpcommon/bl/s390x +++ /dev/null @@ -1,2 +0,0 @@ -034 -178 diff --git a/tests/Library/pcpcommon/lib.sh b/tests/Library/pcpcommon/lib.sh deleted file mode 100755 index b9187ea..0000000 --- a/tests/Library/pcpcommon/lib.sh +++ /dev/null @@ -1,491 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Description: Common functions for PCP tests -# Author: Jan Kuřík -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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 -# 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. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# library-prefix = pcpcommon -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -. /usr/share/beakerlib/beakerlib.sh - -PACKAGE="pcp" - -pcpcommon_TESTDIR="$(pwd)" - -# Set all the usefull PCP variables -pcpcommon_PCP_ENV="${pcpcommon_PCP_ENV:-/etc/pcp.env}" -for i in $(. ${pcpcommon_PCP_ENV}; set | grep '^PCP_' | grep -v '\s'); do - eval pcpcommon_$i -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_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}" -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}" - -function map_metric() { - case "$1" in - dm) - echo dmcache - ;; - *) - echo $1 - ;; - esac - - return 0 -} - -function _pcpcommon_pmda_bpftrace_setup() { - 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' \ - ${pcpcommon_PCP_PMDAS_DIR}/bpftrace/bpftrace.conf" - else - rlRun "sed -i \ - -e 's/^enabled =.*\$/enabled = false/g' \ - ${pcpcommon_PCP_PMDAS_DIR}/bpftrace/bpftrace.conf" - 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() { - # Check if we have already setup the testsuite user or not - [[ -n "${pcpcommon_PCPQA_SETUP}" ]] && return 0 - pcpcommon_PCPQA_SETUP="done" - - #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}" - rlRun "chown -R ${pcpcommon_TESTSUITE_USER}:${pcpcommon_TESTSUITE_USER} \ - ${pcpcommon_TESTSUITE_DIR}" - rlFail "User ${pcpcommon_TESTSUITE_USER} was not created by pcp packages" \ - "- see BZ#1025688" - pcpcommon_PCPQA_CREATED="yes" - fi - - # Fallback - if [[ ! -d ${pcpcommon_TESTSUITE_USER_HOME} ]]; then - rlRun "mkdir -p ${pcpcommon_TESTSUITE_USER_HOME}" - fi - - # Make sure all the testsuite files are owned by pcpqa - rlRun "chown -R ${pcpcommon_TESTSUITE_USER}:${pcpcommon_TESTSUITE_USER} \ - ${pcpcommon_TESTSUITE_DIR} ${pcpcommon_TESTSUITE_USER_HOME}" - - # Configure sudo - if [[ -d "/etc/sudoers.d/" ]]; then - if [[ ! -f "/etc/sudoers.d/99_${pcpcommon_TESTSUITE_USER}" ]]; then - rlRun "rlFileBackup --clean --namespace pcpcommon_pcpqa --missing-ok \ - /etc/sudoers.d/99_${pcpcommon_TESTSUITE_USER}" - rlRun "echo 'Defaults:${pcpcommon_TESTSUITE_USER} !requiretty' \ - > /etc/sudoers.d/99_${pcpcommon_TESTSUITE_USER}" - rlRun "echo '${pcpcommon_TESTSUITE_USER} ALL=(ALL) NOPASSWD: ALL' \ - >> /etc/sudoers.d/99_${pcpcommon_TESTSUITE_USER}" - rlRun "chmod 0440 /etc/sudoers.d/99_${pcpcommon_TESTSUITE_USER}" - fi - else - if ! grep -q "${pcpcommon_TESTSUITE_USER} ALL=(ALL) NOPASSWD: ALL" \ - /etc/sudoers ; then - rlRun "rlFileBackup --namespace pcpcommon_pcpqa /etc/sudoers" - rlRun "echo 'Defaults:${pcpcommon_TESTSUITE_USER} !requiretty' \ - >> /etc/sudoers" - rlRun "echo '${pcpcommon_TESTSUITE_USER} ALL=(ALL) NOPASSWD: ALL' \ - >> /etc/sudoers" - fi - fi - - # Setup ssh - rlRun "rlFileBackup --clean --namespace pcpcommon_pcpqa --missing-ok \ - ${pcpcommon_TESTSUITE_USER_HOME}/.ssh" - if [[ ! -f "${pcpcommon_TESTSUITE_USER_HOME}/.ssh/id_rsa" ]]; then - rlRun "su - -c 'mkdir ${pcpcommon_TESTSUITE_USER_HOME}/.ssh' \ - ${pcpcommon_TESTSUITE_USER}" - rlRun "su - -c 'ssh-keygen -t rsa -N \"\" \ - -f ${pcpcommon_TESTSUITE_USER_HOME}/.ssh/id_rsa' ${pcpcommon_TESTSUITE_USER}" - fi - rlRun "su - -c 'cat ${pcpcommon_TESTSUITE_USER_HOME}/.ssh/id_rsa.pub \ - >> ${pcpcommon_TESTSUITE_USER_HOME}/.ssh/authorized_keys' \ - ${pcpcommon_TESTSUITE_USER}" - rlRun "echo 'Host *' >> ${pcpcommon_TESTSUITE_USER_HOME}/.ssh/config" - rlRun "echo 'StrictHostKeyChecking no' \ - >> ${pcpcommon_TESTSUITE_USER_HOME}/.ssh/config" - rlRun "echo 'UserKnownHostsFile=/dev/null' \ - >> ${pcpcommon_TESTSUITE_USER_HOME}/.ssh/config" - rlRun "chmod 600 ${pcpcommon_TESTSUITE_USER_HOME}/.ssh/config" - rlRun "chmod 0700 ${pcpcommon_TESTSUITE_USER_HOME}/.ssh" - rlRun "chmod 0640 ${pcpcommon_TESTSUITE_USER_HOME}/.ssh/authorized_keys" - - # Setup default PATHs etc. - rlFileBackup --clean --namespace pcpcommon_pcpqa --missing-ok \ - "${pcpcommon_TESTSUITE_USER_HOME}/.bashrc" - rlRun "su -s /bin/sh -c 'touch ${pcpcommon_TESTSUITE_USER_HOME}/.bashrc' \ - ${pcpcommon_TESTSUITE_USER}" - rlRun "echo 'PATH=\${PATH}:\${PCP_BIN_DIR}:\${PCP_BINADM_DIR}:\${PCP_PLATFORM_PATHS}'\ - >> ${pcpcommon_TESTSUITE_USER_HOME}/.bashrc" - - return 0 -} - -function pcpcommon_testsuite_user_cleanup() { - # Check if we have anything to clenup - [[ -z "${pcpcommon_PCPQA_SETUP}" ]] && return 0 - pcpcommon_PCPQA_SETUP= - - # Kill everything related to pcpqa - rlRun "pkill --signal SIGTERM -u ${pcpcommon_TESTSUITE_USER}" 0-255 - rlRun "pkill --signal SIGTERM -g ${pcpcommon_TESTSUITE_USER}" 0-255 - rlRun "sleep 5" 0 "Wait a bit, so proceses can terminate gracefully" - rlRun "pkill --signal SIGKILL -u ${pcpcommon_TESTSUITE_USER}" 0-255 - rlRun "pkill --signal SIGKILL -g ${pcpcommon_TESTSUITE_USER}" 0-255 - - if [[ -n "${pcpcommon_PCPQA_CREATED}" ]]; then - rlRun "userdel -f -r -Z ${pcpcommon_TESTSUITE_USER}" 0-255 - fi - rlFileRestore --namespace pcpcommon_pcpqa - - return 0 -} - -function pcpcommon_log_system_info() { - local pcpcommon_TMP=$(mktemp -d) - local pcpcommon_TAR=$(mktemp /tmp/XXXXXXXX.tar.gz) - - rlShowRunningKernel - [[ -d /etc/os-release ]] && \ - cp /etc/os-release ${pcpcommon_TMP}/os-release - env &> ${pcpcommon_TMP}/env - sestatus &> ${pcpcommon_TMP}/sestatus - [[ -d /var/run/pcp ]] && \ - ls -alZ /var/run/pcp &> ${pcpcommon_TMP}/ls-alZ_var.run.pcp - pstree -u &> ${pcpcommon_TMP}/pstree - ps xau &> ${pcpcommon_TMP}/ps.aux - netstat -lpn &> ${pcpcommon_TMP}/netstat - ip addr &> ${pcpcommon_TMP}/ip.addr - hostname &> ${pcpcommon_TMP}/hostname - cp /etc/hosts ${pcpcommon_TMP}/etc.hosts - which iptables &> /dev/null && \ - iptables -S &> ${pcpcommon_TMP}/iptables - which nft &> /dev/null && \ - nft list ruleset &> ${pcpcommon_TMP}/nftables - - 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} - - return 0 -} - -function pcpcommon_test () { - local ret=0 - local params="$@" - - pcpcommon_testsuite_user - - 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}" - rlIsRHEL && rlFileSubmit "${rlRun_LOG}" "check.log" - local _test_results="${rlRun_LOG}" - - 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="$(grep -E 'Failures: ' ${_test_results} | cut -d' ' -f2-)" - - if [[ -n "${failids}" ]]; then - 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 "grep -E 'Not run: [[:digit:]]+' ${_test_results}" 0,1; then - rlLogWarning "$(cat ${rlRun_LOG})" - fi - - rlRun "popd" - fi - - return ${ret} -} - -function pcpcommon_cleanup () { - # Cleanup everything related to pcpqa - pcpcommon_testsuite_user_cleanup - pcpcommon_testsuite_bl_restore - rlFileRestore --namespace pcpcommon_init - - return $? -} - -function pcpcommon_pmda_install () { - local ret=1 - local pmda="$1" - local retries=${2:-10} - local metrics - - # Make sure the PMDA's RPM is installed - if ! rpm -q pcp-pmda-${pmda} &> /dev/null; then - rlRun "yum install -y pcp-pmda-${pmda}" || return 1 - fi - - # Check if the PMDA is already installed in PCP - rlRun -s "sed -e 's/^#.*\$//' -e '/^\\s*\$/d' -e '/^\\s*\\[.*\$/,\$ d' \ - ${pcpcommon_PCP_PMCDCONF_PATH} | cut -f 1" 0 "Get the list of installed PMDAs" - if grep -w ${pmda} "${rlRun_LOG}"; then - rlLogInfo "${pmda} is already installed" - ret=0 - else - if rlRun "pushd ${pcpcommon_PCP_PMDAS_DIR}/${pmda}"; then - [[ "${pmda}" == "bpftrace" ]] && _pcpcommon_pmda_bpftrace_setup - if rlRun "./Install < /dev/null"; then - ret=0 - - # Log all values the pmda is providing - rlRun -s "pminfo -f $(map_metric ${pmda})" - metrics="${rlRun_LOG}" - while [[ ${retries} -gt 0 ]]; do - if grep -q 'Try again. Information not currently available' \ - "${metrics}"; then - rlRun "sleep 10" 0 "Waiting for metrics to be available" - rlRun -s "pminfo -f $(map_metric ${pmda})" - metrics="${rlRun_LOG}" - rlLog "Number of retries left: $(( --retries ))" - else - retries=0 - fi - done - rlAssertNotGrep "Error: Resource temporarily unavailable" \ - "${metrics}" || ret=1 - rlAssertNotGrep "Try again. Information not currently available" \ - "${metrics}" || ret=1 - rlIsRHEL && rlFileSubmit "${metrics}" "pmda.${pmda}.metrics.log" - fi - rlRun "popd" - else - rlFail "Unable to find PMDA's basedir ${pcpcommon_PCP_PMDAS_DIR}/${pmda}" - fi - fi - - return ${ret} -} - -function pcpcommon_pmda_remove () { - local ret=1 - local pmda="$1" - - if rlRun "pushd ${pcpcommon_PCP_PMDAS_DIR}/${pmda}" 0-255; then - rlRun "./Remove" 0-255 && ret=0 - rlRun "popd" - else - rlLogInfo "Unable to find PMDA's basedir ${pcpcommon_PCP_PMDAS_DIR}/${pmda}" - fi - - return ${ret} -} - -function pcpcommon_pmda_check_log () { - local pmda="$1" - local errstr="fail|warn|error|crit|denied" - local logf="${pcpcommon_PCP_LOG_DIR}/pmcd/${pmda}.log" - local result=0 - - # Skip the log check if requested - case "${PCPCOMMON_PMDA_CHECK_LOG}" in - 0|[Ff][Aa][Ll][Ss][Ee]|[Nn][Oo]) - rlLogInfo "Skipping check of the ${pmda} log file" - return 0 - ;; - esac - - if [[ "${pmda}" == "nfsclient" ]]; then - rlRun -s "grep -v 'ignored, already in cache' ${logf}" - logf="${rlRun_LOG}" - fi - - rlAssertNotGrep "${errstr}" ${logf} -Ei || result=1 - rlIsRHEL && rlFileSubmit "${logf}" - - return ${result} -} - -function pcpcommon_pmda_tests () { - local pmda="$1" - local addparam="$2" - local testgroup="pmda.${pmda}" - - if rlRun "grep -q ${testgroup} ${pcpcommon_TESTSUITE_DIR}/group" 0,1; then - pcpcommon_test "000 -g ${testgroup} ${addparam}" - pcpcommon_pmda_check_log ${pmda} - else - rlLogInfo "No upstream tests for ${pmda}" - fi -} - -function pcpcommonLibraryLoaded () { - if ! rpm -q pcp-testsuite &>/dev/null; then - rlFail "pcp-testsuite RPM is not installed" - return 1 - fi - - rlFileBackup --namespace pcpcommon_init ${pcpcommon_PCP_ENV} - - # RHEL-6 workaround - if ! ping -c 1 $(hostname) &> /dev/null; then - rlFileBackup --namespace pcpcommon_init /etc/hosts - echo 127.0.0.2 $(hostname) >> /etc/hosts - fi - - # For PCP versions < '5.1.0' run the testuite as root - local _pcpver=$(rpm -q --qf '%{version}' pcp) - local _pcpcmp=$(rlCmpVersion "${_pcpver}" "5.2.0") - if [[ "${_pcpcmp}" == "<" ]];then - rlLogInfo "According to the PCP version, the testsuite will run as user: ${pcpcommon_REAL_TESTSUITE_USER}" - pcpcommon_REAL_TESTSUITE_USER="root" - fi - - return 0 -} 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/SASL-authentication-check/PURPOSE b/tests/Sanity/SASL-authentication-check/PURPOSE deleted file mode 100644 index 3631b2e..0000000 --- a/tests/Sanity/SASL-authentication-check/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /tools/pcp/Sanity/SASL-authentication-check -Description: A basic test of SASL authentication -Author: Jan Kuřík diff --git a/tests/Sanity/SASL-authentication-check/main.fmf b/tests/Sanity/SASL-authentication-check/main.fmf deleted file mode 100644 index 0b87aed..0000000 --- a/tests/Sanity/SASL-authentication-check/main.fmf +++ /dev/null @@ -1,15 +0,0 @@ -summary: A basic test of SASL authentication -description: '' -contact: Jan Kuřík -component: -- pcp -test: ./runtest.sh -framework: beakerlib -recommend: -- pcp -- cyrus-sasl-md5 -- cyrus-sasl-scram -- cyrus-sasl-lib -duration: 15m -tag: - - gating diff --git a/tests/Sanity/SASL-authentication-check/runtest.sh b/tests/Sanity/SASL-authentication-check/runtest.sh deleted file mode 100755 index 08567db..0000000 --- a/tests/Sanity/SASL-authentication-check/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/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/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# Include Beaker environment -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="pcp" -METRICUSER="pcpmetricuser" -METRICUSERPW="pcpmetricuserpw" - -#HASHES="scram-sha-256 digest-md5" -HASHES="scram-sha-256" # digest-md5 is now obsolete - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - - rlServiceStart "pmcd" - - rlFileBackup --clean --missing-ok \ - /etc/pcp.env \ - /etc/sasl2/pmcd.conf \ - /etc/pcp/passwd.db - rlRun "useradd -r ${METRICUSER}" - rlPhaseEnd - -for HASH in ${HASHES}; do - - rlPhaseStartTest "Test for ${HASH}" - rlRun "rm -f /etc/pcp/passwd.db" - rlRun "echo -e 'mech_list: ${HASH}\nsasldb_path: /etc/pcp/passwd.db\n' \ - > /etc/sasl2/pmcd.conf" - - rlRun "echo ${METRICUSERPW} | saslpasswd2 -p -a pmcd ${METRICUSER}" - rlRun "chown root:pcp /etc/pcp/passwd.db" - rlRun "chmod 640 /etc/pcp/passwd.db" - - 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" - rlIsRHEL && rlFileSubmit "${rlRun_LOG}" "pminfo.output" - rlAssertNotGrep "user not found" "${rlRun_LOG}" - rlAssertGrep ".*inst .*value .*" "${rlRun_LOG}" -E - rlIsRHEL && rlFileSubmit "/var/log/pcp/pmcd/pmcd.log" - rlPhaseEnd - -done - - rlPhaseStartCleanup - rlRun "userdel -fr ${METRICUSER}" - rlFileRestore - rlServiceRestore - rlPhaseEnd -rlJournalPrintText -rlJournalEnd 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 9d0e19a..0000000 --- a/tests/Sanity/licence-check/main.fmf +++ /dev/null @@ -1,21 +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 -framework: beakerlib -component: -- pcp -contact: Jan Kuřík -recommend: -- pcp -- 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 9761d9d..0000000 --- a/tests/Sanity/licence-check/test.sh +++ /dev/null @@ -1,67 +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=pcp -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 - #rlAssertNotGrep 'Warning: ' "${rlRun_LOG}" \ - # || { rlLogInfo "$(cat ${rlRun_LOG})"; retcode="warn"; } - #rlAssertEquals "Check if the package license is SPDX identifier" \ - # "${l}" "$(cat ${rlRun_LOG})" || 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/pcp-python-compliance/PURPOSE b/tests/Sanity/pcp-python-compliance/PURPOSE deleted file mode 100644 index 1f9ab7f..0000000 --- a/tests/Sanity/pcp-python-compliance/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /tools/pcp/Sanity/pcp-python-compliance -Description: Check for a compliance with Fedora Packaging Guidelines -Author: Jan Kuřík diff --git a/tests/Sanity/pcp-python-compliance/main.fmf b/tests/Sanity/pcp-python-compliance/main.fmf deleted file mode 100644 index d9f5e19..0000000 --- a/tests/Sanity/pcp-python-compliance/main.fmf +++ /dev/null @@ -1,13 +0,0 @@ -summary: Check for a compliance with Fedora Packaging Guidelines -description: '' -contact: Jan Kuřík -component: -- pcp -test: ./runtest.sh -framework: beakerlib -recommend: -- python3-pcp -- python-pcp -duration: 15m -tag: - - gating diff --git a/tests/Sanity/pcp-python-compliance/runtest.sh b/tests/Sanity/pcp-python-compliance/runtest.sh deleted file mode 100755 index 889570d..0000000 --- a/tests/Sanity/pcp-python-compliance/runtest.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh 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/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# Include Beaker environment -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="pcp" -PYPACKAGE="$(rpm -q --qf '%{name}\n' python3-pcp python-pcp 2>/dev/null | grep '^python')" - -rlJournalStart - rlPhaseStartSetup - rlLog "Compliance with Fedora Packaging Guidelines test" - rlLog "Check https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/" - rlAssertRpm ${PACKAGE} - rlAssertRpm ${PYPACKAGE} - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - rlPhaseEnd - - rlPhaseStartTest "Check for *.pyc files" - rlRun "rpm -ql ${PYPACKAGE} > filelist.list" - while read f; do - if [[ ${f##*.} == "py" ]]; then - rlLog "Checking PYC file for $f" - BASE=$(basename $f) - DIR=$(dirname $f) - if [[ "${PYPACKAGE%%-*}" == "python3" ]]; then - rlAssertGrep "${DIR}/__pycache__/${BASE%.*}\..*\.pyc" filelist.list -E - else - rlAssertGrep "${DIR}/${BASE%.*}.*\.pyc" filelist.list -E - fi - fi - done < "filelist.list" - rlPhaseEnd - - rlPhaseStartTest "Check for egg-info files" - rlAssertGrep "/${PACKAGE}-.*\.egg-info" filelist.list -E - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/Sanity/pcp-services/PURPOSE b/tests/Sanity/pcp-services/PURPOSE deleted file mode 100644 index 012e5d8..0000000 --- a/tests/Sanity/pcp-services/PURPOSE +++ /dev/null @@ -1,5 +0,0 @@ -PURPOSE of /tools/pcp/Sanity/pcp-services -Description: Test of pcp services (start / stop) -Author: Jan Kuřík -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 diff --git a/tests/Sanity/pcp-services/main.fmf b/tests/Sanity/pcp-services/main.fmf deleted file mode 100644 index 28ced58..0000000 --- a/tests/Sanity/pcp-services/main.fmf +++ /dev/null @@ -1,16 +0,0 @@ -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 -contact: Jan Kuřík -component: -- pcp -test: ./runtest.sh -framework: beakerlib -recommend: -- pcp -- pcp-zeroconf -- redis -duration: 15m -tag: - - gating diff --git a/tests/Sanity/pcp-services/runtest.sh b/tests/Sanity/pcp-services/runtest.sh deleted file mode 100755 index fccee38..0000000 --- a/tests/Sanity/pcp-services/runtest.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh 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/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# Include Beaker environment -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="pcp" -PCPSERVICES="pmcd pmlogger pmproxy pmie" -TOUT="90" # Timeout to wait for a service to start / stop - -function service_action() { - local service=$1 - local status=$2 - local ss= - local t=${TOUT} - - rlRun -s "systemctl show -p ActiveState --no-pager ${service}" 0 \ - "Check if ${service} service is in expected state" - - # Wait for the service to get into a proper state - while [[ "${ss}" != "${status}" ]]; do - [[ $(( t-- )) -le 0 ]] && break - sleep 1 - ss=$(sed -n 's/^ActiveState=//g p' < ${rlRun_LOG}) - done - if [[ "${ss}" != "${status}" ]]; then - rlFail "The ${service} service is in unexpected state '${ss}'" - return 1 - else - rlPass "${service} state is OK '${ss}'" - return 0 - fi -} - -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 - # 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 - done - rlPhaseEnd - - rlPhaseStartCleanup - rlServiceRestore - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/Sanity/pcp-testsuite-sanity/PURPOSE b/tests/Sanity/pcp-testsuite-sanity/PURPOSE deleted file mode 100644 index 29ee86a..0000000 --- a/tests/Sanity/pcp-testsuite-sanity/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /tools/pcp/Sanity/pcp-testsuite-sanity -Description: pcp testing by upstream testsuite -Author: Jan Kuřík diff --git a/tests/Sanity/pcp-testsuite-sanity/main.fmf b/tests/Sanity/pcp-testsuite-sanity/main.fmf deleted file mode 100644 index 1109ebb..0000000 --- a/tests/Sanity/pcp-testsuite-sanity/main.fmf +++ /dev/null @@ -1,31 +0,0 @@ -summary: pcp testing by upstream testsuite -description: '' -contact: -- Jan Kuřík -component: -- pcp -test: ./runtest.sh -framework: beakerlib -recommend: -- pcp -- time -- sudo -- procps-ng -- avahi -- bzip2 -- pcp-pmda-cisco -- coreutils -- pcp-pmda-news -- perl-PCP-LogImport -- perl-PCP-LogSummary -- python-pcp -- gcc -- redhat-rpm-config -- perl-PCP-LogSummary -- libuv -- libuv-devel -- /usr/bin/netstat -- pcp-testsuite -duration: 4h -tag: - - gating diff --git a/tests/Sanity/pcp-testsuite-sanity/runtest.sh b/tests/Sanity/pcp-testsuite-sanity/runtest.sh deleted file mode 100755 index 4ee914a..0000000 --- a/tests/Sanity/pcp-testsuite-sanity/runtest.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /tools/pcp/Sanity/pcp-testsuite-sanity -# Description: pcp testing by upstream testsuite -# Author: Jan Kuřík -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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 -# 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" -TSUSER="pcpqa" -TCWD="$(pwd)" - -export SYSTEMD_PAGER='' - -function apply_bl() { - local bl="${1}" - local tc - - if [[ ! -r "${bl}" ]] ; then - rlLogDebug "No BL $(basename ${bl}) found" - return - fi - rlLog "Applying BL $(basename ${bl})" - while read tc; do - rlRun "sed -i '/^${tc} /d' ${pcpcommon_TESTSUITE_DIR}/group" - done < "${bl}" - - return -} - -rlJournalStart - rlPhaseStartSetup - rlShowRunningKernel - rlAssertRpm "${PACKAGE}" - rlRun "pcpcommonLibraryLoaded" - 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 - - rlPhaseStartTest "run testsuite" - rlRun "pcpcommon_test -g sanity" || rlRun "pcpcommon_log_system_info" - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "pcpcommon_cleanup" - rlRun "rlServiceRestore" 0-255 - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/Sanity/rpm-config-files/PURPOSE b/tests/Sanity/rpm-config-files/PURPOSE deleted file mode 100644 index 91c591f..0000000 --- a/tests/Sanity/rpm-config-files/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /tools/pcp/Sanity/rpm-config-files -Description: Verification of rpm config files -Author: Jan Kuřík diff --git a/tests/Sanity/rpm-config-files/main.fmf b/tests/Sanity/rpm-config-files/main.fmf deleted file mode 100644 index 7356d43..0000000 --- a/tests/Sanity/rpm-config-files/main.fmf +++ /dev/null @@ -1,13 +0,0 @@ -summary: Verification of rpms config files -description: 'Verification of rpms config files' -contact: Jan Kuřík -component: -- pcp -test: ./runtest.sh -framework: beakerlib -recommend: -- pcp -- rpm-build -duration: 15m -tag: - - gating diff --git a/tests/Sanity/rpm-config-files/runtest.sh b/tests/Sanity/rpm-config-files/runtest.sh deleted file mode 100755 index 8dd72c1..0000000 --- a/tests/Sanity/rpm-config-files/runtest.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh 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/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# Include Beaker environment -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="pcp" - -rlJournalStart - rlPhaseStartSetup - rlRun "T=\$(mktemp -d /var/tmp/XXXXXXXXXXXX)" - rlRun "pushd ${T}" || rlDie 'Something is wrong .... giving up...' - - # 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 "${T}/${SOURCEPKG}" - rlRun "rpm -D '_topdir ${T}' -i ${T}/${SOURCEPKG}" - rlRun "RPMS=\$(rpm -q --qf '%{name}\n' \ - --specfile ${T}/SPECS/${PACKAGE}.spec | \ - grep -v -e '-debuginfo' -e '-debugsource' | tr '\n' ' ')" - rlPhaseEnd - - rlPhaseStartTest "Install and test all ${PACKAGE} rpms" - rlRun "yum install -y ${RPMS}" - for p in ${RPMS}; do - configs=$(rpm -qc ${p}) - etc=$(rpm -ql ${p} | grep '^/etc/') - for f in ${etc}; do - if ! grep -q "${f}" <<< "${configs}"; then - [[ -f "${f}" ]] && [[ ! -h "${f}" ]] && rlFail \ - "File ${f} from ${p} package is not marked as a config file" - fi - done - done - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" # pushd ${T} - rlRun "rm -rf ${T}" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/Sanity/shared-libraries-need-symbol-versioning/PURPOSE b/tests/Sanity/shared-libraries-need-symbol-versioning/PURPOSE deleted file mode 100644 index 5dd9bc8..0000000 --- a/tests/Sanity/shared-libraries-need-symbol-versioning/PURPOSE +++ /dev/null @@ -1,5 +0,0 @@ -PURPOSE of /tools/pcp/Sanity/shared-libraries-need-symbol-versioning -Description: A check for presence of version symbols -Author: Milos Prchlik , Jan Kuřík -Bug summary: pcp shared libraries need symbol-versioning -Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1037771 diff --git a/tests/Sanity/shared-libraries-need-symbol-versioning/main.fmf b/tests/Sanity/shared-libraries-need-symbol-versioning/main.fmf deleted file mode 100644 index 03a1c0e..0000000 --- a/tests/Sanity/shared-libraries-need-symbol-versioning/main.fmf +++ /dev/null @@ -1,16 +0,0 @@ -summary: A check for presence of version symbols -description: | - Bug summary: pcp shared libraries need symbol-versioning - Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1037771 -contact: Jan Kuřík -component: -- pcp -test: ./runtest.sh -framework: beakerlib -recommend: -- pcp -- pcp-libs -- binutils -duration: 15m -tag: - - gating diff --git a/tests/Sanity/shared-libraries-need-symbol-versioning/runtest.sh b/tests/Sanity/shared-libraries-need-symbol-versioning/runtest.sh deleted file mode 100755 index 35928d9..0000000 --- a/tests/Sanity/shared-libraries-need-symbol-versioning/runtest.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh 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. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# Include Beaker environment -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="pcp" - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlPhaseEnd - - rlPhaseStartTest - for lib in `rpm -ql pcp-libs | grep lib64`; do - rlAssertExists "$lib" - rlRun "readelf -s $lib | grep '@PCP_[[:digit:]]\+\.[[:digit:]]\+'" 0 \ - "$lib should contain versioned symbols" - done - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/Sanity/upgrade/PURPOSE b/tests/Sanity/upgrade/PURPOSE deleted file mode 100644 index dc63252..0000000 --- a/tests/Sanity/upgrade/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /Sanity/upgrade -Description: upgrade test between different distro releases -Author: Jan Kurik diff --git a/tests/Sanity/upgrade/main.fmf b/tests/Sanity/upgrade/main.fmf deleted file mode 100644 index 09e205b..0000000 --- a/tests/Sanity/upgrade/main.fmf +++ /dev/null @@ -1,35 +0,0 @@ -summary: upgrade -description: '' -contact: Jan Kurik -component: - - pcp -test: ./runtest.sh -framework: beakerlib -require: - - library(ControlFlow/mcase) -recommend: - - pcp - - beakerlib - - time - - sudo - - procps-ng - - avahi - - bzip2 - - pcp-pmda-cisco - - coreutils - - pcp-pmda-news - - perl-PCP-LogImport - - perl-PCP-LogSummary - - python-pcp - - gcc - - redhat-rpm-config - - perl-PCP-LogSummary - - libuv - - libuv-devel - - /usr/bin/netstat - - pcp-testsuite - - nmap - - valgrind -duration: 1h -tag: - - upgrade diff --git a/tests/Sanity/upgrade/runtest.sh b/tests/Sanity/upgrade/runtest.sh deleted file mode 100755 index f387d29..0000000 --- a/tests/Sanity/upgrade/runtest.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -#shellcheck disable=SC1091 -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/pcp/Sanity/upgrade -# Description: upgrade -# Author: Jan Kurik -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 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 -# 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 - -#shellcheck disable=SC2034 -PACKAGE=pcp - -distribution_mcase__test() { - rlLogInfo 'Verify scenario upgrade works' - - rlRun "yum remove -y pcp-testsuite" 0-255 - rlRun "rm -rf /var/lib/pcp/testsuite" - rlRun "yum install -y pcp-testsuite" 0 "Ensure pcp-testsuite is installed" - rlRun "pushd /var/lib/pcp/pmdas/sample/" - rlRun "./Remove" 0-255 - rlRun "echo | ./Install" 0-255 - rlRun "popd" - rlRun "pcpcommonLibraryLoaded" - rlRun "rlServiceStart pmcd pmlogger" 0,1 - rlRun "rlServiceEnable pmcd pmlogger" 0-255 - rlRun "sleep 10" - - # BL - for tc in 359 665 821 1393; do - rlRun "sed -i -e '/^${tc} /d' /var/lib/pcp/testsuite/group" 0-255 - done - rlRun "pcpcommon_test -g sanity -g pmda.linux -x kernel -x pmda.sample -x valgrind \ - -x containers -x cgroups -x pmda.mmv" \ - || rlRun "pcpcommon_log_system_info" - rlRun "pcpcommon_cleanup" -} - -rlJournalStart - rlPhaseStartSetup "init" - - export LANG=en_US.UTF-8 - export LANGUAGE=en_US:en - export LC_CTYPE=POSIX - export LC_NUMERIC=POSIX - export LC_TIME=POSIX - export LC_COLLATE=POSIX - export LC_MONETARY=POSIX - export LC_MESSAGES=POSIX - export LC_PAPER=POSIX - export LC_NAME=POSIX - export LC_ADDRESS=POSIX - export LC_TELEPHONE=POSIX - export LC_MEASUREMENT=POSIX - export LC_IDENTIFICATION=POSIX - export LC_ALL= - - rlImport "ControlFlow/mcase" - rlPhaseEnd - distribution_mcase__run -rlJournalPrintText -rlJournalEnd - -#template by morf-0.29.25 diff --git a/tests/Sanity/verify-systemd-units/PURPOSE b/tests/Sanity/verify-systemd-units/PURPOSE deleted file mode 100644 index 507ecce..0000000 --- a/tests/Sanity/verify-systemd-units/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /tools/pcp/Sanity/verify-systemd-units -Description: Verification of systemd unit files -Author: Jan Kuřík diff --git a/tests/Sanity/verify-systemd-units/main.fmf b/tests/Sanity/verify-systemd-units/main.fmf deleted file mode 100644 index d496a66..0000000 --- a/tests/Sanity/verify-systemd-units/main.fmf +++ /dev/null @@ -1,15 +0,0 @@ -summary: Verification of systemd unit files -description: '' -contact: Jan Kuřík -component: -- pcp -test: ./runtest.sh -framework: beakerlib -recommend: -- avahi -- pcp-manager -- pcp -- pcp-zeroconf -duration: 5m -tag: - - gating diff --git a/tests/Sanity/verify-systemd-units/runtest.sh b/tests/Sanity/verify-systemd-units/runtest.sh deleted file mode 100755 index 8901b1f..0000000 --- a/tests/Sanity/verify-systemd-units/runtest.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh 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/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# Include Beaker environment -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="pcp" -PKGS="pcp pcp-zeroconf" -UNITS="" -UNITFILESDIR="/usr/lib/systemd/system/" - -rlJournalStart - rlPhaseStartSetup - PCPVER=$(rpm -q --qf '%{version}' pcp) - if rlTestVersion ${PCPVER} '<' '5.2.0'; then - PKGS="${PKGS} pcp-manager" - fi - for P in ${PKGS}; do - rlAssertRpm "${P}" - done - # Generate list of unit files - UNITS=$(rpm -ql ${PKGS} | grep "${UNITFILESDIR}") - rlLog "Available unit files: ${UNITS}" - rlPhaseEnd - - rlPhaseStartTest - FAILEDU="" - for U in ${UNITS}; do - if [[ -f ${U} ]] && [[ "$(dirname ${U})" == "${UNITFILESDIR%/}" ]]; then - if ! rlRun -s "systemd-analyze --no-pager verify ${U}"; then - rlFail "Error in ${U}: $(cat ${rlRun_LOG})" - FAILEDU="${FAILEDU} $(basename ${U})" - fi - if grep -q 'is deprecated' ${rlRun_LOG}; then - rlFail "Error in ${U}: $(cat ${rlRun_LOG})" - FAILEDU="${FAILEDU} $(basename ${U})" - fi - else - rlLog "${U} is not a regular unit file ... skipping" - fi - done - [[ -n "${FAILEDU}" ]] && rlLog "List of failed units: ${FAILEDU}" - rlPhaseEnd - - rlPhaseStartCleanup - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/Sanity/writeable-suid-guid/PURPOSE b/tests/Sanity/writeable-suid-guid/PURPOSE deleted file mode 100644 index 412dde7..0000000 --- a/tests/Sanity/writeable-suid-guid/PURPOSE +++ /dev/null @@ -1,5 +0,0 @@ -PURPOSE of /tools/pcp/Sanity/writeable-suid-guid -Description: Test for BZ#1025583 (pcp creates a world writeable directory) -Author: Milos Prchlik , Jan Kuřík -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/main.fmf b/tests/Sanity/writeable-suid-guid/main.fmf deleted file mode 100644 index 54c72eb..0000000 --- a/tests/Sanity/writeable-suid-guid/main.fmf +++ /dev/null @@ -1,15 +0,0 @@ -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 -contact: Jan Kuřík -component: -- pcp -test: ./runtest.sh -framework: beakerlib -recommend: -- pcp -- pcp-testsuite -duration: 15m -tag: - - gating diff --git a/tests/Sanity/writeable-suid-guid/runtest.sh b/tests/Sanity/writeable-suid-guid/runtest.sh deleted file mode 100755 index 1bbfbb4..0000000 --- a/tests/Sanity/writeable-suid-guid/runtest.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh 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. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# 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 - rlAssertRpm $PACKAGE - rlRun "T=\$(mktemp -d)" - rlRun "pushd ${T}" || rlDie "Can not 'cd' into a temporary directory" - rlPhaseEnd - - rlPhaseStartTest - rlRun -s "find ${DIRS} \ - \\( -perm -4000 -fprintf suid.txt '%#m %u:%g %p\\\\n' \\) , \ - \\( -perm -2000 -fprintf guid.txt '%#m %u:%g %p\\\\n' \\) , \ - \\( -perm -1000 -fprintf sticky.txt '%#m %u:%g %p\\\\n' \\) , \ - \\( -type d -perm -0002 -fprintf writeable-d.txt '%#m %u:%g %p\\\\n' \\) , \ - \\( -type f -perm -0002 -fprintf writeable-f.txt '%#m %u:%g %p\\\\n' \\) \ - " 0 "Search for world-writable, SUID, GUID or sticky bit files and directories" - for f in suid.txt guid.txt sticky.txt writeable-d.txt writeable-f.txt; do - if [[ -s ${f} ]]; then - rlLogInfo "${f} contains the following files:" - rlLogInfo "$(cat ${f})" - rlFail "PCP files/dirs should not contain SUID, GUID, sticky or world" \ - "writeable files" - fi - done - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" - rlRun "rm -rf ${T}" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd