diff --git a/openqa/p_mariadb/01-check_service.sh b/openqa/p_mariadb/01-check_service.sh index 34176ad..66faf9d 100755 --- a/openqa/p_mariadb/01-check_service.sh +++ b/openqa/p_mariadb/01-check_service.sh @@ -1,6 +1,6 @@ #!/bin/bash -x -source ../../library/sh_lib.sh +source library/sh_lib.sh check=0 diff --git a/openqa/p_postgres/01-check_service.sh b/openqa/p_postgres/01-check_service.sh index 210839a..ff93f95 100755 --- a/openqa/p_postgres/01-check_service.sh +++ b/openqa/p_postgres/01-check_service.sh @@ -1,6 +1,6 @@ #!/bin/bash -x -source ../../library/sh_lib.sh +source library/sh_lib.sh check=0 diff --git a/openqa/p_postgres/_init.sh b/openqa/p_postgres/_init.sh index 6b1ab0d..0d51523 100755 --- a/openqa/p_postgres/_init.sh +++ b/openqa/p_postgres/_init.sh @@ -1,6 +1,6 @@ #!/bin/bash -source ../../library/sh_lib.sh +source library/sh_lib.sh check=0 diff --git a/rpm_tests/p_gcc/02-compile-test.sh b/rpm_tests/p_gcc/02-compile-test.sh deleted file mode 100755 index 9dc7ef0..0000000 --- a/rpm_tests/p_gcc/02-compile-test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -x - -echo "Тест компилятора" - -source ../../library/sh_lib.sh - -check=0 - -gcc -o simple_test files/simple_test.c -check=$(eq_is_success ${check} 0) - -./simple_test | grep -E '^Hello, world!$' -check=$(eq_is_success ${check} 0) - -check_test_status ${check} "$0" -exit ${check} diff --git a/rpm_tests/p_gcc/files/simple_test.c b/rpm_tests/p_gcc/files/simple_test.c deleted file mode 100644 index cb26f85..0000000 --- a/rpm_tests/p_gcc/files/simple_test.c +++ /dev/null @@ -1,10 +0,0 @@ -// simple-test.c - -#include - -int main ( void ) -{ - printf ("Hello, world!"); - - return 0; -} // main \ No newline at end of file diff --git a/rpm_tests/p_httpd/001-prepare_environment.sh b/rpm_tests/p_httpd/001-prepare_environment.sh deleted file mode 100755 index 3135f23..0000000 --- a/rpm_tests/p_httpd/001-prepare_environment.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -echo "Подготовка окружения для тестирования пакета ${TEST_PACKAGE_NAME}" - -exit 0 diff --git a/runtests-jenkins.sh b/runtests-jenkins.sh new file mode 100755 index 0000000..88ffc49 --- /dev/null +++ b/runtests-jenkins.sh @@ -0,0 +1,43 @@ +#!/bin/bash -x + +if [ $# -eq 0 ]; then + echo "You should provide argument" + exit 1 +fi + +echo -e "\n[+] `date` -> CentOS QA $0 starting." + +yum -d0 -y install bind-utils hostname + +if [ "$?" -ne "0" ] ;then + echo "[+] ERROR : not even able to install bind-utils pkg so all t_functional tests will fail" + echo "[+] Do we have enabled repositories with correct GPG settings and signed pkgs ?" + exit 1 +fi + +host repo.centos.qa > /dev/null +export SKIP_QA_HARNESS=$? + +LIB_FUNCTIONS='/tests/QA/tests/0_lib/functions.sh' + +# Human friendly symbols +export readonly PASS=0 +export readonly FAIL=1 +# set debug level of yum install in t_InstallPackage +export YUMDEBUG=0 + +[ -f $LIB_FUNCTIONS ] && source $LIB_FUNCTIONS || { echo -e "\n[+] `date` -> Unable to source functions library. Cannot continue\n"; exit $FAIL; } + +# case insensitive filename matching +shopt -s nocasematch + +# exit as soon as any script returns a non-zero exit status +set -e + +# exit on undefined variables +set -u + +# Run test +$1 + +exit 0 diff --git a/runtests.sh b/runtests.sh new file mode 100755 index 0000000..a525c06 --- /dev/null +++ b/runtests.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +# Author: Steve Barnes (steve@echo.id.au) +# Description: this script sources our library functions and starts a test run. + +echo -e "\n[+] `date` -> CentOS QA $0 starting." + +yum -d0 -y install bind-utils hostname + +if [ "$?" -ne "0" ] ;then + echo "[+] ERROR : not even able to install bind-utils pkg so all t_functional tests will fail" + echo "[+] Do we have enabled repositories with correct GPG settings and signed pkgs ?" + exit 1 +fi + +host repo.centos.qa > /dev/null +export SKIP_QA_HARNESS=$? + +LIB_FUNCTIONS='./tests/0_lib/functions.sh' + +# Human friendly symbols +export readonly PASS=0 +export readonly FAIL=1 +# set debug level of yum install in t_InstallPackage +export YUMDEBUG=0 + +[ -f $LIB_FUNCTIONS ] && source $LIB_FUNCTIONS || { echo -e "\n[+] `date` -> Unable to source functions library. Cannot continue\n"; exit $FAIL; } + +# case insensitive filename matching +shopt -s nocasematch + +# exit as soon as any script returns a non-zero exit status +set -e + +# exit on undefined variables +set -u + +# Searching for tests to disable +if [ -e skipped-tests.list ] ;then + t_Log "QA Harness : searching for tests to disable with valid reason" + egrep ^${centos_ver} skipped-tests.list | while read line; + do test=$(echo $line|cut -f 2 -d '|') + t_Log "Disabling QA harness test ${test}" + chmod -x ${test} + done +fi + +# process our test scripts +if [ $# -gt 0 ]; then + t_Process <(/usr/bin/find ./tests/0_*/ -type f|sort -t'/' ) + t_Process <(/usr/bin/find ./tests/$1/ -type f|sort -t'/' ) +else + t_Process <(/usr/bin/find ./tests/0_*/ -type f|sort -t'/' ) + t_Process <(/usr/bin/find ./tests/p_*/ -type f|sort -t'/' ) + t_Process <(/usr/bin/find ./tests/r_*/ -type f|sort -t'/' ) + t_Process <(/usr/bin/find ./tests/z_*/ -type f|sort -t'/' ) +fi + +# and, we're done. +if [ -e skipped-tests.list ] ;then + t_Log "QA Harness : Searching for disabled tests (skipped-tests.list)" + egrep ^${centos_ver} skipped-tests.list | while read line; + do test=$(echo $line|cut -f 2 -d '|') + reason=$(echo $line|cut -f 3 -d '|') + t_Log " =WARNING= : Disabled test : ${test} (${reason})" + done +fi + +t_Log "QA t_functional tests finished." +exit 0 diff --git a/tests/0_common/000_centos_default_repos.py b/tests/0_common/000_centos_default_repos.py new file mode 100644 index 0000000..d4fef1e --- /dev/null +++ b/tests/0_common/000_centos_default_repos.py @@ -0,0 +1,68 @@ +#!/usr/bin/python +# Author: Athmane Madjoudj +# Karanbir Singh +# Test default CentOS repos +# Note: since the -qa and CI setup will modify the +# local repos, we need to run this tests +# before those changes are made +from __future__ import print_function + +import sys +import datetime +import os + +repos = [] + +try: + import yum + base = yum.YumBase() + repos = base.repos.listEnabled() +except Exception: + import dnf + base = dnf.Base() + base.read_all_repos() + repos = list(base.repos.iter_enabled()) + + +def getEnvironOpt(varname,defval): + global now + val=defval + try: + val = int(os.environ[varname]) + except KeyError: + pass + print("[+] %s -> %s:%d" % (now(),varname,val)) + return val + +now = lambda: datetime.datetime.today().strftime("%c") +centos_default_repos = ['base'] + +with open('/etc/centos-release') as x: + f = x.read() + if 'Stream' in f: + centos_default_repos = ['appstream', 'baseos', 'extras-common'] + + +if getEnvironOpt('UPDATES',1): + centos_default_repos.append('updates') +if getEnvironOpt('EXTRAS',1): + centos_default_repos.append('extras') +if getEnvironOpt('CR',1): + centos_default_repos.append('cr') +if getEnvironOpt('CENTOS_KERNEL',1): + centos_default_repos.append('centos-kernel') +if getEnvironOpt('FASTTRACK',0): + centos_default_repos.append('fasttrack') +if getEnvironOpt('CENTOSPLUS',0): + centos_default_repos.append('centosplus') + +print("[+] %s -> Check if non default repo is enabled" % now()) +print(repos) +for repo in repos: + if not repo.id in centos_default_repos: + print('%s is enabled, should be disabled at this stage' % repo.id) + print('[+] %s -> FAIL' % now()) + sys.exit(1) +print('[+] %s -> PASS' % now()) +sys.exit(0) + diff --git a/tests/0_common/00_centos_repos.sh b/tests/0_common/00_centos_repos.sh new file mode 100755 index 0000000..a1d3450 --- /dev/null +++ b/tests/0_common/00_centos_repos.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ "$centos_ver" -ge "8" ]; then + t_Log "python not installed by default on .el8. SKIP" + exit 0 +else + python tests/0_common/000_centos_default_repos.py +fi + diff --git a/tests/0_common/01_dist_release_check.sh b/tests/0_common/01_dist_release_check.sh new file mode 100755 index 0000000..71a514c --- /dev/null +++ b/tests/0_common/01_dist_release_check.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Just a check to determine full version (example 5.8) or just dist (example 6) + +export qa_dist=$(rpm -q --queryformat '%{version}\n' centos-release) +export qa_releasever=$(rpm -q --queryformat '%{version}.' centos-release ; rpm -q --queryformat '%{release}\n' centos-release|cut -f 1 -d '.') diff --git a/tests/0_common/03_print_booted_kernel.sh b/tests/0_common/03_print_booted_kernel.sh new file mode 100755 index 0000000..44081c4 --- /dev/null +++ b/tests/0_common/03_print_booted_kernel.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +kerver="$(uname -r)" +t_Log "Boot Kernel Version: $kerver" + diff --git a/tests/0_common/05_stop_yumupdatesd.sh b/tests/0_common/05_stop_yumupdatesd.sh new file mode 100755 index 0000000..ecf1a06 --- /dev/null +++ b/tests/0_common/05_stop_yumupdatesd.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +t_Log "Running $0 - stopping yum-updatesd service" +t_ServiceControl yum-updatesd stop diff --git a/tests/0_common/10_remove_32bitpkgs.sh b/tests/0_common/10_remove_32bitpkgs.sh new file mode 100755 index 0000000..86e6596 --- /dev/null +++ b/tests/0_common/10_remove_32bitpkgs.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +t_Log "Running $0 - test that all 32-bit rpms can be removed" + +# only run this test on x86_64 machines! +is64=$(uname -m|grep x86_64) + +# This is a non-fatal status, so return PASS. +[ $? -ne 0 ] && { t_Log 'Host is not 64bit, skipping.'; exit $PASS; } + +t_RemovePackage *.i?86 \ No newline at end of file diff --git a/tests/0_common/15_list_repos.sh b/tests/0_common/15_list_repos.sh new file mode 100755 index 0000000..4f568ca --- /dev/null +++ b/tests/0_common/15_list_repos.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +t_Log "Running $0 - Showing the repos we have configured" + +yum -d0 repolist -v + +t_CheckExitStatus $? diff --git a/tests/0_common/20_upgrade_all.sh b/tests/0_common/20_upgrade_all.sh new file mode 100755 index 0000000..89d10c1 --- /dev/null +++ b/tests/0_common/20_upgrade_all.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +t_Log "Running $0 - test that all updates can be applied to this machine cleanly" + +# If CENTOSPLUS, and CentOS 7, and x86_64 change default kernel to kernel-plus +if [ "$CENTOSPLUS" == "1" ] && [ "$centos_ver" == "7" ] && [ "$arch" == "x86_64" ] ; then + sed -i 's,DEFAULTKERNEL=.*,DEFAULTKERNEL=kernel-plus,g' /etc/sysconfig/kernel +fi + +if [ "$centos_ver" -lt 8 ];then + yum -d0 -y install deltarpm +fi +yum -d0 -y upgrade + +t_Log "Running $0 - listing all used/available packages" + +yum list + +t_CheckExitStatus $? diff --git a/tests/0_common/30_dns_works.sh b/tests/0_common/30_dns_works.sh new file mode 100755 index 0000000..9c161c6 --- /dev/null +++ b/tests/0_common/30_dns_works.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +t_Log "Running $0 - testing to see if DNS works" +if [ $SKIP_QA_HARNESS -eq 1 ]; then + HOST=www.centos.org +else + HOST=repo.centos.qa +fi + +# its important we dont hit a dns record with a wildcard like centos.org +getent hosts $HOST >/dev/null + +t_CheckExitStatus $? + +# implied results: +# - network works +# - default route is really routeable +# - atleast one network link on the machine is working +# - kernel' ip stack is functional diff --git a/tests/0_common/40_update_hosts.sh b/tests/0_common/40_update_hosts.sh new file mode 100755 index 0000000..1e0bdfc --- /dev/null +++ b/tests/0_common/40_update_hosts.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Author: Athmane Madjoudj + + +t_Log "Running $0 - Update /etc/hosts" + +echo "127.0.0.1 `hostname`" >> /etc/hosts + diff --git a/tests/0_common/50_test_comps.sh b/tests/0_common/50_test_comps.sh new file mode 100644 index 0000000..76b3037 --- /dev/null +++ b/tests/0_common/50_test_comps.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Author: Alex Iribarren + +t_Log "Running $0 - testing comps.xml groups" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +if [ "$centos_ver" -eq "7" ]; then + t_Log "CentOS $centos_ver -> SKIP" + exit 0 +fi + +/bin/cp -f /etc/os-release /tmp + +# Get **all** the group IDs +ALL_GROUPS=`dnf group list -v --hidden | grep '^ ' | sed 's/.*(\(.*\))$/\1/'` + +for GROUP in $ALL_GROUPS; do + t_Log " - testing group $GROUP" + # Pretend to install the group, but all we really want is the solver debug data + dnf --installroot=/tmp group --releasever $centos_ver install --assumeno --debugsolver $GROUP + pwd + ls + # Check the solver results to see if there are problems + grep '^problem' debugdata/rpms/solver.result + RES=$? + # Clean up the debugdata + rm -rf debugdata/ + + # If 'problem' was not found in the results, grep returns 1 and we're happy + if [[ $RES -eq 1 ]]; then + t_CheckExitStatus 0 + else + t_CheckExitStatus 1 + fi +done diff --git a/tests/0_common/readme b/tests/0_common/readme new file mode 100644 index 0000000..def2b6a --- /dev/null +++ b/tests/0_common/readme @@ -0,0 +1,5 @@ +These are tests that are run everytime a new machine instance comes up; +these tests are run before any package specific or role specific test is run; +these tests should : +- not leave behind any state or content residue that might impact the package/role tests that come after + diff --git a/tests/0_lib/functions.sh b/tests/0_lib/functions.sh new file mode 100755 index 0000000..709b0cf --- /dev/null +++ b/tests/0_lib/functions.sh @@ -0,0 +1,269 @@ +#!/bin/bash + + +# Description: call this function whenever you need to log output (preferred to calling echo) +# Arguments: log string to display +function t_Log +{ + printf "[+] `date` -> $*\n" +} + +# Description: call this at the end of your script to assess the exit status +# Arguments: the exit status from whatever you want checked (ie, '$?') +function t_CheckExitStatus +{ + [ $1 -eq 0 ] && { t_Log "PASS"; return $PASS; } + + t_Log "FAIL" + exit $FAIL +} + +# Description: call this to perform yum-based installs of packages +# Arguments: a space separated list of package names to install. +function t_InstallPackage +{ + if [ "$centos_ver" -ge "8" ]; then + mkdir /var/cache/{dnf,yum,system-upgrade} + dnf makecache + fi + t_Log "Attempting yum install: $*" + /usr/bin/yum -y -d${YUMDEBUG} install "$@" + # TODO: add a hook here, to make sure all binary files have ldd run + # against them, and that there are no missing linker targets + t_CheckExitStatus $? +} + +# Description: call this to install packages without weak dependencies +# Arguments: a space separated list of package names to install +function t_InstallPackageMinimal +{ + t_Log "Installing packages: $@" + dnf --assumeyes --debuglevel ${YUMDEBUG} --setopt install_weak_deps=0 install $@ + t_CheckExitStatus $? +} + +# Description: call this to perform a yum-based removal of packages +# Arguments: a space separated list of package names to remove. +function t_RemovePackage +{ + t_Log "Attempting yum remove: $*" + /usr/bin/yum -y -d0 remove "$@" + t_CheckExitStatus $? +} + +# Description: call this to enable a module stream +# Arguments: the module:stream(s) to enable +function t_EnableModuleStream +{ + t_Log "Enabling module stream $@" + dnf --assumeyes --debuglevel ${YUMDEBUG} module enable $@ + t_CheckExitStatus $? +} + +# Description: call this to reset a module +# Arguments: the module(s) to reset +function t_ResetModule +{ + t_Log "Resetting module $@" + dnf --assumeyes --debuglevel ${YUMDEBUG} module reset $@ + t_CheckExitStatus $? +} + +# Description: call this to process a list of folders containing test scripts +# Arguments: a file handle from which to read the names of paths to process. +function t_Process +{ + exec 7< $@ + + while read -u 7 f + do + echo "Test: ${f}" + # skip files named readme or those that start with an _ + [[ "$(basename ${f})" =~ readme|^_ ]] && continue; + + # handy tip: chmod -x to disable individual test scripts. + [ -x ${f} ] && ${f} + + done + + return 0 +} + +# Description: check to see if one or more packages are installed +# return true if they're all installed, false if not. +# Arguments: one or more package names to check for. +function t_CheckDeps +{ + # TODO + + # success, all packages are installed + return 0 +} + +# Description: perform a service control and sleep for a few seconds to let +# the dust settle. Using this function avoids a race condition wherein +# subsequent tests execute (and typically fail) before a service has had a +# chance to fully start/open a network port etc. +# Call it with cycle instead of start, and it will stop+start +# handy, if you dont know the service might already be running +function t_ServiceControl +{ + if [ $2 = "cycle" ]; then + /sbin/service $1 stop > /dev/null 2>&1 + sleep 3 + /sbin/service $1 start + else + /sbin/service $1 $2 + fi + + # aaaand relax... + sleep 3 +} + +# Description: Get a package (rpm) release number +function t_GetPkgRel +{ + rpm -q --queryformat '%{RELEASE}' $1 +} + +# Description: return the distro release (returns 5 or 6 now) +function t_DistCheck +{ + rpm -q $(rpm -qf /etc/redhat-release) --queryformat '%{version}\n'|cut -f 1 -d '.' +} +# Additionally set distro release to $centos_ver +centos_ver=$(t_DistCheck) + +# Description: test if we are using CentOS Stream +function t_StreamCheck +{ + rpm -q centos-stream-release &> /dev/null && echo "yes" || echo "no" +} +# set stream variable +centos_stream=$(t_StreamCheck) + +# Description: skip test on a particular release +# Arguments: release, reason +function t_SkipRelease { + if [ $(rpm --eval %rhel) -eq $1 ]; then + t_Log "$2" + t_Log "SKIP" + exit 0 + fi +} + +# Description: skip test on everything except a particular release +# Arguments: release, reason +function t_SkipNotRelease { + if [ $(rpm --eval %rhel) -ne $1 ]; then + t_Log "$2" + t_Log "SKIP" + exit 0 + fi +} + +# Description: skip test on releases less than a particular release +# Arguments: release, reason +function t_SkipReleaseLessThan { + if [ $(rpm --eval %rhel) -lt $1 ]; then + t_Log "$2" + t_Log "SKIP" + exit 0 + fi +} + +# Description: skip test on releases greater than a particular release +# Arguments: release, reason +function t_SkipReleaseGreaterThan { + if [ $(rpm --eval %rhel) -gt $1 ]; then + t_Log "$2" + t_Log "SKIP" + exit 0 + fi +} + +# Description: Get a package (rpm) version number +function t_GetPkgVer +{ + rpm -q --queryformat '%{version}' $1 +} + +# Description: get the arch +function t_GetArch +{ + rpm -q kernel --queryformat '%{arch}\n' | head -n 1 +} + +# Set the arch +arch=$(t_GetArch) + +function t_CheckForPort +{ + while true + do + sleep 1 + >/dev/null 2>&1 >/dev/tcp/localhost/$1 + if [ "$?" = "0" ] ; then + t_Log "Waiting for tcp port $1 to be listening ..." + break + fi + done + +} + +function t_Assert +{ + $@ >/dev/null 2>&1 + t_CheckExitStatus $? +} + +function t_Assert_Equals +{ + [ $1 -eq $2 ] + t_CheckExitStatus $? +} +function t_Select_Alternative +{ + name=$1 + search=$2 + option=$(/bin/echo|/usr/sbin/alternatives --config "$name"|/bin/grep -E "$search"|/usr/bin/head -n1|sed 's/ .*//g;s/[^0-9]//g') + if [ -z "$option" ];then + t_Log "Option not found for altenative $search of $name" + t_CheckExitStatus 1 + fi + t_Log "Selecing alternative $option for $name--$search" + /bin/echo "$option"|/usr/sbin/alternatives --config "$name" >/dev/null 2>&1 +} + +# should help with sometimes commands triggering pager and waiting for user input +export PAGER=cat +export SYSTEMD_PAGER=cat + +export -f t_Log +export -f t_CheckExitStatus +export -f t_InstallPackage +export -f t_InstallPackageMinimal +export -f t_RemovePackage +export -f t_EnableModuleStream +export -f t_ResetModule +export -f t_Process +export -f t_CheckDeps +export -f t_ServiceControl +export -f t_SkipRelease +export -f t_SkipNotRelease +export -f t_SkipReleaseLessThan +export -f t_SkipReleaseGreaterThan +export -f t_GetPkgRel +export -f t_DistCheck +export -f t_GetPkgVer +export -f t_GetArch +export -f t_CheckForPort +export -f t_Assert +export -f t_Assert_Equals +export -f t_Select_Alternative +export centos_ver +export centos_stream +export arch +if [ -z "$CONTAINERTEST" ]; then + export CONTAINERTEST=0 +fi diff --git a/tests/0_lib/readme b/tests/0_lib/readme new file mode 100644 index 0000000..94657a8 --- /dev/null +++ b/tests/0_lib/readme @@ -0,0 +1,5 @@ +Put everything that is shared across all tests here. +Every file in this directory will get 'sourced' before tests are run +( which also means we can only ever really use Bash for stuff in here ) + +this readme file is ignored diff --git a/tests/p_abrt-cli/0-install_abrt-cli.sh b/tests/p_abrt-cli/0-install_abrt-cli.sh new file mode 100755 index 0000000..f24f446 --- /dev/null +++ b/tests/p_abrt-cli/0-install_abrt-cli.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Author: Matej Habrnal +# Christoph Galuschka + +if [[ $centos_ver == 7 ]] +then + t_InstallPackage abrt-cli expect curl python python-libs bc +else + echo "Skipped on CentOS 5 and CentOS 6" +fi diff --git a/tests/p_abrt-cli/10-abrt-cli-reporting-test.sh b/tests/p_abrt-cli/10-abrt-cli-reporting-test.sh new file mode 100644 index 0000000..df84dc6 --- /dev/null +++ b/tests/p_abrt-cli/10-abrt-cli-reporting-test.sh @@ -0,0 +1,207 @@ +#!/bin/bash +# Author: Matej Habrnal + +TEST_DIR="tests/p_abrt-cli" +source $TEST_DIR/_lib.sh +source $TEST_DIR/_CentOSBugTracker.conf + +t_Log "Running $0 - test reporting to CentOS Bug Tracker" + +# testing if bugs-test.centos.org is reachable for that test .. +curl --silent -I http://bugs-test.centos.org/my_view_page.php|grep -q "HTTP/1.1 200 OK" +if [ "$?" -ne "0" ];then + t_Log "Mantis test instance doesn't seem reachable ... SKIP" + exit 0 +fi + +# run only on centos 7 or greater +[[ $centos_ver -lt 7 ]] && exit 0 + + +conf_file="/etc/libreport/events/report_CentOSBugTracker.conf" +abrt_action_conf_file="/etc/abrt/abrt-action-save-package-data.conf" + +cat > /etc/libreport/events.d/test_event.conf << _EOF_ +EVENT=notify + touch /tmp/abrt-done +EVENT=notify-dup + touch /tmp/abrt-done +_EOF_ + +function wait_for_hooks() { + echo "Waiting for all hooks to end" + local c=0 + while [ ! -f "/tmp/abrt-done" ]; do + sleep 0.1 + let c=$c+1 + if [ $c -gt 3000 ]; then + echo "Timeout" + break + fi + done + t=$( echo "scale=2; $c/10" | bc ) + echo "Hooks ended in $t seconds" +} + +function get_crash_path() +{ + crash_PATH="$(abrt-cli list 2> /dev/null | grep Directory | awk '{ print $2 }' | tail -n1)" + + if [ ! -d "$crash_PATH" ]; then + echo "No crash dir generated, this shouldn't happen" + exit 1 + fi + echo "crash dir path: $crash_PATH" +} + +function check_prior_crashes() +{ + abrt-cli list 2> /dev/null >cli-list.log + count_of_crashes=`wc -l < cli-list.log` + rm -f cli-list.log + + if [[ $count_of_crashes != 0 ]]; then + echo "There are some existing crashes" + exit 1 + fi +} + +function generate_crash() +{ + echo "Generate crash" + sleep 1000 & + kill -SIGSEGV $! + sleep 3 +} + +function set_configuration() +{ + conf_file_original=`cat $conf_file` + abrt_action_conf_file_original=`cat $abrt_action_conf_file` + + cat > $conf_file << EOF +Mantisbt_MantisbtURL = $URL +Mantisbt_Login = $LOGIN +Mantisbt_Password = $PASSWORD +Mantisbt_SSLVerify = $SSLVERIFY +EOF + + cat > $abrt_action_conf_file << EOF +OpenGPGCheck = no +BlackList = nspluginwrapper, valgrind, strace, mono-core +ProcessUnpackaged = no +BlackListedPaths = /usr/share/doc/*, */example*, /usr/bin/nspluginviewer, /usr/lib/xulrunner-*/plugin-container +Interpreters = python2, python2.7, python, python3, python3.3, perl, perl5.16.2 +EOF +} + +function restore_configuration() +{ + echo $conf_file_original > $conf_file + echo $abrt_action_conf_file_original > $abrt_action_conf_file +} + +rlJournalStart + rlPhaseStartSetup + LANG="" + export LANG + + check_prior_crashes + + systemctl start abrtd + systemctl start abrt-ccpp + + orig_editor=`echo $EDITOR` + export EDITOR=cat + + TmpDir=$(mktemp -d) + cp $TEST_DIR/_expect $TmpDir/expect + cp $TEST_DIR/_expect_report $TmpDir/expect_report + + pushd $TmpDir + rlPhaseEnd + + rlPhaseStartTest "testing workflow" + generate_crash + get_crash_path + wait_for_hooks + + rlRun "./expect $crash_PATH &> abrt-cli.log" 0 "run abrt-cli report CRASH_DIR" + + rlAssertGrep "CentOS Bug Tracker User name:" abrt-cli.log + rlAssertGrep "CentOS Bug Tracker Password:" abrt-cli.log + + mv -fv abrt-cli.log p_abrt-cli-testing_workflow.log + rlPhaseEnd + + rlPhaseStartTest "create a new issue" + #set url, username and password + set_configuration + + echo "I am comment. abrt-cli testing" > $crash_PATH/comment + hash=`date +%s` + echo $hash > $crash_PATH/duphash + rlRun "./expect_report $crash_PATH &> abrt-cli.log" 0 "run report-cli -e report_CentOSBugTracker CRASH_DIR" + + rlAssertGrep "Checking for duplicates" abrt-cli.log + rlAssertGrep "Creating a new issue" abrt-cli.log + rlAssertGrep "Adding External URL to issue" abrt-cli.log + rlAssertNotGrep "Failed to create a new issue" abrt-cli.log + rlAssertNotGrep "504 Gateway Time-out" abrt-cli.log + + grep -q "504 Gateway Time-out" abrt-cli.log + if [ "$?" -eq "0" ];then + echo "!!! Server $URL respond with '504 Gateway Time-out' !!!" + fi + + #get issue id + issue_id=`grep "Status: new " abrt-cli.log | grep -e [0-9]* -o` + if [ "_$issue_id" == "_" ];then + echo "No ID of created issue" + else + echo "Created issue $issue_id" + fi + + mv -fv abrt-cli.log p_abrt-cli-created_new_issue.log + rlPhaseEnd + + rlPhaseStartTest "duplicate issue" + + rlRun "./expect_report $crash_PATH &> abrt-cli.log" 0 "run report-cli -e report_CentOSBugTracker CRASH_DIR" + + rlAssertGrep "Checking for duplicates" abrt-cli.log + rlAssertGrep "Bug is already reported:" abrt-cli.log + rlAssertGrep "Adding new comment to issue" abrt-cli.log + + mv -fv abrt-cli.log p_abrt-cli-duplicate_issue.log + rlPhaseEnd + + rlPhaseStartTest "check created issue" + + data="$LOGIN$PASSWORD$issue_id" + + curl --data "$data" -H "Content-Type:text/xml" $URL"/api/soap/mantisconnect.php" > curl.log + rlAssertGrep "\[abrt\]" curl.log + rlAssertGrep "I am comment. abrt-cli testing" curl.log + rlAssertGrep "AttachmentData\[[0-9]*\]" curl.log -e + rlAssertNotGrep "AttachmentData\[0\]" curl.log + rlAssertGrep "CustomFieldValueForIssueData\[[0-9]*\]" curl.log -e + rlAssertNotGrep "CustomFieldValueForIssueData\[0\]" curl.log + rlAssertGrep "IssueNoteData\[1\]\"" curl.log + + mv -fv curl.log p_abrt-cli-check_created_issue.log + rlPhaseEnd + + rlPhaseStartCleanup + restore_configuration + rlRun "abrt-cli remove $crash_PATH" 0 + rlBundleLogs #create test statistic + # copy all log to /tmp/ + cp -v p_abrt-cli*.log /tmp/ + popd # TmpDir + rm -rf $TmpDir + export EDITOR=$orig_editor + rm -f "/tmp/abrt-done" + rlPhaseEnd + rlJournalPrintText +rlJournalEnd diff --git a/tests/p_abrt-cli/5-abrt-cli-test.sh b/tests/p_abrt-cli/5-abrt-cli-test.sh new file mode 100755 index 0000000..b593dbf --- /dev/null +++ b/tests/p_abrt-cli/5-abrt-cli-test.sh @@ -0,0 +1,642 @@ +#!/bin/bash +# Description: Verify reporter-mantisbt functionality +# Author: Matej Habrnal +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2011 Red Hat, Inc. All rights reserved. +# +# 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 3 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +TEST_DIR="tests/p_abrt-cli" +source $TEST_DIR/_lib.sh + +t_Log "Running $0 - reporter-mantisbt test suite" + +# testing if bugs-test.centos.org is reachable for that test .. +curl --silent -I http://bugs-test.centos.org/my_view_page.php|grep -q "HTTP/1.1 200 OK" +if [ "$?" -ne "0" ];then + t_Log "Mantis test instance doesn't seem reachable ... SKIP" + exit 0 +fi + +# run only on centos 7 or greater +[[ $centos_ver -lt 7 ]] && exit + + +rlJournalStart + rlPhaseStartSetup + LANG="" + export LANG + + TmpDir=$(mktemp -d) + cp -R $TEST_DIR/queries/* $TmpDir + cp -R $TEST_DIR/problem_dir $TmpDir + cp $TEST_DIR/_pyserve $TmpDir/pyserve + cp $TEST_DIR/_mantisbt.conf $TmpDir/mantisbt.conf + cp $TEST_DIR/_mantisbt_format.conf $TmpDir/mantisbt_format.conf + cp $TEST_DIR/_mantisbt_formatdup.conf $TmpDir/mantisbt_formatdup.conf + cp $TEST_DIR/_attachment_file $TmpDir/attachment_file + pushd $TmpDir + rlPhaseEnd + + rlPhaseStartTest "sanity" + rlRun "reporter-mantisbt --help &> null" + rlRun "reporter-mantisbt --help 2>&1 | grep 'Usage:'" + rlPhaseEnd + + # search by duphash + # API new method for searching in MantisBT by duphas + rlPhaseStartTest "search by duphash" + ./pyserve \ + login_correct \ + search_two_issues &> server_log & + + sleep 1 + rlRun "reporter-mantisbt -vvv -h bbfe66399cc9cb8ba647414e33c5d1e4ad82b511 -c mantisbt.conf &> client_log" + kill %1 + + rlAssertGrep "test" server_log + rlAssertGrep "password" server_log + rlAssertGrep "" server_log + rlAssertGrep "abrt_hash" server_log + rlAssertGrep "bbfe66399cc9cb8ba647414e33c5d1e4ad82b511" server_log + + rlAssertGrep "" client_log + rlAssertGrep "2" client_log + rlAssertGrep "test" client_log + + rlAssertGrep "Looking for similar problems in CentOS Bug Tracker" client_log + rlAssertGrep "99" client_log + rlAssertGrep "99" client_log + + # not contain + rlAssertNotGrep "Status: new open http://localhost:12345/view.php?id=99" client_log + rlAssertNotGrep "323795" client_log + + rm -f problem_dir/reported_to + rlPhaseEnd + + # attach files to issue (parameter t, issue ID is specified) + rlPhaseStartTest "attach files to issue (issue ID is specified)" + ./pyserve \ + $QUERIES_DIR/login_correct \ + $QUERIES_DIR/project_get_id_from_name \ + $QUERIES_DIR/attachment \ + &> server_log & + sleep 1 + rlRun "reporter-mantisbt -vvv -c mantisbt.conf -F mantisbt_format.conf \ + -d problem_dir -t1 attachment_file &> client_log" + kill %1 + + # request + rlAssertGrep "test" server_log + + rlAssertGrep "" server_log + rlAssertGrep "1" server_log + rlAssertGrep "attachment_file" server_log + rlAssertGrep "U1NCaGJTQmhkSFJoWTJobFpDQTZLUW89Cg==" server_log + + # response + rlAssertGrep "" client_log + rlAssertGrep "2" client_log + rlAssertGrep "name xsi:type=\"xsd:string\">test" client_log + + rlAssertGrep "Attaching file 'attachment_file' to issue 1" client_log + rlAssertGrep "4" client_log + + # not contain + rlAssertNotGrep "Status: new open http://localhost:12345/view.php?id=99" client_log + rlAssertNotGrep "323795" client_log + + rm -f problem_dir/reported_to + rlPhaseEnd + + # attach files to issue (parameter -t, issue ID is not specified) + # API mc_issue_attachment_add + rlPhaseStartTest "attach files to issue (issue ID is not specified)" + ./pyserve \ + $QUERIES_DIR/login_correct \ + $QUERIES_DIR/project_get_id_from_name \ + $QUERIES_DIR/attachment \ + &> server_log & + + rlRun "echo \"CentOS Bug Tracker: URL=http://localhost:12345/mantisbt/view.php?id=1\" > problem_dir/reported_to" + + sleep 1 + rlRun "reporter-mantisbt -vvv -c mantisbt.conf -F mantisbt_format.conf -d problem_dir -t attachment_file &> client_log" + kill %1 + + # request + rlAssertGrep "" server_log + rlAssertGrep "1" server_log + rlAssertGrep "attachment_file" server_log + + # response + rlAssertGrep "" client_log + rlAssertGrep "2" client_log + rlAssertGrep "name xsi:type=\"xsd:string\">test" client_log + + rlAssertGrep "Attaching file 'attachment_file' to issue 1" client_log + rlAssertGrep "4" client_log + + # not contain + rlAssertNotGrep "Status: new open http://localhost:12345/view.php?id=99" client_log + rlAssertNotGrep "323795" client_log #dummy + + rm -f problem_dir/reported_to + rlPhaseEnd + + # force reporting even if this problem is already reported (parameter -f) + rlPhaseStartTest "force reporting" + ./pyserve \ + $QUERIES_DIR/login_correct \ + $QUERIES_DIR/project_get_id_from_name \ + $QUERIES_DIR/search_two_issues \ + $QUERIES_DIR/search_no_issue \ + $QUERIES_DIR/get_custom_fields \ + $QUERIES_DIR/create \ + $QUERIES_DIR/attachment \ + $QUERIES_DIR/attachment \ + &> server_log & + + # is reported + rlRun "echo \"CentOS Bug Tracker: URL=http://localhost:12345/mantisbt/view.php?id=1\" > problem_dir/reported_to" + + sleep 1 + rlRun "reporter-mantisbt -f -vvv -c mantisbt.conf -F mantisbt_format.conf -A mantisbt_formatdup.conf -d problem_dir >client_log 2>&1 " + kill %1 + + #request + rlAssertGrep "test" server_log + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "proj" server_log + rlAssertGrep "public" server_log + rlAssertGrep "666" server_log + rlAssertGrep "\[abrt\] : rxvt_term::selection_delimit_word(): Process /usr/bin/urxvtd was killed by signal 11 (SIGSEGV)" server_log + rlAssertGrep "" server_log + rlAssertGrep "backtrace" server_log + + rlAssertGrep "7" server_log + rlAssertGrep "backtrace" server_log + + #response + rlAssertGrep "" client_log + rlAssertGrep "2" client_log + rlAssertGrep "name xsi:type=\"xsd:string\">test" client_log + + rlAssertGrep "Checking for duplicates" client_log + rlAssertGrep "CentOS Bug Tracker has 2 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511' including cross-version ones" client_log + rlAssertGrep "" client_log + rlAssertGrep "Potential duplicate: issue 99" client_log + rlAssertGrep "CentOS Bug Tracker has 0 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511'" client_log + rlAssertGrep "" client_log + + rlAssertGrep "Creating a new issue" client_log + rlAssertGrep "7" client_log + + # not contain + rlAssertNotGrep "323795" client_log #dummy + + rm -f problem_dir/reported_to + rlPhaseEnd + + # create a new issue (only potential duplicate issues exist) + rlPhaseStartTest "create an issue (only potential duplicate issues exist)" + ./pyserve \ + $QUERIES_DIR/login_correct \ + $QUERIES_DIR/project_get_id_from_name \ + $QUERIES_DIR/search_two_issues \ + $QUERIES_DIR/search_no_issue \ + $QUERIES_DIR/get_custom_fields \ + $QUERIES_DIR/create \ + $QUERIES_DIR/attachment \ + $QUERIES_DIR/attachment \ + &> server_log & + + # is reported + rlRun "echo \"CentOS Bug Tracker: URL=http://localhost:12345/mantisbt/view.php?id=1\" > problem_dir/reported_to" + + sleep 1 + rlRun "reporter-mantisbt -f -vvv -c mantisbt.conf -F mantisbt_format.conf -A mantisbt_formatdup.conf -d problem_dir >client_log 2>&1 " + kill %1 + + #request + rlAssertGrep "test" server_log + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "proj" server_log + rlAssertGrep "public" server_log + rlAssertGrep "666" server_log + rlAssertGrep "\[abrt\] : rxvt_term::selection_delimit_word(): Process /usr/bin/urxvtd was killed by signal 11 (SIGSEGV)" server_log + rlAssertGrep "" server_log + rlAssertGrep "backtrace" server_log + + rlAssertGrep "7" server_log + rlAssertGrep "backtrace" server_log + + #response + rlAssertGrep "" client_log + rlAssertGrep "2" client_log + rlAssertGrep "name xsi:type=\"xsd:string\">test" client_log + + rlAssertGrep "Checking for duplicates" client_log + rlAssertGrep "CentOS Bug Tracker has 2 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511' including cross-version ones" client_log + rlAssertGrep "" client_log + rlAssertGrep "Potential duplicate: issue 99" client_log + rlAssertGrep "CentOS Bug Tracker has 0 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511'" client_log + rlAssertGrep "" client_log + + rlAssertGrep "Creating a new issue" client_log + rlAssertGrep "7" client_log + + rlAssertGrep "Status: new http://localhost:12345/view.php?id=7" client_log + + # not contain + rlAssertNotGrep "323795" client_log #dummy + + rm -f problem_dir/reported_to + rlPhaseEnd + + # create a new issue (no potential duplicate issues exist) + rlPhaseStartTest "create an issue (no potential duplicate issues exist)" + ./pyserve \ + $QUERIES_DIR/login_correct \ + $QUERIES_DIR/project_get_id_from_name \ + $QUERIES_DIR/search_no_issue \ + $QUERIES_DIR/get_custom_fields \ + $QUERIES_DIR/create \ + $QUERIES_DIR/attachment \ + $QUERIES_DIR/attachment \ + &> server_log & + + sleep 1 + rlRun "reporter-mantisbt -vvv -c mantisbt.conf -F mantisbt_format.conf -d problem_dir &> client_log" + kill %1 + + #request + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "" server_log + + #response + rlAssertGrep "" client_log + rlAssertGrep "2" client_log + rlAssertGrep "name xsi:type=\"xsd:string\">test" client_log + + rlAssertGrep "Checking for duplicates" client_log + rlAssertGrep "CentOS Bug Tracker has 0 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511' including cross-version ones" client_log + rlAssertGrep "" client_log + + # not contain + rlAssertNotGrep "CentOS Bug Tracker has 2 reports" client_log #not + + rlAssertGrep "Creating a new issue" client_log + rlAssertGrep "7" client_log + + rlAssertGrep "Status: new http://localhost:12345/view.php?id=7" client_log + rlAssertNotGrep "323795" client_log #dummy + + rm -f problem_dir/reported_to + rlPhaseEnd + + # duplicate issue exist (comment doesn't exist, not closed as duplicate) + rlPhaseStartTest "duplicate issue exist (comment doesn't exist)" + ./pyserve \ + $QUERIES_DIR/login_correct \ + $QUERIES_DIR/project_get_id_from_name \ + $QUERIES_DIR/search_two_issues \ + $QUERIES_DIR/search_one_issue \ + $QUERIES_DIR/get_issue \ + &> server_log & + + rlRun "rm -f problem_dir/comment" + + sleep 1 + rlRun "reporter-mantisbt -vvv -c mantisbt.conf -F mantisbt_format.conf -A mantisbt_formatdup.conf -d problem_dir &> client_log" + kill %1 + + # request + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "99" server_log + + # response + rlAssertGrep "" client_log + rlAssertGrep "2" client_log + rlAssertGrep "name xsi:type=\"xsd:string\">test" client_log + + rlAssertGrep "Checking for duplicates" client_log + rlAssertGrep "CentOS Bug Tracker has 2 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511' including cross-version ones" client_log + rlAssertGrep "" client_log + rlAssertGrep "CentOS Bug Tracker has 1 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511'" client_log + rlAssertNotGrep "" client_log #not + + rlAssertGrep "99" client_log + rlAssertGrep "new" client_log + rlAssertGrep "Bug is already reported: 99" client_log + + rlAssertGrep "Status: new open http://localhost:12345/view.php?id=99" client_log + + # not contain + rlAssertNotGrep "323795" client_log #dummy + + rm -f problem_dir/reported_to + rlPhaseEnd + + # duplicate issue exist (comment doesn't exist, closed as duplicate) + rlPhaseStartTest "duplicate issue exist (comment doesn't exist)" + ./pyserve \ + $QUERIES_DIR/login_correct \ + $QUERIES_DIR/project_get_id_from_name \ + $QUERIES_DIR/search_two_issues \ + $QUERIES_DIR/search_one_issue \ + $QUERIES_DIR/get_issue_closed_as_duplicate \ + $QUERIES_DIR/get_issue \ + &> server_log & + + sleep 1 + rlRun "reporter-mantisbt -vvv -c mantisbt.conf -F mantisbt_format.conf -A mantisbt_formatdup.conf -d problem_dir &> client_log" + kill %1 + + # request + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "99" server_log + + # response + rlAssertGrep "" client_log + rlAssertGrep "2" client_log + rlAssertGrep "name xsi:type=\"xsd:string\">test" client_log + + rlAssertGrep "Checking for duplicates" client_log + rlAssertGrep "CentOS Bug Tracker has 2 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511' including cross-version ones" client_log + rlAssertGrep "" client_log + rlAssertGrep "CentOS Bug Tracker has 1 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511'" client_log + + # not contain + rlAssertNotGrep "" client_log + + rlAssertGrep "99" client_log + rlAssertGrep "new" client_log + rlAssertGrep "duplicate" client_log + rlAssertGrep "Bug is already reported: 99" client_log + rlAssertGrep "Issue 99 is a duplicate, using parent issue 101" client_log + + rlAssertGrep "Status: new open http://localhost:12345/view.php?id=101" client_log + # not contain + rlAssertNotGrep "Status: new open http://localhost:12345/view.php?id=99" client_log + rlAssertNotGrep "323795" client_log #dummy + + rm -f problem_dir/reported_to + rm -f problem_dir/comment + + rlPhaseEnd + + # duplicate issue exist (comment file exists, isn't duplicate, attach backtrace) + rlPhaseStartTest "duplicate issue exist (comment file exists, isn't duplicate, attach backtrace)" + ./pyserve \ + $QUERIES_DIR/login_correct \ + $QUERIES_DIR/project_get_id_from_name \ + $QUERIES_DIR/search_two_issues \ + $QUERIES_DIR/search_one_issue \ + $QUERIES_DIR/get_issue \ + $QUERIES_DIR/add_note \ + $QUERIES_DIR/attachment \ + &> server_log & + + # create a comment file + rlRun "echo \"i am comment\" > problem_dir/comment" + + sleep 1 + rlRun "reporter-mantisbt -vvv -c mantisbt.conf -F mantisbt_format.conf -A mantisbt_formatdup.conf -d problem_dir &> client_log" + kill %1 + + # request + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "99" server_log + rlAssertGrep "" server_log + rlAssertGrep "" server_log + + # response + rlAssertGrep "" client_log + rlAssertGrep "2" client_log + rlAssertGrep "name xsi:type=\"xsd:string\">test" client_log + + rlAssertGrep "Checking for duplicates" client_log + rlAssertGrep "CentOS Bug Tracker has 2 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511' including cross-version ones" client_log + rlAssertGrep "" client_log + rlAssertGrep "CentOS Bug Tracker has 1 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511'" client_log + rlAssertNotGrep "" client_log #not + + rlAssertGrep "99" client_log + rlAssertGrep "new" client_log + rlAssertGrep "Bug is already reported: 99" client_log + rlAssertGrep "Adding new comment to issue 99" client_log + rlAssertGrep "Attaching better backtrace" client_log + rlAssertGrep "5" client_log + rlAssertGrep "4" client_log + + rlAssertGrep "Status: new open http://localhost:12345/view.php?id=99" client_log + + # not contain + rlAssertNotGrep "323795" client_log #dummy + + rm -f problem_dir/reported_to + rm -f problem_dir/comment + rlPhaseEnd + + # duplicate issue exist (comment file exists, is duplicate) + rlPhaseStartTest "duplicate issue exist (comment file exists, is duplicate)" + ./pyserve \ + $QUERIES_DIR/login_correct \ + $QUERIES_DIR/project_get_id_from_name \ + $QUERIES_DIR/search_two_issues \ + $QUERIES_DIR/search_one_issue \ + $QUERIES_DIR/get_issue_dup_comment_rating_1 \ + &> server_log & + + # create a comment file + rlRun "echo \"i am comment\" > problem_dir/comment" + + sleep 1 + rlRun "reporter-mantisbt -vvv -c mantisbt.conf -F mantisbt_format.conf -A mantisbt_formatdup.conf -d problem_dir &> client_log" + kill %1 + + # request + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "99" server_log + + # response + rlAssertGrep "" client_log + rlAssertGrep "2" client_log + rlAssertGrep "name xsi:type=\"xsd:string\">test" client_log + + rlAssertGrep "Checking for duplicates" client_log + rlAssertGrep "CentOS Bug Tracker has 2 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511' including cross-version ones" client_log + rlAssertGrep "" client_log + rlAssertGrep "CentOS Bug Tracker has 1 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511'" client_log + + # not contain + rlAssertNotGrep "" client_log + + rlAssertGrep "99" client_log + rlAssertGrep "new" client_log + rlAssertGrep "Bug is already reported: 99" client_log + rlAssertGrep "Found the same comment in the issue history, not adding a new one" client_log + + # not contain + rlAssertNotGrep "5" client_log + rlAssertNotGrep "4" client_log + + rlAssertGrep "Status: new open http://localhost:12345/view.php?id=99" client_log + rlAssertNotGrep "323795" client_log #dummy + + rm -f problem_dir/reported_to + rm -f problem_dir/comment + rlPhaseEnd + + rlPhaseStartTest "duplicate issue exist (comment file exists, isn't duplicate, the same backtrace rating)" + ./pyserve \ + $QUERIES_DIR/login_correct \ + $QUERIES_DIR/project_get_id_from_name \ + $QUERIES_DIR/search_two_issues \ + $QUERIES_DIR/search_one_issue \ + $QUERIES_DIR/get_issue_comment_rating_1 \ + $QUERIES_DIR/add_note \ + &> server_log & + + # create a comment file + rlRun "echo \"i am comment\" > problem_dir/comment" + + sleep 1 + rlRun "reporter-mantisbt -vvv -c mantisbt.conf -F mantisbt_format.conf -A mantisbt_formatdup.conf -d problem_dir &> client_log" + kill %1 + + # request + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "99" server_log + rlAssertGrep "" server_log + + #not contain + rlAssertNotGrep "" server_log + + # response + rlAssertGrep "" client_log + rlAssertGrep "2" client_log + rlAssertGrep "name xsi:type=\"xsd:string\">test" client_log + + rlAssertGrep "Checking for duplicates" client_log + rlAssertGrep "CentOS Bug Tracker has 2 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511' including cross-version ones" client_log + rlAssertGrep "" client_log + rlAssertGrep "CentOS Bug Tracker has 1 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511'" client_log + rlAssertGrep "Status: new open http://localhost:12345/view.php?id=99" client_log + + + rlAssertGrep "99" client_log + rlAssertGrep "new" client_log + rlAssertGrep "Bug is already reported: 99" client_log + rlAssertGrep "5" client_log + rlAssertGrep "Adding new comment to issue 99" client_log + + # not contain + rlAssertNotGrep "" client_log + rlAssertNotGrep "Attaching better backtrace" client_log + rlAsserNottGrep "Found the same comment in the issue history, not adding a new one" client_log + rlAssertNotGrep "4" client_log + rlAssertNotGrep "323795" client_log #dummy + + + rm -f problem_dir/reported_to + rm -f problem_dir/comment + rlPhaseEnd + + rlPhaseStartTest "duplicate issue exist (comment file exists, isn't duplicate, better backtrace rating)" + ./pyserve \ + $QUERIES_DIR/login_correct \ + $QUERIES_DIR/project_get_id_from_name \ + $QUERIES_DIR/search_two_issues \ + $QUERIES_DIR/search_one_issue \ + $QUERIES_DIR/get_issue_comment_rating_1 \ + $QUERIES_DIR/add_note \ + $QUERIES_DIR/attachment \ + &> server_log & + + # create a comment file + rlRun "echo \"i am comment\" > problem_dir/comment" + rlRun "echo \"5\" > problem_dir/backtrace_rating" + + sleep 1 + rlRun "reporter-mantisbt -vvv -c mantisbt.conf -F mantisbt_format.conf -A mantisbt_formatdup.conf -d problem_dir &> client_log" + kill %1 + + # request + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "" server_log + rlAssertGrep "99" server_log + rlAssertGrep "" server_log + rlAssertGrep "" server_log + + # response + rlAssertGrep "" client_log + rlAssertGrep "2" client_log + rlAssertGrep "name xsi:type=\"xsd:string\">test" client_log + + rlAssertGrep "Checking for duplicates" client_log + rlAssertGrep "CentOS Bug Tracker has 2 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511' including cross-version ones" client_log + rlAssertGrep "" client_log + + # not contain + rlAssertGrep "CentOS Bug Tracker has 1 reports with duphash 'bbfe66399cc9cb8ba647414e33c5d1e4ad82b511'" client_log + rlAssertNotGrep "" client_log + + rlAssertGrep "99" client_log + rlAssertGrep "new" client_log + rlAssertGrep "Bug is already reported: 99" client_log + rlAssertGrep "5" client_log + rlAssertGrep "Adding new comment to issue 99" client_log + rlAssertGrep "Attaching better backtrace" client_log + rlAssertGrep "4" client_log + + rlAssertGrep "Status: new open http://localhost:12345/view.php?id=99" client_log + + # not contain + rlAsserNottGrep "Found the same comment in the issue history, not adding a new one" client_log + rlAssertNotGrep "323795" client_log #dummy + + rm -f problem_dir/reported_to + rm -f problem_dir/comment + rlRun "echo \"1\" > problem_dir/backtrace_rating" + rlPhaseEnd + + rlPhaseStartCleanup + rlBundleLogs abrt server* client* + popd # TmpDir + rm -rf $TmpDir + rlPhaseEnd + rlJournalPrintText +rlJournalEnd diff --git a/tests/p_abrt-cli/_CentOSBugTracker.conf b/tests/p_abrt-cli/_CentOSBugTracker.conf new file mode 100644 index 0000000..7593ae3 --- /dev/null +++ b/tests/p_abrt-cli/_CentOSBugTracker.conf @@ -0,0 +1,4 @@ +URL=http://bugs-test.centos.org +LOGIN=abrtuser +PASSWORD=abrttestpass +SSLVERIFY=no diff --git a/tests/p_abrt-cli/_attachment_file b/tests/p_abrt-cli/_attachment_file new file mode 100644 index 0000000..7beed84 --- /dev/null +++ b/tests/p_abrt-cli/_attachment_file @@ -0,0 +1 @@ +SSBhbSBhdHRhY2hlZCA6KQo= diff --git a/tests/p_abrt-cli/_expect b/tests/p_abrt-cli/_expect new file mode 100755 index 0000000..da5b382 --- /dev/null +++ b/tests/p_abrt-cli/_expect @@ -0,0 +1,49 @@ +#!/usr/bin/expect -f + +set dir [lindex $argv 0] + +spawn abrt-cli report $dir + +set timeout 10 +set workflow_no 3 + +# timeout handler +proc itstime {args} { + puts "!! expect timeout !!" + exit 1 +} + +while {1} { + expect { + + eof {break} + + timeout { itstime } + + -regexp {[[:space:]]+([[:digit:]]+)[[:space:]]+Report to CentOS Bug Tracker} { + set workflow_no $expect_out(1,string) + } + + "Ok to upload core dump? (It may contain sensitive data)." { + send "N\n" + } + "This problem was already reported to CentOS Bug Tracker" { + send "y\n" + } + -re "Downloading.*Continue?.*" { + send "N\n" + } + "CentOS Bug Tracker Password" { + send "\n" + } + "CentOS Bug Tracker User name" { + send "\n" + } + "CentOS Bug Tracker CentOS Bug Tracker project" { + send "\n" + } + "Select a workflow to run" { + send "$workflow_no\n" + } + } +} diff --git a/tests/p_abrt-cli/_expect_report b/tests/p_abrt-cli/_expect_report new file mode 100755 index 0000000..da2b81c --- /dev/null +++ b/tests/p_abrt-cli/_expect_report @@ -0,0 +1,46 @@ +#!/usr/bin/expect -f + +set dir [lindex $argv 0] + +spawn report-cli -e report_CentOSBugTracker -vvv $dir + +set timeout 100 +set workflow_no 3 + +# timeout handler +proc itstime {args} { + puts "!! expect timeout !!" + exit 1 +} + +while {1} { + expect { + + eof {break} + + timeout { itstime } + + -regexp {[[:space:]]+([[:digit:]]+)[[:space:]]+Report to CentOS Bug Tracker} { + set workflow_no $expect_out(1,string) + } + + "Ok to upload core dump? (It may contain sensitive data)." { + send "N\n" + } + "This problem was already reported to CentOS Bug Tracker" { + send "y\n" + } + -re "Downloading.*Continue?.*" { + send "N\n" + } + "CentOS Bug Tracker Password" { + send "aaa\n" + } + "CentOS Bug Tracker User name" { + send "aaa\n" + } + "Select a workflow to run" { + send "$workflow_no\n" + } + } +} diff --git a/tests/p_abrt-cli/_lib.sh b/tests/p_abrt-cli/_lib.sh new file mode 100755 index 0000000..6e3fddb --- /dev/null +++ b/tests/p_abrt-cli/_lib.sh @@ -0,0 +1,163 @@ +#!/bin/bash +# Author: Matej Habrnal + +LOG_FILE=test.log +LOG_SEPARATOR='----------------------------------------------------' + +QUERIES_DIR="." + +function createSeparator +{ + sep="$LOG_SEPARATOR\n" + sep+="$1" + sep+="\n" + sep+="$LOG_SEPARATOR\n" +} + +function log +{ + echo -e "$1" + echo -e "$1" >> $LOG_FILE +} + +function logWithSeparator +{ + createSeparator "$1" + log "$sep" +} + +# logResult returnCode message +function logResult +{ + if [[ $1 == 0 ]]; then + log "PASS : $2\n" + else + log "FAIL : $2\n" + fi +} + +function rlJournalStart +{ + return 0 +} + +function rlPhaseStartSetup +{ + return 0 +} + +function rlPhaseStartTest +{ + logWithSeparator "$1" +} + +function rlPhaseEnd +{ +#logWithSeparator "rlPhaseEnd" + return 0 +} + +function rlRun +{ + local command=$1 + local expected_orig=${2:-0} + local expected=${2:-0} + local comment + local comment_begin + if [[ -z "$3" ]]; then + comment_begin="Running '$command'" + comment="Command '$command'" + else + comment_begin="$3 :: actually running '$command'" + comment="$3" + fi + + echo "$comment_begin" "BEGIN" + + eval "$command" + local exitcode=$? + + echo "rlRun: command = '$command'; exitcode = $exitcode; expected = $expected" + if [[ $exitcode == $expected ]]; then + retval=0 + else + retval=1 + fi + + logResult $retval "$command" + return $retval +} + +function rlAssertGrep +{ + if [ ! -e "$2" ] ; then + echo "rlAssertGrep: failed to find file $2" + return 2 + fi + local options=${3:--q} + grep $options "$1" "$2" + + local exitcode=$? + command="File '$2' should contain '$1'" + echo $command + + logResult $exitcode "$command" + return $exitcode +} + +function rlAssertNotGrep +{ + if [ ! -e "$2" ] ; then + echo "rlAssertGrep: failed to find file $2" + return 2 + fi + local options=${3:--q} + grep $options "$1" "$2" + + local exitcode=$? + if [ $exitcode == 0 ]; then + exitcode=1 + else + exitcode=0 + fi + + command="File '$2' should not contain '$1'" + echo $command + + logResult $exitcode "$command" + return $exitcode +} + +function rlPhaseStartCleanup +{ + logWithSeparator "rlPhaseStartCleanup" +} + +function rlBundleLogs +{ + local pass_count=`grep 'PASS' $LOG_FILE | wc -l` + local fail_count=`grep 'FAIL' $LOG_FILE | wc -l` + + log $LOG_SEPARATOR + log "TEST STATUS" + log "PASS: $pass_count" + log "FAIL: $fail_count" + log "TOTAL: $(( $pass_count + $fail_count))" + log $LOG_SEPARATOR + + if [[ $fail_count == 0 ]]; then + test_return_value=0 + else + test_return_value=1 + fi +} + +function rlJournalPrintText +{ + return 0 +} + +function rlJournalEnd +{ + t_CheckExitStatus $test_return_value +} diff --git a/tests/p_abrt-cli/_mantisbt.conf b/tests/p_abrt-cli/_mantisbt.conf new file mode 100644 index 0000000..058af36 --- /dev/null +++ b/tests/p_abrt-cli/_mantisbt.conf @@ -0,0 +1,11 @@ +# MantisBT URL +MantisbtURL = http://localhost:12345 +# yes means that ssl certificates will be checked +SSLVerify = no +# your login has to exist, if you don have any, please create one +Login = test +# your password +Password = password + +Project = proj +ProjectVersion = 666 diff --git a/tests/p_abrt-cli/_mantisbt_format.conf b/tests/p_abrt-cli/_mantisbt_format.conf new file mode 100644 index 0000000..52e29c8 --- /dev/null +++ b/tests/p_abrt-cli/_mantisbt_format.conf @@ -0,0 +1,58 @@ +# Lines starting with # are ignored. +# Lines can be continued on the next line using trailing backslash. +# +# Format: +# %summary:: summary format +# section:: element1[,element2]... +# The literal text line to be added to Bugzilla comment. Can be empty. +# (IOW: empty lines are NOT ignored!) +# +# Summary format is a line of text, where %element% is replaced by +# text element's content, and [[...%element%...]] block is used only if +# %element% exists. [[...]] blocks can nest. +# +# Sections can be: +# - %summary: bug summary format string. +# - %attach: a list of elements to attach. +# - text, double colon (::) and the list of comma-separated elements. +# Text can be empty (":: elem1, elem2, elem3" works), +# in this case "Text:" header line will be omitted. +# +# Elements can be: +# - problem directory element names, which get formatted as +# : +# or +# : +# : +# : +# : +# - problem directory element names prefixed by "%bare_", +# which is formatted as-is, without ":" and colons +# - %oneline, %multiline, %text wildcards, which select all corresponding +# elements for output or attachment +# - %binary wildcard, valid only for %attach section, instructs to attach +# binary elements +# - problem directory element names prefixed by "-", +# which excludes given element from all wildcards +# +# Nonexistent elements are silently ignored. +# If none of elements exists, the section will not be created. + +%summary:: [abrt] %pkg_name%[[: %crash_function%()]][[: %reason%]][[: TAINTED %tainted_short%]] + +Description of problem:: %bare_comment + +Version-Release number of selected component:: %bare_package + +Truncated backtrace:: %bare_%short_backtrace + +%Additional info:: +:: -pkg_arch,-pkg_epoch,-pkg_name,-pkg_release,-pkg_version,\ + >--->----component,-architecture,\ + >----analyzer,-count,-duphash,-uuid,-abrt_version,\ + >----username,-hostname,-os_release,-os_info,\ + >----time,-pid,-pwd,-last_occurrence,-ureports_counter,\ + >---%reporter,\ + >---%oneline + +%attach:: backtrace, maps diff --git a/tests/p_abrt-cli/_mantisbt_formatdup.conf b/tests/p_abrt-cli/_mantisbt_formatdup.conf new file mode 100644 index 0000000..98345a0 --- /dev/null +++ b/tests/p_abrt-cli/_mantisbt_formatdup.conf @@ -0,0 +1,64 @@ +# Lines starting with # are ignored. +# Lines can be continued on the next line using trailing backslash. +# +# Format: +# %summary:: summary format +# section:: element1[,element2]... +# The literal text line to be added to Bugzilla comment. Can be empty. +# (IOW: empty lines are NOT ignored!) +# +# Summary format is a line of text, where %element% is replaced by +# text element's content, and [[...%element%...]] block is used only if +# %element% exists. [[...]] blocks can nest. +# +# Sections can be: +# - %summary: bug summary format string. +# - %attach: a list of elements to attach. +# - text, double colon (::) and the list of comma-separated elements. +# Text can be empty (":: elem1, elem2, elem3" works), +# in this case "Text:" header line will be omitted. +# +# Elements can be: +# - problem directory element names, which get formatted as +# : +# or +# : +# : +# : +# : +# - problem directory element names prefixed by "%bare_", +# which is formatted as-is, without ":" and colons +# - %oneline, %multiline, %text wildcards, which select all corresponding +# elements for output or attachment +# - %binary wildcard, valid only for %attach section, instructs to attach +# binary elements +# - problem directory element names prefixed by "-", +# which excludes given element from all wildcards +# +# Nonexistent elements are silently ignored. +# If none of elements exists, the section will not be created. + +# When we add a comment to an existing BZ, %summary is ignored +# (it specifies *new bug* summary field): +# %summary:: blah blah + +# When dup is detected, BZ reporter adds a comment to it. +# This comment may interrupt an ongoing conversation in the BZ. +# (Three people independently filed a bug against abrt about this). +# Need to clearly explain what this comment is, to prevent confusion. +# Hopefully, this line would suffice: +Another user experienced a similar problem: + +# If user filled out comment field, show it: +:: %bare_comment + +# var_log_messages has too much variance (time/date), +# we exclude it from message so that dup message elimination has more chances to work +:: \ + -pkg_arch,-pkg_epoch,-pkg_name,-pkg_release,-pkg_version,\ + -component,-architecture,\ + -analyzer,-count,-duphash,-uuid,-abrt_version,\ + -username,-hostname,-os_release,-os_info,\ + -time,-pid,-pwd,-last_occurrence,-ureports_counter,\ + -var_log_messages,\ + %oneline diff --git a/tests/p_abrt-cli/_pyserve b/tests/p_abrt-cli/_pyserve new file mode 100755 index 0000000..dd71ae0 --- /dev/null +++ b/tests/p_abrt-cli/_pyserve @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# Single purpose HTTP server +# - serves files specified as arguments in order of appearance + + +import os +import sys +import BaseHTTPServer +#from pprint import pprint + +class Handler(BaseHTTPServer.BaseHTTPRequestHandler): + def do_POST(self): + + print self.rfile.read(int(self.headers.getheader('content-length'))) + + response = self.dummy_response + if not self.filelist: + print 'No more files to serve - sending dummy response' + sys.stdout.flush() + else: + response = self.filelist.pop() + self.reply(response) + + def reply(self, response): + try: + #redirect stdout to client + stdout = sys.stdout + sys.stdout = self.wfile + print response + stdout.flush() + finally: + sys.stdout = stdout # restore + pass + +PORT = 12345 +print "Serving at port", PORT +sys.stdout.flush() + +filelist = [] +for file in sys.argv[1:]: + if os.path.isfile(file): + print "Adding file %s" % file + sys.stdout.flush() + with open(file) as f: + filelist.append(f.read()) + +filelist.reverse() +Handler.filelist = filelist +Handler.dummy_response = open("dummy", "r").read() +httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler) +httpd.serve_forever() diff --git a/tests/p_abrt-cli/problem_dir/analyzer b/tests/p_abrt-cli/problem_dir/analyzer new file mode 100644 index 0000000..1ab966f --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/analyzer @@ -0,0 +1 @@ +CCpp \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/architecture b/tests/p_abrt-cli/problem_dir/architecture new file mode 100644 index 0000000..8790996 --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/architecture @@ -0,0 +1 @@ +x86_64 \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/backtrace b/tests/p_abrt-cli/problem_dir/backtrace new file mode 100644 index 0000000..2352266 --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/backtrace @@ -0,0 +1,305 @@ +[New LWP 10303] +warning: File "/usr/lib64/perl5/CORE/libperl.so" has a different build-id, file skipped +Missing separate debuginfo for /usr/lib64/freetype-freeworld/libfreetype.so.6 +Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/32/e3c32575e6fd2a16d5db151377c140c1130f3e +Missing separate debuginfo for +Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/3a/8fe6cb0063d56fc9be76ecd085c05f1b8a76e6 +warning: File "/usr/lib64/perl5/CORE/libperl.so" has a different build-id, file skipped +warning: the debug information found in "/usr/lib/debug//usr/lib64/perl5/CORE/libperl.so.debug" does not match "/usr/lib64/perl5/CORE/libperl.so" (CRC mismatch). + +warning: the debug information found in "/usr/lib/debug/usr/lib64/perl5/CORE/libperl.so.debug" does not match "/usr/lib64/perl5/CORE/libperl.so" (CRC mismatch). + +[Thread debugging using libthread_db enabled] +Core was generated by `urxvtd -q -o -f'. +Program terminated with signal 11, Segmentation fault. +#0 0x0000000000420240 in rxvt_term::selection_delimit_word (this=0x12e7ee0, dirn=DN, mark=, ret=0x12e8154) at screen.C:3047 +3047 stp = ROW(row).t + col; w1 = DELIMIT_TEXT (*stp); + +Thread 1 (Thread 0x7f7badf717e0 (LWP 10303)): +#0 0x0000000000420240 in rxvt_term::selection_delimit_word (this=0x12e7ee0, dirn=DN, mark=, ret=0x12e8154) at screen.C:3047 + tcol = + w2 = + col = + stp = 0x56 + row = 44 + dirnadd = 1 + trow = + w1 = + bound = {row = 44, col = 139} +#1 0x00000000004209ec in rxvt_term::selection_extend_colrow (this=0x12e7ee0, col=, row=, button3=, buttonpress=, clickchange=) at screen.C:3279 + pos = + closeto = rxvt_term::RIGHT +#2 0x000000000040f368 in rxvt_term::button_press (this=0x12e7ee0, ev=...) at command.C:1938 + reportmode = 0 + clickintime = +#3 0x000000000041148b in rxvt_term::x_cb (this=0x12e7ee0, ev=...) at command.C:1365 + dpy = 0x10f1800 + unused_root = 228704954805 + unused_root_y = 17775536 + unused_mask = 0 + unused_child = 30064771104 + unused_root_x = -1 +#4 0x0000000000429c8a in call (a1=..., this=) at ./callback.h:83 +No locals. +#5 rxvt_display::flush_cb (this=0x10f15f0, w=..., revents=) at rxvttoolkit.C:585 + i = 4 + xev = {type = 4, xany = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124}, xkey = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, root = 199, subwindow = 0, time = 149820128, x = 400, y = 755, x_root = 407, y_root = 786, state = 1, keycode = 1, same_screen = 1}, xbutton = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, root = 199, subwindow = 0, time = 149820128, x = 400, y = 755, x_root = 407, y_root = 786, state = 1, button = 1, same_screen = 1}, xmotion = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, root = 199, subwindow = 0, time = 149820128, x = 400, y = 755, x_root = 407, y_root = 786, state = 1, is_hint = 1 '\001', same_screen = 1}, xcrossing = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, root = 199, subwindow = 0, time = 149820128, x = 400, y = 755, x_root = 407, y_root = 786, mode = 1, detail = 1, same_screen = 1, focus = -1162223360, state = 3132743936}, xfocus = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, mode = 199, detail = 0}, xexpose = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, x = 199, y = 0, width = 0, height = 0, count = 149820128}, xgraphicsexpose = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, drawable = 27263124, x = 199, y = 0, width = 0, height = 0, count = 149820128, major_code = 0, minor_code = 400}, xnoexpose = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, drawable = 27263124, major_code = 199, minor_code = 0}, xvisibility = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, state = 199}, xcreatewindow = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, parent = 27263124, window = 199, x = 0, y = 0, width = 149820128, height = 0, border_width = 400, override_redirect = 755}, xdestroywindow = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, event = 27263124, window = 199}, xunmap = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, event = 27263124, window = 199, from_configure = 0}, xmap = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, event = 27263124, window = 199, override_redirect = 0}, xmaprequest = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, parent = 27263124, window = 199}, xreparent = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, event = 27263124, window = 199, parent = 0, x = 149820128, y = 0, override_redirect = 400}, xconfigure = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, event = 27263124, window = 199, x = 0, y = 0, width = 149820128, height = 0, border_width = 400, above = 3375844295063, override_redirect = 1}, xgravity = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, event = 27263124, window = 199, x = 0, y = 0}, xresizerequest = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, width = 199, height = 0}, xconfigurerequest = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, parent = 27263124, window = 199, x = 0, y = 0, width = 149820128, height = 0, border_width = 400, above = 3375844295063, detail = 1, value_mask = 13455032751862317057}, xcirculate = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, event = 27263124, window = 199, place = 0}, xcirculaterequest = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, parent = 27263124, window = 199, place = 0}, xproperty = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, atom = 199, time = 0, state = 149820128}, xselectionclear = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, selection = 199, time = 0}, xselectionrequest = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, owner = 27263124, requestor = 199, selection = 0, target = 149820128, property = 3242700308880, time = 3375844295063}, xselection = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, requestor = 27263124, selection = 199, target = 0, property = 149820128, time = 3242700308880}, xcolormap = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, colormap = 199, c_new = 0, state = 0}, xclient = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, message_type = 199, format = 0, data = {b = "\340\022\356\b\000\000\000\000\220\001\000\000\363\002\000\000\227\001\000", s = {4832, 2286, 0, 0, 400, 0, 755, 0, 407, 0}, l = {149820128, 3242700308880, 3375844295063, 4294967297, -4991711321847234559}}}, xmapping = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, request = 199, first_keycode = 0, count = 0}, xerror = {type = 4, display = 0x8446, resourceid = 13310917563786461184, serial = 17766400, error_code = 148 '\224', request_code = 0 '\000', minor_code = 160 '\240'}, xkeymap = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, window = 27263124, key_vector = "\307", '\000' "\340, \022\356\b\000\000\000\000\220\001\000\000\363\002\000"}, xgeneric = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, extension = 27263124, evtype = 0}, xcookie = {type = 4, serial = 33862, send_event = 0, display = 0x10f1800, extension = 27263124, evtype = 0, cookie = 199, data = 0x0}, pad = {227633266692, 33862, -5135826509923090432, 17766400, 27263124, 199, 0, 149820128, 3242700308880, 3375844295063, 4294967297, -4991711321847234559, -4991711318714490624, -4991711318714490624, -4991711318714490624, -4919653724659785472, -4919653724659785472, -4919653724659785472, -4919653724659785472, -4847596130605080320, -4775538536550375168, -4703480942495670016, -4631423348440964864, -9170770298910613248}} +#6 0x000000000042cf04 in ev_invoke_pending () at ../libev/ev.c:2117 + p = +#7 0x000000000042e233 in ev_run (flags=0) at ../libev/ev.c:2392 +No locals. +#8 0x000000000040920c in main (argc=, argv=) at rxvtd.C:302 + opt_fork = 1 '\001' + pid = + opt_opendisplay = 1 '\001' + opt_quiet = 1 '\001' + opt_lock = 0 '\000' + sockname = + l = {fd = 7, accept_ev = {> = { = {active = 1, pending = 0, data = 0x7fff728dca10, cb = 0x409f00 ::method_thunk(ev_io*, int)>, next = 0x0, fd = 7, events = 1}, }, }} +warning: File "/usr/lib64/perl5/CORE/libperl.so" has a different build-id, file skipped +From To Syms Read Shared Object Library +0x0000003b7b005d90 0x0000003b7b01f7fc Yes /usr/lib64/libfontconfig.so.1.4.4 +0x0000003b7b4040c0 0x0000003b7b410c3c Yes /usr/lib64/libXft.so.2.2.0 +0x0000003541e01910 0x0000003541e0810c Yes /usr/lib64/libXrender.so.1.3.0 +0x000000353fa1dce0 0x000000353faa97ec Yes /usr/lib64/libX11.so.6.3.0 +0x00000035a4c06290 0x00000035a4c19c9c Yes /usr/lib64/libgdk_pixbuf-2.0.so.0.2300.3 +0x00000035a4804890 0x00000035a481eb8c Yes /usr/lib64/libpng12.so.0.46.0 +0x000000353d603ea0 0x000000353d643e9c Yes /lib64/libm-2.14.so +0x000000353ee09970 0x000000353ee39dcc Yes /lib64/libgobject-2.0.so.0.2800.8 +0x000000353ea01560 0x000000353ea02a2c Yes /lib64/libgthread-2.0.so.0.2800.8 +0x000000353d202160 0x000000353d2053ec Yes /lib64/librt-2.14.so +0x000000353c216cd0 0x000000353c2adbec Yes /lib64/libglib-2.0.so.0.2800.8 +0x0000003b83635050 0x0000003b83738bec Yes (*) /usr/lib64/perl5/CORE/libperl.so +0x000000353e603840 0x000000353e61354c Yes /lib64/libresolv-2.14.so +0x0000003550603ff0 0x00000035506117fc Yes /lib64/libnsl-2.14.so +0x000000353ce00de0 0x000000353ce0191c Yes /lib64/libdl-2.14.so +0x0000003546e00c10 0x0000003546e05afc Yes /lib64/libcrypt-2.14.so +0x000000354e600e10 0x000000354e60168c Yes /lib64/libutil-2.14.so +0x000000353ca05640 0x000000353ca1038c Yes /lib64/libpthread-2.14.so +0x0000003548e5a400 0x0000003548ec308a Yes /usr/lib64/libstdc++.so.6.0.16 +0x000000353c61ece0 0x000000353c74304c Yes /lib64/libc-2.14.so +0x000000353de028a0 0x000000353de120cc Yes /lib64/libgcc_s-4.6.0-20110530.so.1 + No /usr/lib64/freetype-freeworld/libfreetype.so.6 +0x0000003540603b70 0x000000354061d84c Yes /lib64/libexpat.so.1.5.2 +0x000000353fe08660 0x000000353fe13b9c Yes /usr/lib64/libxcb.so.1.1.0 +0x000000353f6294a0 0x000000353f6d2b3c Yes /lib64/libgio-2.0.so.0.2800.8 +0x000000353f200fe0 0x000000353f201f8c Yes /lib64/libgmodule-2.0.so.0.2800.8 +0x000000353da01e70 0x000000353da0e67c Yes /lib64/libz.so.1.2.5 +0x000000353be00b20 0x000000353be18caa Yes /lib64/ld-2.14.so +0x0000003546603170 0x00000035466417bc Yes /lib64/libfreebl3.so +0x0000003540200dd0 0x0000003540201b2c Yes /usr/lib64/libXau.so.6.0.0 +0x000000353e205980 0x000000353e2159dc Yes /lib64/libselinux.so.1 +0x0000003544a028d0 0x0000003544a0749c Yes /usr/lib64/libXcursor.so.1.0.2 +0x00000035422013e0 0x000000354220450c Yes /usr/lib64/libXfixes.so.3.1.0 +0x00007f7ba79495d0 0x00007f7ba794cf9c Yes /usr/lib64/perl5/vendor_perl/auto/List/Util/Util.so +0x00007f7ba759a170 0x00007f7ba75a18ac Yes /lib64/libnss_files-2.14.so +(*): Shared library is missing debugging information. +$1 = 0x0 +$2 = 0x0 +rax 0x1405b18 20994840 +rbx 0x12e7ee0 19824352 +rcx 0x0 0 +rdx 0x56 86 +rsi 0x1 1 +rdi 0x12e7ee0 19824352 +rbp 0x1 0x1 +rsp 0x7fff728dc680 0x7fff728dc680 +r8 0x0 0 +r9 0x1 1 +r10 0x16 22 +r11 0x14053b0 20992944 +r12 0x2b 43 +r13 0x2c 44 +r14 0x8b 139 +r15 0x1 1 +rip 0x420240 0x420240 +eflags 0x10256 [ PF AF ZF IF RF ] +cs 0x33 51 +ss 0x2b 43 +ds 0x0 0 +es 0x0 0 +fs 0x0 0 +gs 0x0 0 +Dump of assembler code for function rxvt_term::selection_delimit_word(page_dirn, row_col_t const*, row_col_t*): + 0x00000000004201d0 <+0>: push %r15 + 0x00000000004201d2 <+2>: push %r14 + 0x00000000004201d4 <+4>: push %r13 + 0x00000000004201d6 <+6>: push %r12 + 0x00000000004201d8 <+8>: push %rbp + 0x00000000004201d9 <+9>: mov %esi,%ebp + 0x00000000004201db <+11>: push %rbx + 0x00000000004201dc <+12>: mov %rdi,%rbx + 0x00000000004201df <+15>: sub $0x38,%rsp + 0x00000000004201e3 <+19>: test %esi,%esi + 0x00000000004201e5 <+21>: mov %rcx,0x20(%rsp) + 0x00000000004201ea <+26>: jne 0x4203b0 + 0x00000000004201f0 <+32>: mov 0x44(%rdi),%eax + 0x00000000004201f3 <+35>: xor %r14d,%r14d + 0x00000000004201f6 <+38>: mov $0xffffffff,%r15d + 0x00000000004201fc <+44>: sub $0x1,%eax + 0x00000000004201ff <+47>: mov %eax,0x2c(%rsp) + 0x0000000000420203 <+51>: mov 0x4(%rdx),%eax + 0x0000000000420206 <+54>: xor %r12d,%r12d + 0x0000000000420209 <+57>: mov (%rdx),%r13d + 0x000000000042020c <+60>: mov 0x38(%rbx),%ecx + 0x000000000042020f <+63>: mov 0x1d0(%rbx),%r11 + 0x0000000000420216 <+70>: test %eax,%eax + 0x0000000000420218 <+72>: cmovns %eax,%r12d + 0x000000000042021c <+76>: mov 0x3c(%rbx),%eax + 0x000000000042021f <+79>: add %r13d,%eax + 0x0000000000420222 <+82>: add %ecx,%eax + 0x0000000000420224 <+84>: mov %eax,%edx + 0x0000000000420226 <+86>: sar $0x1f,%edx + 0x0000000000420229 <+89>: idiv %ecx + 0x000000000042022b <+91>: movslq %edx,%rdx + 0x000000000042022e <+94>: lea (%rdx,%rdx,2),%rax + 0x0000000000420232 <+98>: movslq %r12d,%rdx + 0x0000000000420235 <+101>: lea (%r11,%rax,8),%rax + 0x0000000000420239 <+105>: mov (%rax),%rcx + 0x000000000042023c <+108>: lea (%rcx,%rdx,2),%rdx +=> 0x0000000000420240 <+112>: movzwl (%rdx),%edi + 0x0000000000420243 <+115>: mov %rdx,0x8(%rsp) + 0x0000000000420248 <+120>: callq 0x428ef0 + 0x000000000042024d <+125>: test %al,%al + 0x000000000042024f <+127>: movl $0x2,0x14(%rsp) + 0x0000000000420257 <+135>: mov 0x8(%rsp),%rdx + 0x000000000042025c <+140>: jne 0x420274 + 0x000000000042025e <+142>: movzwl (%rdx),%esi + 0x0000000000420261 <+145>: movl $0x0,0x14(%rsp) + 0x0000000000420269 <+153>: cmp $0xff,%si + 0x000000000042026e <+158>: jbe 0x420428 + 0x0000000000420274 <+164>: movslq %r15d,%rax + 0x0000000000420277 <+167>: add %rax,%rax + 0x000000000042027a <+170>: mov %rax,0x18(%rsp) + 0x000000000042027f <+175>: cmp %r14d,%r12d + 0x0000000000420282 <+178>: je 0x4202f8 + 0x0000000000420284 <+180>: add 0x18(%rsp),%rdx + 0x0000000000420289 <+185>: movzwl (%rdx),%edi + 0x000000000042028c <+188>: cmp $0xffff,%di + 0x0000000000420290 <+192>: je 0x4202f0 + 0x0000000000420292 <+194>: movzwl %di,%edi + 0x0000000000420295 <+197>: mov %rdx,0x8(%rsp) + 0x000000000042029a <+202>: callq 0x428ef0 + 0x000000000042029f <+207>: test %al,%al + 0x00000000004202a1 <+209>: mov $0x2,%ecx + 0x00000000004202a6 <+214>: mov 0x8(%rsp),%rdx + 0x00000000004202ab <+219>: jne 0x4202bd + 0x00000000004202ad <+221>: movzwl (%rdx),%esi + 0x00000000004202b0 <+224>: xor %cl,%cl + 0x00000000004202b2 <+226>: cmp $0xff,%si + 0x00000000004202b7 <+231>: jbe 0x420400 + 0x00000000004202bd <+237>: cmp %ecx,0x14(%rsp) + 0x00000000004202c1 <+241>: je 0x4202f0 + 0x00000000004202c3 <+243>: mov 0x20(%rsp),%rdx + 0x00000000004202c8 <+248>: xor %eax,%eax + 0x00000000004202ca <+250>: cmp $0x1,%ebp + 0x00000000004202cd <+253>: sete %al + 0x00000000004202d0 <+256>: add %eax,%r12d + 0x00000000004202d3 <+259>: mov %r13d,(%rdx) + 0x00000000004202d6 <+262>: mov %r12d,0x4(%rdx) + 0x00000000004202da <+266>: add $0x38,%rsp + 0x00000000004202de <+270>: pop %rbx + 0x00000000004202df <+271>: pop %rbp + 0x00000000004202e0 <+272>: pop %r12 + 0x00000000004202e2 <+274>: pop %r13 + 0x00000000004202e4 <+276>: pop %r14 + 0x00000000004202e6 <+278>: pop %r15 + 0x00000000004202e8 <+280>: retq + 0x00000000004202e9 <+281>: nopl 0x0(%rax) + 0x00000000004202f0 <+288>: add %r15d,%r12d + 0x00000000004202f3 <+291>: cmp %r14d,%r12d + 0x00000000004202f6 <+294>: jne 0x420284 + 0x00000000004202f8 <+296>: cmp 0x2c(%rsp),%r13d + 0x00000000004202fd <+301>: je 0x4202c3 + 0x00000000004202ff <+303>: test %ebp,%ebp + 0x0000000000420301 <+305>: mov 0x3c(%rbx),%edi + 0x0000000000420304 <+308>: mov %r13d,%edx + 0x0000000000420307 <+311>: sete %r8b + 0x000000000042030b <+315>: mov 0x38(%rbx),%ecx + 0x000000000042030e <+318>: mov 0x1d0(%rbx),%rsi + 0x0000000000420315 <+325>: movzbl %r8b,%eax + 0x0000000000420319 <+329>: sub %eax,%edx + 0x000000000042031b <+331>: mov %edx,%eax + 0x000000000042031d <+333>: add %edi,%eax + 0x000000000042031f <+335>: add %ecx,%eax + 0x0000000000420321 <+337>: mov %eax,%edx + 0x0000000000420323 <+339>: sar $0x1f,%edx + 0x0000000000420326 <+342>: idiv %ecx + 0x0000000000420328 <+344>: movslq %edx,%rdx + 0x000000000042032b <+347>: lea (%rdx,%rdx,2),%rax + 0x000000000042032f <+351>: testb $0x1,0x14(%rsi,%rax,8) + 0x0000000000420334 <+356>: je 0x4202c3 + 0x0000000000420336 <+358>: lea 0x0(%r13,%r15,1),%eax + 0x000000000042033b <+363>: xor %r12d,%r12d + 0x000000000042033e <+366>: test %r8b,%r8b + 0x0000000000420341 <+369>: mov %eax,0x28(%rsp) + 0x0000000000420345 <+373>: je 0x42034f + 0x0000000000420347 <+375>: mov 0x14(%rbx),%r12d + 0x000000000042034b <+379>: sub $0x1,%r12d + 0x000000000042034f <+383>: mov 0x28(%rsp),%eax + 0x0000000000420353 <+387>: add %edi,%eax + 0x0000000000420355 <+389>: add %ecx,%eax + 0x0000000000420357 <+391>: mov %eax,%edx + 0x0000000000420359 <+393>: sar $0x1f,%edx + 0x000000000042035c <+396>: idiv %ecx + 0x000000000042035e <+398>: movslq %edx,%rdx + 0x0000000000420361 <+401>: lea (%rdx,%rdx,2),%rax + 0x0000000000420365 <+405>: mov (%rsi,%rax,8),%rax + 0x0000000000420369 <+409>: test %rax,%rax + 0x000000000042036c <+412>: je 0x4203a2 + 0x000000000042036e <+414>: movslq %r12d,%rdx + 0x0000000000420371 <+417>: lea (%rax,%rdx,2),%rdx + 0x0000000000420375 <+421>: movzwl (%rdx),%edi + 0x0000000000420378 <+424>: mov %rdx,0x8(%rsp) + 0x000000000042037d <+429>: callq 0x428ef0 + 0x0000000000420382 <+434>: test %al,%al + 0x0000000000420384 <+436>: mov $0x2,%ecx + 0x0000000000420389 <+441>: mov 0x8(%rsp),%rdx + 0x000000000042038e <+446>: jne 0x42039c + 0x0000000000420390 <+448>: movzwl (%rdx),%esi + 0x0000000000420393 <+451>: xor %cl,%cl + 0x0000000000420395 <+453>: cmp $0xff,%si + 0x000000000042039a <+458>: jbe 0x4203d0 + 0x000000000042039c <+460>: cmp %ecx,0x14(%rsp) + 0x00000000004203a0 <+464>: je 0x4203f2 + 0x00000000004203a2 <+466>: mov %r14d,%r12d + 0x00000000004203a5 <+469>: jmpq 0x4202c3 + 0x00000000004203aa <+474>: nopw 0x0(%rax,%rax,1) + 0x00000000004203b0 <+480>: mov 0x18(%rdi),%eax + 0x00000000004203b3 <+483>: mov 0x14(%rdi),%r14d + 0x00000000004203b7 <+487>: mov $0x1,%r15d + 0x00000000004203bd <+493>: mov %eax,0x2c(%rsp) + 0x00000000004203c1 <+497>: sub $0x1,%r14d + 0x00000000004203c5 <+501>: jmpq 0x420203 + 0x00000000004203ca <+506>: nopw 0x0(%rax,%rax,1) + 0x00000000004203d0 <+512>: mov 0x17c0(%rbx),%rdi + 0x00000000004203d7 <+519>: movzwl %si,%esi + 0x00000000004203da <+522>: callq 0x4074a0 + 0x00000000004203df <+527>: xor %ecx,%ecx + 0x00000000004203e1 <+529>: test %rax,%rax + 0x00000000004203e4 <+532>: mov 0x8(%rsp),%rdx + 0x00000000004203e9 <+537>: setne %cl + 0x00000000004203ec <+540>: cmp %ecx,0x14(%rsp) + 0x00000000004203f0 <+544>: jne 0x4203a2 + 0x00000000004203f2 <+546>: mov 0x28(%rsp),%r13d + 0x00000000004203f7 <+551>: jmpq 0x42027f + 0x00000000004203fc <+556>: nopl 0x0(%rax) + 0x0000000000420400 <+560>: mov 0x17c0(%rbx),%rdi + 0x0000000000420407 <+567>: movzwl %si,%esi + 0x000000000042040a <+570>: callq 0x4074a0 + 0x000000000042040f <+575>: xor %ecx,%ecx + 0x0000000000420411 <+577>: test %rax,%rax + 0x0000000000420414 <+580>: mov 0x8(%rsp),%rdx + 0x0000000000420419 <+585>: setne %cl + 0x000000000042041c <+588>: jmpq 0x4202bd + 0x0000000000420421 <+593>: nopl 0x0(%rax) + 0x0000000000420428 <+600>: mov 0x17c0(%rbx),%rdi + 0x000000000042042f <+607>: movzwl %si,%esi + 0x0000000000420432 <+610>: callq 0x4074a0 + 0x0000000000420437 <+615>: test %rax,%rax + 0x000000000042043a <+618>: mov 0x8(%rsp),%rdx + 0x000000000042043f <+623>: setne %al + 0x0000000000420442 <+626>: movzbl %al,%eax + 0x0000000000420445 <+629>: mov %eax,0x14(%rsp) + 0x0000000000420449 <+633>: jmpq 0x420274 +End of assembler dump. diff --git a/tests/p_abrt-cli/problem_dir/backtrace_rating b/tests/p_abrt-cli/problem_dir/backtrace_rating new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/backtrace_rating @@ -0,0 +1 @@ +1 diff --git a/tests/p_abrt-cli/problem_dir/cmdline b/tests/p_abrt-cli/problem_dir/cmdline new file mode 100644 index 0000000..f97e476 --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/cmdline @@ -0,0 +1 @@ +urxvtd -q -o -f \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/component b/tests/p_abrt-cli/problem_dir/component new file mode 100644 index 0000000..0b27954 --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/component @@ -0,0 +1 @@ +rxvt-unicode \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/crash_function b/tests/p_abrt-cli/problem_dir/crash_function new file mode 100644 index 0000000..d41666a --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/crash_function @@ -0,0 +1 @@ +rxvt_term::selection_delimit_word \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/dso_list b/tests/p_abrt-cli/problem_dir/dso_list new file mode 100644 index 0000000..6f2c6fa --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/dso_list @@ -0,0 +1,40 @@ +/lib64/libcrypt-2.14.so glibc-2.14-4.x86_64 (Fedora Project) 1310382635 +/lib64/libfreebl3.so nss-softokn-freebl-3.12.10-2.fc15.x86_64 (Fedora Project) 1310382622 +/lib64/libgthread-2.0.so.0.2800.8 glib2-2.28.8-1.fc15.x86_64 (Fedora Project) 1310382640 +/usr/lib64/libpng12.so.0.46.0 libpng-2:1.2.46-1.fc15.x86_64 (Fedora Project) 1311205059 +/usr/lib64/perl5/CORE/libperl.so perl-libs-4:5.12.4-159.fc15.x86_64 (Fedora Project) 1310382649 +/lib64/libz.so.1.2.5 zlib-1.2.5-3.fc15.x86_64 (Fedora Project) 1310382636 +/usr/lib/locale/locale-archive glibc-common-2.14-4.x86_64 (Fedora Project) 1310382628 +/usr/lib64/libXcursor.so.1.0.2 libXcursor-1.1.11-3.fc15.x86_64 (Fedora Project) 1310382891 +/usr/lib64/libxcb.so.1.1.0 libxcb-1.7-2.fc15.x86_64 (Fedora Project) 1310382643 +/usr/lib64/libfontconfig.so.1.4.4 fontconfig-2.8.0-3.fc15.x86_64 (Fedora Project) 1310382676 +/lib64/libdl-2.14.so glibc-2.14-4.x86_64 (Fedora Project) 1310382635 +/lib64/libgio-2.0.so.0.2800.8 glib2-2.28.8-1.fc15.x86_64 (Fedora Project) 1310382640 +/usr/bin/urxvtd rxvt-unicode-9.12-2.fc15.x86_64 (Fedora Project) 1311324474 +/lib64/libm-2.14.so glibc-2.14-4.x86_64 (Fedora Project) 1310382635 +/lib64/ld-2.14.so glibc-2.14-4.x86_64 (Fedora Project) 1310382635 +/usr/lib64/freetype-freeworld/libfreetype.so.6.6.2 freetype-freeworld-2.4.4-3.fc15.x86_64 (RPM Fusion) 1310418014 +/lib64/libutil-2.14.so glibc-2.14-4.x86_64 (Fedora Project) 1310382635 +/lib64/libselinux.so.1 libselinux-2.0.99-4.fc15.x86_64 (Fedora Project) 1310382639 +/usr/share/fonts/dejavu/DejaVuSansMono.ttf dejavu-sans-mono-fonts-2.33-1.fc15.noarch (Fedora Project) 1310382882 +/lib64/libgmodule-2.0.so.0.2800.8 glib2-2.28.8-1.fc15.x86_64 (Fedora Project) 1310382640 +/usr/lib64/libXfixes.so.3.1.0 libXfixes-5.0-1.fc15.x86_64 (Fedora Project) 1310382889 +/usr/lib64/gconv/gconv-modules.cache glibc-2.14-4.x86_64 (Fedora Project) 1310382635 +/usr/lib64/libXrender.so.1.3.0 libXrender-0.9.6-2.fc15.x86_64 (Fedora Project) 1310382889 +/lib64/libc-2.14.so glibc-2.14-4.x86_64 (Fedora Project) 1310382635 +/usr/lib64/libXau.so.6.0.0 libXau-1.0.6-2.fc15.x86_64 (Fedora Project) 1310382642 +/usr/lib64/libXft.so.2.2.0 libXft-2.2.0-2.fc15.x86_64 (Fedora Project) 1310382895 +/usr/lib64/libstdc++.so.6.0.16 libstdc++-4.6.0-9.fc15.x86_64 (Fedora Project) 1310382636 +/lib64/libgcc_s-4.6.0-20110530.so.1 libgcc-4.6.0-9.fc15.x86_64 (Fedora Project) 1310382602 +/usr/lib64/perl5/vendor_perl/auto/List/Util/Util.so perl-Scalar-List-Utils-1.23-1.fc15.x86_64 (Fedora Project) 1310382648 +/lib64/libgobject-2.0.so.0.2800.8 glib2-2.28.8-1.fc15.x86_64 (Fedora Project) 1310382640 +/lib64/librt-2.14.so glibc-2.14-4.x86_64 (Fedora Project) 1310382635 +/lib64/libresolv-2.14.so glibc-2.14-4.x86_64 (Fedora Project) 1310382635 +/lib64/libglib-2.0.so.0.2800.8 glib2-2.28.8-1.fc15.x86_64 (Fedora Project) 1310382640 +/lib64/libnsl-2.14.so glibc-2.14-4.x86_64 (Fedora Project) 1310382635 +/lib64/libexpat.so.1.5.2 expat-2.0.1-11.fc15.x86_64 (Fedora Project) 1310382637 +/usr/lib64/libX11.so.6.3.0 libX11-1.4.3-1.fc15.x86_64 (Fedora Project) 1310382888 +/usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf dejavu-sans-mono-fonts-2.33-1.fc15.noarch (Fedora Project) 1310382882 +/usr/lib64/libgdk_pixbuf-2.0.so.0.2300.3 gdk-pixbuf2-2.23.3-2.fc15.x86_64 (Fedora Project) 1310382889 +/lib64/libnss_files-2.14.so glibc-2.14-4.x86_64 (Fedora Project) 1310382635 +/lib64/libpthread-2.14.so glibc-2.14-4.x86_64 (Fedora Project) 1310382635 diff --git a/tests/p_abrt-cli/problem_dir/duphash b/tests/p_abrt-cli/problem_dir/duphash new file mode 100644 index 0000000..b3699c3 --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/duphash @@ -0,0 +1 @@ +bbfe66399cc9cb8ba647414e33c5d1e4ad82b511 \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/executable b/tests/p_abrt-cli/problem_dir/executable new file mode 100644 index 0000000..7b9643b --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/executable @@ -0,0 +1 @@ +/usr/bin/urxvtd \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/hostname b/tests/p_abrt-cli/problem_dir/hostname new file mode 100644 index 0000000..7646f7c --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/hostname @@ -0,0 +1 @@ +fluffy \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/kernel b/tests/p_abrt-cli/problem_dir/kernel new file mode 100644 index 0000000..e47f395 --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/kernel @@ -0,0 +1 @@ +2.6.38.8-35.fc15.x86_64 \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/maps b/tests/p_abrt-cli/problem_dir/maps new file mode 100644 index 0000000..af75592 --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/maps @@ -0,0 +1,196 @@ +00400000-00514000 r-xp 00000000 fd:02 2528625 /usr/bin/urxvtd +00713000-0071f000 rw-p 00113000 fd:02 2528625 /usr/bin/urxvtd +0091e000-00923000 rw-p 0011e000 fd:02 2528625 /usr/bin/urxvtd +010ee000-0148c000 rw-p 00000000 00:00 0 [heap] +353be00000-353be1f000 r-xp 00000000 fd:02 918046 /lib64/ld-2.14.so +353c01e000-353c01f000 r--p 0001e000 fd:02 918046 /lib64/ld-2.14.so +353c01f000-353c020000 rw-p 0001f000 fd:02 918046 /lib64/ld-2.14.so +353c020000-353c021000 rw-p 00000000 00:00 0 +353c200000-353c315000 r-xp 00000000 fd:02 918061 /lib64/libglib-2.0.so.0.2800.8 +353c315000-353c515000 ---p 00115000 fd:02 918061 /lib64/libglib-2.0.so.0.2800.8 +353c515000-353c516000 rw-p 00115000 fd:02 918061 /lib64/libglib-2.0.so.0.2800.8 +353c516000-353c517000 rw-p 00000000 00:00 0 +353c600000-353c78f000 r-xp 00000000 fd:02 918047 /lib64/libc-2.14.so +353c78f000-353c98e000 ---p 0018f000 fd:02 918047 /lib64/libc-2.14.so +353c98e000-353c992000 r--p 0018e000 fd:02 918047 /lib64/libc-2.14.so +353c992000-353c993000 rw-p 00192000 fd:02 918047 /lib64/libc-2.14.so +353c993000-353c999000 rw-p 00000000 00:00 0 +353ca00000-353ca16000 r-xp 00000000 fd:02 918048 /lib64/libpthread-2.14.so +353ca16000-353cc15000 ---p 00016000 fd:02 918048 /lib64/libpthread-2.14.so +353cc15000-353cc16000 r--p 00015000 fd:02 918048 /lib64/libpthread-2.14.so +353cc16000-353cc17000 rw-p 00016000 fd:02 918048 /lib64/libpthread-2.14.so +353cc17000-353cc1b000 rw-p 00000000 00:00 0 +353ce00000-353ce02000 r-xp 00000000 fd:02 918050 /lib64/libdl-2.14.so +353ce02000-353d002000 ---p 00002000 fd:02 918050 /lib64/libdl-2.14.so +353d002000-353d003000 r--p 00002000 fd:02 918050 /lib64/libdl-2.14.so +353d003000-353d004000 rw-p 00003000 fd:02 918050 /lib64/libdl-2.14.so +353d200000-353d207000 r-xp 00000000 fd:02 918049 /lib64/librt-2.14.so +353d207000-353d406000 ---p 00007000 fd:02 918049 /lib64/librt-2.14.so +353d406000-353d407000 r--p 00006000 fd:02 918049 /lib64/librt-2.14.so +353d407000-353d408000 rw-p 00007000 fd:02 918049 /lib64/librt-2.14.so +353d600000-353d683000 r-xp 00000000 fd:02 918069 /lib64/libm-2.14.so +353d683000-353d882000 ---p 00083000 fd:02 918069 /lib64/libm-2.14.so +353d882000-353d883000 r--p 00082000 fd:02 918069 /lib64/libm-2.14.so +353d883000-353d884000 rw-p 00083000 fd:02 918069 /lib64/libm-2.14.so +353da00000-353da16000 r-xp 00000000 fd:02 918065 /lib64/libz.so.1.2.5 +353da16000-353dc16000 ---p 00016000 fd:02 918065 /lib64/libz.so.1.2.5 +353dc16000-353dc17000 rw-p 00016000 fd:02 918065 /lib64/libz.so.1.2.5 +353de00000-353de15000 r-xp 00000000 fd:02 918070 /lib64/libgcc_s-4.6.0-20110530.so.1 +353de15000-353e014000 ---p 00015000 fd:02 918070 /lib64/libgcc_s-4.6.0-20110530.so.1 +353e014000-353e015000 rw-p 00014000 fd:02 918070 /lib64/libgcc_s-4.6.0-20110530.so.1 +353e200000-353e21d000 r-xp 00000000 fd:02 918056 /lib64/libselinux.so.1 +353e21d000-353e41c000 ---p 0001d000 fd:02 918056 /lib64/libselinux.so.1 +353e41c000-353e41d000 r--p 0001c000 fd:02 918056 /lib64/libselinux.so.1 +353e41d000-353e41e000 rw-p 0001d000 fd:02 918056 /lib64/libselinux.so.1 +353e41e000-353e41f000 rw-p 00000000 00:00 0 +353e600000-353e617000 r-xp 00000000 fd:02 918055 /lib64/libresolv-2.14.so +353e617000-353e817000 ---p 00017000 fd:02 918055 /lib64/libresolv-2.14.so +353e817000-353e818000 r--p 00017000 fd:02 918055 /lib64/libresolv-2.14.so +353e818000-353e819000 rw-p 00018000 fd:02 918055 /lib64/libresolv-2.14.so +353e819000-353e81b000 rw-p 00000000 00:00 0 +353ea00000-353ea04000 r-xp 00000000 fd:02 918062 /lib64/libgthread-2.0.so.0.2800.8 +353ea04000-353ec03000 ---p 00004000 fd:02 918062 /lib64/libgthread-2.0.so.0.2800.8 +353ec03000-353ec04000 rw-p 00003000 fd:02 918062 /lib64/libgthread-2.0.so.0.2800.8 +353ee00000-353ee4c000 r-xp 00000000 fd:02 918063 /lib64/libgobject-2.0.so.0.2800.8 +353ee4c000-353f04b000 ---p 0004c000 fd:02 918063 /lib64/libgobject-2.0.so.0.2800.8 +353f04b000-353f04d000 rw-p 0004b000 fd:02 918063 /lib64/libgobject-2.0.so.0.2800.8 +353f04d000-353f04e000 rw-p 00000000 00:00 0 +353f200000-353f203000 r-xp 00000000 fd:02 918064 /lib64/libgmodule-2.0.so.0.2800.8 +353f203000-353f402000 ---p 00003000 fd:02 918064 /lib64/libgmodule-2.0.so.0.2800.8 +353f402000-353f403000 rw-p 00002000 fd:02 918064 /lib64/libgmodule-2.0.so.0.2800.8 +353f600000-353f721000 r-xp 00000000 fd:02 918066 /lib64/libgio-2.0.so.0.2800.8 +353f721000-353f920000 ---p 00121000 fd:02 918066 /lib64/libgio-2.0.so.0.2800.8 +353f920000-353f926000 rw-p 00120000 fd:02 918066 /lib64/libgio-2.0.so.0.2800.8 +353f926000-353f927000 rw-p 00000000 00:00 0 +353fa00000-353fb39000 r-xp 00000000 fd:02 2510411 /usr/lib64/libX11.so.6.3.0 +353fb39000-353fd38000 ---p 00139000 fd:02 2510411 /usr/lib64/libX11.so.6.3.0 +353fd38000-353fd3e000 rw-p 00138000 fd:02 2510411 /usr/lib64/libX11.so.6.3.0 +353fe00000-353fe1b000 r-xp 00000000 fd:02 2510410 /usr/lib64/libxcb.so.1.1.0 +353fe1b000-354001a000 ---p 0001b000 fd:02 2510410 /usr/lib64/libxcb.so.1.1.0 +354001a000-354001b000 rw-p 0001a000 fd:02 2510410 /usr/lib64/libxcb.so.1.1.0 +3540200000-3540202000 r-xp 00000000 fd:02 2510409 /usr/lib64/libXau.so.6.0.0 +3540202000-3540402000 ---p 00002000 fd:02 2510409 /usr/lib64/libXau.so.6.0.0 +3540402000-3540403000 rw-p 00002000 fd:02 2510409 /usr/lib64/libXau.so.6.0.0 +3540600000-3540627000 r-xp 00000000 fd:02 918073 /lib64/libexpat.so.1.5.2 +3540627000-3540826000 ---p 00027000 fd:02 918073 /lib64/libexpat.so.1.5.2 +3540826000-3540829000 rw-p 00026000 fd:02 918073 /lib64/libexpat.so.1.5.2 +3541e00000-3541e09000 r-xp 00000000 fd:02 2510412 /usr/lib64/libXrender.so.1.3.0 +3541e09000-3542009000 ---p 00009000 fd:02 2510412 /usr/lib64/libXrender.so.1.3.0 +3542009000-354200a000 rw-p 00009000 fd:02 2510412 /usr/lib64/libXrender.so.1.3.0 +3542200000-3542205000 r-xp 00000000 fd:02 2510420 /usr/lib64/libXfixes.so.3.1.0 +3542205000-3542405000 ---p 00005000 fd:02 2510420 /usr/lib64/libXfixes.so.3.1.0 +3542405000-3542406000 rw-p 00005000 fd:02 2510420 /usr/lib64/libXfixes.so.3.1.0 +3544a00000-3544a09000 r-xp 00000000 fd:02 2510421 /usr/lib64/libXcursor.so.1.0.2 +3544a09000-3544c09000 ---p 00009000 fd:02 2510421 /usr/lib64/libXcursor.so.1.0.2 +3544c09000-3544c0a000 rw-p 00009000 fd:02 2510421 /usr/lib64/libXcursor.so.1.0.2 +3546600000-354665c000 r-xp 00000000 fd:02 918051 /lib64/libfreebl3.so +354665c000-354685b000 ---p 0005c000 fd:02 918051 /lib64/libfreebl3.so +354685b000-354685d000 rw-p 0005b000 fd:02 918051 /lib64/libfreebl3.so +354685d000-3546861000 rw-p 00000000 00:00 0 +3546e00000-3546e08000 r-xp 00000000 fd:02 918052 /lib64/libcrypt-2.14.so +3546e08000-3547007000 ---p 00008000 fd:02 918052 /lib64/libcrypt-2.14.so +3547007000-3547008000 r--p 00007000 fd:02 918052 /lib64/libcrypt-2.14.so +3547008000-3547009000 rw-p 00008000 fd:02 918052 /lib64/libcrypt-2.14.so +3547009000-3547037000 rw-p 00000000 00:00 0 +3548e00000-3548ee8000 r-xp 00000000 fd:02 2493423 /usr/lib64/libstdc++.so.6.0.16 +3548ee8000-35490e8000 ---p 000e8000 fd:02 2493423 /usr/lib64/libstdc++.so.6.0.16 +35490e8000-35490f0000 r--p 000e8000 fd:02 2493423 /usr/lib64/libstdc++.so.6.0.16 +35490f0000-35490f2000 rw-p 000f0000 fd:02 2493423 /usr/lib64/libstdc++.so.6.0.16 +35490f2000-3549107000 rw-p 00000000 00:00 0 +354e600000-354e602000 r-xp 00000000 fd:02 918067 /lib64/libutil-2.14.so +354e602000-354e801000 ---p 00002000 fd:02 918067 /lib64/libutil-2.14.so +354e801000-354e802000 r--p 00001000 fd:02 918067 /lib64/libutil-2.14.so +354e802000-354e803000 rw-p 00002000 fd:02 918067 /lib64/libutil-2.14.so +3550600000-3550616000 r-xp 00000000 fd:02 918088 /lib64/libnsl-2.14.so +3550616000-3550815000 ---p 00016000 fd:02 918088 /lib64/libnsl-2.14.so +3550815000-3550816000 r--p 00015000 fd:02 918088 /lib64/libnsl-2.14.so +3550816000-3550817000 rw-p 00016000 fd:02 918088 /lib64/libnsl-2.14.so +3550817000-3550819000 rw-p 00000000 00:00 0 +35a4800000-35a4826000 r-xp 00000000 fd:02 2503123 /usr/lib64/libpng12.so.0.46.0 +35a4826000-35a4a26000 ---p 00026000 fd:02 2503123 /usr/lib64/libpng12.so.0.46.0 +35a4a26000-35a4a27000 rw-p 00026000 fd:02 2503123 /usr/lib64/libpng12.so.0.46.0 +35a4c00000-35a4c21000 r-xp 00000000 fd:02 2529059 /usr/lib64/libgdk_pixbuf-2.0.so.0.2300.3 +35a4c21000-35a4e21000 ---p 00021000 fd:02 2529059 /usr/lib64/libgdk_pixbuf-2.0.so.0.2300.3 +35a4e21000-35a4e22000 rw-p 00021000 fd:02 2529059 /usr/lib64/libgdk_pixbuf-2.0.so.0.2300.3 +3b7ac00000-3b7ac97000 r-xp 00000000 fd:02 2650372 /usr/lib64/freetype-freeworld/libfreetype.so.6.6.2 +3b7ac97000-3b7ae96000 ---p 00097000 fd:02 2650372 /usr/lib64/freetype-freeworld/libfreetype.so.6.6.2 +3b7ae96000-3b7ae9c000 rw-p 00096000 fd:02 2650372 /usr/lib64/freetype-freeworld/libfreetype.so.6.6.2 +3b7b000000-3b7b034000 r-xp 00000000 fd:02 2518521 /usr/lib64/libfontconfig.so.1.4.4 +3b7b034000-3b7b233000 ---p 00034000 fd:02 2518521 /usr/lib64/libfontconfig.so.1.4.4 +3b7b233000-3b7b235000 rw-p 00033000 fd:02 2518521 /usr/lib64/libfontconfig.so.1.4.4 +3b7b400000-3b7b414000 r-xp 00000000 fd:02 2529043 /usr/lib64/libXft.so.2.2.0 +3b7b414000-3b7b613000 ---p 00014000 fd:02 2529043 /usr/lib64/libXft.so.2.2.0 +3b7b613000-3b7b614000 rw-p 00013000 fd:02 2529043 /usr/lib64/libXft.so.2.2.0 +3b83600000-3b8376b000 r-xp 00000000 fd:02 2907405 /usr/lib64/perl5/CORE/libperl.so +3b8376b000-3b8396a000 ---p 0016b000 fd:02 2907405 /usr/lib64/perl5/CORE/libperl.so +3b8396a000-3b83973000 rw-p 0016a000 fd:02 2907405 /usr/lib64/perl5/CORE/libperl.so +7f7ba7598000-7f7ba75a4000 r-xp 00000000 fd:02 917534 /lib64/libnss_files-2.14.so +7f7ba75a4000-7f7ba77a3000 ---p 0000c000 fd:02 917534 /lib64/libnss_files-2.14.so +7f7ba77a3000-7f7ba77a4000 r--p 0000b000 fd:02 917534 /lib64/libnss_files-2.14.so +7f7ba77a4000-7f7ba77a5000 rw-p 0000c000 fd:02 917534 /lib64/libnss_files-2.14.so +7f7ba77a5000-7f7ba77f2000 rw-p 00000000 00:00 0 +7f7ba782d000-7f7ba787a000 r--p 00000000 fd:02 2762087 /usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf +7f7ba787a000-7f7ba78cc000 r--p 00000000 fd:02 2762090 /usr/share/fonts/dejavu/DejaVuSansMono.ttf +7f7ba78cc000-7f7ba78ce000 r--s 00000000 fd:02 3162805 /var/cache/fontconfig/7e24c1c3b25754604c4f46a5df32e5c1-le64.cache-3 +7f7ba78ce000-7f7ba78d0000 r--s 00000000 fd:02 3156198 /var/cache/fontconfig/3ad840390a44011d5fc042cdf95ddcfe-le64.cache-3 +7f7ba78d0000-7f7ba78d4000 r--s 00000000 fd:02 3162779 /var/cache/fontconfig/87f5e051180a7a75f16eb6fe7dbd3749-le64.cache-3 +7f7ba78d4000-7f7ba78dd000 r--s 00000000 fd:02 3156202 /var/cache/fontconfig/b79f3aaa7d385a141ab53ec885cc22a8-le64.cache-3 +7f7ba78dd000-7f7ba78e0000 r--s 00000000 fd:02 3162822 /var/cache/fontconfig/0b1bcc92b4d25cc154d77dafe3bceaa0-le64.cache-3 +7f7ba78e0000-7f7ba78e2000 r--s 00000000 fd:02 3162821 /var/cache/fontconfig/afda88ba2c9de689dfd6d8c6d2e4e427-le64.cache-3 +7f7ba78e2000-7f7ba78e3000 r--s 00000000 fd:03 131441 /home/rmarko/.fontconfig/54091e63ccbc9b283e4dea7ca32e5491-le64.cache-3 +7f7ba78e3000-7f7ba78e7000 r--s 00000000 fd:03 131428 /home/rmarko/.fontconfig/68fe5182b80ae2709eaaf65e42dcaf33-le64.cache-3 +7f7ba78e7000-7f7ba78e8000 r--s 00000000 fd:03 131426 /home/rmarko/.fontconfig/ac1b9faef01ec4feb36ba76b98842887-le64.cache-3 +7f7ba78e8000-7f7ba78eb000 r--s 00000000 fd:03 131425 /home/rmarko/.fontconfig/ebb99784de50d4c4223a6523ac9c5d63-le64.cache-3 +7f7ba78eb000-7f7ba78f2000 r--s 00000000 fd:03 131439 /home/rmarko/.fontconfig/8034b44ea17662c765f963e9b699c5b6-le64.cache-3 +7f7ba78f2000-7f7ba78f3000 r--s 00000000 fd:03 131471 /home/rmarko/.fontconfig/ad3af325ad4e0a82eb2b3e930ff23cd5-le64.cache-3 +7f7ba78f3000-7f7ba78f5000 r--s 00000000 fd:03 131493 /home/rmarko/.fontconfig/0c76f5ee3a101157014da521290d0599-le64.cache-3 +7f7ba78f5000-7f7ba78f8000 r--s 00000000 fd:02 3162813 /var/cache/fontconfig/2e1514a9fdd499050989183bb65136db-le64.cache-3 +7f7ba78f8000-7f7ba78fb000 r--s 00000000 fd:02 3162812 /var/cache/fontconfig/5c755b2f27115486aa6359c84dd3cbda-le64.cache-3 +7f7ba78fb000-7f7ba7901000 r--s 00000000 fd:02 3162811 /var/cache/fontconfig/75726aeed9fe8691fd29315754d820cc-le64.cache-3 +7f7ba7901000-7f7ba7903000 r--s 00000000 fd:02 3162810 /var/cache/fontconfig/3f821257dd33660ba7bbb45c32deb84c-le64.cache-3 +7f7ba7903000-7f7ba7905000 r--s 00000000 fd:02 3162809 /var/cache/fontconfig/830f035fa84a65ce80e050178dbb630d-le64.cache-3 +7f7ba7905000-7f7ba7906000 r--s 00000000 fd:02 3162808 /var/cache/fontconfig/81a173283b451552b599cfaafd6236bd-le64.cache-3 +7f7ba7906000-7f7ba7907000 r--s 00000000 fd:02 3162807 /var/cache/fontconfig/ac68f755438cc3dc5a526084839fc7ca-le64.cache-3 +7f7ba7907000-7f7ba7908000 r--s 00000000 fd:02 3162806 /var/cache/fontconfig/12513961c6e7090f8648812f9eaf65d6-le64.cache-3 +7f7ba7908000-7f7ba790a000 r--s 00000000 fd:02 3162803 /var/cache/fontconfig/e26bf336397aae6fcef4d3803472adec-le64.cache-3 +7f7ba790a000-7f7ba790b000 r--s 00000000 fd:02 3162802 /var/cache/fontconfig/a5c2dc934fad9bbf30c854216245519d-le64.cache-3 +7f7ba790b000-7f7ba790c000 r--s 00000000 fd:02 3162801 /var/cache/fontconfig/17e60ccdf2eb53b214a9a5d6663eb217-le64.cache-3 +7f7ba790c000-7f7ba790d000 r--s 00000000 fd:02 3146299 /var/cache/fontconfig/6fcb01a03a016cc71057b587cdea6709-le64.cache-3 +7f7ba790d000-7f7ba790e000 r--s 00000000 fd:02 3162799 /var/cache/fontconfig/2678730374f88f8c6b5c0192ab5a46db-le64.cache-3 +7f7ba790e000-7f7ba790f000 r--s 00000000 fd:02 3162798 /var/cache/fontconfig/46d51d90fe9d963f6f4186edb936a931-le64.cache-3 +7f7ba790f000-7f7ba7910000 r--s 00000000 fd:02 3162797 /var/cache/fontconfig/b887eea8f1b96e1d899b44ed6681fc27-le64.cache-3 +7f7ba7910000-7f7ba7911000 r--s 00000000 fd:02 3162796 /var/cache/fontconfig/860639f272b8b4b3094f9e399e41bccd-le64.cache-3 +7f7ba7911000-7f7ba7912000 r--s 00000000 fd:02 3162795 /var/cache/fontconfig/211368abcb0ff835c229ff05c9ec01dc-le64.cache-3 +7f7ba7912000-7f7ba7913000 r--s 00000000 fd:02 3162794 /var/cache/fontconfig/c46020d7221988a13df853d2b46304fc-le64.cache-3 +7f7ba7913000-7f7ba7914000 r--s 00000000 fd:02 3162793 /var/cache/fontconfig/fa2b533b7056bdadb961f088bc0a978b-le64.cache-3 +7f7ba7914000-7f7ba7915000 r--s 00000000 fd:02 3162792 /var/cache/fontconfig/df893b4576ad6107f9397134092c4059-le64.cache-3 +7f7ba7915000-7f7ba7916000 r--s 00000000 fd:02 3162791 /var/cache/fontconfig/900402270e15d763a6e008bb2d4c7686-le64.cache-3 +7f7ba7916000-7f7ba7917000 r--s 00000000 fd:02 3156052 /var/cache/fontconfig/47f48679023f44a4d1e44699a69464f6-le64.cache-3 +7f7ba7917000-7f7ba7918000 r--s 00000000 fd:02 3162789 /var/cache/fontconfig/2881ed3fd21ca306ddad6f9b0dd3189f-le64.cache-3 +7f7ba7918000-7f7ba7919000 r--s 00000000 fd:02 3162788 /var/cache/fontconfig/3c3fb04d32a5211b073874b125d29701-le64.cache-3 +7f7ba7919000-7f7ba791a000 r--s 00000000 fd:02 3162787 /var/cache/fontconfig/e61abf8156cc476151baa07d67337cae-le64.cache-3 +7f7ba791a000-7f7ba791f000 r--s 00000000 fd:02 3162786 /var/cache/fontconfig/b67b32625a2bb51b023d3814a918f351-le64.cache-3 +7f7ba791f000-7f7ba7923000 r--s 00000000 fd:02 3162785 /var/cache/fontconfig/d3379abda271c4acd2ad0c01f565d0b0-le64.cache-3 +7f7ba7923000-7f7ba7933000 r--s 00000000 fd:02 3162782 /var/cache/fontconfig/614d1caaa4d7914789410f6367de37ca-le64.cache-3 +7f7ba7933000-7f7ba793c000 r--s 00000000 fd:02 3162780 /var/cache/fontconfig/12b26b760a24f8b4feb03ad48a333a72-le64.cache-3 +7f7ba793c000-7f7ba7947000 r--s 00000000 fd:02 3162777 /var/cache/fontconfig/33315028185e8b9ecf55d3c7f93d9205-le64.cache-3 +7f7ba7947000-7f7ba794e000 r-xp 00000000 fd:02 2883650 /usr/lib64/perl5/vendor_perl/auto/List/Util/Util.so +7f7ba794e000-7f7ba7b4d000 ---p 00007000 fd:02 2883650 /usr/lib64/perl5/vendor_perl/auto/List/Util/Util.so +7f7ba7b4d000-7f7ba7b4e000 rw-p 00006000 fd:02 2883650 /usr/lib64/perl5/vendor_perl/auto/List/Util/Util.so +7f7ba7b4e000-7f7badf71000 r--p 00000000 fd:02 2491408 /usr/lib/locale/locale-archive +7f7badf71000-7f7badf80000 rw-p 00000000 00:00 0 +7f7badf82000-7f7badf87000 r--s 00000000 fd:02 3162784 /var/cache/fontconfig/46b47dbc682d2ca4191e148ea7bde7f2-le64.cache-3 +7f7badf87000-7f7badf88000 r--s 00000000 fd:02 3162783 /var/cache/fontconfig/b4d0b56f766d89640448751fcd18ec1e-le64.cache-3 +7f7badf88000-7f7badf89000 r--s 00000000 fd:02 3162781 /var/cache/fontconfig/27a26a6572d8db04e2609c64fb6f9476-le64.cache-3 +7f7badf89000-7f7badf90000 r--s 00000000 fd:02 3162776 /var/cache/fontconfig/928306c3ad40271d946e41014a49fc28-le64.cache-3 +7f7badf90000-7f7badf97000 r--s 00000000 fd:02 3162775 /var/cache/fontconfig/fa1582dab13e7e8e44e5a9424d309f0e-le64.cache-3 +7f7badf97000-7f7badf99000 r--s 00000000 fd:02 3162774 /var/cache/fontconfig/cf88f444488d569f9535e4f0ee8ed9a1-le64.cache-3 +7f7badf99000-7f7badf9c000 r--s 00000000 fd:02 3162773 /var/cache/fontconfig/e3ead4b767b8819993a6fa3ae306afa9-le64.cache-3 +7f7badf9c000-7f7badfa3000 r--s 00000000 fd:02 3162764 /var/cache/fontconfig/18db0204b1f108dd01663673626fcd3d-le64.cache-3 +7f7badfa3000-7f7badfa7000 r--s 00000000 fd:02 3162772 /var/cache/fontconfig/f5da82313d22ae5bf5bc6e539d256292-le64.cache-3 +7f7badfa7000-7f7badfa8000 r--s 00000000 fd:02 3162771 /var/cache/fontconfig/3640555adad8a8f6978400293cfce7ab-le64.cache-3 +7f7badfa8000-7f7badfaf000 r--s 00000000 fd:02 2491669 /usr/lib64/gconv/gconv-modules.cache +7f7badfaf000-7f7badfb0000 rw-p 00000000 00:00 0 +7fff728be000-7fff728df000 rw-p 00000000 00:00 0 [stack] +7fff72993000-7fff72994000 r-xp 00000000 00:00 0 [vdso] +ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] diff --git a/tests/p_abrt-cli/problem_dir/os_release b/tests/p_abrt-cli/problem_dir/os_release new file mode 100644 index 0000000..cd4dc97 --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/os_release @@ -0,0 +1 @@ +Fedora release 15 (Lovelock) \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/package b/tests/p_abrt-cli/problem_dir/package new file mode 100644 index 0000000..2493f30 --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/package @@ -0,0 +1 @@ +rxvt-unicode-9.12-2.fc15 \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/reason b/tests/p_abrt-cli/problem_dir/reason new file mode 100644 index 0000000..9567b2b --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/reason @@ -0,0 +1 @@ +Process /usr/bin/urxvtd was killed by signal 11 (SIGSEGV) \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/time b/tests/p_abrt-cli/problem_dir/time new file mode 100644 index 0000000..79313c0 --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/time @@ -0,0 +1 @@ +1312184367 \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/type b/tests/p_abrt-cli/problem_dir/type new file mode 100644 index 0000000..1ab966f --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/type @@ -0,0 +1 @@ +CCpp \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/uid b/tests/p_abrt-cli/problem_dir/uid new file mode 100644 index 0000000..99f9f07 --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/uid @@ -0,0 +1 @@ +502 \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/username b/tests/p_abrt-cli/problem_dir/username new file mode 100644 index 0000000..15d5dfe --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/username @@ -0,0 +1 @@ +rmarko diff --git a/tests/p_abrt-cli/problem_dir/uuid b/tests/p_abrt-cli/problem_dir/uuid new file mode 100644 index 0000000..15eb651 --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/uuid @@ -0,0 +1 @@ +b43d70450c44352de194f545a7d3841eb80b1ae5 \ No newline at end of file diff --git a/tests/p_abrt-cli/problem_dir/var_log_messages b/tests/p_abrt-cli/problem_dir/var_log_messages new file mode 100644 index 0000000..d0b9f8b --- /dev/null +++ b/tests/p_abrt-cli/problem_dir/var_log_messages @@ -0,0 +1,2 @@ +Aug 1 09:39:27 fluffy kernel: [149820.130191] urxvtd[10303]: segfault at 56 ip 0000000000420240 sp 00007fff728dc680 error 4 in urxvtd[400000+114000] +Aug 1 09:39:28 fluffy abrt[19696]: saved core dump of pid 10303 (/usr/bin/urxvtd) to /var/spool/abrt/ccpp-2011-08-01-09:39:27-10303.new/coredump (5025792 bytes) diff --git a/tests/p_abrt-cli/problem_dir/xsession_errors b/tests/p_abrt-cli/problem_dir/xsession_errors new file mode 100644 index 0000000..e69de29 diff --git a/tests/p_abrt-cli/queries/add_note b/tests/p_abrt-cli/queries/add_note new file mode 100644 index 0000000..557a1c6 --- /dev/null +++ b/tests/p_abrt-cli/queries/add_note @@ -0,0 +1,13 @@ +HTTP/1.1 200 OK +Date: Fri, 07 Nov 2014 18:15:20 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.2 +X-Powered-By: PHP/5.6.2 +Set-Cookie: PHPSESSID=a70ip3geh5ddob2hf7hjcnolh4; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 03 Mar 2014 19:19:50 GMT +Connection: close +Content-Length: 546 +Content-Type: text/xml; charset=utf-8 + + +5 diff --git a/tests/p_abrt-cli/queries/attachment b/tests/p_abrt-cli/queries/attachment new file mode 100644 index 0000000..af58730 --- /dev/null +++ b/tests/p_abrt-cli/queries/attachment @@ -0,0 +1,13 @@ +HTTP/1.1 200 OK +Date: Fri, 07 Nov 2014 13:04:41 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.2 +X-Powered-By: PHP/5.6.2 +Set-Cookie: PHPSESSID=up77lotcauq5g3dq9age3i2so4; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 03 Mar 2014 19:19:50 GMT +Connection: close +Content-Length: 558 +Content-Type: text/xml; charset=utf-8 + + +4 diff --git a/tests/p_abrt-cli/queries/create b/tests/p_abrt-cli/queries/create new file mode 100644 index 0000000..d15d34f --- /dev/null +++ b/tests/p_abrt-cli/queries/create @@ -0,0 +1,12 @@ +HTTP/1.1 200 OK +Date: Thu, 06 Nov 2014 17:47:51 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.2 +X-Powered-By: PHP/5.6.2 +Set-Cookie: PHPSESSID=4q0l4ugs1maaf5o9e84svovqi5; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 03 Mar 2014 19:19:50 GMT +Connection: close +Content-Length: 496 +Content-Type: text/xml; charset=utf-8 + +7 diff --git a/tests/p_abrt-cli/queries/dummy b/tests/p_abrt-cli/queries/dummy new file mode 100644 index 0000000..ddc28f3 --- /dev/null +++ b/tests/p_abrt-cli/queries/dummy @@ -0,0 +1,17 @@ + + + + + + + + id + + 323795 + + + + + + + diff --git a/tests/p_abrt-cli/queries/get_custom_fields b/tests/p_abrt-cli/queries/get_custom_fields new file mode 100644 index 0000000..cdbe088 --- /dev/null +++ b/tests/p_abrt-cli/queries/get_custom_fields @@ -0,0 +1,13 @@ +HTTP/1.1 200 OK +Date: Fri, 07 Nov 2014 21:12:48 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.2 +X-Powered-By: PHP/5.6.2 +Set-Cookie: PHPSESSID=22qmssa8tsrsrejsiv0od5t7k2; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 03 Mar 2014 19:19:50 GMT +Connection: close +Content-Length: 2776 +Content-Type: text/xml; charset=utf-8 + + +1abrt_hash0101000truetruefalsefalsefalsefalsefalsefalse2URL0101000truetruefalsefalsefalsefalsefalsefalse diff --git a/tests/p_abrt-cli/queries/get_issue b/tests/p_abrt-cli/queries/get_issue new file mode 100644 index 0000000..454de09 --- /dev/null +++ b/tests/p_abrt-cli/queries/get_issue @@ -0,0 +1,13 @@ +HTTP/1.1 200 OK +Date: Wed, 14 Jan 2015 08:50:07 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.3 +X-Powered-By: PHP/5.6.3 +Set-Cookie: PHPSESSID=tq25vlcb178go69v81olmibrm6; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 24 Nov 2014 11:23:27 GMT +Connection: close +Content-Length: 3113 +Content-Type: text/xml; charset=utf-8 + + +9910public2015-01-14T18:07:54+01:001testwill-crash30normal50minor10new1administratorroot@localhostwer70have not tried2015-01-14T09:29:23+01:00010none10none10openwer1abrt_hashbbfe66399cc9cb8ba647414e33c5d1e4ad82b5112URLfalse diff --git a/tests/p_abrt-cli/queries/get_issue_closed_as_duplicate b/tests/p_abrt-cli/queries/get_issue_closed_as_duplicate new file mode 100644 index 0000000..745b104 --- /dev/null +++ b/tests/p_abrt-cli/queries/get_issue_closed_as_duplicate @@ -0,0 +1,27 @@ +HTTP/1.1 200 OK +Date: Wed, 14 Jan 2015 08:50:07 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.3 +X-Powered-By: PHP/5.6.3 +Set-Cookie: PHPSESSID=tq25vlcb178go69v81olmibrm6; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 24 Nov 2014 11:23:27 GMT +Connection: close +Content-Length: 4798 +Content-Type: text/xml; charset=utf-8 + + +9910public2015-01-14T21:40:26+01:001testwill-crash30normal50minor90closed1administratorroot@localhostwer70have not tried2015-01-14T09:29:23+01:00010none10none60duplicatewer90duplicate of101371administratorroot@localhostAnother user experienced a similar problem: + +i am comment + +reporter: libreport-2.3.0.59.gb561.dirty +backtrace_rating: 1 +cmdline: urxvtd -q -o -f +crash_function: rxvt_term::selection_delimit_word +executable: /usr/bin/urxvtd +kernel: 2.6.38.8-35.fc15.x86_64 +package: rxvt-unicode-9.12-2.fc15 +reason: Process /usr/bin/urxvtd was killed by signal 11 (SIGSEGV) +type: CCpp +uid: 502 +xsession_errors:10public2015-01-14T19:52:40+01:002015-01-14T19:52:40+01:00001abrt_hashbbfe66399cc9cb8ba647414e33c5d1e4ad82b5112URLfalse diff --git a/tests/p_abrt-cli/queries/get_issue_comment_rating_1 b/tests/p_abrt-cli/queries/get_issue_comment_rating_1 new file mode 100644 index 0000000..09e7daa --- /dev/null +++ b/tests/p_abrt-cli/queries/get_issue_comment_rating_1 @@ -0,0 +1,27 @@ +HTTP/1.1 200 OK +Date: Wed, 14 Jan 2015 08:50:07 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.3 +X-Powered-By: PHP/5.6.3 +Set-Cookie: PHPSESSID=tq25vlcb178go69v81olmibrm6; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 24 Nov 2014 11:23:27 GMT +Connection: close +Content-Length: 4450 +Content-Type: text/xml; charset=utf-8 + + +9910public2015-01-14T19:52:40+01:001testwill-crash30normal50minor10new1administratorroot@localhostwer70have not tried2015-01-14T09:29:23+01:00010none10none10openwer371administratorroot@localhostAnother user experienced a similar problem: + +i am second comment + +reporter: libreport-2.3.0.59.gb561.dirty +backtrace_rating: 1 +cmdline: urxvtd -q -o -f +crash_function: rxvt_term::selection_delimit_word +executable: /usr/bin/urxvtd +kernel: 2.6.38.8-35.fc15.x86_64 +package: rxvt-unicode-9.12-2.fc15 +reason: Process /usr/bin/urxvtd was killed by signal 11 (SIGSEGV) +type: CCpp +uid: 502 +xsession_errors:10public2015-01-14T19:52:40+01:002015-01-14T19:52:40+01:00001abrt_hashbbfe66399cc9cb8ba647414e33c5d1e4ad82b5112URLfalse diff --git a/tests/p_abrt-cli/queries/get_issue_dup_comment_rating_1 b/tests/p_abrt-cli/queries/get_issue_dup_comment_rating_1 new file mode 100644 index 0000000..865de1f --- /dev/null +++ b/tests/p_abrt-cli/queries/get_issue_dup_comment_rating_1 @@ -0,0 +1,26 @@ +HTTP/1.1 200 OK +Date: Wed, 14 Jan 2015 08:50:07 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.3 +X-Powered-By: PHP/5.6.3 +Set-Cookie: PHPSESSID=tq25vlcb178go69v81olmibrm6; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 24 Nov 2014 11:23:27 GMT +Connection: close +Content-Length: 4392 +Content-Type: text/xml; charset=utf-8 + + +9910public2015-01-14T19:52:40+01:001testwill-crash30normal50minor10new1administratorroot@localhostwer70have not tried2015-01-14T09:29:23+01:00010none10none10openwer371administratorroot@localhostAnother user experienced a similar problem: + +i am comment + +backtrace_rating: 1 +cmdline: urxvtd -q -o -f +crash_function: rxvt_term::selection_delimit_word +executable: /usr/bin/urxvtd +kernel: 2.6.38.8-35.fc15.x86_64 +package: rxvt-unicode-9.12-2.fc15 +reason: Process /usr/bin/urxvtd was killed by signal 11 (SIGSEGV) +type: CCpp +uid: 502 +xsession_errors:10public2015-01-14T19:52:40+01:002015-01-14T19:52:40+01:00001abrt_hashbbfe66399cc9cb8ba647414e33c5d1e4ad82b5112URLfalse diff --git a/tests/p_abrt-cli/queries/login_correct b/tests/p_abrt-cli/queries/login_correct new file mode 100644 index 0000000..1583c29 --- /dev/null +++ b/tests/p_abrt-cli/queries/login_correct @@ -0,0 +1,13 @@ +HTTP/1.1 200 OK +Date: Fri, 07 Nov 2014 21:12:48 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.2 +X-Powered-By: PHP/5.6.2 +Set-Cookie: PHPSESSID=22qmssa8tsrsrejsiv0od5t7k2; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 03 Mar 2014 19:19:50 GMT +Connection: close +Content-Length: 866 +Content-Type: text/xml; charset=utf-8 + + +2testtesttest@email.com25Europe/Prague diff --git a/tests/p_abrt-cli/queries/login_incorrect b/tests/p_abrt-cli/queries/login_incorrect new file mode 100644 index 0000000..2cd29c7 --- /dev/null +++ b/tests/p_abrt-cli/queries/login_incorrect @@ -0,0 +1,13 @@ +HTTP/1.1 500 Internal Service Error +Date: Fri, 07 Nov 2014 21:51:25 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.2 +X-Powered-By: PHP/5.6.2 +Set-Cookie: PHPSESSID=d7codh295fdqov4hta9jb1c6a6; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 03 Mar 2014 19:19:50 GMT +Connection: close +Content-Length: 280 +Content-Type: text/xml; charset=utf-8 + + +SOAP-ENV:ClientAccess denied diff --git a/tests/p_abrt-cli/queries/project_get_id_from_name b/tests/p_abrt-cli/queries/project_get_id_from_name new file mode 100644 index 0000000..ebe31fb --- /dev/null +++ b/tests/p_abrt-cli/queries/project_get_id_from_name @@ -0,0 +1,13 @@ +HTTP/1.1 200 OK +Date: Fri, 07 Nov 2014 21:12:48 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.2 +X-Powered-By: PHP/5.6.2 +Set-Cookie: PHPSESSID=22qmssa8tsrsrejsiv0od5t7k2; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 03 Mar 2014 19:19:50 GMT +Connection: close +Content-Length: 566 +Content-Type: text/xml; charset=utf-8 + + +1 diff --git a/tests/p_abrt-cli/queries/search_no_issue b/tests/p_abrt-cli/queries/search_no_issue new file mode 100644 index 0000000..7575614 --- /dev/null +++ b/tests/p_abrt-cli/queries/search_no_issue @@ -0,0 +1,13 @@ +HTTP/1.1 200 OK +Date: Fri, 07 Nov 2014 11:34:12 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.2 +X-Powered-By: PHP/5.6.2 +Set-Cookie: PHPSESSID=07lf8bbdtbqv33i9g2l7ffska6; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 03 Mar 2014 19:19:50 GMT +Connection: close +Content-Length: 568 +Content-Type: text/xml; charset=utf-8 + + + diff --git a/tests/p_abrt-cli/queries/search_one_issue b/tests/p_abrt-cli/queries/search_one_issue new file mode 100644 index 0000000..08985c0 --- /dev/null +++ b/tests/p_abrt-cli/queries/search_one_issue @@ -0,0 +1,13 @@ +HTTP/1.1 200 OK +Date: Wed, 14 Jan 2015 08:50:07 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.3 +X-Powered-By: PHP/5.6.3 +Set-Cookie: PHPSESSID=tq25vlcb178go69v81olmibrm6; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 24 Nov 2014 11:23:27 GMT +Connection: close +Content-Length: 3197 +Content-Type: text/xml; charset=utf-8 + + +9910public2015-01-14T09:29:23+01:001testwill-crash30normal50minor10new1administratorroot@localhostwer70have not tried2015-01-14T09:29:23+01:00010none10none10openwer1abrt_hashbbfe66399cc9cb8ba647414e33c5d1e4ad82b5112URLfalse diff --git a/tests/p_abrt-cli/queries/search_two_issues b/tests/p_abrt-cli/queries/search_two_issues new file mode 100644 index 0000000..8e2d66b --- /dev/null +++ b/tests/p_abrt-cli/queries/search_two_issues @@ -0,0 +1,22 @@ +HTTP/1.1 200 OK +Date: Wed, 14 Jan 2015 08:50:07 GMT +Server: Apache/2.4.10 (Fedora) PHP/5.6.3 +X-Powered-By: PHP/5.6.3 +Set-Cookie: PHPSESSID=tq25vlcb178go69v81olmibrm6; path=/; HttpOnly +Cache-Control: private, max-age=10800, pre-check=10800 +Last-Modified: Mon, 24 Nov 2014 11:23:27 GMT +Connection: close +Content-Length: 6839 +Content-Type: text/xml; charset=utf-8 + + +9910public2015-01-14T09:29:23+01:001testwill-crash30normal50minor10new1administratorroot@localhostwer70have not tried2015-01-14T09:29:23+01:00010none10none10openwer1abrt_hashbbfe66399cc9cb8ba647414e33c5d1e4ad82b5112URLfalse9810public2015-01-14T07:25:11+01:001testwill-crash30normal50minor10new2mhabrnalemail@email.com[abrt] will-crash: will_segfault killed by SIGSEGV77.7.770have not tried2015-01-14T06:19:46+01:00010none10none10openVersion-Release number of selected component: +will-crash-0.8-1.fc21 +reporter: libreport-2.3.0.59.gb561.dirty +cmdline: will_segfault +executable: /usr/bin/will_segfault +kernel: 3.17.0-301.fc21.x86_64 +runlevel: N 5 +type: CCpp +uid: 1000 +532open_fds138text2015-01-14T06:19:50+01:00http://localhost/mantisbt/file_download.php?file_id=532&amp;type=bug21abrt_hashbbfe66399cc9cb8ba647414e33c5d1e4ad82b5112URLhttps://retrace.fedoraproject.org/faf/reports/347291/false diff --git a/tests/p_abrt/0-install_abrt.sh b/tests/p_abrt/0-install_abrt.sh new file mode 100755 index 0000000..cfc62a1 --- /dev/null +++ b/tests/p_abrt/0-install_abrt.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Author: Athmane Madjoudj + + +if (t_GetPkgRel basesystem | grep -q el6) +then + t_InstallPackage abrt +else + echo "Skipped on CentOS 5" +fi diff --git a/tests/p_abrt/abrt_gpg_keys_test.sh b/tests/p_abrt/abrt_gpg_keys_test.sh new file mode 100755 index 0000000..9c67b80 --- /dev/null +++ b/tests/p_abrt/abrt_gpg_keys_test.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Christoph Galuschka +# Note: This was a known issue in CentOS 6.0 +# See: http://bugs.centos.org/view.php?id=4993 +# Christoph Galuschka: added functionality for C7 + +t_Log "Running $0 - check that abrt is using CentOS' gpg keys." + +if [ "$centos_ver" = "7" ] ;then + ls /etc/pki/rpm-gpg/ | grep -q "RPM-GPG-KEY-CentOS" +elif [ "$centos_ver" = "6" ] ; then + grep -q "RPM-GPG-KEY-CentOS" /etc/abrt/gpg_keys +else + echo "Skipped on CentOS 5" +fi + +t_CheckExitStatus $? diff --git a/tests/p_acl/0-install_acl.sh b/tests/p_acl/0-install_acl.sh new file mode 100755 index 0000000..be914c2 --- /dev/null +++ b/tests/p_acl/0-install_acl.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "$0 - installing acl" +t_InstallPackage acl + +t_Log "Remount root fs with acl support" +mount -o remount,acl / +sleep 2 diff --git a/tests/p_acl/01-set_get_test.sh b/tests/p_acl/01-set_get_test.sh new file mode 100755 index 0000000..f5c55dc --- /dev/null +++ b/tests/p_acl/01-set_get_test.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# Author: Dan Trainor +# Athmane Madjoudj + +echo "Running $0 - Check that we can get and set acl" + +source library/sh_lib.sh + +check=0 + +touch /tmp/acl_test_file + +setfacl -m user:nobody:r-- /tmp/acl_test_file +getfacl /tmp/acl_test_file |grep -q 'user:nobody:r--' + +# t_CheckExitStatus $? +check=$(eq_is_success ${check} 0) + +/bin/rm -f /tmp/acl_test_file + +check_test_status ${check} "$0" +exit ${check} diff --git a/tests/p_acl/acl_set_get_test.sh b/tests/p_acl/acl_set_get_test.sh new file mode 100755 index 0000000..d9741c5 --- /dev/null +++ b/tests/p_acl/acl_set_get_test.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# Author: Dan Trainor +# Athmane Madjoudj + +t_Log "Running $0 - Check that we can get and set acl" + +touch /tmp/acl_test_file + +setfacl -m user:nobody:r-- /tmp/acl_test_file +getfacl /tmp/acl_test_file |grep -q 'user:nobody:r--' + +t_CheckExitStatus $? + +/bin/rm -f /tmp/acl_test_file diff --git a/tests/p_amanda/0-install_amanda.sh b/tests/p_amanda/0-install_amanda.sh new file mode 100755 index 0000000..76dd389 --- /dev/null +++ b/tests/p_amanda/0-install_amanda.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "$0 - installing amanda system" + + +if (t_GetPkgRel basesystem | grep -q el5) +then + t_Log "This is a C5 system. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Amanda not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_InstallPackage amanda amanda-server amanda-client +id -u amandabackup &>/dev/null || useradd amandabackup diff --git a/tests/p_amanda/001-prepare_environment.sh b/tests/p_amanda/001-prepare_environment.sh new file mode 100755 index 0000000..76dd389 --- /dev/null +++ b/tests/p_amanda/001-prepare_environment.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "$0 - installing amanda system" + + +if (t_GetPkgRel basesystem | grep -q el5) +then + t_Log "This is a C5 system. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Amanda not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_InstallPackage amanda amanda-server amanda-client +id -u amandabackup &>/dev/null || useradd amandabackup diff --git a/tests/p_amanda/amanda-server_test.sh b/tests/p_amanda/amanda-server_test.sh new file mode 100755 index 0000000..a2d64b1 --- /dev/null +++ b/tests/p_amanda/amanda-server_test.sh @@ -0,0 +1,139 @@ +#!/bin/sh +# Author: Christoph Galuschka +t_Log "Running $0 - amanda server runs a simple task (backing up /etc)" + +if (t_GetPkgRel basesystem | grep -q el5) +then + t_Log "This is a C5 system. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Amanda not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +ret_val=0 + +# Creating necessary directories +mkdir -p /etc/amanda/MyConfig +mkdir -p /amanda/vtapes/slot{1,2} +mkdir -p /amanda/holding +mkdir -p /amanda/state/{curinfo,log,index} + +# creating testfile in /etc +# just some content to grep later +STRING='This string must be found' +echo $STRING > /etc/amandabackup-test + +cat > /etc/amanda/MyConfig/amanda.conf <> /etc/amanda/MyConfig/amanda.conf +else + echo 'dumpuser "amandabackup"' >> /etc/amanda/MyConfig/amanda.conf +fi + +cat >> /etc/amanda/MyConfig/amanda.conf <> /etc/amanda/MyConfig/amanda.conf +else + echo 'label_new_tapes "MyData%%"' >> /etc/amanda/MyConfig/amanda.conf +fi + +cat >> /etc/amanda/MyConfig/amanda.conf < /etc/amanda/MyConfig/disklist +if (t_GetPkgRel basesystem | grep -q el5) +then + chown -R amanda /etc/amanda/MyConfig + chown -R amanda /amanda +else + chown -R amandabackup /etc/amanda/MyConfig + chown -R amandabackup /amanda +fi + +## running amanda configuration check +if (t_GetPkgRel basesystem | grep -q el5) +then + su amanda -c 'amcheck MyConfig' | grep -q '0 problems found' +else + su amandabackup -c 'amcheck MyConfig' | grep -q '0 problems found' +fi +if [ $? = 1 ] +then + t_Log "amanda Configuration check failed." + ret_val=1 +else + t_Log "amanda Configuration OK." +fi + +## running backup of /etc +if (t_GetPkgRel basesystem | grep -q el5) +then + su amanda -c 'amdump MyConfig' +else + su amandabackup -c 'amdump MyConfig' +fi + +if [ $? -ne 0 ] +then + t_Log "Backup job failed." + ret_val=1 +else + t_Log "Backup job successfull." +fi + +## checking data in backup +grep -q "${STRING}" $(find /amanda/vtapes/ -name 00001.localhost._etc.0) +if [ $? -ne 0 ] +then + t_Log "Something is wrong with the backup - can't find content of /etc/amandabackup-test file." + ret_val=1 +else + t_Log "Backup seems OK and contains content of /etc/amandabackup-test file." +fi + +# cleaning up +/bin/rm -rf /amanda +/bin/rm -rf /etc/amanda/MyConfig +/bin/rm -rf /etc/amandabackup-test + +t_CheckExitStatus $ret_val + diff --git a/tests/p_anaconda/0-install_anaconda.sh b/tests/p_anaconda/0-install_anaconda.sh new file mode 100755 index 0000000..6c722a0 --- /dev/null +++ b/tests/p_anaconda/0-install_anaconda.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +uname_arch=$(uname -m) +if [ "$centos_ver" -eq "8" ]; then + t_Log "c8 => SKIPPING" + exit 0 +fi + +if [ "$uname_arch" == "armv7l" ]; then + t_Log "*** Not testing on Arch: $uname_arch ***" + exit 0 +fi + +t_InstallPackage anaconda diff --git a/tests/p_anaconda/anaconda_centos_patch.sh b/tests/p_anaconda/anaconda_centos_patch.sh new file mode 100755 index 0000000..c309c43 --- /dev/null +++ b/tests/p_anaconda/anaconda_centos_patch.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - CentOS Anaconda patch is applied test." + +uname_arch=$(uname -m) +if [ "$centos_ver" -eq "8" ]; then + t_Log "c8 => SKIPPING" + exit 0 +fi + +if [ "$centos_ver" -eq "9" ]; then + t_Log "c9 => SKIPPING" + exit 0 +fi + +if [ "$uname_arch" == "aarch64" ] || [ "$uname_arch" == "i686" ] || [ "$uname_arch" == "armv7l" ]; then + t_Log "*** Not testing on Arch: $uname_arch ***" + exit 0 +fi + +if [ "$centos_ver" = "7" ];then + ANACONDA_PATH=/usr/lib64/python2.7/site-packages/pyanaconda/ + ANACONDA_FILE="centos.py" +else + ANACONDA_PATH=/usr/lib/anaconda/ + ANACONDA_FILE="rhel.py" +fi + + +grep "CentOS Linux" $ANACONDA_PATH/installclasses/$ANACONDA_FILE >/dev/null 2>&1 + + +t_CheckExitStatus $? diff --git a/tests/p_annobin/0-install_annobin.sh b/tests/p_annobin/0-install_annobin.sh new file mode 100755 index 0000000..ace2e60 --- /dev/null +++ b/tests/p_annobin/0-install_annobin.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Author: Neal Gompa + +# Skip if older than CentOS 8 +if [ "$centos_ver" -lt "8" ]; then + t_Log "annobin does not exist pre-c8 => SKIP" + exit 0 +fi + +# Install annobin and gcc +t_Log "Running $0 - installing annobin and gcc." + +t_InstallPackage annobin redhat-rpm-config gcc gcc-c++ diff --git a/tests/p_annobin/10-test_annobin-gcc.sh b/tests/p_annobin/10-test_annobin-gcc.sh new file mode 100755 index 0000000..2b6e3af --- /dev/null +++ b/tests/p_annobin/10-test_annobin-gcc.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Author: Neal Gompa + +# Skip if older than CentOS 8 +if [ "$centos_ver" -lt "8" ]; then + t_Log "annobin does not exist pre-c8 => SKIP" + exit 0 +fi + +# Run the test +t_Log "Running $0 - build a hello world program with gcc using annobin" + +BUILTPROG=$(mktemp) + +cat < +int main() { + printf("Hello World!\n"); + return 0; +} +EOF + +${BUILTPROG} | grep -q "Hello World" +t_CheckExitStatus $? + +rm -f ${BUILTPROG} diff --git a/tests/p_annobin/20-test_annobin-gcc-c++.sh b/tests/p_annobin/20-test_annobin-gcc-c++.sh new file mode 100755 index 0000000..761cdf3 --- /dev/null +++ b/tests/p_annobin/20-test_annobin-gcc-c++.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Author: Neal Gompa + +# Skip if older than CentOS 8 +if [ "$centos_ver" -lt "8" ]; then + t_Log "annobin does not exist pre-c8 => SKIP" + exit 0 +fi + +# Run the test +t_Log "Running $0 - build a hello world program with gcc-c++ using annobin" + +BUILTPROG=$(mktemp) + +cat < +int main() { + std::cout << "Hello World!\n"; + return 0; +} +EOF + +${BUILTPROG} | grep -q "Hello World" +t_CheckExitStatus $? + +rm -f ${BUILTPROG} diff --git a/tests/p_arpwatch/0_install_arpwatch.sh b/tests/p_arpwatch/0_install_arpwatch.sh new file mode 100755 index 0000000..49a7b53 --- /dev/null +++ b/tests/p_arpwatch/0_install_arpwatch.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Author: Christoph Galuschka +# Rene Diepstraten + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + + +# Install requirements +t_InstallPackage arpwatch psmisc net-tools + diff --git a/tests/p_arpwatch/10_arpwatch_test.sh b/tests/p_arpwatch/10_arpwatch_test.sh new file mode 100755 index 0000000..29c4693 --- /dev/null +++ b/tests/p_arpwatch/10_arpwatch_test.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# Author: Christoph Galuschka +# Rene Diepstraten + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_Log "Running $0 - arpwatch on interface with default gateway" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +# arpwatch is broken in el7 +# See https://bugzilla.redhat.com/show_bug.cgi?id=1044062 +[[ $centos_ver -eq 7 ]] && { + t_Log "arpwatch is broken on el7. Skipping test." + exit +} + +# Kill arpwatch instance from previous test +# killall arpwatch + +# getting IP-address of default gateway +defgw=$(ip route | awk '/^default via/ {print $3}') +if [ -z $defgw ] + then + t_Log "No default gateway, can't test arpwatch" + exit +fi + +# setting path to arp.dat +if (t_GetPkgRel basesystem | grep -q el5) + then + arpdat='/var/arpwatch/arp.dat' +else + arpdat='/var/lib/arpwatch/arp.dat' +fi + +# beginning and running test +arpwatch +sleep 4 +arp -d $defgw +sleep 4 +ping -q -i 1 -c 5 $defgw +killall arpwatch +sleep 2 +grep -q $defgw $arpdat + +t_CheckExitStatus $? + +# cleaning up +cat /dev/null > $arpdat + diff --git a/tests/p_attr/0-install-attr.sh b/tests/p_attr/0-install-attr.sh new file mode 100755 index 0000000..cba3032 --- /dev/null +++ b/tests/p_attr/0-install-attr.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# Author: Dan Trainor + +t_InstallPackage attr diff --git a/tests/p_attr/attr_check_installed.sh b/tests/p_attr/attr_check_installed.sh new file mode 100755 index 0000000..e27b007 --- /dev/null +++ b/tests/p_attr/attr_check_installed.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# Author: Dan Trainor +# Athmane Madjoudj + +t_Log "Running $0 - Checking to see if setfattr, getfattr work" + + +dd if=/dev/zero of=/tmp/attrtest.img bs=1024000 count=100 &>/dev/null +t_CheckExitStatus $? + +echo -e 'y\n' | mkfs.ext3 /tmp/attrtest.img > /dev/null 2>&1 + +mkdir /mnt/attr_test +mount -t ext3 -o loop,user_xattr /tmp/attrtest.img /mnt/attr_test +touch /mnt/attr_test/testfile +setfattr -n user.test /mnt/attr_test/testfile +getfattr /mnt/attr_test/testfile | grep -oq "user.test" + +t_CheckExitStatus $? + +umount /mnt/attr_test +rm -f /tmp/attrtest.img diff --git a/tests/p_audit/0_install_auditd.sh b/tests/p_audit/0_install_auditd.sh new file mode 100755 index 0000000..19ee155 --- /dev/null +++ b/tests/p_audit/0_install_auditd.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Install tests deps +t_Log "Running $0 - auditd" + + +t_InstallPackage audit +t_ServiceControl auditd restart + diff --git a/tests/p_audit/1_auditd_running.sh b/tests/p_audit/1_auditd_running.sh new file mode 100755 index 0000000..7dbf2ce --- /dev/null +++ b/tests/p_audit/1_auditd_running.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "Running $0 - check if auditd is running." + +if [ "$SKIP_QA_HARNESS" -eq 1 ] | [ "$CONTAINERTEST" -eq 1 ] ; then + echo "Skipping this test ..." +else + service auditd status > /dev/null 2>&1 + t_CheckExitStatus $? +fi diff --git a/tests/p_audit/2_auditd_generate-events.sh b/tests/p_audit/2_auditd_generate-events.sh new file mode 100755 index 0000000..e6dd704 --- /dev/null +++ b/tests/p_audit/2_auditd_generate-events.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +if [ $SKIP_QA_HARNESS -eq 1 -o $CONTAINERTEST -eq 1 ]; then + echo "Skipping this test ..." +else +t_Log "Running $0 - Generate some events for audit log." + +useradd testauditd +userdel testauditd + +t_CheckExitStatus $? +fi diff --git a/tests/p_audit/3_auditd_logging.sh b/tests/p_audit/3_auditd_logging.sh new file mode 100755 index 0000000..53e4c96 --- /dev/null +++ b/tests/p_audit/3_auditd_logging.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# Author: Athmane Madjoudj +if [ $SKIP_QA_HARNESS -eq 1 -o $CONTAINERTEST -eq 1 ]; then + echo "Skipping this test ..." +else +t_Log "Running $0 - check if audit log is not empty." + +[[ -s /var/log/audit/audit.log ]] + +t_CheckExitStatus $? +fi diff --git a/tests/p_autofs/0-install_autofs.sh b/tests/p_autofs/0-install_autofs.sh new file mode 100755 index 0000000..14a5c24 --- /dev/null +++ b/tests/p_autofs/0-install_autofs.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Author: Christoph Galuschka + +if [ $CONTAINERTEST -eq 1 ]; then + echo "Skipping this test ..." +else + +t_Log "Running $0 - Installing required packages" + +if [ "$centos_ver" = "5" ] ; then + t_InstallPackage autofs nfs-utils portmap +else + t_InstallPackage autofs nfs-utils rpcbind +fi + + +t_Log 'Preparing NFS-Share and starting NFS-Server' +echo '/var/lib/ 127.0.0.1(ro)' >> /etc/exports + +if [ "$centos_ver" = "5" ] ; then + t_ServiceControl portmap restart + t_ServiceControl nfs restart +elif [ "$centos_ver" -ge 8 ] ; then + t_ServiceControl rpcbind restart + t_ServiceControl nfs-server restart +else + t_ServiceControl rpcbind restart + t_ServiceControl nfs restart +fi + + +t_Log 'verify if NFS is mountable' +mount -t nfs 127.0.0.1:/var/lib /mnt +ls -al /mnt | egrep -q '(dnf|yum)' + +t_CheckExitStatus $? +umount /mnt +fi diff --git a/tests/p_autofs/10-autofs-nfs-mount.sh b/tests/p_autofs/10-autofs-nfs-mount.sh new file mode 100755 index 0000000..0a402b4 --- /dev/null +++ b/tests/p_autofs/10-autofs-nfs-mount.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# Author: Christoph Galuschka +if [ $CONTAINERTEST -eq 1 ]; then + echo "Skipping this test ..." +else +t_Log "Running $0 - autofs can mount nfs share test." + +t_Log 'Preparing autofs configuration' +cp -a /etc/auto.master /etc/auto.master_orig +echo '/autofs /etc/auto.autofs' >> /etc/auto.master +echo 'nfs -fstype=nfs 127.0.0.1:/var/lib' > /etc/auto.autofs + +t_ServiceControl autofs restart + +t_Log 'Running test - accessing /var/lib via autofs' + +ls -al /autofs/nfs | egrep -q '(dnf|yum)' +t_CheckExitStatus $? + +# return everything to previous state +cp -a /etc/auto.master_orig /etc/auto.master +rm -rf /etc/auto.autofs +cat /dev/null > /etc/exports +t_ServiceControl autofs stop +t_ServiceControl nfs stop +t_ServiceControl nfs-server stop +t_ServiceControl rpcbind stop +fi diff --git a/tests/p_bash/bash_version_info_test.sh b/tests/p_bash/bash_version_info_test.sh new file mode 100755 index 0000000..988910e --- /dev/null +++ b/tests/p_bash/bash_version_info_test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Note: This was a known issue in CentOS 6.0 +# See: http://bugs.centos.org/view.php?id=5158 + +t_Log "Running $0 - check that bash version info is the same with upstream." + +bash --version | grep -qE "(i386|i686|x86_64|aarch64|armv7hl|powerpc64le|powerpc64)-redhat-linux-gnu" + +t_CheckExitStatus $? diff --git a/tests/p_bc/0-install_bc.sh b/tests/p_bc/0-install_bc.sh new file mode 100755 index 0000000..2107276 --- /dev/null +++ b/tests/p_bc/0-install_bc.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author : Varadharajan M +# Manoj Mahalingam +t_InstallPackage bc +t_CheckExitStatus $? diff --git a/tests/p_bc/10-bc-installed-test.sh b/tests/p_bc/10-bc-installed-test.sh new file mode 100755 index 0000000..9f622f8 --- /dev/null +++ b/tests/p_bc/10-bc-installed-test.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author : Varadharajan M +# Manoj Mahalingam + +t_Log "Running $0 - Test bc is installed" +bc --version +t_CheckExitStatus $? diff --git a/tests/p_bc/20-bc-test-simple-calculation.sh b/tests/p_bc/20-bc-test-simple-calculation.sh new file mode 100755 index 0000000..a80e46a --- /dev/null +++ b/tests/p_bc/20-bc-test-simple-calculation.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author : Varadharajan M +# Manoj Mahalingam + +t_Log "Running $0 - Testing basic bc functionalities" +test `echo "5 + 6 * 5 / 10 - 1" | bc` -eq "7" +t_CheckExitStatus $? diff --git a/tests/p_bc/bc-test-basic-functionalities.sh b/tests/p_bc/bc-test-basic-functionalities.sh new file mode 100755 index 0000000..716b9a1 --- /dev/null +++ b/tests/p_bc/bc-test-basic-functionalities.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author : Varadharajan M +# Manoj Mahalingam + +t_Log "Running $0 - Testing basic bc functionalities" +test `echo "5 + 6 * 5 / 10 - 1" | bc` -eq "7" ; t_CheckExitStatus $? diff --git a/tests/p_bc/bc-test-installation.sh b/tests/p_bc/bc-test-installation.sh new file mode 100755 index 0000000..a58d7a1 --- /dev/null +++ b/tests/p_bc/bc-test-installation.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Author : Varadharajan M +# Manoj Mahalingam + + +t_Log "Running $0 - Test bc is installed" +bc --version +t_CheckExitStatus $? diff --git a/tests/p_bind/0-install_bind.sh b/tests/p_bind/0-install_bind.sh new file mode 100755 index 0000000..028daf1 --- /dev/null +++ b/tests/p_bind/0-install_bind.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_InstallPackage bind bind-utils + +if (t_GetPkgRel basesystem | grep -q el5) +then + cat > /etc/named.conf < + +t_Log "Running $0 - bind: local resolver can qualify 127.0.0.1" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +dig +timeout=1 +short @127.0.0.1 localhost | grep -q '127.0.0.1' + +t_CheckExitStatus $? diff --git a/tests/p_bridge-utils/00-install_bridge-utils.sh b/tests/p_bridge-utils/00-install_bridge-utils.sh new file mode 100755 index 0000000..6ae9b1b --- /dev/null +++ b/tests/p_bridge-utils/00-install_bridge-utils.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Madhurranjan Mohaan + +# Install bridge_utils package +t_Log "Running $0 - bridge-utils: Installation" + +if [ "$centos_ver" -ge 8 ] ; then +t_InstallPackage iproute +else +t_InstallPackage bridge-utils +fi diff --git a/tests/p_bridge-utils/05-add_bridge.sh b/tests/p_bridge-utils/05-add_bridge.sh new file mode 100755 index 0000000..63ed5ec --- /dev/null +++ b/tests/p_bridge-utils/05-add_bridge.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Author : Madhurranjan Mohaan + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +if [ $# -eq 0 ] +then + bridge=testbridge1 +else + bridge=$1 +fi + +. "$(dirname "$0")"/p_bridge-utils-functions + +t_Log "Running $0 - Adding a dummy Bridge: $bridge" +ret_val=$(bru_add_bridge $bridge) + +t_CheckExitStatus $ret_val +bru_del_bridge $bridge >/dev/null +exit $ret_val diff --git a/tests/p_bridge-utils/10-delete_bridge.sh b/tests/p_bridge-utils/10-delete_bridge.sh new file mode 100755 index 0000000..65725c9 --- /dev/null +++ b/tests/p_bridge-utils/10-delete_bridge.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Author : Madhurranjan Mohaan + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +. "$(dirname "$0")"/p_bridge-utils-functions +#add bridge +bridge=testbridge2 +bru_add_bridge $bridge >/dev/null + +t_Log "Running $0 - Deleting the dummy bridge: $bridge" + +t_Log "Deleting bridge $bridge" +ret_val=$(bru_del_bridge $bridge) + +t_CheckExitStatus $ret_val diff --git a/tests/p_bridge-utils/p_bridge-utils-functions b/tests/p_bridge-utils/p_bridge-utils-functions new file mode 100644 index 0000000..0020d4b --- /dev/null +++ b/tests/p_bridge-utils/p_bridge-utils-functions @@ -0,0 +1,97 @@ +#!/bin/bash + +function bru_add_bridge_7 +{ + bridge=$1 + bridge_present=`brctl show | grep $bridge` + if ! [ "$bridge_present" ] + then + brctl addbr $bridge + bridge_present=`brctl show | grep $bridge` + if [ "$bridge_present" ] + then + ret_val=0 + else + ret_val=1 + fi + else + ret_val=0 + fi + echo $ret_val +} +function bru_add_bridge_8 +{ + bridge=$1 + bridge_present=`cat /proc/net/dev | grep $bridge` + if ! [ "$bridge_present" ] + then + ip link add name $bridge type bridge + bridge_present=`cat /proc/net/dev | grep $bridge` + if [ "$bridge_present" ] + then + ret_val=0 + else + ret_val=1 + fi + else + ret_val=0 + fi + echo $ret_val +} + +function bru_del_bridge_7 +{ + bridge=$1 + bridge_present=`brctl show | grep $bridge` + if ! [ "$bridge_present" ] + then + ret_val=1 + else + brctl delbr $bridge + bridge_present=`brctl show | grep $bridge` + if [ "$bridge_present" ] + then + ret_val=1 + else + ret_val=0 + fi + fi + echo $ret_val +} +function bru_del_bridge_8 +{ + bridge=$1 + bridge_present=`cat /proc/net/dev | grep $bridge` + if ! [ "$bridge_present" ] + then + ret_val=1 + else + ip link del name $bridge + bridge_present=`cat /proc/net/dev | grep $bridge` + if [ $bridge_present ] + then + ret_val=1 + else + ret_val=0 + fi + fi + echo $ret_val +} + +function bru_add_bridge +{ + if [ "$centos_ver" -ge 8 ] ; then + bru_add_bridge_8 $1 + else + bru_add_bridge_7 $1 + fi +} + +function bru_del_bridge +{ + if [ "$centos_ver" -ge 8 ] ; then + bru_del_bridge_8 $1 + else + bru_del_bridge_7 $1 + fi +} diff --git a/tests/p_busybox/00_install_busybox.sh b/tests/p_busybox/00_install_busybox.sh new file mode 100755 index 0000000..eae5d28 --- /dev/null +++ b/tests/p_busybox/00_install_busybox.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Christoph Galuschka +# Author: Rene Diepstraten + +[[ $centos_ver -ge 7 ]] && { t_Log "busybox is not part of el${centos_ver}" ; exit ; } + +t_Log "Running $0 - attempting to install busybox." +t_InstallPackage busybox + diff --git a/tests/p_busybox/10_test_busybox.sh b/tests/p_busybox/10_test_busybox.sh new file mode 100755 index 0000000..e7aa2e8 --- /dev/null +++ b/tests/p_busybox/10_test_busybox.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Author: Christoph Galuschka +# Author: Rene Diepstraten + +[[ $centos_ver -ge 7 ]] && exit + +t_Log "Running $0 - busybox test: busybox lists available functions." + +busybox | grep -q 'Currently defined functions' +busy_ok=$? +if [ $busy_ok = 1 ] + then + t_Log 'busybox does not seem to list available functions' +fi +t_CheckExitStatus $busy_ok diff --git a/tests/p_busybox/20_functiontest_busybox.sh b/tests/p_busybox/20_functiontest_busybox.sh new file mode 100755 index 0000000..6d526a4 --- /dev/null +++ b/tests/p_busybox/20_functiontest_busybox.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Author: Christoph Galuschka +# Author: Rene Diepstraten + +[[ $centos_ver -ge 7 ]] && exit + +t_Log "Running $0 - busybox functional tests: busybox provided functions are working." + + +ret_val=0 +busybox | grep -q 'ls,' +if [ $? == 0 ] + then + t_Log "busybox provides 'ls'; testing it" + touch /var/tmp/busybox + busybox ls /var/tmp/ |grep -q busybox + if [ $? == 1 ] + then + t_Log "busybox provides 'ls' but it does not seem to work" + ret_val=1 + else + t_Log "'ls' works" + fi + #cleaning up + /bin/rm /var/tmp/busybox +fi + +busybox | grep -q 'touch,' +if [ $? == 0 ] + then + t_Log "busybox provides 'touch'; testing it" + busybox touch /var/tmp/busybox + ls /var/tmp/ |grep -q busybox + if [ $? == 1 ] + then + t_Log "busybox provides 'touch' but it does not seem to work" + ret_val=1 + else + t_Log "'touch' works" + fi + #cleaning up + /bin/rm /var/tmp/busybox +fi + +t_CheckExitStatus $ret_val + diff --git a/tests/p_bzip2/0_install_bzip2.sh b/tests/p_bzip2/0_install_bzip2.sh new file mode 100755 index 0000000..6f560ef --- /dev/null +++ b/tests/p_bzip2/0_install_bzip2.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - attempting to install bzip2." +t_InstallPackage bzip2 + diff --git a/tests/p_bzip2/10-bzip2-test.sh b/tests/p_bzip2/10-bzip2-test.sh new file mode 100755 index 0000000..ef1aae8 --- /dev/null +++ b/tests/p_bzip2/10-bzip2-test.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Author: Christoph Galuschka + +t_Log "Running $0 - run a file through bzip2,bzcat and bunzip2 test." + +# create file +FILE=/var/tmp/bzip2-test.txt + +cat > $FILE < + +t_Log "$0 - installing file utility" +t_InstallPackage file diff --git a/tests/p_centos-release/centos-release_centos-base_repos.sh b/tests/p_centos-release/centos-release_centos-base_repos.sh new file mode 100755 index 0000000..9a5f7f2 --- /dev/null +++ b/tests/p_centos-release/centos-release_centos-base_repos.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - CentOS Base repos sanity test." + +# grep "name=CentOS" /etc/yum.repos.d/CentOS*-Base*.repo >/dev/null 2>&1 +grep "name=CentOS" /etc/yum.repos.d/*.repo >/dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_centos-release/centos-release_centos_gpg.sh b/tests/p_centos-release/centos-release_centos_gpg.sh new file mode 100755 index 0000000..4e7da4b --- /dev/null +++ b/tests/p_centos-release/centos-release_centos_gpg.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - CentOS RPM GPG Keys exist." + +file /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS* >/dev/null 2>&1 && \ +file /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Security* >/dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_centos-release/centos-release_issue.sh b/tests/p_centos-release/centos-release_issue.sh new file mode 100755 index 0000000..36d84b2 --- /dev/null +++ b/tests/p_centos-release/centos-release_issue.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - /etc/issue* has correct branding" +if [ "$centos_ver" -ge 7 ] ; then + t_Log "CentOS $centos_ver -> SKIP" + exit 0 +else + (grep "CentOS" /etc/issue >/dev/null 2>&1) && \ + (grep "CentOS" /etc/issue.net >/dev/null 2>&1) + t_CheckExitStatus $? +fi diff --git a/tests/p_centos-release/centos-release_os-release.sh b/tests/p_centos-release/centos-release_os-release.sh new file mode 100755 index 0000000..c26f4bb --- /dev/null +++ b/tests/p_centos-release/centos-release_os-release.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Author: Fabian Arrotin + +t_Log "Running $0 - /etc/os-release has correct ABRT string for CentOS $centos_ver" + +if [ "$centos_ver" -ge 7 ];then + if [[ $centos_stream == "no" ]]; then + for string in CENTOS_MANTISBT_PROJECT=\"CentOS-$centos_ver\" CENTOS_MANTISBT_PROJECT_VERSION=\"$centos_ver\" + do + grep -q $string /etc/os-release + if [ $? -ne "0" ];then + t_Log "missing string $string in os-release file !" + exit 1 + fi + done + else + echo "Skipping for CentOS Stream" ; exit 0 + fi + + if [ "$centos_ver" -eq 7 ]; then + for string in REDHAT_SUPPORT_PRODUCT=\"centos\" REDHAT_SUPPORT_PRODUCT_VERSION=\"$centos_ver\" + do + grep -q $string /etc/os-release + if [ $? -ne "0" ];then + t_Log "missing string $string in os-release file !" + exit 1 + fi + done + fi +else + echo "Skipping for CentOS 5 and 6 ..." ; exit 0 + +fi + +t_CheckExitStatus $? + diff --git a/tests/p_centos-release/centos-release_release_compat_symlinks.sh b/tests/p_centos-release/centos-release_release_compat_symlinks.sh new file mode 100755 index 0000000..b82b616 --- /dev/null +++ b/tests/p_centos-release/centos-release_release_compat_symlinks.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - /etc/centos-release compatibility symbolic links test." +if [ "$centos_ver" -ge 6 ] +then + grep "CentOS" /etc/centos-release >/dev/null 2>&1 + (file /etc/redhat-release | grep -E "symbolic link to .?centos-release.?" >/dev/null 2>&1) &&\ + (file /etc/system-release | grep -E "symbolic link to .?centos-release.?" >/dev/null 2>&1) +else + echo "This test is not comptatible with CentOS <= 5" +fi + +t_CheckExitStatus $? diff --git a/tests/p_centos-release/centos-release_system_release.sh b/tests/p_centos-release/centos-release_system_release.sh new file mode 100755 index 0000000..40128ca --- /dev/null +++ b/tests/p_centos-release/centos-release_system_release.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - /etc/centos-release has correct branding" + +if [ "$centos_ver" = "5" ] ; then + grep "CentOS" /etc/redhat-release >/dev/null 2>&1 +else + grep "CentOS" /etc/centos-release >/dev/null 2>&1 +fi + +t_CheckExitStatus $? + diff --git a/tests/p_chkconfig/chkconfig_list_services.sh b/tests/p_chkconfig/chkconfig_list_services.sh new file mode 100755 index 0000000..f7cdd28 --- /dev/null +++ b/tests/p_chkconfig/chkconfig_list_services.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Rene Diepstraten + +t_Log "Running $0 - check if chkconfig can list a service status" + +if [ $centos_ver -ge 8 ]; then + echo "CentOS $centos_ver does not use chkconfig, skipping" + exit 0 +fi + +# network is used as example because it's standard with minimal install + +chkconfig --list network | grep -q '3:on' + +t_CheckExitStatus $? + diff --git a/tests/p_coreutils/0-install_coreutils.sh b/tests/p_coreutils/0-install_coreutils.sh new file mode 100755 index 0000000..dc6a246 --- /dev/null +++ b/tests/p_coreutils/0-install_coreutils.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 - installing coreutils" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_InstallPackage coreutils-single +else + t_InstallPackage coreutils +fi \ No newline at end of file diff --git a/tests/p_coreutils/arch.sh b/tests/p_coreutils/arch.sh new file mode 100755 index 0000000..5850ef8 --- /dev/null +++ b/tests/p_coreutils/arch.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 Check arch agrees with current running kernel" +uname -a | grep -q `arch` +t_CheckExitStatus $? diff --git a/tests/p_coreutils/basename.sh b/tests/p_coreutils/basename.sh new file mode 100755 index 0000000..ef817d3 --- /dev/null +++ b/tests/p_coreutils/basename.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 testing basename" + +basename $0 | grep -q basename.sh || exit 1 +basename /etc/hosts | grep -q hosts +t_CheckExitStatus $? + diff --git a/tests/p_coreutils/cat.sh b/tests/p_coreutils/cat.sh new file mode 100755 index 0000000..6c33c66 --- /dev/null +++ b/tests/p_coreutils/cat.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 test cat command" + +cat > /var/tmp/cat-test < /var/tmp/cat-test2 && grep -q "file 2" /var/tmp/cat-test2 +t_CheckExitStatus $? + +rm /var/tmp/cat-test diff --git a/tests/p_coreutils/cut.sh b/tests/p_coreutils/cut.sh new file mode 100755 index 0000000..d7d775c --- /dev/null +++ b/tests/p_coreutils/cut.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 test cut" + +test `echo "1 2 3" | cut -f2 -d" "` -eq 2 +t_CheckExitStatus $? diff --git a/tests/p_coreutils/false.sh b/tests/p_coreutils/false.sh new file mode 100755 index 0000000..9442951 --- /dev/null +++ b/tests/p_coreutils/false.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 test false command" +false +test $? -eq 1 +t_CheckExitStatus $? diff --git a/tests/p_coreutils/head.sh b/tests/p_coreutils/head.sh new file mode 100755 index 0000000..85a1b25 --- /dev/null +++ b/tests/p_coreutils/head.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 test head command" + +cat << EOF > /var/tmp/head-test +1 +2 +3 +4 +5 +EOF + +head -n1 /var/tmp/head-test | grep -q 1 +t_CheckExitStatus $? + +# Cleanup +rm /var/tmp/head-test diff --git a/tests/p_coreutils/pathchk.sh b/tests/p_coreutils/pathchk.sh new file mode 100755 index 0000000..fbc243f --- /dev/null +++ b/tests/p_coreutils/pathchk.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Alice Kaerast +t_Log "$0 testing pathchk gives good results" +pathchk -p "<>" 2> /dev/null +test $? -eq 1 && pathchk /var/tmp/1234567890123456789012345123456789012345678901234512345678901234567890123451234567890123456789012345123456789012345678901234512345678901234567890123451234567890123456789012345123456789012345678901234512345678901234567890123451234567890123456789012345123456 2> /dev/null +test $? -eq 1 && pathchk /var/tmp +t_CheckExitStatus $? diff --git a/tests/p_coreutils/readlink.sh b/tests/p_coreutils/readlink.sh new file mode 100755 index 0000000..d60e9af --- /dev/null +++ b/tests/p_coreutils/readlink.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 checking readlink prints target of a symlink" + +ln -s /var/tmp/foo /var/tmp/readlink-test +readlink /var/tmp/readlink-test | grep -q "/var/tmp/foo" +t_CheckExitStatus $? +rm /var/tmp/readlink-test diff --git a/tests/p_coreutils/seq.sh b/tests/p_coreutils/seq.sh new file mode 100755 index 0000000..2adaaaa --- /dev/null +++ b/tests/p_coreutils/seq.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0" +seq -s " " 5 | grep -q "1 2 3 4 5" && seq -s " " 6 8 | grep -q "6 7 8" && seq -s " " 8 2 12 | grep -q "8 10 12" +t_CheckExitStatus $? diff --git a/tests/p_coreutils/sleeptimeout.sh b/tests/p_coreutils/sleeptimeout.sh new file mode 100755 index 0000000..134754c --- /dev/null +++ b/tests/p_coreutils/sleeptimeout.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Author Alice Kaerast + +t_Log "$0 checking timeout and sleep" + +if [ $centos_ver = 5 ] + then + t_Log "This is a C5 system. no 'timeout' available. Skipping." + ret_val=0 +else + timeout 1 sleep 2 + test $? -eq 124 && timeout 2 sleep 1 + ret_val=$? +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_coreutils/tail.sh b/tests/p_coreutils/tail.sh new file mode 100755 index 0000000..b724b83 --- /dev/null +++ b/tests/p_coreutils/tail.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 test tail command" + +cat << EOF > /var/tmp/tail-test +1 +2 +3 +4 +5 +EOF + +tail -n1 /var/tmp/tail-test | grep -q 5 +t_CheckExitStatus $? + +# Cleanup +rm /var/tmp/tail-test diff --git a/tests/p_coreutils/test_hashsums.sh b/tests/p_coreutils/test_hashsums.sh new file mode 100755 index 0000000..c2a9ad7 --- /dev/null +++ b/tests/p_coreutils/test_hashsums.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 test various hash sum tools" +echo "abcdefghijklmnopqrstuvwxyz1234567890" > /var/tmp/test-hashsums +/usr/bin/sha1sum /var/tmp/test-hashsums | grep -q f2cc9f1b642d1962f244ba7b0ab206649d5f153c +/usr/bin/sha224sum /var/tmp/test-hashsums | grep -q 00f95b5eb233164f4690f1963447fd42d2055ff6e660ee9b9a1943f4 +/usr/bin/sha256sum /var/tmp/test-hashsums | grep -q e125e4eabe1eaac7988796098acb9e1eb8e81628ebf9937a4ec502411e461107 +/usr/bin/sha384sum /var/tmp/test-hashsums | grep -q 8bfefc0ba5512fc53c55a99f2e5d686e3c63c33fb4553edb1ea8844543492d6db5845470e5d6366a09596fd5cbeffce9 +/usr/bin/sha512sum /var/tmp/test-hashsums | grep -q 7ff71e3ce6dcabd62738506f37cba533fb42393981cb526c423ea24528a72d6561bc120eefbb679d831f49abc75de9c35829ea4ec2ea59f74903d15107f90b50 +/usr/bin/md5sum /var/tmp/test-hashsums | grep -q 6c6506b6cb9e6d9a85ec9f8621d85864 +t_CheckExitStatus $? + +# Cleanup +rm /var/tmp/test-hashsums diff --git a/tests/p_coreutils/touch.sh b/tests/p_coreutils/touch.sh new file mode 100755 index 0000000..0e32b60 --- /dev/null +++ b/tests/p_coreutils/touch.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 testing touch and ls" + +# Create two files +touch -t 198307081200 /var/tmp/touch-test-1 +touch -t 198707071200 /var/tmp/touch-test-2 + +# ls -lt should show oldest file last +ls -lt /var/tmp/touch-test-? | tail -n 1 | grep -q "touch-test-1" + +t_CheckExitStatus $? + +# Cleanup +rm /var/tmp/touch-test-? diff --git a/tests/p_coreutils/true.sh b/tests/p_coreutils/true.sh new file mode 100755 index 0000000..d9d79a5 --- /dev/null +++ b/tests/p_coreutils/true.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 test true command" +true +t_CheckExitStatus $? diff --git a/tests/p_coreutils/uniq.sh b/tests/p_coreutils/uniq.sh new file mode 100755 index 0000000..7fafb00 --- /dev/null +++ b/tests/p_coreutils/uniq.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 test uniq command" + +cat << EOF > /var/tmp/uniq-test +1 +2 +2 +3 +3 +4 +5 +EOF + +uniq -d /var/tmp/uniq-test | wc -l | grep -q 2 && uniq -u /var/tmp/uniq-test | wc -l | grep -q 3 +t_CheckExitStatus $? diff --git a/tests/p_coreutils/wc.sh b/tests/p_coreutils/wc.sh new file mode 100755 index 0000000..82b0055 --- /dev/null +++ b/tests/p_coreutils/wc.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 - test wc output" + +cat << EOF > /var/tmp/wc-test +1 2 +3 4 +5 6 +EOF + +# file should have 3 lines, 12 bytes, 12 characters, max line length of 3, and 6 words +wc -l /var/tmp/wc-test | grep -q 3 && wc -c /var/tmp/wc-test | grep -q 12 && wc -m /var/tmp/wc-test | grep -q 12 && wc -L /var/tmp/wc-test | grep -q 3 && wc -w /var/tmp/wc-test | grep -q 6 + +t_CheckExitStatus $? + +# Cleanup +rm /var/tmp/wc-test diff --git a/tests/p_coreutils/yes.sh b/tests/p_coreutils/yes.sh new file mode 100755 index 0000000..2bc68c7 --- /dev/null +++ b/tests/p_coreutils/yes.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 - Test yes command" + +# Create test files +touch /var/tmp/test-yes-123 +touch /var/tmp/test-yes-456 + +# -i makes rm ask for confirmation with 'y' so pipe yes to it +yes | rm -i /var/tmp/test-yes-* || exit 1 + +#Set deleted to 1, until we've succesfully tested that the files have gone +deleted=1 +#Test that the files don't exist then set deleted=0 +test -f /var/tmp/test-yes-123 || test -f /var/tmp/test-yes-456 || deleted=0 +t_CheckExitStatus $deleted diff --git a/tests/p_cpio/0_install_cpio b/tests/p_cpio/0_install_cpio new file mode 100755 index 0000000..a42ac10 --- /dev/null +++ b/tests/p_cpio/0_install_cpio @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Iain Douglas +#Ensure the packeages we require are available + +t_Log "Running $0 installing required packages" +t_InstallPackage cpio diffutils diff --git a/tests/p_cpio/10-cpio-tests b/tests/p_cpio/10-cpio-tests new file mode 100755 index 0000000..4bbac69 --- /dev/null +++ b/tests/p_cpio/10-cpio-tests @@ -0,0 +1,47 @@ +#!/bin/bash +# +# Author: Iain Douglas +# + +ExitFail() { + t_Log "FAIL" + exit $FAIL +} + +# Basic tests for cpio + +OUTDIR=/var/tmp/cpio/cpio_out +INDIR=/var/tmp/cpio/cpio_in +PASSDIR=/var/tmp/cpio/cpio_pass + +[ -d /var/tmp/cpio ] && rm -rf /var/tmp/cpio +mkdir -p "$OUTDIR" +mkdir -p "$INDIR" +mkdir -p "$PASSDIR" + +# create a basic cpio archive +echo "Basic copy out test" + +ls | cpio -o > "$OUTDIR"/cpio.out +t_CheckExitStatus $? + +# Basic copy incheck +echo "Basic copy in test" +pushd "$INDIR" +cpio -i <"$OUTDIR"/cpio.out +t_CheckExitStatus $? +popd +# Basic pass through mode +echo "Basic pass through test" + +pushd $INDIR +find . | cpio -pd "$PASSDIR" +t_CheckExitStatus $? +popd + +# Check that $PASSDIR and $INDIR are the same +echo "Check that the working directories are the same" +diff $PASSDIR $INDIR &>/dev/null +t_CheckExitStatus $? + +#rm -rf /var/tmp/cpio diff --git a/tests/p_cracklib/0-install_cracklib.sh b/tests/p_cracklib/0-install_cracklib.sh new file mode 100755 index 0000000..17dab20 --- /dev/null +++ b/tests/p_cracklib/0-install_cracklib.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - installing cracklib." +t_InstallPackage cracklib diff --git a/tests/p_cracklib/cracklib_passwordtest.sh b/tests/p_cracklib/cracklib_passwordtest.sh new file mode 100755 index 0000000..c3bd801 --- /dev/null +++ b/tests/p_cracklib/cracklib_passwordtest.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - cracklib can check some passwords." +ret_val=0 + +t_Log "checking very simple password" +echo -e "test" | cracklib-check | grep -q 'too short' +t_CheckExitStatus $? + +t_Log "checking simple password" +echo -e "testing" | cracklib-check | grep -q 'dictionary' +t_CheckExitStatus $? + +if (t_GetPkgRel basesystem | grep -q el5) +then + t_Log "Simplistic password not checked on C5" +else + t_Log "checking simplistic password" + echo -e "1234_Hgi" | cracklib-check | grep -q 'simplistic' + t_CheckExitStatus $? +fi + +t_Log "checking complicated password" +echo -e "1536_Hargi" | cracklib-check | grep -q 'OK' +t_CheckExitStatus $? diff --git a/tests/p_cron/0-install_cron.sh b/tests/p_cron/0-install_cron.sh new file mode 100755 index 0000000..bf527bc --- /dev/null +++ b/tests/p_cron/0-install_cron.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "$0 - Installing crond" +if (t_GetPkgRel basesystem | grep -q -E 'el6|el7|el8|el9') +then + pn="cronie" +else + pn="vixie-cron" +fi + +t_InstallPackage $pn +t_ServiceControl crond cycle diff --git a/tests/p_cron/cron_crontab_daily_test.sh b/tests/p_cron/cron_crontab_daily_test.sh new file mode 100755 index 0000000..58741c5 --- /dev/null +++ b/tests/p_cron/cron_crontab_daily_test.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - crontab will run daily jobs." + +# Add a test cron +cat > /etc/cron.daily/test.sh< + +t_Log "Running $0 - crontab will run hourly jobs." + +# Add a test cron +cat > /etc/cron.hourly/test.sh< + +t_Log "Running $0 - crontab will run weekly jobs" + +# Add a test cron +cat > /etc/cron.weekly/test.sh< +# Christoph Galuschka + +t_Log "$0 - installing curl" +if [ "$centos_ver" -ge "9" ]; then + binary=$(which curl) + if [ -z $binary ]; then + t_InstallPackage curl-minimal + fi +else + t_InstallPackage curl +fi + diff --git a/tests/p_curl/curl_test.sh b/tests/p_curl/curl_test.sh new file mode 100755 index 0000000..f5e85b7 --- /dev/null +++ b/tests/p_curl/curl_test.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - curl can access http-host and retrieve index.html." + + +if [ $SKIP_QA_HARNESS -eq 1 ]; then + CHECK_FOR="The CentOS Project" + URL="http://www.centos.org/" +else + CHECK_FOR="Index of /srv" + URL="http://repo.centos.qa/srv/CentOS/" +fi + +t_Log "Querying ${URL}" +curl --location -s ${URL} | grep -q "${CHECK_FOR}" + +t_CheckExitStatus $? diff --git a/tests/p_diffutils/0_install_diffutils b/tests/p_diffutils/0_install_diffutils new file mode 100755 index 0000000..5da57fa --- /dev/null +++ b/tests/p_diffutils/0_install_diffutils @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Iain Douglas +#Ensure the packeages we require are available + +t_Log "Running $0 installing required packages" +t_InstallPackage diffutils diff --git a/tests/p_diffutils/10-cmp-tests b/tests/p_diffutils/10-cmp-tests new file mode 100644 index 0000000..76504b0 --- /dev/null +++ b/tests/p_diffutils/10-cmp-tests @@ -0,0 +1,60 @@ +#!/bin/bash +# Author: Iain Douglas + +# Tests for cmp + +function ExitFail { + t_Log "FAIL" + exit $FAIL +} +# Basic Tests + +t_Log "Running $0 - cmp tests" + +t_Log "Basic Check" +cmp -v &>/dev/null || ExitFail + +FILE=/var/tmp/diffutils +# Cleanup just in case we exited without doing so earlier. +rm ${FILE}a ${FILE}b &>/dev/null + +# Create some files to work with +cat << EOF >${FILE}a +This is some text to play with +EOF + +cat << EOF >${FILE}b +This is some test to play with +EOF + +# Basic check of 2 files +t_Log "Compare 2 files" +cmp ${FILE}a ${FILE}b | grep -q "byte 16, line 1" || ExitFail + +t_Log "Compare 2 files -b" +cmp -b ${FILE}a ${FILE}b | grep -q " line 1 is 170 x 163 s" || ExitFail +t_Log "Check -i - skip bytes " + +# Expect this to pass as the difference is at byte 16 +cmp -b -i 16 ${FILE}a ${FILE}b || ExitFail + +t_Log "check -i skip1:skip2" + +# Expect this to have a different output to earlier +cmp -i 15:16 ${FILE}a ${FILE}b | grep -q "byte 1, line 1"|| ExitFail + +# Chek that -n works +t_Log "Check -n limit bytes" +cmp -n 15 ${FILE}a ${FILE}b || ExitFail + +# Verbose output +t_Log "Check -l - verbose output" +cmp -l ${FILE}a ${FILE}b | grep -q "16 170 163" || ExitFail + +# Silent - exit status only, first scheck that there is no output +t_Log "Check -s - silent mode" +cmp -s ${FILE}a ${FILE}b | wc -m | grep -q "^0" || ExitFail +cmp -i 16 -s ${FILE}a ${FILE}b +t_CheckExitStatus $? + +rm ${FILE}a ${FILE}b &>/dev/null diff --git a/tests/p_diffutils/20-diff-tests b/tests/p_diffutils/20-diff-tests new file mode 100755 index 0000000..72dce1e --- /dev/null +++ b/tests/p_diffutils/20-diff-tests @@ -0,0 +1,361 @@ +#!/bin/bash +# Author: Iain Douglas + +# Tests for diff + +# Basic Tests + +ExitFail() { + t_Log "FAIL" + exit $FAIL +} + +t_Log "Running $0 - diff tests" + +diff -v &>/dev/null + +t_CheckExitStatus $? +F1=/var/tmp/testf1.txt +F2=/var/tmp/testf2.txt + + +# Most of the following tests are taken from the examples in the info +# documentation for diffutils. +# +# Create a couple of files to work with. We'll use sed to make changes as we +# go. + +TEXT="Here lyeth muche rychnesse in lytell space. -- John Heywood" +echo $TEXT >$F1 +cp $F1 $F2 + +# Start by checking the options that determine how whitespace and case are +# handled -E -b -w -B -i -I -q and their long form variants + +# Baseline check to ensure diff sees the files are the same. +echo "Check files are the same" +diff $F1 $F2 +t_CheckExitStatus $? + +# Convert a to in F2 then check that diff sees the change +# as it should. + +sed -i 's/ / \t/' $F2 +echo "Check different files" +diff $F1 $F2 &>/dev/null && ExitFail +t_Log "PASS" + +# Convert the first space in $F1 to 4 spaces and check that -E and +# --ignore-tab-expansion works and sees no difference between the +# two files. + +echo "Check diff -E" +sed -i 's/ / /' $F1 +diff -E $F1 $F2 +t_CheckExitStatus $? +echo "Check diff --ignore-tab-expansion" +diff --ignore-tab-expansion $F1 $F2 +t_CheckExitStatus $? + +# reduce the 4 spaces to 3 and check diff -E sees a difference +echo "Check diff -E sees a difference in whitespace" +sed -i 's/ / /' $F1 +diff -E $F1 $F2 &>/dev/null && ExitFail +t_Log "PASS" + +# Check -b --ignore-space-change add some spaces to the end of the line +# to make sure. +sed -i 's/$/ /' $F1 +echo "Check diff -b" +diff -b $F1 $F2 +t_CheckExitStatus $? +echo "Check diff --ignore-space-change" +diff --ignore-space-change $F1 $F2 +t_CheckExitStatus $? + +# The -b option ignotes difference in whitespace where it already exists. +# Check that whitespace added in $F1 where non exists in $F2 is caught by +# -b +echo "Check diff -b sees whitespace where non exists" +sed -i 's/ss/s s/' $F1 +diff -b $F1 $F2 &>/dev/null && ExitFail +t_Log "PASS" + +# Check -w --ignore-all-space +echo "Check diff -w" +diff -w $F1 $F2 +t_CheckExitStatus $? +echo "Check diff --ignore-all-space" +diff --ignore-all-space $F1 $F2 +t_CheckExitStatus $? + +# Check -B --ignore blank lines, create some new files to work with first. + +echo $TEXT>$F1 +echo $TEXT>>$F1 +echo $TEXT>$F2 +echo "" >>$F2 +echo $TEXT>>$F2 + +# Check that diff sees the new test files are different. +echo "-B --ignore blank lines, pre check files are different" +diff $F1 $F2 &>/dev/null && ExitFail +t_Log "PASS" + +echo "Check diff -B" +diff -B $F1 $F2 +t_CheckExitStatus $? +echo "Check diff --ignore-blank-lines" +diff --ignore-blank-lines $F1 $F2 +t_CheckExitStatus $? + +# Check -i --ignore-case, first ensure that diff sees a difference in case, +# as we're using the files from the earlier test we need to use the -B option +# too. + +echo "Check test file is different" +sed -i 's/l/L/g' $F1 +diff -B $F1 $F2 &>/dev/null && ExitFail +t_Log "PASS" + +# Check that -i causes diff to ignore the difference in case. +echo "Check diff -i" +diff -B -i $F1 $F2 +t_CheckExitStatus $? +echo "Check diff --ignore-case" +diff -B --ignore-case $F1 $F2 +t_CheckExitStatus $? + +# Check -I --ignore-matching-lines=regexp +echo $TEXT >$F1 +echo "1"$TEXT"1" >>$F1 +echo "1"$TEXT >$F2 +echo $TEXT >>$F2 +echo "Check test files are different" +diff $F1 $F2 &>/dev/null && ExitFail +t_Log "PASS" +echo "Check -I" +diff -I '^[[:digit:]]' $F1 $F2 +t_CheckExitStatus $? +echo "Check --ignore-matching-lines=regexp" +diff --ignore-matching-lines='^[[:digit:]]' $F1 $F2 +t_CheckExitStatus $? + +# Check -q --brief +echo "Check diff -q" +diff -q $F1 $F2 | grep -q "Files /var/tmp/testf1.txt and /var/tmp/testf2.txt differ" +t_CheckExitStatus $? +echo "diff --brief" +diff --brief $F1 $F2 | grep -q "Files /var/tmp/testf1.txt and /var/tmp/testf2.txt differ" +t_CheckExitStatus $? + +# Check output formats are correct, again the examples from the info docs are +# used in the tests as are the lao and tzu texts. As we've previously testes +# cmp it should be safe to use to compare the generated output against known +# correct output. +# +# start with normal format +echo "Check diff output formats" + +DIR=./tests/p_diffutils +FILES="$DIR"/files + +echo "Check normal output format" +diff "$FILES"/lao "$FILES"/tzu | cmp "$FILES"/normal_format - +t_CheckExitStatus $? + +# Check contxt format - note that this outputs time information that we will +# ignore by skipping the first 3 lines + +echo Check default context format -c + +diff -c "$FILES"/lao "$FILES"/tzu | tail -n +3 | cmp "$FILES"/context_format - +t_CheckExitStatus $? + +# Check contect format with only 1 line +echo "Check context format with Less Context -C 1" +diff -C 1 "$FILES"/lao "$FILES"/tzu | tail -n +3 | cmp "$FILES"/context_format-1 - +t_CheckExitStatus $? + +# Check unified format again there are timestams which we will ignore +echo "Check unified format " +diff -u "$FILES"/lao "$FILES"/tzu | tail -n +3 | cmp "$FILES"/unified_format - +t_CheckExitStatus $? + +# Check unified shortend format -U lines and the long form option +# --unified=lines, in both cases we'll use 1 for lines. +echo "Check unified output with less context -U 1" +diff -U 1 "$FILES"/lao "$FILES"/tzu | tail -n +3 | cmp "$FILES"/unified_format-1 - +t_CheckExitStatus $? + +echo "Check unified output with less context --unified=1" +diff --unified=1 "$FILES"/lao "$FILES"/tzu | tail -n +3 | cmp "$FILES"/unified_format-1 - +t_CheckExitStatus $? + +# Check we can change the labels +echo "Check the --label option" +diff -C 2 --label=original --label=modified "$FILES"/lao "$FILES"/tzu | cmp "$FILES"/label-change +t_CheckExitStatus $? + +# Check side-by-side output width = 72 +echo "Check side-by-side" output -y -W 72 +diff -t -y -W 72 "$FILES"/lao "$FILES"/tzu | cmp "$FILES"/side-by-side-W72 - +t_CheckExitStatus $? + +# Check side-by-side with left column suppression +echo "Check left column suppression in side-by-side output" +diff --width=72 -y --left-column "$FILES"/lao "$FILES"/tzu | cmp "$FILES"/left_column +t_CheckExitStatus $? + +# Check side-by-side with common line suppression +echo "Check left column suppression in side-by-side output" +diff --width=72 -y --suppress-common-lines "$FILES"/lao "$FILES"/tzu | cmp "$FILES"/supress_common_lines - +t_CheckExitStatus $? + +# Check an ed script is correctly generated +echo "Check an ed script is correctly generated diff -e" +diff -e "$FILES"/lao "$FILES"/tzu | cmp "$FILES"/ed_script - +t_CheckExitStatus $? + +# Check diff -f --forward-ed works +echo "Check that a forward ed script is generated -f " +diff -f "$FILES"/lao "$FILES"/tzu | cmp "$FILES"/ed_script-f - +t_CheckExitStatus $? +echo "Check that a forward ed script is generated --forward-ed " +diff --forward-ed "$FILES"/lao "$FILES"/tzu | cmp "$FILES"/ed_script-f - +t_CheckExitStatus $? + +# Check RCS script generation -n --rcs +echo "Check RCS scripts are generated -n" +diff -n "$FILES"/lao "$FILES"/tzu | cmp "$FILES"/rcs_script - +t_CheckExitStatus $? +echo "Check RCS scripts are generated --rcs" +diff --rcs "$FILES"/lao "$FILES"/tzu | cmp "$FILES"/rcs_script - +t_CheckExitStatus $? + +# Check if-then-else output diff -D --ifdef +echo "Check -D output" +diff -DTWO "$FILES"/lao "$FILES"/tzu | cmp "$FILES"/if_then_else - +t_CheckExitStatus $? + +echo "Check --ifdef output" +diff --ifdef=TWO "$FILES"/lao "$FILES"/tzu | cmp "$FILES"/if_then_else - +t_CheckExitStatus $? + +# Check Incomplete last line (no \n) +echo "Checking incomplete last line - normal" +diff "$FILES"/F "$FILES"/G | cmp "$FILES"/F-G - +t_CheckExitStatus $? + +echo "Checking incomplete last line -n" +diff -n "$FILES"/F "$FILES"/G | cmp "$FILES"/n_F-G - +t_CheckExitStatus $? + +echo "Checking incomplete last line -e" +diff -e "$FILES"/F "$FILES"/G 2>&1 | cmp "$FILES"/e_F-G +t_CheckExitStatus $? + +# Check diff output to -l --paginate, the header is variable so skip over it +echo "Check diff output to pager -l" +diff -l "$FILES"/lao "$FILES"/tzu |tail -n +4 | cmp "$FILES"/paginate - +t_CheckExitStatus $? + +echo "Check diff output to pager -l" +diff -l "$FILES"/lao "$FILES"/tzu | tail -n +4 | cmp "$FILES"/paginate - +t_CheckExitStatus $? + + +# Directories tested from here down +# Setup a directory structure and populate it with files to work with +# +DIRTEST=/var/tmp/difftest + +[[ -d "$DIRTEST" ]] && rm -r "$DIRTEST" +mkdir "$DIRTEST" +mkdir -p "$DIRTEST"/a/1 +mkdir -p "$DIRTEST"/b/1 +cp "$FILES"/lao "$DIRTEST"/a +cp "$FILES"/lao "$DIRTEST"/b +cp "$FILES"/tzu "$DIRTEST"/a +cp "$FILES"/tao "$DIRTEST"/a/1 + +# Check plain diff of 2 directories +echo "Check basic directory comparison" +diff "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir - +t_CheckExitStatus $? + +# Check -s --report-identical-files +echo "Check identical files reported -s" +diff -s "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir_s - +t_CheckExitStatus $? + +echo "Check identical files reported --report-identical-files" +diff --report-identical-files "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir_s - +t_CheckExitStatus $? + +# Check recursive directory diff +echo "Check recursive directory diff -r" +diff -sr "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir_r - +t_CheckExitStatus $? + +echo "Check recursive directory diff --recursive" +diff -s --recursive "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir_r - +t_CheckExitStatus $? + +# Check -N --new-file output +echo "Check directory diff -N" +diff -Nsr "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir_N - +t_CheckExitStatus $? + +echo "Check directory diff --new-file" +diff --new-file -sr "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir_new_file - +t_CheckExitStatus $? + +# Check diff --unidirectional-new-file. Swap the command line arguments +# around to make this work + +echo "Check directory diff --unidirectional-new-file" +diff --unidirectional-new-file "$DIRTEST"/b "$DIRTEST"/a | cmp "$FILES"/dir_unidirectional - +t_CheckExitStatus $? + +# Check we can ignore patterns with diff in directory mode -x +echo "Check diff -x excludes file patterns" +diff -x tz* "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir_x - +t_CheckExitStatus $? + +# Check we can ignore patterns read from a file with diff in directory mode +# -X --exclude-from= +echo "Check diff -X excludes file patterns" +diff -X "$FILES"/exclude "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir_x - +t_CheckExitStatus $? + +echo "Check diff --exclude-from excludes file patterns" +diff --exclude-from="$FILES"/exclude "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir_x - +t_CheckExitStatus $? + +# Check we can exclude differences based on file name case +# https://bugzilla.redhat.com/show_bug.cgi?id=719001 +# +mv "$DIRTEST"/a/lao "$DIRTEST"/a/LAO +echo "Checking --ignore-file-name-case" +echo "see https://bugzilla.redhat.com/show_bug.cgi?id=719001" +echo "If this fails then the bug has been fixed" +if [ "$centos_ver" -ge 7 ];then + echo SKIP +else + diff --ignore-file-name-case "$DIRTEST"/a "$DIRTEST"/b | cmp "$FILES"/dir_case + t_CheckExitStatus $? +fi + +# Check the --to-file option +echo "Checking the --to-file option against a file" +diff --to-file $FILES/lao $DIRTEST/a/LAO +t_CheckExitStatus $? + +echo "Checking the --to-file option against a directory" +diff --to-file $FILES/lao $DIRTEST/b +t_CheckExitStatus $? + +rm -f "$F1" +rm -f "$F2" +rm -r "$DIRTEST" diff --git a/tests/p_diffutils/30-diff3-tests b/tests/p_diffutils/30-diff3-tests new file mode 100755 index 0000000..36ab2de --- /dev/null +++ b/tests/p_diffutils/30-diff3-tests @@ -0,0 +1,102 @@ +#!/bin/bash +# Author: Iain Douglas + +# Tests for diff3 + +# Basic Tests + +t_Log "Running $0 - diff3 tests" + +diff3 -v &>/dev/null +t_CheckExitStatus $? + +DIR=./tests/p_diffutils +FILES=$DIR/files + +# Test the diff3 normal output. As we've already tested diff +# we can now use it to test our output. +echo "Check diff3 normal output" +diff3 $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_normal - +t_CheckExitStatus $? + +# Check the -e output --ed +echo "Check the diff3 -e output" +diff3 -e $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_ed_script - +t_CheckExitStatus $? + +echo "Check the diff3 --ed output" +diff3 --ed $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_ed_script - +t_CheckExitStatus $? + +# Check the -3 --easy-only output +echo "Check the diff3 -3 output" +diff3 -3 $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_easy_only - +t_CheckExitStatus $? + +echo "Check the diff3 --easy-only output" +diff3 --easy-only $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_easy_only - +t_CheckExitStatus $? + +# Check the -x --overlap-only output +echo "Check the diff3 -x output" +diff3 -x $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_overlap_only - +t_CheckExitStatus $? + +echo "Check the diff3 --overlap-only output" +diff3 --overlap-only $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_overlap_only - +t_CheckExitStatus $? + +# Check the -A --show-all option +echo "Check the diff3 -A output" +diff3 -A $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_show_all - +t_CheckExitStatus $? + +echo "Check the diff3 --show-all output" +diff3 --show-all $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_show_all - +t_CheckExitStatus $? + +# Check the -E --show-overlap option +echo "Check the diff3 -E output" +diff3 -E $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_show_overlap - +t_CheckExitStatus $? + +echo "Check the diff3 --show-overlap output" +diff3 --show-overlap $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_show_overlap - +t_CheckExitStatus $? + +# Check the -m --merge option +echo "Check the diff3 -m output" +diff3 -m $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_merge - +t_CheckExitStatus $? + +echo "Check the diff3 --merge output" +diff3 --merge $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_merge - +t_CheckExitStatus $? + +# Check the -i option to write the changes +echo "Check the diff3 -i output" +diff3 -i -3 $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_i - +t_CheckExitStatus $? + +# Check the -L --label output +echo "Check the diff3 -L output" +diff3 -m -L LAO -L TZU -L TAO $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_label - +t_CheckExitStatus $? + +echo "Check the diff3 --label= output" +diff3 -m --label=LAO --label=TZU --label=TAO $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_label - +t_CheckExitStatus $? + +# Check the --diff-program. Copy /usr/bin/diff to /var/tmp/newdiff then +# use --diff-program=/var/tmp/newdiff to force diff3 to use it. +# + +echo "Check --diff-program" + +[[ -e /var/tmp/newdiff ]] && rm /var/tmp/newdiff +cp /usr/bin/diff /var/tmp/newdiff + +diff3 --diff-program=/var/tmp/newdiff $FILES/lao $FILES/tzu $FILES/tao | diff $FILES/diff3_normal - +t_CheckExitStatus $? + +rm /var/tmp/newdiff diff --git a/tests/p_diffutils/40-sdiff-tests b/tests/p_diffutils/40-sdiff-tests new file mode 100755 index 0000000..de8d0db --- /dev/null +++ b/tests/p_diffutils/40-sdiff-tests @@ -0,0 +1,23 @@ +#!/bin/bash +# Author: Iain Douglas + +# Tests for sdiff + +# Basic Tests + +t_Log "Running $0 - sdiff tests" + +sdiff -v &>/dev/null + +t_CheckExitStatus $? + +FILES=./tests/p_diffutils/files + +# sdiff will take it's commands from a /dev/null && Exitfail +diff "$FILES"/sdiff_output /var/tmp/sdiff.out +t_CheckExitStatus $? + +# Clean up +rm -f /var/tmp/sdiff.out diff --git a/tests/p_diffutils/TODO b/tests/p_diffutils/TODO new file mode 100644 index 0000000..c26949b --- /dev/null +++ b/tests/p_diffutils/TODO @@ -0,0 +1,15 @@ +The following haven't been tested mostly because I can't figure out how to do so. +diff --minimal +diff --horizon-lines +diff --speed-large-files +diff --show-c-function +diff --show-function-line +diff --starting-file + +diff -x | -X in combination with --ignore-file-name-case as the latter doesn't work due to a bug. + +diff3 -a +diff3 -T + + + diff --git a/tests/p_diffutils/files/F b/tests/p_diffutils/files/F new file mode 100644 index 0000000..4d1ae35 --- /dev/null +++ b/tests/p_diffutils/files/F @@ -0,0 +1 @@ +f \ No newline at end of file diff --git a/tests/p_diffutils/files/F-G b/tests/p_diffutils/files/F-G new file mode 100644 index 0000000..bcdaec0 --- /dev/null +++ b/tests/p_diffutils/files/F-G @@ -0,0 +1,6 @@ +1c1 +< f +\ No newline at end of file +--- +> g +\ No newline at end of file diff --git a/tests/p_diffutils/files/G b/tests/p_diffutils/files/G new file mode 100644 index 0000000..7937c68 --- /dev/null +++ b/tests/p_diffutils/files/G @@ -0,0 +1 @@ +g \ No newline at end of file diff --git a/tests/p_diffutils/files/H b/tests/p_diffutils/files/H new file mode 100644 index 0000000..be54354 --- /dev/null +++ b/tests/p_diffutils/files/H @@ -0,0 +1 @@ +h \ No newline at end of file diff --git a/tests/p_diffutils/files/context_format b/tests/p_diffutils/files/context_format new file mode 100644 index 0000000..475bba3 --- /dev/null +++ b/tests/p_diffutils/files/context_format @@ -0,0 +1,25 @@ +*************** +*** 1,7 **** +- The Way that can be told of is not the eternal Way; +- The name that can be named is not the eternal name. + The Nameless is the origin of Heaven and Earth; +! The Named is the mother of all things. + Therefore let there always be non-being, + so we may see their subtlety, + And let there always be being, +--- 1,6 ---- + The Nameless is the origin of Heaven and Earth; +! The named is the mother of all things. +! + Therefore let there always be non-being, + so we may see their subtlety, + And let there always be being, +*************** +*** 9,11 **** +--- 8,13 ---- + The two are the same, + But after they are produced, + they have different names. ++ They both may be called deep and profound. ++ Deeper and more profound, ++ The door of all subtleties! diff --git a/tests/p_diffutils/files/context_format-1 b/tests/p_diffutils/files/context_format-1 new file mode 100644 index 0000000..2a0cd28 --- /dev/null +++ b/tests/p_diffutils/files/context_format-1 @@ -0,0 +1,19 @@ +*************** +*** 1,5 **** +- The Way that can be told of is not the eternal Way; +- The name that can be named is not the eternal name. + The Nameless is the origin of Heaven and Earth; +! The Named is the mother of all things. + Therefore let there always be non-being, +--- 1,4 ---- + The Nameless is the origin of Heaven and Earth; +! The named is the mother of all things. +! + Therefore let there always be non-being, +*************** +*** 11 **** +--- 10,13 ---- + they have different names. ++ They both may be called deep and profound. ++ Deeper and more profound, ++ The door of all subtleties! diff --git a/tests/p_diffutils/files/diff3_easy_only b/tests/p_diffutils/files/diff3_easy_only new file mode 100644 index 0000000..0602759 --- /dev/null +++ b/tests/p_diffutils/files/diff3_easy_only @@ -0,0 +1,3 @@ +8c + so we may see their result. +. diff --git a/tests/p_diffutils/files/diff3_ed_script b/tests/p_diffutils/files/diff3_ed_script new file mode 100644 index 0000000..c826f81 --- /dev/null +++ b/tests/p_diffutils/files/diff3_ed_script @@ -0,0 +1,7 @@ +11a + + -- The Way of Lao-Tzu, tr. Wing-tsit Chan +. +8c + so we may see their result. +. diff --git a/tests/p_diffutils/files/diff3_i b/tests/p_diffutils/files/diff3_i new file mode 100644 index 0000000..3be59be --- /dev/null +++ b/tests/p_diffutils/files/diff3_i @@ -0,0 +1,5 @@ +8c + so we may see their result. +. +w +q diff --git a/tests/p_diffutils/files/diff3_label b/tests/p_diffutils/files/diff3_label new file mode 100644 index 0000000..33be896 --- /dev/null +++ b/tests/p_diffutils/files/diff3_label @@ -0,0 +1,23 @@ +<<<<<<< TZU +======= +The Way that can be told of is not the eternal Way; +The name that can be named is not the eternal name. +>>>>>>> TAO +The Nameless is the origin of Heaven and Earth; +The Named is the mother of all things. +Therefore let there always be non-being, + so we may see their subtlety, +And let there always be being, + so we may see their result. +The two are the same, +But after they are produced, + they have different names. +<<<<<<< LAO +||||||| TZU +They both may be called deep and profound. +Deeper and more profound, +The door of all subtleties! +======= + + -- The Way of Lao-Tzu, tr. Wing-tsit Chan +>>>>>>> TAO diff --git a/tests/p_diffutils/files/diff3_merge b/tests/p_diffutils/files/diff3_merge new file mode 100644 index 0000000..a556686 --- /dev/null +++ b/tests/p_diffutils/files/diff3_merge @@ -0,0 +1,23 @@ +<<<<<<< ./tests/p_diffutils/files/tzu +======= +The Way that can be told of is not the eternal Way; +The name that can be named is not the eternal name. +>>>>>>> ./tests/p_diffutils/files/tao +The Nameless is the origin of Heaven and Earth; +The Named is the mother of all things. +Therefore let there always be non-being, + so we may see their subtlety, +And let there always be being, + so we may see their result. +The two are the same, +But after they are produced, + they have different names. +<<<<<<< ./tests/p_diffutils/files/lao +||||||| ./tests/p_diffutils/files/tzu +They both may be called deep and profound. +Deeper and more profound, +The door of all subtleties! +======= + + -- The Way of Lao-Tzu, tr. Wing-tsit Chan +>>>>>>> ./tests/p_diffutils/files/tao diff --git a/tests/p_diffutils/files/diff3_normal b/tests/p_diffutils/files/diff3_normal new file mode 100644 index 0000000..9dfcad8 --- /dev/null +++ b/tests/p_diffutils/files/diff3_normal @@ -0,0 +1,28 @@ +====2 +1:1,2c +3:1,2c + The Way that can be told of is not the eternal Way; + The name that can be named is not the eternal name. +2:0a +====1 +1:4c + The Named is the mother of all things. +2:2,3c +3:4,5c + The named is the mother of all things. + +====3 +1:8c +2:7c + so we may see their outcome. +3:9c + so we may see their result. +==== +1:11a +2:11,13c + They both may be called deep and profound. + Deeper and more profound, + The door of all subtleties! +3:13,14c + + -- The Way of Lao-Tzu, tr. Wing-tsit Chan diff --git a/tests/p_diffutils/files/diff3_overlap_only b/tests/p_diffutils/files/diff3_overlap_only new file mode 100644 index 0000000..75d6ffa --- /dev/null +++ b/tests/p_diffutils/files/diff3_overlap_only @@ -0,0 +1,4 @@ +11a + + -- The Way of Lao-Tzu, tr. Wing-tsit Chan +. diff --git a/tests/p_diffutils/files/diff3_show_all b/tests/p_diffutils/files/diff3_show_all new file mode 100644 index 0000000..e185188 --- /dev/null +++ b/tests/p_diffutils/files/diff3_show_all @@ -0,0 +1,23 @@ +11a +||||||| ./tests/p_diffutils/files/tzu +They both may be called deep and profound. +Deeper and more profound, +The door of all subtleties! +======= + + -- The Way of Lao-Tzu, tr. Wing-tsit Chan +>>>>>>> ./tests/p_diffutils/files/tao +. +11a +<<<<<<< ./tests/p_diffutils/files/lao +. +8c + so we may see their result. +. +2a +>>>>>>> ./tests/p_diffutils/files/tao +. +0a +<<<<<<< ./tests/p_diffutils/files/tzu +======= +. diff --git a/tests/p_diffutils/files/diff3_show_overlap b/tests/p_diffutils/files/diff3_show_overlap new file mode 100644 index 0000000..b6273b5 --- /dev/null +++ b/tests/p_diffutils/files/diff3_show_overlap @@ -0,0 +1,12 @@ +11a +======= + + -- The Way of Lao-Tzu, tr. Wing-tsit Chan +>>>>>>> ./tests/p_diffutils/files/tao +. +11a +<<<<<<< ./tests/p_diffutils/files/lao +. +8c + so we may see their result. +. diff --git a/tests/p_diffutils/files/diff_pager b/tests/p_diffutils/files/diff_pager new file mode 100644 index 0000000..ac8a3e1 --- /dev/null +++ b/tests/p_diffutils/files/diff_pager @@ -0,0 +1,66 @@ + + +2013-01-09 13:57 diff -lc lao tzu Page 1 + + +*** lao 2013-01-02 22:36:20.628242206 +0100 +--- tzu 2013-01-02 22:36:38.412254788 +0100 +*************** +*** 1,7 **** +- The Way that can be told of is not the eternal Way; +- The name that can be named is not the eternal name. + The Nameless is the origin of Heaven and Earth; +! The Named is the mother of all things. + Therefore let there always be non-being, + so we may see their subtlety, + And let there always be being, +--- 1,6 ---- + The Nameless is the origin of Heaven and Earth; +! The named is the mother of all things. +! + Therefore let there always be non-being, + so we may see their subtlety, + And let there always be being, +*************** +*** 9,11 **** +--- 8,13 ---- + The two are the same, + But after they are produced, + they have different names. ++ They both may be called deep and profound. ++ Deeper and more profound, ++ The door of all subtleties! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/p_diffutils/files/dir b/tests/p_diffutils/files/dir new file mode 100644 index 0000000..4aaa9c6 --- /dev/null +++ b/tests/p_diffutils/files/dir @@ -0,0 +1,2 @@ +Common subdirectories: /var/tmp/difftest/a/1 and /var/tmp/difftest/b/1 +Only in /var/tmp/difftest/a: tzu diff --git a/tests/p_diffutils/files/dir_N b/tests/p_diffutils/files/dir_N new file mode 100644 index 0000000..583b736 --- /dev/null +++ b/tests/p_diffutils/files/dir_N @@ -0,0 +1,32 @@ +diff -Nsr /var/tmp/difftest/a/1/tao /var/tmp/difftest/b/1/tao +1,14d0 +< The Way that can be told of is not the eternal Way; +< The name that can be named is not the eternal name. +< The Nameless is the origin of Heaven and Earth; +< The named is the mother of all things. +< +< Therefore let there always be non-being, +< so we may see their subtlety, +< And let there always be being, +< so we may see their result. +< The two are the same, +< But after they are produced, +< they have different names. +< +< -- The Way of Lao-Tzu, tr. Wing-tsit Chan +Files /var/tmp/difftest/a/lao and /var/tmp/difftest/b/lao are identical +diff -Nsr /var/tmp/difftest/a/tzu /var/tmp/difftest/b/tzu +1,13d0 +< The Nameless is the origin of Heaven and Earth; +< The named is the mother of all things. +< +< Therefore let there always be non-being, +< so we may see their subtlety, +< And let there always be being, +< so we may see their outcome. +< The two are the same, +< But after they are produced, +< they have different names. +< They both may be called deep and profound. +< Deeper and more profound, +< The door of all subtleties! diff --git a/tests/p_diffutils/files/dir_X b/tests/p_diffutils/files/dir_X new file mode 100644 index 0000000..41bcf1f --- /dev/null +++ b/tests/p_diffutils/files/dir_X @@ -0,0 +1 @@ +Common subdirectories: /var/tmp/difftest/a/1 and /var/tmp/difftest/b/1 diff --git a/tests/p_diffutils/files/dir_case b/tests/p_diffutils/files/dir_case new file mode 100644 index 0000000..dccf148 --- /dev/null +++ b/tests/p_diffutils/files/dir_case @@ -0,0 +1,4 @@ +Common subdirectories: /var/tmp/difftest/a/1 and /var/tmp/difftest/b/1 +Only in /var/tmp/difftest/b: lao +Only in /var/tmp/difftest/a: LAO +Only in /var/tmp/difftest/a: tzu diff --git a/tests/p_diffutils/files/dir_new_file b/tests/p_diffutils/files/dir_new_file new file mode 100644 index 0000000..aac18c9 --- /dev/null +++ b/tests/p_diffutils/files/dir_new_file @@ -0,0 +1,32 @@ +diff --new-file -sr /var/tmp/difftest/a/1/tao /var/tmp/difftest/b/1/tao +1,14d0 +< The Way that can be told of is not the eternal Way; +< The name that can be named is not the eternal name. +< The Nameless is the origin of Heaven and Earth; +< The named is the mother of all things. +< +< Therefore let there always be non-being, +< so we may see their subtlety, +< And let there always be being, +< so we may see their result. +< The two are the same, +< But after they are produced, +< they have different names. +< +< -- The Way of Lao-Tzu, tr. Wing-tsit Chan +Files /var/tmp/difftest/a/lao and /var/tmp/difftest/b/lao are identical +diff --new-file -sr /var/tmp/difftest/a/tzu /var/tmp/difftest/b/tzu +1,13d0 +< The Nameless is the origin of Heaven and Earth; +< The named is the mother of all things. +< +< Therefore let there always be non-being, +< so we may see their subtlety, +< And let there always be being, +< so we may see their outcome. +< The two are the same, +< But after they are produced, +< they have different names. +< They both may be called deep and profound. +< Deeper and more profound, +< The door of all subtleties! diff --git a/tests/p_diffutils/files/dir_r b/tests/p_diffutils/files/dir_r new file mode 100644 index 0000000..cc7f7ff --- /dev/null +++ b/tests/p_diffutils/files/dir_r @@ -0,0 +1,3 @@ +Only in /var/tmp/difftest/a/1: tao +Files /var/tmp/difftest/a/lao and /var/tmp/difftest/b/lao are identical +Only in /var/tmp/difftest/a: tzu diff --git a/tests/p_diffutils/files/dir_s b/tests/p_diffutils/files/dir_s new file mode 100644 index 0000000..7e21b71 --- /dev/null +++ b/tests/p_diffutils/files/dir_s @@ -0,0 +1,3 @@ +Common subdirectories: /var/tmp/difftest/a/1 and /var/tmp/difftest/b/1 +Files /var/tmp/difftest/a/lao and /var/tmp/difftest/b/lao are identical +Only in /var/tmp/difftest/a: tzu diff --git a/tests/p_diffutils/files/dir_unidirectional b/tests/p_diffutils/files/dir_unidirectional new file mode 100644 index 0000000..dd80b10 --- /dev/null +++ b/tests/p_diffutils/files/dir_unidirectional @@ -0,0 +1,16 @@ +Common subdirectories: /var/tmp/difftest/b/1 and /var/tmp/difftest/a/1 +diff --unidirectional-new-file /var/tmp/difftest/b/tzu /var/tmp/difftest/a/tzu +0a1,13 +> The Nameless is the origin of Heaven and Earth; +> The named is the mother of all things. +> +> Therefore let there always be non-being, +> so we may see their subtlety, +> And let there always be being, +> so we may see their outcome. +> The two are the same, +> But after they are produced, +> they have different names. +> They both may be called deep and profound. +> Deeper and more profound, +> The door of all subtleties! diff --git a/tests/p_diffutils/files/dir_x b/tests/p_diffutils/files/dir_x new file mode 100644 index 0000000..41bcf1f --- /dev/null +++ b/tests/p_diffutils/files/dir_x @@ -0,0 +1 @@ +Common subdirectories: /var/tmp/difftest/a/1 and /var/tmp/difftest/b/1 diff --git a/tests/p_diffutils/files/e_F-G b/tests/p_diffutils/files/e_F-G new file mode 100644 index 0000000..07de368 --- /dev/null +++ b/tests/p_diffutils/files/e_F-G @@ -0,0 +1,7 @@ +1c +g +. +diff: ./tests/p_diffutils/files/F: No newline at end of file + +diff: ./tests/p_diffutils/files/G: No newline at end of file + diff --git a/tests/p_diffutils/files/ed_script b/tests/p_diffutils/files/ed_script new file mode 100644 index 0000000..43c2b2f --- /dev/null +++ b/tests/p_diffutils/files/ed_script @@ -0,0 +1,10 @@ +11a +They both may be called deep and profound. +Deeper and more profound, +The door of all subtleties! +. +4c +The named is the mother of all things. + +. +1,2d diff --git a/tests/p_diffutils/files/ed_script-f b/tests/p_diffutils/files/ed_script-f new file mode 100644 index 0000000..12d00b1 --- /dev/null +++ b/tests/p_diffutils/files/ed_script-f @@ -0,0 +1,10 @@ +d1 2 +c4 +The named is the mother of all things. + +. +a11 +They both may be called deep and profound. +Deeper and more profound, +The door of all subtleties! +. diff --git a/tests/p_diffutils/files/exclude b/tests/p_diffutils/files/exclude new file mode 100644 index 0000000..df3b51d --- /dev/null +++ b/tests/p_diffutils/files/exclude @@ -0,0 +1 @@ +tz* diff --git a/tests/p_diffutils/files/if_then_else b/tests/p_diffutils/files/if_then_else new file mode 100644 index 0000000..ed3e990 --- /dev/null +++ b/tests/p_diffutils/files/if_then_else @@ -0,0 +1,23 @@ +#ifndef TWO +The Way that can be told of is not the eternal Way; +The name that can be named is not the eternal name. +#endif /* ! TWO */ +The Nameless is the origin of Heaven and Earth; +#ifndef TWO +The Named is the mother of all things. +#else /* TWO */ +The named is the mother of all things. + +#endif /* TWO */ +Therefore let there always be non-being, + so we may see their subtlety, +And let there always be being, + so we may see their outcome. +The two are the same, +But after they are produced, + they have different names. +#ifdef TWO +They both may be called deep and profound. +Deeper and more profound, +The door of all subtleties! +#endif /* TWO */ diff --git a/tests/p_diffutils/files/label-change b/tests/p_diffutils/files/label-change new file mode 100644 index 0000000..0e29ee9 --- /dev/null +++ b/tests/p_diffutils/files/label-change @@ -0,0 +1,24 @@ +*** original +--- modified +*************** +*** 1,6 **** +- The Way that can be told of is not the eternal Way; +- The name that can be named is not the eternal name. + The Nameless is the origin of Heaven and Earth; +! The Named is the mother of all things. + Therefore let there always be non-being, + so we may see their subtlety, +--- 1,5 ---- + The Nameless is the origin of Heaven and Earth; +! The named is the mother of all things. +! + Therefore let there always be non-being, + so we may see their subtlety, +*************** +*** 10,11 **** +--- 9,13 ---- + But after they are produced, + they have different names. ++ They both may be called deep and profound. ++ Deeper and more profound, ++ The door of all subtleties! diff --git a/tests/p_diffutils/files/lao b/tests/p_diffutils/files/lao new file mode 100644 index 0000000..635ef2c --- /dev/null +++ b/tests/p_diffutils/files/lao @@ -0,0 +1,11 @@ +The Way that can be told of is not the eternal Way; +The name that can be named is not the eternal name. +The Nameless is the origin of Heaven and Earth; +The Named is the mother of all things. +Therefore let there always be non-being, + so we may see their subtlety, +And let there always be being, + so we may see their outcome. +The two are the same, +But after they are produced, + they have different names. diff --git a/tests/p_diffutils/files/left_column b/tests/p_diffutils/files/left_column new file mode 100644 index 0000000..5c9e8aa --- /dev/null +++ b/tests/p_diffutils/files/left_column @@ -0,0 +1,15 @@ +The Way that can be told of is n < +The name that can be named is no < +The Nameless is the origin of He ( +The Named is the mother of all t | The named is the mother of all t + > +Therefore let there always be no ( + so we may see their subtlety, ( +And let there always be being, ( + so we may see their outcome. ( +The two are the same, ( +But after they are produced, ( + they have different names. ( + > They both may be called deep and + > Deeper and more profound, + > The door of all subtleties! diff --git a/tests/p_diffutils/files/n_F-G b/tests/p_diffutils/files/n_F-G new file mode 100644 index 0000000..801a80d --- /dev/null +++ b/tests/p_diffutils/files/n_F-G @@ -0,0 +1,3 @@ +d1 1 +a1 1 +g \ No newline at end of file diff --git a/tests/p_diffutils/files/normal_format b/tests/p_diffutils/files/normal_format new file mode 100644 index 0000000..6f82a1c --- /dev/null +++ b/tests/p_diffutils/files/normal_format @@ -0,0 +1,12 @@ +1,2d0 +< The Way that can be told of is not the eternal Way; +< The name that can be named is not the eternal name. +4c2,3 +< The Named is the mother of all things. +--- +> The named is the mother of all things. +> +11a11,13 +> They both may be called deep and profound. +> Deeper and more profound, +> The door of all subtleties! diff --git a/tests/p_diffutils/files/paginate b/tests/p_diffutils/files/paginate new file mode 100644 index 0000000..0ce2850 --- /dev/null +++ b/tests/p_diffutils/files/paginate @@ -0,0 +1,63 @@ + + +1,2d0 +< The Way that can be told of is not the eternal Way; +< The name that can be named is not the eternal name. +4c2,3 +< The Named is the mother of all things. +--- +> The named is the mother of all things. +> +11a11,13 +> They both may be called deep and profound. +> Deeper and more profound, +> The door of all subtleties! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/p_diffutils/files/rcs_script b/tests/p_diffutils/files/rcs_script new file mode 100644 index 0000000..0806979 --- /dev/null +++ b/tests/p_diffutils/files/rcs_script @@ -0,0 +1,9 @@ +d1 2 +d4 1 +a4 2 +The named is the mother of all things. + +a11 3 +They both may be called deep and profound. +Deeper and more profound, +The door of all subtleties! diff --git a/tests/p_diffutils/files/sdiff_input b/tests/p_diffutils/files/sdiff_input new file mode 100644 index 0000000..7b53344 --- /dev/null +++ b/tests/p_diffutils/files/sdiff_input @@ -0,0 +1,5 @@ +l +r +l + + diff --git a/tests/p_diffutils/files/sdiff_output b/tests/p_diffutils/files/sdiff_output new file mode 100644 index 0000000..69bc7d8 --- /dev/null +++ b/tests/p_diffutils/files/sdiff_output @@ -0,0 +1,12 @@ +The Way that can be told of is not the eternal Way; +The name that can be named is not the eternal name. +The Nameless is the origin of Heaven and Earth; +The named is the mother of all things. + +Therefore let there always be non-being, + so we may see their subtlety, +And let there always be being, + so we may see their outcome. +The two are the same, +But after they are produced, + they have different names. diff --git a/tests/p_diffutils/files/side-by-side-W72 b/tests/p_diffutils/files/side-by-side-W72 new file mode 100644 index 0000000..a47bfd6 --- /dev/null +++ b/tests/p_diffutils/files/side-by-side-W72 @@ -0,0 +1,15 @@ +The Way that can be told of is not < +The name that can be named is not < +The Nameless is the origin of Heav The Nameless is the origin of Heav +The Named is the mother of all thi | The named is the mother of all thi + > +Therefore let there always be non- Therefore let there always be non- + so we may see their subtlety, so we may see their subtlety, +And let there always be being, And let there always be being, + so we may see their outcome. so we may see their outcome. +The two are the same, The two are the same, +But after they are produced, But after they are produced, + they have different names. they have different names. + > They both may be called deep and p + > Deeper and more profound, + > The door of all subtleties! diff --git a/tests/p_diffutils/files/supress_common_lines b/tests/p_diffutils/files/supress_common_lines new file mode 100644 index 0000000..58adc38 --- /dev/null +++ b/tests/p_diffutils/files/supress_common_lines @@ -0,0 +1,7 @@ +The Way that can be told of is n < +The name that can be named is no < +The Named is the mother of all t | The named is the mother of all t + > + > They both may be called deep and + > Deeper and more profound, + > The door of all subtleties! diff --git a/tests/p_diffutils/files/tao b/tests/p_diffutils/files/tao new file mode 100644 index 0000000..ffe1ba3 --- /dev/null +++ b/tests/p_diffutils/files/tao @@ -0,0 +1,14 @@ +The Way that can be told of is not the eternal Way; +The name that can be named is not the eternal name. +The Nameless is the origin of Heaven and Earth; +The named is the mother of all things. + +Therefore let there always be non-being, + so we may see their subtlety, +And let there always be being, + so we may see their result. +The two are the same, +But after they are produced, + they have different names. + + -- The Way of Lao-Tzu, tr. Wing-tsit Chan diff --git a/tests/p_diffutils/files/tzu b/tests/p_diffutils/files/tzu new file mode 100644 index 0000000..5af88a8 --- /dev/null +++ b/tests/p_diffutils/files/tzu @@ -0,0 +1,13 @@ +The Nameless is the origin of Heaven and Earth; +The named is the mother of all things. + +Therefore let there always be non-being, + so we may see their subtlety, +And let there always be being, + so we may see their outcome. +The two are the same, +But after they are produced, + they have different names. +They both may be called deep and profound. +Deeper and more profound, +The door of all subtleties! diff --git a/tests/p_diffutils/files/unified_format b/tests/p_diffutils/files/unified_format new file mode 100644 index 0000000..00bb63c --- /dev/null +++ b/tests/p_diffutils/files/unified_format @@ -0,0 +1,17 @@ +@@ -1,7 +1,6 @@ +-The Way that can be told of is not the eternal Way; +-The name that can be named is not the eternal name. + The Nameless is the origin of Heaven and Earth; +-The Named is the mother of all things. ++The named is the mother of all things. ++ + Therefore let there always be non-being, + so we may see their subtlety, + And let there always be being, +@@ -9,3 +8,6 @@ + The two are the same, + But after they are produced, + they have different names. ++They both may be called deep and profound. ++Deeper and more profound, ++The door of all subtleties! diff --git a/tests/p_diffutils/files/unified_format-1 b/tests/p_diffutils/files/unified_format-1 new file mode 100644 index 0000000..e980ad1 --- /dev/null +++ b/tests/p_diffutils/files/unified_format-1 @@ -0,0 +1,13 @@ +@@ -1,5 +1,4 @@ +-The Way that can be told of is not the eternal Way; +-The name that can be named is not the eternal name. + The Nameless is the origin of Heaven and Earth; +-The Named is the mother of all things. ++The named is the mother of all things. ++ + Therefore let there always be non-being, +@@ -11 +10,4 @@ + they have different names. ++They both may be called deep and profound. ++Deeper and more profound, ++The door of all subtleties! diff --git a/tests/p_dovecot/0-install_dovecot.sh b/tests/p_dovecot/0-install_dovecot.sh new file mode 100755 index 0000000..ede3de3 --- /dev/null +++ b/tests/p_dovecot/0-install_dovecot.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "Running $0 - installation and startup of dovecot IMAP/POP3." + +# Install some pkgs needed by the tests +t_InstallPackage nc grep dovecot + +t_ServiceControl dovecot start diff --git a/tests/p_dovecot/1-config_dovecot.sh b/tests/p_dovecot/1-config_dovecot.sh new file mode 100755 index 0000000..43b4b11 --- /dev/null +++ b/tests/p_dovecot/1-config_dovecot.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +if (t_GetPkgRel dovecot | egrep -q 'el6|7|8') +then + t_Log "Running $0 - Configuration of Dovecot" + + cat > /etc/dovecot/conf.d/11-mail.conf < +# Christoph Galuschka + +t_Log "Running $0 - adding imaptest local user account + attempting IMAP login" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +{ userdel -rf imaptest; useradd imaptest && echo imaptest | passwd --stdin imaptest; } &>/dev/null + +# creating maildir in HOME, else test will fail at first try +mkdir -m 700 -p /home/imaptest/mail/.imap/INBOX +chown -R imaptest:imaptest /home/imaptest/mail + +ret_val=1 + +t_Log "Dovecot IMAP login test" + +# EL7 comes with nmap-nc , different from nc so different options to use + +if [ "$centos_ver" -ge 7 ];then + nc_options="-d 3 -w 5" +else + nc_options="-i 3 -w 5" +fi + +echo -e "01 LOGIN imaptest imaptest\n" | nc ${nc_options} localhost 143 | grep -q "Logged in." + +ret_val=$? + +if [ $ret_val != 0 ] +then + tail /var/log/secure + tail /var/log/maillog +fi +t_CheckExitStatus $ret_val + +userdel -rf imaptest diff --git a/tests/p_dovecot/dovecot_pop3_login.sh b/tests/p_dovecot/dovecot_pop3_login.sh new file mode 100755 index 0000000..33885ca --- /dev/null +++ b/tests/p_dovecot/dovecot_pop3_login.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - adding pop3test local user account + attempting POP3 login" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +{ userdel -rf pop3test; useradd pop3test && echo pop3test | passwd --stdin pop3test; } &>/dev/null + +# creating maildir in HOME, else test will fail at first try +mkdir -m 700 -p /home/pop3test/mail/.imap/INBOX +chown -R pop3test:pop3test /home/pop3test/mail/.imap/INBOX + +t_Log "Dovecot POP3 login test" +# EL7 comes with nmap-nc , different from nc so different options to use + +if [ "$centos_ver" -ge 7 ];then + nc_options="-d 3 -w 5" +else + nc_options="-i 3 -w 5" +fi + + +echo -e "user pop3test\npass pop3test\n" | nc ${nc_options} localhost 110 | grep -q "+OK Logged in." + +t_CheckExitStatus $? + +userdel -rf pop3test diff --git a/tests/p_exim/0-install_exim.sh b/tests/p_exim/0-install_exim.sh new file mode 100755 index 0000000..9fed650 --- /dev/null +++ b/tests/p_exim/0-install_exim.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - remove unused MTAs and install exim" + +if (t_GetPkgRel basesystem | grep -q el5) +then + t_InstallPackage exim expect telnet + # Remove other MTAs + t_ServiceControl postfix stop + t_ServiceControl sendmail stop + sleep 3 + t_RemovePackage postfix sendmail + # Fix exim.conf to not use IPv6 + sed -i 's/\:\:1//' /etc/exim/exim.conf + t_ServiceControl exim start +else + t_Log "This seems to be a C6 system - skipping" +fi + diff --git a/tests/p_exim/10-test-sendmail.sh b/tests/p_exim/10-test-sendmail.sh new file mode 100755 index 0000000..1e3fb80 --- /dev/null +++ b/tests/p_exim/10-test-sendmail.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - testing if /usr/sbin/sendmail for exim is sane." + +if (t_GetPkgRel basesystem | grep -q el5) +then + mta=$(ls -H /usr/sbin/sendmail) + + if [ $mta == '/usr/sbin/sendmail' ] + then + t_Log "link to sendmail seems to be sane" + ret_val=0 + else + t_Log "link to sendmail seems to be wrong" + ret_val=1 + fi +else + t_Log "This seems to be a C6 system - skipping" + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_exim/15_exim_smtp.sh b/tests/p_exim/15_exim_smtp.sh new file mode 100755 index 0000000..d2523d2 --- /dev/null +++ b/tests/p_exim/15_exim_smtp.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - Exim SMTP test." + +if (t_GetPkgRel basesystem | grep -q el5) +then + echo "helo test" | nc -i 1 -w 3 localhost 25 | grep -q '250' + ret_val=$? +else + t_Log "This seems to be a C6 system - skipping" + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_exim/20_exim_mta_helo-test.sh b/tests/p_exim/20_exim_mta_helo-test.sh new file mode 100755 index 0000000..2b714af --- /dev/null +++ b/tests/p_exim/20_exim_mta_helo-test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - exim can accept and deliver local email." + +if [ $centos_ver == '5' ] + then + ret_val=1 + + # create user for local delivery + useradd eximtest + + # send mail to localhost + mail=$(./tests/p_exim/_helper_exim_helo.expect | grep "250 OK") + MTA_ACCEPT=$? + if [ $MTA_ACCEPT == 0 ] + then + t_Log 'Mail has been queued successfully' + fi + + regex='250\ OK\ id\=([0-9A-Za-z-]*)' + if [[ $mail =~ $regex ]] + then + sleep 1 + grep -q "${BASH_REMATCH[1]} Completed" /var/log/exim/main.log + DELIVERED=$? + fi + + if ([ $MTA_ACCEPT == 0 ] && [ $DELIVERED == 0 ]) + then + ret_val=0 + fi +else + t_Log "This is not a C5 system - skipping" + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_exim/30_exim_mta_ehlo-test.sh b/tests/p_exim/30_exim_mta_ehlo-test.sh new file mode 100755 index 0000000..22ac9f3 --- /dev/null +++ b/tests/p_exim/30_exim_mta_ehlo-test.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - exim can accept and deliver local email." + +if [ $centos_ver == '5' ] + then + ret_val=1 + + # send mail to localhost + mail=$(./tests/p_exim/_helper_exim_ehlo.expect | grep "250 OK") + MTA_ACCEPT=$? + if [ $MTA_ACCEPT == 0 ] + then + t_Log 'Mail has been queued successfully' + fi + + regex='250\ OK\ id\=([0-9A-Za-z-]*)' + if [[ $mail =~ $regex ]] + then + sleep 1 + grep -q "${BASH_REMATCH[1]} Completed" /var/log/exim/main.log + DELIVERED=$? + fi + + if ([ $MTA_ACCEPT == 0 ] && [ $DELIVERED == 0 ]) + then + ret_val=0 + fi + + # delete user for local delivery + userdel eximtest + +else + t_Log "This is not a C5 system - skipping" + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_exim/_helper_exim_ehlo.expect b/tests/p_exim/_helper_exim_ehlo.expect new file mode 100755 index 0000000..9250885 --- /dev/null +++ b/tests/p_exim/_helper_exim_ehlo.expect @@ -0,0 +1,19 @@ +#!/usr/bin/expect -f +# Author: Christoph Galuschka + +set timeout 1 +spawn telnet localhost 25 +expect "220 *" +send -- "ehlo localhost\n" +expect -- "250-PIPELINING" +sleep 1 +send -- "mail from: root@localhost\n" +expect -- "250\ OK" +send -- "rcpt to: eximtest@localhost\n" +expect -- "250\ Accepted" +send -- "data\n" +expect -- "354*" +send -- "t_functional test\n.\n" +expect -- "250\ OK*" +send -- "quit\n" +expect "221*closing\ connection" diff --git a/tests/p_exim/_helper_exim_helo.expect b/tests/p_exim/_helper_exim_helo.expect new file mode 100755 index 0000000..941c55c --- /dev/null +++ b/tests/p_exim/_helper_exim_helo.expect @@ -0,0 +1,19 @@ +#!/usr/bin/expect -f +# Author: Christoph Galuschka + +set timeout 1 +spawn telnet localhost 25 +expect "220 *" +send -- "helo localhost\n" +expect -- "250*Hello\ localhost*" +sleep 1 +send -- "mail from: root@localhost\n" +expect -- "250\ OK" +send -- "rcpt to: eximtest@localhost\n" +expect -- "250\ Accepted" +send -- "data\n" +expect -- "354*" +send -- "t_functional test\n.\n" +expect -- "250\ OK*" +send -- "quit\n" +expect "221*closing\ connection" diff --git a/tests/p_file/00_file_package.sh b/tests/p_file/00_file_package.sh new file mode 100755 index 0000000..42058cd --- /dev/null +++ b/tests/p_file/00_file_package.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +t_Log "Running $0 - checking if file package is installed" + +t_InstallPackage file + +t_Assert "rpm -q file" diff --git a/tests/p_file/01_file_mime_application.sh b/tests/p_file/01_file_mime_application.sh new file mode 100755 index 0000000..38572f1 --- /dev/null +++ b/tests/p_file/01_file_mime_application.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: ??? +# Christoph Galuschka + +t_Log "Running $0 - checking if file can recognize mime executable type " + +if [ "$centos_ver" -eq "8" ] ;then + string="application/x-sharedlib" +elif [ "$centos_ver" -eq "9" ] ;then + string="application/x-pie-executable" +else + string="application/x-executable" +fi + +file /bin/bash -i | grep -q "${string}" + +t_CheckExitStatus $? diff --git a/tests/p_file/02_file_mime_image.sh b/tests/p_file/02_file_mime_image.sh new file mode 100755 index 0000000..c47d574 --- /dev/null +++ b/tests/p_file/02_file_mime_image.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: ??? +# Christoph Galuschka +# Rene Diepstraten + +t_Log "Running $0 - checking if file can recognize image mime file type " + +pngfile="$(find /usr/share/ -type f -name '*.png' -print -quit)" + +if [ -z "$pngfile" ];then + t_Log "No png file found => SKIP" + exit 0 +fi + +file $pngfile -i | grep -q 'image/png' + +t_CheckExitStatus $? diff --git a/tests/p_file/03_file_mime_symlink.sh b/tests/p_file/03_file_mime_symlink.sh new file mode 100755 index 0000000..b8ea775 --- /dev/null +++ b/tests/p_file/03_file_mime_symlink.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Author: ??? +# Christoph Galuschka + +t_Log "Running $0 - checking if file can recognize symlink mime file type " + +TEST_FILE_PATH=/tmp/p_file_link_test + +ln -s /etc/hosts $TEST_FILE_PATH + +case $centos_ver in + 5) + mimetype='x-not-regular-file' + ;; + 6) + mimetype='application/x-symlink' + ;; + *) + mimetype='inode/symlink' + ;; +esac + +file -i $TEST_FILE_PATH | grep -q $mimetype +ret_val=$? + +t_CheckExitStatus $ret_val diff --git a/tests/p_findutils/0-install_findutils b/tests/p_findutils/0-install_findutils new file mode 100755 index 0000000..01c525c --- /dev/null +++ b/tests/p_findutils/0-install_findutils @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "$0 - installing findutils" +t_InstallPackage findutils diff --git a/tests/p_findutils/10-find_tests b/tests/p_findutils/10-find_tests new file mode 100755 index 0000000..279e2f7 --- /dev/null +++ b/tests/p_findutils/10-find_tests @@ -0,0 +1,32 @@ +#!/bin/bash +# Author: Iain Douglas +# + +echo "Running $0" +TMPDIR=/var/tmp/find + +[[ -e "$TMPDIR" ]] && rm -rf "$TMPDIR" + +mkdir -p "$TMPDIR" || { t_Log "FAIL: Can't create working area $TMPDIR" ; exit $FAIL; } +touch "$TMPDIR"/file1 +touch "$TMPDIR"/"file space" +# Basic find tests +echo "Basic find tests" + +find "$TMPDIR" &>/dev/null +t_CheckExitStatus $? + +# Check find fails for non existent directory +echo "Check find fails for non existent directory" +find "$TMPDIR"/1 &>/dev/null && { t_Log "FAIL: find incorrectly exited with 0 status"; exit $FAIL ; } +t_Log "PASS" + +# Check print0 works so we can use it for an xargs test +echo "Test -print0" +lines_count=$( find "$TMPDIR" -print0 | wc -l ) + +if [ $lines_count -eq 0 ] ; then + t_CheckExitStatus 0 +else + t_CheckExitStatus 1 +fi diff --git a/tests/p_findutils/20-xargs_tests b/tests/p_findutils/20-xargs_tests new file mode 100755 index 0000000..8f57aee --- /dev/null +++ b/tests/p_findutils/20-xargs_tests @@ -0,0 +1,17 @@ +#!/bin/bash +echo "Running $0" +TMPDIR=/var/tmp/find +# Basic xargs tests + +echo "Basic xargs tests" +find "$TMPDIR" -type f -print0 | xargs -0 ls &>/dev/null +#ls -l >/dev/null +t_CheckExitStatus $? + +echo "Check xargs fails when filenames with spaces are passed in" +find "$TMPDIR" -type f | xargs ls &>/dev/null && { t_Log "FAIL: This test returned 0 status incorrectly"; exit $FAIL; } +t_Log "PASS" + + +# Cleanup +[[ -d "$TMPDIR" ]] && rm -rf "$TMPDIR" diff --git a/tests/p_firefox/00-install_firefox.sh b/tests/p_firefox/00-install_firefox.sh new file mode 100755 index 0000000..8973798 --- /dev/null +++ b/tests/p_firefox/00-install_firefox.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Christoph Galuschka + +# Install firefox + +t_Log "Running $0 - installation of firefox." + +t_InstallPackage firefox + diff --git a/tests/p_firefox/10-check_default_startpage.sh b/tests/p_firefox/10-check_default_startpage.sh new file mode 100755 index 0000000..5103dab --- /dev/null +++ b/tests/p_firefox/10-check_default_startpage.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Author: Christoph Galuschka + +# Check for centos.org in preferences.js +t_Log "Running $0 - firefox has www.centos.org as default page." + +if (t_GetArch firefox | grep -q 'x86_64') + then + path='/usr/lib64/firefox/defaults/preferences/all-redhat.js' + else + path='/usr/lib/firefox/defaults/preferences/all-redhat.js' +fi + +count=$(grep -c www.centos.org $path) + +if [ $count=2 ] + then + t_CheckExitStatus 0 + else + t_CheckExitStatus 1 +fi diff --git a/tests/p_freeradius/00-install_freeradius.sh b/tests/p_freeradius/00-install_freeradius.sh new file mode 100755 index 0000000..deb4ead --- /dev/null +++ b/tests/p_freeradius/00-install_freeradius.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Author: Christoph Galuschka + +# Install freeradius +# C6 comes with freeradius2 +# C7 comes with freeradius3 + +t_Log "Running $0 - installation and startup of freeradius." + +#if [ $centos_ver -gt 5 ] +#then +#Install Freeradius (V2/V3) +t_InstallPackage freeradius freeradius-utils +#else +# #Install Freeradius2 +# t_InstallPackage freeradius2 freeradius2-utils +#fi + +# start daemon with default settings +if [ $centos_ver -gt 5 ] +then + t_ServiceControl radiusd start +else + # C5 has an eap-setting in radiusd.conf and 3 "sites-enabled" which prevent successfull start (probably missing some dep) + # as the basic test works without these, the eap settings and 2 sites-enabled will be removed for the test and later restored + # Check if we allready did this + if [ ! -e /etc/raddb/radiusd.conf.orig ] + then + # File not yet copied + /bin/cp -a /etc/raddb/radiusd.conf /etc/raddb/radiusd.conf.orig + grep -iv eap /etc/raddb/radiusd.conf.orig > /etc/raddb/radiusd.conf + fi + rm -rf /etc/raddb/sites-enabled/control-socket + rm -rf /etc/raddb/sites-enabled/inner-tunnel + # /etc/raddb/sites-configured will be changed to include only basic files-authentication + # Check if we allready did this + if [ ! -e /etc/raddb/sites-available/default.orig ] + then + # File not yet copied + /bin/cp -a /etc/raddb/sites-available/default /etc/raddb/sites-available/default.orig + fi +cat > /etc/raddb/sites-available/default < +# Athmane Madjodj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Freeradius doesn't work. FIX LATER. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + + +t_Log "Running $0 - freeradius-access test" + +# Make Backup of /etc/raddb/users and add testuser steve +/bin/cp /etc/raddb/users /etc/raddb/users.orig +echo 'steve Cleartext-Password := "centos"' >> /etc/raddb/users +echo ' Service-Type = Framed-User' >> /etc/raddb/users + +# Restart Service +service radiusd restart + +#Run test + +t_Log "Running Test" +echo "User-Name=steve,User-Password=centos " | radclient -x localhost:1812 auth testing123 |grep -q 'Access-Accept' +ret_val=$? + +# Restore settings +/bin/cp /etc/raddb/users.orig /etc/raddb/users +rm -rf /etc/raddb/users.orig +service radiusd stop + +t_CheckExitStatus $ret_val diff --git a/tests/p_gcc-c++/0-install_gcc-c++.sh b/tests/p_gcc-c++/0-install_gcc-c++.sh new file mode 100755 index 0000000..2d62f48 --- /dev/null +++ b/tests/p_gcc-c++/0-install_gcc-c++.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Dries Verachtert + +t_Log "$0 - installing gcc-c++" +t_InstallPackage gcc-c++ diff --git a/tests/p_gcc-c++/1-test_hello_world.sh b/tests/p_gcc-c++/1-test_hello_world.sh new file mode 100755 index 0000000..1f91977 --- /dev/null +++ b/tests/p_gcc-c++/1-test_hello_world.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Author: Dries Verachtert + +t_Log "Running $0 - test gcc-c++ with a hello world program" + +CPPBINARY=`mktemp` + +cat < +int main(int argc, char** argv) { + std::cout << "Hello world!" << std::endl; +} +EOF + +$CPPBINARY | grep -q "Hello world" +t_CheckExitStatus $? + +rm -f $CPPBINARY diff --git a/tests/p_gcc-gnat/0-install_gcc-gnat.sh b/tests/p_gcc-gnat/0-install_gcc-gnat.sh new file mode 100755 index 0000000..fa1919e --- /dev/null +++ b/tests/p_gcc-gnat/0-install_gcc-gnat.sh @@ -0,0 +1,13 @@ +#!/bin/bash -x +# Author: Pablo Greco + +# Install gcc-gnat +t_Log "Running $0 - installing gcc-gnat." + + +# Install gcc-gnat +if [ $centos_ver -eq 7 ]; then + t_InstallPackage gcc-gnat +else + t_Log "This test is only valid in CentOS7." +fi diff --git a/tests/p_gcc-gnat/test_gcc-gnat.sh b/tests/p_gcc-gnat/test_gcc-gnat.sh new file mode 100755 index 0000000..3870a36 --- /dev/null +++ b/tests/p_gcc-gnat/test_gcc-gnat.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Author: Pablo Greco + +t_Log "Running $0 - gcc-gnat can build a hello.adb" + +if [ "$centos_ver" -ne 7 ] ; then + t_Log "CentOS $centos_ver -> SKIP" + exit 0 +fi + +# creating source code +pushd '/var/tmp' >/dev/null +FILE='/var/tmp/gcctesthello.adb' +EXE='/var/tmp/gcctesthello' + +cat > $FILE </dev/null diff --git a/tests/p_gcc/0-install_gcc.sh b/tests/p_gcc/0-install_gcc.sh new file mode 100755 index 0000000..fb6ef1c --- /dev/null +++ b/tests/p_gcc/0-install_gcc.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Author: Christoph Galuschka + +# Install gcc +t_Log "Running $0 - installing gcc." + +echo "Подготовка окружения для тестирования пакета ${TEST_PACKAGE_NAME}" + +t_InstallPackage gcc +t_InstallPackage man man-pages util-linux diff --git a/rpm_tests/p_gcc/001-prepare_environment.sh b/tests/p_gcc/001-prepare_environment.sh similarity index 100% rename from rpm_tests/p_gcc/001-prepare_environment.sh rename to tests/p_gcc/001-prepare_environment.sh diff --git a/rpm_tests/p_gcc/01-bugzilla-links.sh b/tests/p_gcc/01-bugzilla-links.sh similarity index 94% rename from rpm_tests/p_gcc/01-bugzilla-links.sh rename to tests/p_gcc/01-bugzilla-links.sh index c4c7528..f8e3629 100755 --- a/rpm_tests/p_gcc/01-bugzilla-links.sh +++ b/tests/p_gcc/01-bugzilla-links.sh @@ -2,7 +2,7 @@ echo "Тест наличия bugzilla ссылок" -source ../../library/sh_lib.sh +source library/sh_lib.sh check=0 diff --git a/tests/p_gcc/test_gcc.sh b/tests/p_gcc/test_gcc.sh new file mode 100755 index 0000000..f22b69d --- /dev/null +++ b/tests/p_gcc/test_gcc.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# Author: Christoph Galuschka +# Athmane Madjodj + +t_Log "Running $0 - gcc can build a hello world .c" + +# creating source code +FILE='/var/tmp/gcc-test.c' +EXE='/var/tmp/gcc' + +cat > $FILE < +main() +{ + printf("hello, centos\n"); +} +EOF + +# Executing gcc +gcc $FILE -o $EXE + +# run EXE +$EXE |grep -q 'hello, centos' +t_CheckExitStatus $? + +# remove files +/bin/rm $FILE +/bin/rm $EXE + + diff --git a/tests/p_git/0-install_git.sh b/tests/p_git/0-install_git.sh new file mode 100755 index 0000000..40d8bfb --- /dev/null +++ b/tests/p_git/0-install_git.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Author: Pratima Singh , Nilesh Bairagi , Madhurranjan Mohaan +# Christoph Galuschka + +t_Log "Running $0 - installing git" + +# Install git +if [ $centos_ver -ge 6 ] + then + t_InstallPackage git +else + t_Log "This test is skipped in CentOS5." +fi diff --git a/tests/p_git/10-test_git.sh b/tests/p_git/10-test_git.sh new file mode 100755 index 0000000..79ac9c3 --- /dev/null +++ b/tests/p_git/10-test_git.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Author: Pratima Singh , Nilesh Bairagi , Madhurranjan Mohaan +# Christoph Galuschka + +# Check git installation + +t_Log "Running $0 - checking git installation" + +if [ $centos_ver -ge 6 ] + then + git --version + ret_val=$? +else + t_Log "This test is skipped in CentOS5." + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_git/11-test_git_clone.sh b/tests/p_git/11-test_git_clone.sh new file mode 100755 index 0000000..ff06766 --- /dev/null +++ b/tests/p_git/11-test_git_clone.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Author: Pratima Singh , Nilesh Bairagi , Madhurranjan Mohaan +# Christoph Galuschka + +t_Log "Running $0 - testing a local git clone operation" + +if [ $centos_ver -ge 6 ] + then + # Testing Git clone by comparing SHAs + workpath=$(pwd) + rm -rf /tmp/temprepo/ /tmp/cloned_repo/ /tmp/testing_clone_repo + temp_repo="/tmp/temprepo" + SHA1=`echo "hello world" | git hash-object --stdin` + mkdir -p $temp_repo + cd $temp_repo + git init . --bare + cd /tmp + git clone $temp_repo cloned_repo + cd cloned_repo + git config user.email "centos@centos.org" + git config user.name "t_functional tests" + echo "hello world" > hello + git add hello + git commit -m "Temp commit" + git push origin master + + git clone $temp_repo /tmp/testing_clone_repo + cd /tmp/testing_clone_repo + SHA2=`cat hello | git hash-object --stdin` + expr $SHA1 == $SHA2 2>&1 + ret_val=$? + cd $workpath +else + t_Log "This test is skipped in CentOS5." + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_git/12-test_git_log.sh b/tests/p_git/12-test_git_log.sh new file mode 100755 index 0000000..22c4940 --- /dev/null +++ b/tests/p_git/12-test_git_log.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Author: Pratima Singh , Nilesh Bairagi , Madhurranjan Mohaan +# Christoph Galuschka + +t_Log "Running $0 - testing git logging and commit messages" + +if [ $centos_ver -ge 6 ] + then + # Testing git log and git commit msgs + workpath=$(pwd) + rm -rf /tmp/temprepo/ /tmp/cloned_repo/ + temp_repo="/tmp/temprepo" + mkdir -p $temp_repo + cd $temp_repo + git init . --bare + cd /tmp + git clone $temp_repo cloned_repo + cd cloned_repo + git config user.email "centos@centos.org" + git config user.name "t_functional tests" + echo "hello world" > hello + git add hello + git commit -m "Temp commit" 2>&1 + git log --grep="Temp commit" 2>&1 + ret_val=$? + cd $workpath +else + t_Log "This test is skipped in CentOS5." + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_grep/00-install_grep.sh b/tests/p_grep/00-install_grep.sh new file mode 100755 index 0000000..febf918 --- /dev/null +++ b/tests/p_grep/00-install_grep.sh @@ -0,0 +1,4 @@ +#!/bin/env bash +# Author: Ravi Kumar P , Anoop Hallur +t_Log "running $0 - installing grep" +t_InstallPackage grep diff --git a/tests/p_grep/10-test_grep.sh b/tests/p_grep/10-test_grep.sh new file mode 100755 index 0000000..e24d66f --- /dev/null +++ b/tests/p_grep/10-test_grep.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Ravi Kumar P , Anoop Hallur + +# Check grep installation + +t_Log "Running $0 - checking grep installation" + +grep --version &>/dev/null +t_CheckExitStatus $? diff --git a/tests/p_grep/11-test_grep.sh b/tests/p_grep/11-test_grep.sh new file mode 100755 index 0000000..70b63d6 --- /dev/null +++ b/tests/p_grep/11-test_grep.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Ravi Kumar P , Anoop Hallur + +# Check grep functionality + +t_Log "Running $0 - checking grep functionality" + +echo "wow grep is working" | grep -q "wow" +t_CheckExitStatus $? diff --git a/tests/p_grep/13-test_grep.sh b/tests/p_grep/13-test_grep.sh new file mode 100755 index 0000000..c620817 --- /dev/null +++ b/tests/p_grep/13-test_grep.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Ravi Kumar P , Anoop Hallur + +# Check grep functionality with count of repititive words + +t_Log "Running $0 - checking grep with count" + +count=`echo -e "wow grep is working" | grep -c "wow"` +t_Log $count + +t_Assert_Equals $count 1 diff --git a/tests/p_grub/grub_dir_layout_test.sh b/tests/p_grub/grub_dir_layout_test.sh new file mode 100755 index 0000000..1b44d37 --- /dev/null +++ b/tests/p_grub/grub_dir_layout_test.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Note: This was a known issue in CentOS 6.0 +# See: http://bugs.centos.org/view.php?id=4995 + +t_Log "Running $0 - check that grub file layout is the same with upstream." + +if [ "$centos_ver" -ge 7 ] ; then + t_Log "el$centos_ver comes with grub2, skipping grub test ..." + t_CheckExitStatus 0 + exit 0 +fi + + +ARCH=`uname -m | sed 's/i6/i3/'` + +[[ $( ls /usr/share/grub/ | wc -l ) -eq 1 ]] && \ +ls /usr/share/grub/ | grep -q "$ARCH-redhat" + +t_CheckExitStatus $? diff --git a/rpm_tests/p_grub2-efi-x64-cdboot/001-prepare_environment.sh b/tests/p_grub2-efi-x64-cdboot/001-prepare_environment.sh similarity index 100% rename from rpm_tests/p_grub2-efi-x64-cdboot/001-prepare_environment.sh rename to tests/p_grub2-efi-x64-cdboot/001-prepare_environment.sh diff --git a/rpm_tests/p_grub2-efi-x64-cdboot/01-files-check.sh b/tests/p_grub2-efi-x64-cdboot/01-files-check.sh similarity index 100% rename from rpm_tests/p_grub2-efi-x64-cdboot/01-files-check.sh rename to tests/p_grub2-efi-x64-cdboot/01-files-check.sh diff --git a/rpm_tests/p_grub2-efi-x64-cdboot/02-pesigcheck.sh b/tests/p_grub2-efi-x64-cdboot/02-pesigcheck.sh similarity index 100% rename from rpm_tests/p_grub2-efi-x64-cdboot/02-pesigcheck.sh rename to tests/p_grub2-efi-x64-cdboot/02-pesigcheck.sh diff --git a/rpm_tests/p_grub2-efi-x64/001-prepare_environment.sh b/tests/p_grub2-efi-x64/001-prepare_environment.sh similarity index 100% rename from rpm_tests/p_grub2-efi-x64/001-prepare_environment.sh rename to tests/p_grub2-efi-x64/001-prepare_environment.sh diff --git a/rpm_tests/p_grub2-efi-x64/01-files-check.sh b/tests/p_grub2-efi-x64/01-files-check.sh similarity index 95% rename from rpm_tests/p_grub2-efi-x64/01-files-check.sh rename to tests/p_grub2-efi-x64/01-files-check.sh index 14280de..d6a831e 100755 --- a/rpm_tests/p_grub2-efi-x64/01-files-check.sh +++ b/tests/p_grub2-efi-x64/01-files-check.sh @@ -2,7 +2,7 @@ echo "Тест наличия файлов пакета ${TEST_PACKAGE_NAME}" -source ../../library/sh_lib.sh +source library/sh_lib.sh if [[ "${TEST_PACKAGE_NAME}" != "grub2-efi-x64" ]] && [[ "${TEST_PACKAGE_NAME}" != "grub2-efi-x64-cdboot" ]]; then echo "ERROR: Неверное имя пакета - '${TEST_PACKAGE_NAME}'. Этот тест предназначен для пакетов grub2-efi-x64 и grub2-efi-x64-cdboot" diff --git a/rpm_tests/p_grub2-efi-x64/02-pesigcheck.sh b/tests/p_grub2-efi-x64/02-pesigcheck.sh similarity index 96% rename from rpm_tests/p_grub2-efi-x64/02-pesigcheck.sh rename to tests/p_grub2-efi-x64/02-pesigcheck.sh index 19497d0..1a0100e 100755 --- a/rpm_tests/p_grub2-efi-x64/02-pesigcheck.sh +++ b/tests/p_grub2-efi-x64/02-pesigcheck.sh @@ -2,7 +2,7 @@ echo "Тест pesigcheck файлов пакета ${TEST_PACKAGE_NAME}" -source ../../library/sh_lib.sh +source library/sh_lib.sh if [[ "${TEST_PACKAGE_NAME}" != "grub2-efi-x64" ]] && [[ "${TEST_PACKAGE_NAME}" != "grub2-efi-x64-cdboot" ]]; then echo "ERROR: Неверное имя пакета - '${TEST_PACKAGE_NAME}'. Этот тест предназначен для пакетов grub2-efi-x64 и grub2-efi-x64-cdboot" diff --git a/tests/p_grub2/01_grub2_secureboot_signed.sh b/tests/p_grub2/01_grub2_secureboot_signed.sh new file mode 100755 index 0000000..0d30272 --- /dev/null +++ b/tests/p_grub2/01_grub2_secureboot_signed.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# This test will verify that grub2-efi is correctly signed with correct cert in the CA chain + +t_Log "Running $0 - Verifying that grub2-efi is correctly signed with correct cert" + +arch=$(uname -m) + +if [[ "$centos_ver" -ge 7 && "$arch" = "x86_64" ]] ; then + t_InstallPackage pesign grub2-efi-x64 + pesign --show-signature --in /boot/efi/EFI/centos/grubx64.efi|egrep -q 'CentOS Secure Boot Signing 202' + t_CheckExitStatus $? +else + t_Log "previous versions than CentOS 7 - or not x86_64 arch - aren't using secureboot ... skipping" + exit 0 +fi + diff --git a/tests/p_gzip/0_install_gzip.sh b/tests/p_gzip/0_install_gzip.sh new file mode 100755 index 0000000..feddc82 --- /dev/null +++ b/tests/p_gzip/0_install_gzip.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - attempting to install gzip." +t_InstallPackage gzip zip diffutils less util-linux-ng expect +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "Ncompress unavailable in el9" +else + t_InstallPackage ncompress +fi + diff --git a/tests/p_gzip/10-C5-test-binaries b/tests/p_gzip/10-C5-test-binaries new file mode 100755 index 0000000..7f568b2 --- /dev/null +++ b/tests/p_gzip/10-C5-test-binaries @@ -0,0 +1,48 @@ +#!/bin/bash +# Author: Iain Douglas +# +# Check the binaries from the CentOS 5 package exist and run ok + +function ExitFail { + t_Log "Fail" + exit $FAIL +} + +[ $centos_ver != '5' ] && exit + +# Some ov the binaries respond to a --version and some don't. Of those that +# don't, some exit with a status of 1 and others exit with a status of 2 +# nice and consistent NOT! + +t_Log "Running $0 - Checking binaries are present and run on C5" +[ "$(readlink -e /usr/bin/gunzip)" == "/bin/gunzip" ] || ExitFail +[ "$(readlink -e /usr/bin/gzip)" == "/bin/gzip" ] || ExitFail + +for binary in gunzip gzip zcat gzexe zless +do + echo -n "$binary " + $binary --version &>/dev/null || ExitFail +done + +#disabled, needs to be looked into +#for binary in zmore +#do +# echo -n "$binary " +# $binary &>/dev/null || ExitFail +#done + +for binary in znew zforce +do + echo -n "$binary " + $binary &>/dev/null + [ $? != '1' ] && ExitFail +done + +for binary in zgrep zfgrep zegrep zdiff zcmp +do + echo -n "$binary " + $binary &>/dev/null + [ $? != '2' ] && ExitFail +done +echo "" +t_Log "PASS" diff --git a/tests/p_gzip/10-test-binaries b/tests/p_gzip/10-test-binaries new file mode 100755 index 0000000..2c7ee7b --- /dev/null +++ b/tests/p_gzip/10-test-binaries @@ -0,0 +1,36 @@ +#!/bin/bash +# Author: Iain Douglas +# Author: Rene Diepstraten +# Christoph Galuschka +# +# Check the binaries from the package exist and run ok + +function ExitFail { + t_Log "Fail" + exit $FAIL +} + +if [ $centos_ver -lt 6 ] + then + exit 0 +fi + +t_Log "Checking binaries are present and run on C6/C7" + +if [ $centos_ver -ge 7 ] +then + [ "$(readlink -e /usr/bin/gunzip)" == "/usr/bin/gunzip" ] || ExitFail + [ "$(readlink -e /usr/bin/gzip)" == "/usr/bin/gzip" ] || ExitFail +elif [ $centos_ver == 6 ] +then + [ "$(readlink -e /bin/gunzip)" == "/bin/gunzip" ] || ExitFail + [ "$(readlink -e /bin/gzip)" == "/bin/gzip" ] || ExitFail +fi + +for binary in gunzip gzip zcat gzexe zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew +do + echo -n "$binary " + $binary --version &>/dev/null || ExitFail +done +echo "" +t_Log "PASS" diff --git a/tests/p_gzip/20-gzip-test b/tests/p_gzip/20-gzip-test new file mode 100755 index 0000000..043ecd6 --- /dev/null +++ b/tests/p_gzip/20-gzip-test @@ -0,0 +1,199 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Author: Christoph Galuschka +# Author: Iain Douglas +# Author: Rene Diepstraten + +function ExitFail { + t_Log "FAIL" + exit $FAIL +} + +function cleanup { +rm $FILE* &>/dev/null +rm /var/tmp/gziptest/* &>/dev/null +rmdir /var/tmp/gziptest &>/dev/null +} + +t_Log "Running $0 - run a file through gzip,zcat and gunzip test." + +# create file +FILE=/var/tmp/gzip-test.txt + +# Just in case earlier runs failed +cleanup +# Use the provided file as it has known contents and known name/timestamp +# information. + +cp ./tests/p_gzip/gzip-test.txt.gz /var/tmp + +#run file through gunzip +t_Log "Test basic gunzip" +gunzip $FILE.gz +#checking file contents +grep -q 'gzip-test of single file' $FILE || ExitFail + +# run file through gzip +t_Log "Test basic gzip" +gzip $FILE || ExitFail + +#just to make sure +/bin/rm -rf $FILE + +#run file through zcat +t_Log "Test basic zcat" +zcat $FILE.gz | grep -q 'gzip-test of single file' || ExitFail + +# Basic tests complete - go a little deeper. + +# Check that we cannot overwrite an existing file +t_Log "Check files will not be overwritten" +touch $FILE +echo | gunzip $FILE &>/dev/null +[ $? -ne 2 ] && ExitFail + +echo | gzip $FILE &>/dev/null +[ $? -ne 2 ] && ExitFail + +# Check that we can force files to be overwritten +t_Log "Check force overwrite" +gunzip -f $FILE.gz || ExitFail +touch $FILE.gz +gzip -f $FILE || ExitFail + +# Check that -a is ignored +t_Log "Check -a is ignored as we're on CentOS" +if [ $centos_ver == '5' ] + then + gunzip -a $FILE.gz 2>&1 | head -n 1 | grep -q 'gunzip: option --ascii ignored on this system' || ExitFail +elif [[ $centos_ver =~ ^(6|7|8|9)$ ]] + then + gunzip -a $FILE.gz 2>&1 | head -n 1 | grep -q 'gzip: option --ascii ignored on this system' || ExitFail +fi + +# Check -c writes to stdout +t_Log "check -c writes to stdout" + +gzip -c $FILE | gunzip | grep -q 'gzip-test of single file' || ExitFail + +# Check the correct info is listed for -l the output is +# compressed uncompressed ratio uncompressed_name +# 59 25 24.0% /var/tmp/gzip-test.txt +# +# The md5sum is 4cbaba004a815915904bd524ede5edec +# +# The 32-bit gzip behaves differently: +# +# compressed uncompressed ratio uncompressed_name +# 59 25 -8.0% /var/tmp/gzip-test.txt +# +# The md5sum is caf6dee7a56022a840316520134967a4 + +t_Log "Check the output of -l" +gzip $FILE +mdhash=$(gzip -l $FILE.gz | md5sum | cut -f1 -d' ') +[ "$mdhash" == "4cbaba004a815915904bd524ede5edec" -o "$mdhash" == "caf6dee7a56022a840316520134967a4" ] || ExitFail + +# Check that -q works which removes the header information from -l +t_Log "Check -q reduced the output verbosity" +gzip -ql $FILE | grep -qv "ratio" || ExitFail + +# Check -v gives us more information - we shouls see the files +# CRC which is d14bbb86 +t_Log "Check -v increases verbosity" +gzip -lv $FILE | grep -q "d14bbb86" || ExitFail + +# Check -n and -N work correctly. The original datestamp on the +# test file is '2010-11-22 13:11' gzip-test.txt +# At this point we shouldn't see the original timestamp if the default +# -n to gunzip and -N to gzip are working. + +t_Log "check -n and -N work correctly" +TZ_SAVE=$TZ +export TZ=UTC +gunzip $FILE.gz +ls -l --time-style=+"%F %R" $FILE | grep -q '2010-11-22 13:11' && ExitFail + +# Reset the test file with a different name +# the file should gunzup as gzip-test.1 +cp ./tests/p_gzip/gzip-test.txt.gz /var/tmp/gzip-test.txt.1.gz +gunzip $FILE.1.gz +[ -e "$FILE.1" ] || ExitFail + +# Reset the test file with a different name +cp ./tests/p_gzip/gzip-test.txt.gz /var/tmp/gzip-test.txt.1.gz + +# The file should gunzip with it's original name and timestamp. +gunzip -f -N $FILE.1.gz +ls -l $FILE --time-style=+"%F %R" | grep -q '2010-11-22 13:11' || ExitFail +export TZ=$TZ_SAVE +# Check that -t works and detects a damaged file +t_Log "Check -t can detect a corrupt file" +gzip $FILE +echo -ne \\x34 | dd conv=notrunc bs=1 count=1 seek=27 of=$FILE.gz &>/dev/null +gzip -t $FILE.gz 2>&1 | grep -qv "data--crc error" || ExitFail + +# Check we can use a custon suffix .iain will do ;) +t_Log "Check that a custom suffix can be used -S" +cp ./tests/p_gzip/gzip-test.txt.gz /var/tmp/gzip-test.txt.gz +gunzip $FILE.gz +gzip -S .iain $FILE +[ -e $FILE.iain ] || ExitFail +gunzip -S .iain $FILE || ExitFail + +# Check that -r works - create a directory, populate it then just pass +# the dirname to gzip - it should zip all the files. + +t_Log "Check that -r works " +mkdir /var/tmp/gziptest +touch /var/tmp/gziptest/a +touch /var/tmp/gziptest/b +gzip -r /var/tmp/gziptest +[ "$(ls /var/tmp/gziptest/*.gz | wc -l)" -eq "2" ] || ExitFail + +# Text the different compression levels +t_Log "Check different compression levels" +gzip -1 $FILE.1 # 61 bytes +gzip -9 $FILE # 59 bytes +[ "$(stat -c %s $FILE.gz)" -ne "$(stat -c %s $FILE.1.gz)" ] || ExitFail + +# Multiple input files +t_Log "Multiple input files on the command line" +# Multiple files on one command line +gunzip $FILE.1.gz $FILE || ExitFail + +# Don't specify the .gz extension +t_Log "No file extension supplied for gunzip" +gzip $FILE $FILE.1 || ExitFail + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Ncompress not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +else + + # Compress the file then get gunzip to uncompress it, the file needs + # to be larger for compress to work + t_Log "Check gunzip can handle .Z files" + gunzip $FILE + ls -l /var/tmp >>$FILE + compress $FILE || ExitFail + gunzip $FILE.Z || ExitFail +fi + +# Zip the file then get gunzip to uncompress it. +t_Log "Check gunzip can handle .zip files" +zip $FILE.zip $FILE &>/dev/null || ExitFail +gunzip -f -S .zip $FILE.zip || ExitFail + +# Handle .tgz correctly +t_Log "Check gunzip creates a .tar file from .tgz" +tar -czf $FILE.tgz $FILE &>/dev/null +gunzip $FILE.tgz +[ -e $FILE.tar ] +t_CheckExitStatus $? + +#tar the file rename it to .tgz +#reversing changes +cleanup diff --git a/tests/p_gzip/30-gzexe-test b/tests/p_gzip/30-gzexe-test new file mode 100644 index 0000000..184af12 --- /dev/null +++ b/tests/p_gzip/30-gzexe-test @@ -0,0 +1,36 @@ +#!/bin/bash +#Author: Iain Douglas + +function ExitFail { + t_Log "FAIL" + exit $FAIL +} + +t_Log Running $0 Check gzexe + +# Create a file to work with + +t_Log "Create file to work with" + +FILE=/var/tmp/gzexe-test-script +rm $FILE* $OUTPUT &>/dev/null + +cat <$FILE +#!/bin/bash +echo "Hello World" +EOF + +chmod +x $FILE +$FILE | grep -q "Hello World" || ExitFail + +t_Log "Run file through gzexe" + +gzexe $FILE &>/dev/null || ExitFail + +t_Log "Check resultant file runs" +$FILE | grep -q "Hello World" +t_CheckExitStatus $? + +#Cleanup +rm $FILE* 2>/dev/null + diff --git a/tests/p_gzip/40-gcmp-gdiff-tests b/tests/p_gzip/40-gcmp-gdiff-tests new file mode 100755 index 0000000..8f24dde --- /dev/null +++ b/tests/p_gzip/40-gcmp-gdiff-tests @@ -0,0 +1,34 @@ +#!/bin/bash +# Author: Iain Douglas + +function ExitFail { + t_Log "FAIL" + exit $FAIL +} + +t_Log "Running $0 Check zcmp and zdiff" + +# We don't check that cmp and diff work - that should be done as +# part of p_diffutils. + +BASEFILE=/var/tmp/gzip-test +rm $BASEFILE* &>/dev/null + +# Create files to work with +cat <$BASEFILE.1 +Some data to be testing with +EOF + + +gzip $BASEFILE.1 || exit FAIL +cp $BASEFILE.1.gz $BASEFILE.2.gz + +t_Log "Check zcmp" +zcmp $BASEFILE.1.gz $BASEFILE.2.gz || ExitFail + +t_Log "Check zdiff" +zdiff $BASEFILE.1.gz $BASEFILE.2.gz +t_CheckExitStatus $? + +rm $BASEFILE* + diff --git a/tests/p_gzip/50-zgrep-tests b/tests/p_gzip/50-zgrep-tests new file mode 100755 index 0000000..44e4256 --- /dev/null +++ b/tests/p_gzip/50-zgrep-tests @@ -0,0 +1,21 @@ +#!/bin/bash +# Author: Iain Douglas +# + +# Only check zgrep as zegrep is zgrep -E and zfgrep is zgrep -F +# also not testing grep - that should be done in p_grep + +t_Log "running $0 Testing zgrep" +BASEFILE=/var/tmp/gzip-test +rm $BASEFILE* &>/dev/null + +# Create files to work with +cat <$BASEFILE.1 +Some data to be testing with +EOF +gzip $BASEFILE.1 + +zgrep -q 'Some data to be testing with' $BASEFILE.1 +t_CheckExitStatus $? + +rm $BASEFILE* diff --git a/tests/p_gzip/60-zforce-tests b/tests/p_gzip/60-zforce-tests new file mode 100755 index 0000000..6814973 --- /dev/null +++ b/tests/p_gzip/60-zforce-tests @@ -0,0 +1,35 @@ +#!/bin/bash +# Author: Iain Douglas +# + +# Test zforce - force a .gz extension on all suitable files. +# Currently doesen't work see +# http://bugs.centos.org/view.php?id=6096 +# + +function ExitFail { + t_Log "FAIL" + exit $FAIL +} + +t_Log "Running $0 Testing zforce " +t_Log "Skipped see http://bugs.centos.org/view.php?id=6096" +exit 0 + +BASEFILE=/var/tmp/12345678901234 +rm $BASEFILE* &>/dev/null + +# Create files to work with +cat <$BASEFILE +Some data to be testing with +EOF + +gzip $BASEFILE +mv $BASEFILE.gz $BASEFILE + +zforce $BASEFILE || ExitFail + +[ -e /var/tmp/12345678901234.gz ] +t_CheckExitStatus $? + +rm /var/tmp/12345678901234.gz diff --git a/tests/p_gzip/70-zless-tests b/tests/p_gzip/70-zless-tests new file mode 100755 index 0000000..40e7f21 --- /dev/null +++ b/tests/p_gzip/70-zless-tests @@ -0,0 +1,15 @@ +#!/bin/bash +# Author: Iain Douglas +# + +# The zless utility is a wrapper round less so just check that +# it works as less should be tested as part of p_less +# + +t_Log "Running $0 Testing zless " + +# -F makes less quit if the output all fits on one screen. + +zless -F ./tests/p_gzip/gzip-test.txt.gz | grep -q 'gzip-test of single file' +t_CheckExitStatus $? + diff --git a/tests/p_gzip/80-zmore-tests b/tests/p_gzip/80-zmore-tests new file mode 100755 index 0000000..1039c13 --- /dev/null +++ b/tests/p_gzip/80-zmore-tests @@ -0,0 +1,44 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0 Testing zmore" + +# The zmore utility is just a wrapper round more which should be +# tested as part of p_util-linux-ng. It does however deal with +# multiple files for more so test that. + +TESTFILE="./tests/p_gzip/gzip-test.txt.gz" +t_Log "Check single file invocation" +zmore $TESTFILE | grep -q -- 'gzip-test of single file' +t_CheckExitStatus $? + +# Check multifile invocation + +t_Log "Check multifile invocation" + +if [ $centos_ver -ge 8 ] +then +expect << EOF &>/dev/null +spawn zmore $TESTFILE $TESTFILE +set timeout 2 +set match_max 1000 +expect -- "gzip-test of single file" +expect -- "gzip-test of single file" {exit 0} +exit 1 +EOF +retval=$? +else +expect << EOF &>/dev/null +spawn zmore $TESTFILE $TESTFILE +set timeout 2 +set match_max 1000 +expect -- "--More--(Next file: ./tests/p_gzip/gzip-test.txt.gz)" {send n} timeout {exit 1 } +expect -- "gzip-test of single file" {exit 0} +exit 1 +EOF +retval=$? +fi + +t_CheckExitStatus $retval + + diff --git a/tests/p_gzip/90-znew-tests b/tests/p_gzip/90-znew-tests new file mode 100755 index 0000000..ae79089 --- /dev/null +++ b/tests/p_gzip/90-znew-tests @@ -0,0 +1,23 @@ +#!/bin/bash +# Author: Iian Douglas + +# Test znew - converts .Z files to .gz +# Create a test file + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Ncompress not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_Log "Running $0 - Testing znew" + +TESTFILE=/var/tmp/znew.txt +rm $TESTFILE* &>/dev/null + +ls /usr/bin >$TESTFILE +compress $TESTFILE + +znew $TESTFILE.Z +t_CheckExitStatus $? diff --git a/tests/p_gzip/gzip-test.txt.gz b/tests/p_gzip/gzip-test.txt.gz new file mode 100644 index 0000000..f666956 Binary files /dev/null and b/tests/p_gzip/gzip-test.txt.gz differ diff --git a/rpm_tests/p_httpd-core/001-prepare_environment.sh b/tests/p_httpd-core/001-prepare_environment.sh similarity index 100% rename from rpm_tests/p_httpd-core/001-prepare_environment.sh rename to tests/p_httpd-core/001-prepare_environment.sh diff --git a/rpm_tests/p_httpd-core/01-httpd-running.bats b/tests/p_httpd-core/01-httpd-running.bats similarity index 100% rename from rpm_tests/p_httpd-core/01-httpd-running.bats rename to tests/p_httpd-core/01-httpd-running.bats diff --git a/tests/p_httpd/0-install_httpd.sh b/tests/p_httpd/0-install_httpd.sh new file mode 100755 index 0000000..429883a --- /dev/null +++ b/tests/p_httpd/0-install_httpd.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Christoph Galuschka + +php_mysql="php-mysql" +if [ $centos_ver -ge 7 ] +then + php_mysql="php-mysqlnd" +fi + +#curl="curl" +#if [ $centos_ver -ge 8 ] & [ "$CONTAINERTEST" -eq "1" ] +#then +# curl="curl" +#fi + +# Install tests deps +# t_Log "Running $0 - httpd: installing $curl, http, php and $php_mysql" +t_Log "Running $0 - httpd: installing http, php and $php_mysql" + +#t_InstallPackage curl + +# HTTPD / PHP +# t_InstallPackage $curl httpd mod_ssl php $php_mysql +t_InstallPackage httpd mod_ssl php $php_mysql +t_ServiceControl httpd stop +sleep 3 +killall httpd +sleep 3 +t_ServiceControl httpd start + diff --git a/rpm_tests/p_httpd/01-httpd-running.bats b/tests/p_httpd/01-httpd-running.bats similarity index 100% rename from rpm_tests/p_httpd/01-httpd-running.bats rename to tests/p_httpd/01-httpd-running.bats diff --git a/rpm_tests/p_httpd/02-group-presence.sh b/tests/p_httpd/02-group-presence.sh similarity index 84% rename from rpm_tests/p_httpd/02-group-presence.sh rename to tests/p_httpd/02-group-presence.sh index 503b3dc..247fb58 100755 --- a/rpm_tests/p_httpd/02-group-presence.sh +++ b/tests/p_httpd/02-group-presence.sh @@ -2,7 +2,8 @@ # Test apache group present -source ../../library/sh_lib.sh +pwd +source library/sh_lib.sh check=0 diff --git a/tests/p_httpd/httpd_basic_auth.sh b/tests/p_httpd/httpd_basic_auth.sh new file mode 100755 index 0000000..5310b84 --- /dev/null +++ b/tests/p_httpd/httpd_basic_auth.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - httpd: basic authentication" + +cat > /etc/httpd/conf.d/dir-test-basic-auth.conf < + AuthType Basic + AuthName "Test" + AuthUserFile /etc/httpd/htpasswd + require user test + +EOF + +htpasswd -c -b /etc/httpd/htpasswd test test +mkdir -p /var/www/html/basic_auth_test +echo "Basic authentication Test Page" > /var/www/html/basic_auth_test/index.html +t_ServiceControl httpd stop +sleep 3 +killall httpd +sleep 3 +t_ServiceControl httpd start + +curl -s -u test:test http://localhost/basic_auth_test/ | grep 'Basic authentication Test Page' > /dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_httpd/httpd_centos_brand_server_tokens.sh b/tests/p_httpd/httpd_centos_brand_server_tokens.sh new file mode 100755 index 0000000..2dd5cd3 --- /dev/null +++ b/tests/p_httpd/httpd_centos_brand_server_tokens.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - httpd: centos branding / Server tokens value " + +curl -sI http://localhost/ | grep -i "Server:\ Apache.*\ (CentOS" > /dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_httpd/httpd_centos_brand_welcome.sh b/tests/p_httpd/httpd_centos_brand_welcome.sh new file mode 100755 index 0000000..6b42804 --- /dev/null +++ b/tests/p_httpd/httpd_centos_brand_welcome.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - httpd: Welcome page has CentOS Branding." + +curl -s http://localhost/ | grep 'CentOS' > /dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_httpd/httpd_php.sh b/tests/p_httpd/httpd_php.sh new file mode 100755 index 0000000..3624ce5 --- /dev/null +++ b/tests/p_httpd/httpd_php.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - httpd: can parse a phpinfo/PHP page" + +echo "" > /var/www/html/test.php + +curl -s http://localhost/test.php | grep 'PHP Version' > /dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_httpd/httpd_servehtml.sh b/tests/p_httpd/httpd_servehtml.sh new file mode 100755 index 0000000..80325b2 --- /dev/null +++ b/tests/p_httpd/httpd_servehtml.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - httpd: serve html page" + +curl -H 'Accept-Language: en' -s http://localhost/ | grep 'Test Page' > /dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_httpd/httpd_servehtml_ssl.sh b/tests/p_httpd/httpd_servehtml_ssl.sh new file mode 100755 index 0000000..a37699e --- /dev/null +++ b/tests/p_httpd/httpd_servehtml_ssl.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - httpd: serve html page over SSL " + +curl -H 'Accept-Language: en' -ks https://localhost/ | grep 'Test Page' > /dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_httpd/httpd_vhost.sh b/tests/p_httpd/httpd_vhost.sh new file mode 100755 index 0000000..317cb14 --- /dev/null +++ b/tests/p_httpd/httpd_vhost.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - httpd: NameVirtualHost is functional" + +echo "127.0.0.1 test" >> /etc/hosts +cat > /etc/httpd/conf.d/vhost-test.conf < + ServerAdmin webmaster@test + DocumentRoot /var/www/vhosts/test/ + ServerName test + +EOF + +mkdir -p /var/www/vhosts/test/ +echo "Virtual Host Test Page" > /var/www/vhosts/test/index.html +t_ServiceControl httpd stop +sleep 3 +killall httpd +sleep 3 +t_ServiceControl httpd start + +curl -s http://test/ | grep 'Virtual Host Test Page' > /dev/null 2>&1 + +t_CheckExitStatus $? + +# SteveCB: remove vhost-test.conf to prevent later tests +# that assume DocumentRoot is /var/www/html from failing +/bin/rm /etc/httpd/conf.d/vhost-test.conf +t_ServiceControl httpd stop + diff --git a/tests/p_initscripts/initscripts_centos_brand_rcsysinit.sh b/tests/p_initscripts/initscripts_centos_brand_rcsysinit.sh new file mode 100755 index 0000000..8b13d35 --- /dev/null +++ b/tests/p_initscripts/initscripts_centos_brand_rcsysinit.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - initscripts CentOS branding " + +if [ "$centos_ver" -gt "5" ] ; then + t_Log "Test not required for CentOS $centos_ver -> SKIP" + exit 0 +else + grep "CentOS" /etc/rc.sysinit > /dev/null 2>&1 +fi + +t_CheckExitStatus $? diff --git a/tests/p_initscripts/initscripts_service_status.sh b/tests/p_initscripts/initscripts_service_status.sh new file mode 100755 index 0000000..e307b83 --- /dev/null +++ b/tests/p_initscripts/initscripts_service_status.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +t_Log "Running $0 - check if service cmd can get service status" + +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + +# auditd is used as example because it's standard with minimal install +if ! service auditd status > ${output_file} 2>&1; then + cat ${output_file} + t_CheckExitStatus 1 +fi + +t_CheckExitStatus 0 diff --git a/tests/p_ipa-server/0-preclean.sh b/tests/p_ipa-server/0-preclean.sh new file mode 100644 index 0000000..3477f86 --- /dev/null +++ b/tests/p_ipa-server/0-preclean.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') + then + + t_Log "Running $0 - Stopping and removing httpd if present" + if /sbin/service httpd status 2>&1 | grep 'running...' &> /dev/null + then + /sbin/service httpd stop &> /dev/null + fi + if rpm -q httpd &> /dev/null + then + /usr/bin/yum -y remove httpd &> /dev/null + rm -rf /etc/httpd + fi + + t_Log "Running $0 - Stopping and removing bind if present" + if /sbin/service named status 2>&1 | grep 'running...' &> /dev/null + then + /sbin/service named stop &> /dev/null + fi + if rpm -q bind &> /dev/null + then + /usr/bin/yum -y remove bind &> /dev/null + rm -rf /etc/named /var/named + fi + + + t_Log "Running $0 - Backing up resolv.conf" + cp /etc/resolv.conf /tmp/resolv.conf.ipa-tests + + t_Log "Running $0 - Backing up nsswitch.conf" + cp /etc/nsswitch.conf /tmp/nsswitch.conf.ipa-tests + + t_Log "Running $0 - Backing up hosts file" + cp /etc/hosts /tmp/hosts.ipa-tests + + t_Log "Running $0 - Saving current hostname" + echo $(hostname) >/tmp/hostname.ipa-tests + + if [[ -f /etc/ntp.conf ]] + then + t_Log "Running $0 - Backing up ntp.conf file" + cp /etc/ntp.conf /tmp/ntp.conf.ipa-tests + fi + + t_Log "Running $0 - Backing up saving yum history id" + /usr/bin/yum history list | awk 'NR == 4 {print $1}' > /tmp/yum-rollback-id.ipa-tests + + t_Log "Running $0 - Cleaning up hosts file" + sed -i "s/127.0.0.1 $(hostname)//" /etc/hosts + + t_Log "Running $0 - Cleaning previous tomcat/pki instances if any" + yum remove -d0 -y tomcat ipa-server >/dev/null 2>&1 + /bin/rm -Rf /var/lib/pki/pki-tomcat/ /etc/sysconfig/pki-tomcat /var/log/pki/pki-tomcat /etc/pki/pki-tomcat /etc/sysconfig/pki/tomcat/pki-tomcat + + t_Log "Running $0 - Backing up ssh_config" + cp /etc/ssh/ssh_config /etc/ssh/ssh_config.ipa-tests + +else + echo "Skipped on CentOS 5" +fi + diff --git a/tests/p_ipa-server/1-install_freeipa.sh b/tests/p_ipa-server/1-install_freeipa.sh new file mode 100644 index 0000000..53c9b3c --- /dev/null +++ b/tests/p_ipa-server/1-install_freeipa.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') && !(t_GetArch | grep -qE 'aarch64') + then + t_Log "Running $0 - Installing java-1.6 to fix java-issues with 1.7/1.8, to be fixed with 6.7" + t_InstallPackage java-1.6.0-openjdk + t_Log "Running $0 - Installing packages, this takes around 2-3 mins" + t_InstallPackage ipa-server bind-dyndb-ldap libsss_sudo +else + echo "Skipped on CentOS 5 and AArch64" +fi + + diff --git a/tests/p_ipa-server/2-configure_freeipa.sh b/tests/p_ipa-server/2-configure_freeipa.sh new file mode 100644 index 0000000..0cea899 --- /dev/null +++ b/tests/p_ipa-server/2-configure_freeipa.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') && !(t_GetArch | grep -qE 'aarch64') + then + + t_Log "Running $0 - setting hostname of system" + eth_int=$(ip addr|grep -B 1 "link/ether"|head -n 1|awk '{print $2}'|tr -d ':') + eth_ip=$(ip -4 addr show dev $eth_int | awk '$0 ~ /scope global/ {print $2}' | cut -d'/' -f 1) + if [ "$centos_ver" = "7" ] ; then + hostnamectl set-hostname c6test.c6ipa.local + else + hostname c6test.c6ipa.local + fi + + echo $eth_ip $(hostname) >> /etc/hosts + hostname | grep "c6test.c6ipa.local" &> /dev/null + t_CheckExitStatus $? + + + t_Log "Running $0 - Configuring IPA server - this can take some time" + + ipa-server-install -U --hostname=c6test.c6ipa.local --ip-address=$eth_ip -r C6IPA.LOCAL -n c6ipa.local -p p455w0rd -a p455w0rd --ssh-trust-dns --setup-dns --forwarder=$(awk '$0 ~ /nameserver/ {print $2}' /etc/resolv.conf | head -n 1) + + t_CheckExitStatus $? + + t_Log "Running $0 - Enabling mkhomedir" + authconfig --enablemkhomedir --enablesssd --update + t_CheckExitStatus $? + + if /sbin/service sssd status | grep 'is stopped' &> /dev/null + then + /sbin/service sssd start &> /dev/null + fi + +else + echo "Skipped on CentOS 5 and AArch64" +fi + diff --git a/tests/p_ipa-server/3-verify_kerberos_tickets.sh b/tests/p_ipa-server/3-verify_kerberos_tickets.sh new file mode 100644 index 0000000..7f361ec --- /dev/null +++ b/tests/p_ipa-server/3-verify_kerberos_tickets.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') && !(t_GetArch | grep -qE 'aarch64') +then + +# kinit cannot take password from stdin so use expect + +t_InstallPackage expect + +t_Log "Running $0 - testing host kerberos principal" +klist -k /etc/krb5.keytab | grep "host/c6test.c6ipa.local" &> /dev/null + +t_CheckExitStatus $? + +t_Log "Running $0 - testing admin user kerberos principal" + +kdestroy &> /dev/null + +klist 2>&1 | grep -E "(No credentials|Credentials cache .* not found)" &> /dev/null + +t_CheckExitStatus $? + +expect -f - < /dev/null + +t_CheckExitStatus $? + +else + echo "Skipped on CentOS 5 and AArch64" +fi + diff --git a/tests/p_ipa-server/4-adduser.sh b/tests/p_ipa-server/4-adduser.sh new file mode 100644 index 0000000..72c3f91 --- /dev/null +++ b/tests/p_ipa-server/4-adduser.sh @@ -0,0 +1,102 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') && !(t_GetArch | grep -qE 'aarch64') +then + +# Need admin credentials +kdestroy &> /dev/null + +klist 2>&1 | grep -E "(No credentials|Credentials cache .* not found)" &> /dev/null + +t_CheckExitStatus $? + +expect -f - < /dev/null + +t_CheckExitStatus $? + + + +t_Log "Running $0 - test adding user" +userdetails="$(ipa user-add --first=test --last=user --random ipatestuser)" +echo "$userdetails" | grep 'Added user "ipatestuser"' &> /dev/null + +t_CheckExitStatus $? + +t_Log "Running $0 - verify details of user" + +echo "$userdetails" | grep ' First name: test' &> /dev/null + +t_CheckExitStatus $? + +echo "$userdetails" | grep 'Last name: user' &> /dev/null + +t_CheckExitStatus $? + +echo "$userdetails" | grep 'Full name: test user' &> /dev/null + +t_CheckExitStatus $? + +echo "$userdetails" | grep 'Home directory: /home/ipatestuser' &> /dev/null + +t_CheckExitStatus $? + +t_Log "Running $0 - testing initial password change of user" +kdestroy &> /dev/null + +expect -f - < /dev/null + +t_CheckExitStatus $? + +kdestroy &> /dev/null + + +t_Log "Running $0 - testing ipatestuser is in getent" +getent passwd ipatestuser &> /dev/null +t_CheckExitStatus $? + +else + echo "Skipped on CentOS 5 and AArch64" +fi + + diff --git a/tests/p_ipa-server/5-addservice.sh b/tests/p_ipa-server/5-addservice.sh new file mode 100644 index 0000000..2d918b5 --- /dev/null +++ b/tests/p_ipa-server/5-addservice.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') && !(t_GetArch | grep -qE 'aarch64') +then + +# Need admin credentials +kdestroy &> /dev/null + +klist 2>&1 | grep -E "(No credentials|Credentials cache .* not found)" &> /dev/null + +t_CheckExitStatus $? + +expect -f - < /dev/null + +t_CheckExitStatus $? + + +t_Log "Running $0 - Adding test service" +ipa service-add testservice/c6test.c6ipa.local &> /dev/null + +t_CheckExitStatus $? + +t_Log "Running $0 - getting keytab for service" +ipa-getkeytab -s c6test.c6ipa.local -p testservice/c6test.c6ipa.local -k /tmp/testservice.keytab &> /dev/null +t_CheckExitStatus $? + +t_Log "Running $0 - getting certificate for service" +ipa-getcert request -K testservice/c6test.c6ipa.local -D c6test.c6ipa.local -f /etc/pki/tls/certs/testservice.crt -k /etc/pki/tls/private/testservice.key &> /dev/null +t_CheckExitStatus $? + +while true +do +entry="$(ipa-getcert list -r | sed -n '/Request ID/,/auto-renew: yes/p')" +if [[ $entry =~ "status:" ]] && [[ $entry =~ "CA_REJECTED" ]] +then +t_CheckExitStatus 1 +break +fi +if [[ $entry =~ "" ]] +then +t_CheckExitStatus 0 +break +fi +sleep 1 +done + +#avoiding race condition of certmonger getting the certificates and writing them but not actually on disk yet +while ! stat /etc/pki/tls/certs/testservice.crt &> /dev/null +do +sync +sleep 1 +done + +t_Log "Running $0 - verifying keytab" +klist -k /tmp/testservice.keytab | grep "testservice/c6test.c6ipa.local" &> /dev/null +t_CheckExitStatus $? + +t_Log "Running $0 - verifying key matches certificate" +diff <(openssl x509 -in /etc/pki/tls/certs/testservice.crt -noout -modulus 2>&1 ) <(openssl rsa -in /etc/pki/tls/private/testservice.key -noout -modulus 2>&1 ) +t_CheckExitStatus $? + +t_Log "Running $0 - verifying certificate against CA" +openssl verify -CAfile /etc/ipa/ca.crt /etc/pki/tls/certs/testservice.crt | grep "/etc/pki/tls/certs/testservice.crt: OK" &> /dev/null +t_CheckExitStatus $? + +else + echo "Skipped on CentOS 5 and AArch64" +fi + + diff --git a/tests/p_ipa-server/6-dnsdetails.sh b/tests/p_ipa-server/6-dnsdetails.sh new file mode 100644 index 0000000..0bb4ba4 --- /dev/null +++ b/tests/p_ipa-server/6-dnsdetails.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') && !(t_GetArch | grep -qE 'aarch64') +then + +# Need admin credentials +kdestroy &> /dev/null + +klist 2>&1 | grep -E "(No credentials|Credentials cache .* not found)" &> /dev/null + +t_CheckExitStatus $? + +expect -f - < /dev/null + +t_CheckExitStatus $? + +#There's an element of asynchronous behaviour we've seen here +#Sleeping after the IPA commands to give time for changes to +#happen and named to notice through the bind-dyndb-ldap backend + +#Add zone +t_Log "Running $0 - Adding a subdomain 'testzone'" +ipa dnszone-add --name-server=c6test.c6ipa.local. --admin-email=hostmaster.testzone.c6ipa.local. testzone.c6ipa.local &> /dev/null +t_CheckExitStatus $? +sleep 5 + +#Can get SOA for new zone from DNS +t_Log "Running $0 - Can retrieve SOA for 'testzone'" +dig @localhost -t SOA testzone.c6ipa.local | grep "status: NOERROR" &> /dev/null +t_CheckExitStatus $? + +#Add record to standard zone +t_Log "Running $0 - Adding a testrecord to main domain" +ipa dnsrecord-add c6ipa.local testrecord --cname-hostname=c6test &> /dev/null +t_CheckExitStatus $? +sleep 5 + +#Can get record from DNS +t_Log "Running $0 - Testing can retrieve record" +dig @localhost -t CNAME testrecord.c6ipa.local | grep "status: NOERROR" &> /dev/null +t_CheckExitStatus $? + +#Add record to new zone +t_Log "Running $0 - Adding a testrecord to subdomain" +ipa dnsrecord-add testzone.c6ipa.local testrecord --cname-hostname=c6test.c6ipa.local. &> /dev/null +t_CheckExitStatus $? +sleep 5 + +#Can get record from DNS for new zone +t_Log "Running $0 - Testing can retrieve record from subdomain" +dig @localhost -t CNAME testrecord.testzone.c6ipa.local | grep "status: NOERROR" &> /dev/null +t_CheckExitStatus $? + +#Configure global options instead of named.conf for forwarders - note this is looking for an ipv4 adddress ... there is no testing on ipv6 at this point +t_Log "Running $0 - Changing configuration to use LDAP for forwarder configuration" +forwarder="$(sed -n '1,/forwarders/!{ /};/,/forwarders/!s/^//p;}' /etc/named.conf | sed 's/^[ \t]*\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\);$/\1/')" +sed -i '/forwarders/{N ; s/\n.*// }' /etc/named.conf +service named restart +t_CheckExitStatus $? +ipa dnsconfig-mod --forwarder=${forwarder} &> /dev/null +t_CheckExitStatus $? + +t_Log "Running $0 - Regression test of RHBA-2103-0739" +for i in {1..30} +do +service named reload &> /dev/null +service named status | grep running &> /dev/null || t_CheckExitStatus $? +sleep 1 +done + +else + echo "Skipped on CentOS 5 and AArch64" +fi + diff --git a/tests/p_ipa-server/7-addsudo.sh b/tests/p_ipa-server/7-addsudo.sh new file mode 100644 index 0000000..5ab8c18 --- /dev/null +++ b/tests/p_ipa-server/7-addsudo.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') && !(t_GetArch | grep -qE 'aarch64') +then + +# Need admin credentials +kdestroy &> /dev/null + +klist 2>&1 | grep -E "(No credentials|Credentials cache .* not found)" &> /dev/null + +t_CheckExitStatus $? + +expect -f - < /dev/null + +t_CheckExitStatus $? + +t_Log "Running $0 - test adding sudo command" +ipa sudorule-add test_rule --desc="Test rule in ipa testing" --hostcat=all --cmdcat=all --runasusercat=all --runasgroupcat=all &> /dev/null +t_CheckExitStatus $? +ipa sudorule-add-user test_rule --users="ipatestuser" &> /dev/null +t_CheckExitStatus $? + +t_Log "Running $0 - verifying sudo command is in freeipa" +sudodetails="$(ipa sudorule-show test_rule)" +echo "$sudodetails" | grep 'Rule name: test_rule' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'Description: Test rule in ipa testing' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'Enabled: TRUE' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'Host category: all' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'Command category: all' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'RunAs User category: all' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'RunAs Group category: all' &> /dev/null +t_CheckExitStatus $? +echo "$sudodetails" | grep 'Users: ipatestuser' &> /dev/null +t_CheckExitStatus $? + +t_Log "Running $0 - clearing the sssd cache" +/sbin/service sssd stop &> /dev/null +rm -rf /var/lib/sss/db/* +/sbin/service sssd start &> /dev/null +/sbin/service sssd status | grep 'running' &> /dev/null +t_CheckExitStatus $? + +## Leaving a little time to settle as there seems to be a slight race condition to go right away +sleep 10 + +t_Log "Running $0 - test sudo works" +expect -f - &> /tmp/sudotestoutput.ipa-test < /dev/null +t_CheckExitStatus $? +grep 'ALL) ALL' /tmp/sudotestoutput.ipa-test &> /dev/null +t_CheckExitStatus $? + +else + echo "Skipped on CentOS 5 and AArch64" +fi + diff --git a/tests/p_ipa-server/99-postclean.sh b/tests/p_ipa-server/99-postclean.sh new file mode 100644 index 0000000..3277479 --- /dev/null +++ b/tests/p_ipa-server/99-postclean.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Author: James Hogarth +# + +if (t_GetPkgRel basesystem | grep -qE 'el(6|7)') && !(t_GetArch | grep -qE 'aarch64') + then + if (t_GetPkgRel basesystem | grep -qE 'el(6)') + then + CP=/bin/cp + fi + if (t_GetPkgRel basesystem | grep -qE 'el(7)') + then + CP=/usr/bin/cp + fi + + t_Log "Running $0 - Restoring up resolv.conf" + ${CP} /tmp/resolv.conf.ipa-tests /etc/resolv.conf + + t_Log "Running $0 - Restoring nsswitch.conf" + ${CP} /tmp/nsswitch.conf.ipa-tests /etc/nsswitch.conf + + t_Log "Running $0 - Restoring hosts file" + ${CP} /tmp/hosts.ipa-tests /etc/hosts + + if [[ -f /tmp/ntp.conf.ipa-tests ]] + then + t_Log "Running $0 - Restoring ntp.conf file" + ${CP} /tmp/ntp.conf.ipa-tests /etc/ntp.conf + fi + + t_Log "Running $0 - Rolling back to yum history id - this will take some time" + /usr/bin/yum -y history rollback $(cat /tmp/yum-rollback-id.ipa-tests) &> /dev/null + + t_Log "Running $0 - Restoring ssh_config" + ${CP} /etc/ssh/ssh_config.ipa-tests /etc/ssh/ssh_config + + + rm -f /tmp/*.ipa-test /etc/httpd/conf.d/* + + if [ "$centos_ver" = "7" ] ; then + hostnamectl set-hostname $(cat /tmp/hostname.ipa-tests) + else + hostname $(cat /tmp/hostname.ipa-tests) + fi + +else + echo "Skipped on CentOS 5 and AArch64" +fi + diff --git a/tests/p_iptables/00_install_service.sh b/tests/p_iptables/00_install_service.sh new file mode 100644 index 0000000..38833df --- /dev/null +++ b/tests/p_iptables/00_install_service.sh @@ -0,0 +1,3 @@ +t_InstallPackage iptables-services +systemctl start iptables +systemctl enable iptables diff --git a/tests/p_iptables/iptables_add-remove_test.sh b/tests/p_iptables/iptables_add-remove_test.sh new file mode 100755 index 0000000..04e1aeb --- /dev/null +++ b/tests/p_iptables/iptables_add-remove_test.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - verify iptables can insert and delete rules" + +if [ "$centos_ver" -ge "7" ];then + t_Log "CentOS $centos_ver uses firewalld and not iptables -> SKIP" + t_CheckExitStatus 0 + exit 0 +fi + + +ACL='INPUT -s 1.2.3.4/32 -d 5.6.7.8/32 -p tcp -m tcp --dport 22 -j ACCEPT' +FILE=/var/tmp/iptables_acl + +# verify we are starting with default firewall +/etc/init.d/iptables restart > /dev/null + +iptables -I ${ACL} +iptables-save > ${FILE} + +# The ACL should be exactly at line 6 after "OUTPUT ACCEPT" +head -6 ${FILE} |tail -1 | grep -q "${ACL}" +add=$? + +# removing ACL again +iptables -D ${ACL} +iptables-save > ${FILE} + +# ACL should not be found +grep -cq "${ACL}" ${FILE} +del=$? + +if [ $add==0 ] && [ $del==1 ] + then + ret_val=0 +fi + +t_CheckExitStatus $ret_val + +# Cleaning up +/bin/rm ${FILE} diff --git a/tests/p_iptables/iptables_default_rules.sh b/tests/p_iptables/iptables_default_rules.sh new file mode 100755 index 0000000..25b6b7d --- /dev/null +++ b/tests/p_iptables/iptables_default_rules.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "Running $0 - check iptables default rules" + +if [ "$centos_ver" -ge 7 ];then + t_Log "CentOS $centos_ver uses firewalld and not iptables -> SKIP" + t_CheckExitStatus 0 + exit 0 +fi + +if [ $SKIP_QA_HARNESS -eq 1 ]; then + echo "Skip, No standard firewall config ..." +else + +(grep "state --state ESTABLISHED,RELATED -j ACCEPT" /etc/sysconfig/iptables > /dev/null 2>&1 ) && \ + +(grep "state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT" /etc/sysconfig/iptables > /dev/null 2>&1 ) && \ + +(grep "REJECT --reject-with icmp-host-prohibited" /etc/sysconfig/iptables > /dev/null 2>&1 ) + +fi + +t_CheckExitStatus $? + diff --git a/tests/p_iptables/iptables_function-check_test.sh b/tests/p_iptables/iptables_function-check_test.sh new file mode 100755 index 0000000..731ea91 --- /dev/null +++ b/tests/p_iptables/iptables_function-check_test.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# Author: Christoph Galuschka +# Athmane Madjoudj + +t_Log "Running $0 - iptables functional check - deny ping on loopback" + +if [ "$centos_ver" -ge 7 ];then + t_Log "CentOS $centos_ver uses firewalld and not iptables -> SKIP" + t_CheckExitStatus 0 + exit 0 +fi + + +ACL='INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -p icmp -m icmp -j REJECT' +COUNT='4' +DEADTIME='1' + +# ensure we have the default iptables-setting +#/etc/init.d/iptables restart > /dev/null +service iptables restart + +# Verify it worked previously +ping -q -c $COUNT -i 0.25 127.0.0.1 |grep -qc "${COUNT} received" + +if [ $? == 1 ] + then + t_Log "ping to loopback failed prior to test, this should not happen" + t_CheckExitStatus 1 +fi + +# Applying ACL +iptables -I ${ACL} + +ping -q -c $COUNT -i 0.25 -w $DEADTIME 127.0.0.1 > /dev/null 2>&1 +if [ $? == 1 ] + then + t_Log "iptables REJECT works fine" + ret_val=0 +else + ret_val=1 +fi + +# cleanup +service iptables restart +#/etc/init.d/iptables restart > /dev/null + +t_CheckExitStatus $ret_val + diff --git a/tests/p_iptables/iptables_kmod_loaded.sh b/tests/p_iptables/iptables_kmod_loaded.sh new file mode 100755 index 0000000..07cbf07 --- /dev/null +++ b/tests/p_iptables/iptables_kmod_loaded.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "Running $0 - check if iptables kernel modules are loaded" + +if [ "$centos_ver" -ge 7 ];then + t_Log "CentOS $centos_ver uses firewalld and not iptables -> SKIP" + t_CheckExitStatus 0 + exit 0 +fi + +lsmod | grep "ip_tables" > /dev/null 2>&1 + +t_CheckExitStatus $? + diff --git a/tests/p_iptraf/0-install_iptraf.sh b/tests/p_iptraf/0-install_iptraf.sh new file mode 100755 index 0000000..2dc5418 --- /dev/null +++ b/tests/p_iptraf/0-install_iptraf.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +t_Log "Running $0 - iptraf: install iptraf and which" + +# IPTraf traffic monitoring package +t_InstallPackage iptraf + +# Required by the test +t_InstallPackage which diff --git a/tests/p_iptraf/5-test_iptraf.sh b/tests/p_iptraf/5-test_iptraf.sh new file mode 100755 index 0000000..f3f8228 --- /dev/null +++ b/tests/p_iptraf/5-test_iptraf.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +t_Log "Running $0 - checking iptraf runs and returns non-zero exit status." + +TMP=/tmp/iptraf.log + +# clean up after ourselves +trap "[ -e ${TMP} ] && { /bin/rm ${TMP}; }" EXIT + +# iptraf only be run by root +[ ${EUID} -eq 0 ] || { t_Log "Not running as root, skipping this test. Non-fatal."; exit $PASS; } + +if [ "$centos_ver" -ge 7 ] ; then + IPTRAF=`which iptraf-ng` +else + IPTRAF=`which iptraf` +fi +PING=`which ping` +STAT=`which stat` +KILL=`which kill` + +[ "$IPTRAF" ] || { t_Log "Failed to find iptraf binary. That ain't good..."; exit $FAIL; } +[ "$PING" ] || { t_Log "Failed to find the ping binary. That ain't good..."; exit $FAIL; } +[ "$STAT" ] || { t_Log "Failed to find the stat binary. That ain't good..."; exit $FAIL; } +[ "$KILL" ] || { t_Log "Failed to find the kill binary. That ain't good..."; exit $FAIL; } + +# start iptraf running in the background on all interfaces, logging to a file. +${IPTRAF} -i all -t 1 -B -L ${TMP} &>/dev/null + +# give iptraf something to chew on +${PING} -c 5 127.0.0.1 &>/dev/null + +# check the our log file actually has some data in it, which it should, given that we just pinged ourselves... +LOGSIZE=`stat -c '%s' ${TMP}` + +# kill iptraf +${KILL} -USR2 `pidof $IPTRAF` + +# confirm our iptraf log file has something in it +if [ ${LOGSIZE} -gt 0 ] ; then + t_CheckExitStatus 0 +else + t_Log "iptraf failed to log any traffic?!. That ain't good..." + t_CheckExitStatus 1 +fi + diff --git a/tests/p_iputils/0-install_iputils.sh b/tests/p_iputils/0-install_iputils.sh new file mode 100644 index 0000000..c5ff56d --- /dev/null +++ b/tests/p_iputils/0-install_iputils.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - installing package iputils" +t_InstallPackage iputils + diff --git a/tests/p_iputils/tracepath_test.sh b/tests/p_iputils/tracepath_test.sh new file mode 100644 index 0000000..bc4f1c5 --- /dev/null +++ b/tests/p_iputils/tracepath_test.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# Author: Christoph Galuschka + +TEST=tracepath + +# Testing availability of network +if [ $SKIP_QA_HARNESS -eq 1 ]; then + HOST="www.centos.org" +else + HOST="www.centos.org" +fi + +t_Log "Running $0 - running ${TEST} to ${HOST}" + +IP=$(dig +short ${HOST} A ${HOST} AAAA) +FILE=/var/tmp/tracepath_result +ret_val=1 +# getting IP-address of default gateway as a fall back +defgw=$(ip route list | grep default | cut -d' ' -f3) + +if [[ ! -z "$IP" ]] +then + tracepath -n ${HOST} > ${FILE} + COUNT=$(echo "$IP" | grep -cf - ${FILE}) + TTL=$(grep -c 'Too many hops' ${FILE}) + GW=$(grep -c ${defgw} ${FILE}) + if ([ $COUNT = 1 ] || [ $COUNT = 2 ]) + then + t_Log "${TEST} reached ${HOST}" + ret_val=0 + elif ([ $COUNT = 0 ] && [ $TTL = 1 ]) + then + t_Log "${TEST} didn't reach ${HOST} because of too many hops. This is treated as SUCCESS." + ret_val=0 + elif ([ $COUNT = 0 ] && [ $GW -gt 0 ]) + then + t_Log "${TEST} didn't reach ${HOST} (maybe because of ACLs on the network), but at least the Default Gateway ${defgw} was reached. Treating as SUCCESS." + ret_val=0 + else + t_Log "${TEST} didn't return anything we expect - FAILING" + ret_val=1 + fi +fi + +/bin/rm ${FILE} +t_CheckExitStatus $ret_val diff --git a/tests/p_java-1.6.0-openjdk/0-install-openjdk.sh b/tests/p_java-1.6.0-openjdk/0-install-openjdk.sh new file mode 100755 index 0000000..38dfb35 --- /dev/null +++ b/tests/p_java-1.6.0-openjdk/0-install-openjdk.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: Christoph Galuschka + +# Install java +if [ $centos_ver -ge 8 ]; then + echo "Package not included in CentOS $centos_ver, skipping" + exit 0 +fi +if (t_GetArch | grep -qE 'aarch64|ppc64le') + then + echo "Package not included for current arch, skipping" + exit 0 +fi + +t_Log "Running $0 - installing openjdk runtime/development environment." + +t_InstallPackage java-1.6.0-openjdk java-1.6.0-openjdk-devel diff --git a/tests/p_java-1.6.0-openjdk/10-test_java.sh b/tests/p_java-1.6.0-openjdk/10-test_java.sh new file mode 100755 index 0000000..93d6264 --- /dev/null +++ b/tests/p_java-1.6.0-openjdk/10-test_java.sh @@ -0,0 +1,51 @@ +#!/bin/sh +# Author: Christoph Galuschka + +if [ $centos_ver -ge 8 ]; then + echo "Package not included in CentOS $centos_ver, skipping" + exit 0 +fi +if (t_GetArch | grep -qE 'aarch64|ppc64le') + then + echo "Package not included for current arch, skipping" + exit 0 +fi + +t_Log "Running $0 - javac can compile and java can print 'hello centos'" + +# selecting the right alternative +t_Select_Alternative java jre-1.6.0-openjdk +t_Select_Alternative javac java-1.6.0-openjdk + +# creating source file +PATH2FILE='/var/tmp/' +FILE='HelloWorld' +FILE2=$PATH2FILE$FILE.java + +cat > $FILE2 < +# Based on java-1.6.0-openjdk test from Christoph Galuschka + +. $(dirname "$0")/p_java-openjdk-common + +t_Log "Running $0 - installing openjdk runtime/development environment." + +for i in $JAVA_VERSIONS;do + t_InstallPackage java-$i-openjdk java-$i-openjdk-devel +done diff --git a/tests/p_java-openjdk/10-test_java.sh b/tests/p_java-openjdk/10-test_java.sh new file mode 100755 index 0000000..010014e --- /dev/null +++ b/tests/p_java-openjdk/10-test_java.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Author: Pablo Greco +# Based on java-1.6.0-openjdk test from Christoph Galuschka + +. $(dirname "$0")/p_java-openjdk-common + +for i in $JAVA_VERSIONS;do +t_Log "Running $0 - javac can compile and java can print 'hello centos'" + +# selecting the right alternative +t_Select_Alternative java "(jre|java)-$i-openjdk" +t_Select_Alternative javac "java-$i-openjdk" + +# creating source file +PATH2FILE='/var/tmp/' +FILE='HelloWorld' +FILE2=$PATH2FILE$FILE.java + +cat > $FILE2 < +# Based on java-1.6.0-openjdk test from Christoph Galuschka + +[ ${centos_ver} -lt 7 ] && { t_Log "Multiple java versions test is only available since el7, skipping tests..." ; exit ; } + +if [ ${centos_ver} -eq 8 ];then +JAVA_VERSIONS="1.8.0 11" +elif [ ${centos_ver} -eq 9 ];then +JAVA_VERSIONS="1.8.0 11 17" +else +JAVA_VERSIONS="1.7.0 1.8.0 11" + +if (t_GetArch | grep -qvE 'aarch64|ppc64le') + then + JAVA_VERSIONS="1.6.0 $JAVA_VERSIONS" +fi +fi + +[ -z "${JAVA_VERSIONS}" ] && { t_Log "No java versions to test, skipping tests..." ; exit ; } diff --git a/tests/p_jwhois/0-install_jwhois.sh b/tests/p_jwhois/0-install_jwhois.sh new file mode 100755 index 0000000..5f5b3fa --- /dev/null +++ b/tests/p_jwhois/0-install_jwhois.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +# nc (netcat) is required for the test + +if [ "$centos_ver" -ge 8 ] ;then + t_Log "No whois package for CentOS $centos_ver -> SKIP" + t_CheckExitStatus 0 + exit 0 +elif [ "$centos_ver" = "7" ] ;then + whois_pkg="whois" +else + whois_pkg="jwhois" +fi + +t_InstallPackage $whois_pkg nc + diff --git a/tests/p_jwhois/jwhois_test.sh b/tests/p_jwhois/jwhois_test.sh new file mode 100755 index 0000000..097328e --- /dev/null +++ b/tests/p_jwhois/jwhois_test.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +if [ "$centos_ver" -ge 8 ] ;then + exit 0 +fi +t_Log "Running $0 - check that jwhois can connect to whois server and get the info." + +# Dummy whois server +echo 'tf_jwhois_test_response' | nc -l 43 & +sleep 1 + +whois -h 127.0.0.1 domain.tld | grep -q 'tf_jwhois_test_response' + +t_CheckExitStatus $? diff --git a/tests/p_kernel/01_kernel_centos_keyring.sh b/tests/p_kernel/01_kernel_centos_keyring.sh new file mode 100644 index 0000000..5065099 --- /dev/null +++ b/tests/p_kernel/01_kernel_centos_keyring.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Note: This was a known issue with CentOS 6.0 GA kernel + +t_Log "Running $0 - check CentOS' Kernel Module GPG key." + +uname_arch=$(uname -m) +uname_kernel=$(uname -r) +uname_kernel=${uname_kernel:0:6} + + +if [ "$uname_arch" == "aarch64" ] || [ "$uname_arch" == "armv7l" ] || [ "$uname_arch" == "i686" ]; then + t_Log "*** Not testing on Arch: $uname_arch ***" + exit 0 +fi + +if [ "$centos_ver" -ge 7 ] ; then + if [ "$centos_ver" -eq 7 ];then + if [ "$uname_arch" == "ppc64le" -a "$uname_kernel" == "4.18.0" ];then + # power9 with c8 kernel + ring=.builtin_trusted_keys + else + ring=.system_keyring + fi + else + ring=.builtin_trusted_keys + fi + for id in kpatch "Driver update" kernel + do + t_Log "Verifying x.509 CentOS ${id}" + keyctl list %:$ring | grep -i "CentOS \(Linux \)\?${id} signing key" > /dev/null 2>&1 + t_CheckExitStatus $? + done +else + grep 'User ID: CentOS (Kernel Module GPG key)' /var/log/dmesg > /dev/null 2>&1 + t_CheckExitStatus $? +fi + diff --git a/tests/p_kernel/02_kernel_secureboot_signed.sh b/tests/p_kernel/02_kernel_secureboot_signed.sh new file mode 100755 index 0000000..69b1f71 --- /dev/null +++ b/tests/p_kernel/02_kernel_secureboot_signed.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# This test will verify that grub2-efi is correctly signed with correct cert in the CA chain + +t_Log "Running $0 - Verifying that kernel is correctly signed with correct cert" + +if [[ "$centos_ver" -ge 7 && "$arch" = "x86_64" ]] ; then + t_InstallPackage pesign + for kernel in $(rpm -q kernel --queryformat '%{version}-%{release}.%{arch}\n') + do + t_Log "Validating kernel $kernel ..." + if [[ "$centos_ver" -eq 8 ]] ; then + key_ver="201" + elif [[ "$centos_ver" -eq 9 ]] ; then + key_ver="201" + fi + if [[ "$centos_ver" -ge 8 && "$kernel" > "4.18.0-480.el8" ]] ; then + pesign --show-signature --in /boot/vmlinuz-${kernel}|egrep -q "Red Hat Inc.|CentOS Secure Boot Signing $key_ver" + else + pesign --show-signature --in /boot/vmlinuz-${kernel}|egrep -q 'Red Hat Inc.|CentOS Secure Boot \(key 1\)' + fi + t_CheckExitStatus $? + done +else + t_Log "previous versions than CentOS 7 - or not x86_64 -aren't using secureboot ... skipping" + exit 0 +fi + diff --git a/tests/p_kvdo/0-install_kvdo.sh b/tests/p_kvdo/0-install_kvdo.sh new file mode 100755 index 0000000..61b14f8 --- /dev/null +++ b/tests/p_kvdo/0-install_kvdo.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +if [ "$centos_ver" -ne "8" ]; then + t_Log "non c8 => SKIPPING" + exit 0 +fi + +t_Log "Running $0 - installing beakerlib" +t_InstallPackage git make patch +pushd /tmp +git clone https://github.com/beakerlib/beakerlib +cd beakerlib +make +make install +popd diff --git a/tests/p_kvdo/kvdo_runtest.sh b/tests/p_kvdo/kvdo_runtest.sh new file mode 100755 index 0000000..57b785e --- /dev/null +++ b/tests/p_kvdo/kvdo_runtest.sh @@ -0,0 +1,217 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of VDO smoke test +# Description: Check that VDO is able to read/write data and start/stop +# Author: Andy Walsh +# Vendored into sig-core-t_functional by Adam Saleh +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# only run on centos 8 for now +if [ "$centos_ver" -ne "8" ]; then + t_Log "non c8 => SKIPPING" + exit 0 +fi + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +arch=$(uname -m) + +function insertModuleWithDMesgOutput() { + moduleName=$1 + + modulePath=$(rpm -ql kmod-kvdo | grep "${1}.ko$") + + exitVal=0 + rlRun "dmesg -c > /dev/null" + rlRun "insmod ${modulePath}" || exitVal=255 + rlRun "dmesg" + + if [ ${exitVal} -ne 0 ]; then + rlDie "Exiting with failure due to module/kernel incompatibility" + fi +} + +# Check whether we received URLs (via environment variables), and if not, let +# the system just use the enabled repositories to install the packages. +if [ -z ${kvdo_version} ] || [ -z ${kvdo_release} ]; then + kvdo_pkg=kmod-kvdo +else + kvdo_pkg=${brew_base_url}/kmod-kvdo/${kvdo_version}/${kvdo_release}/${arch}/kmod-kvdo-${kvdo_version}-${kvdo_release}.${arch}.rpm +fi + +if [ -z ${vdo_version} ] || [ -z ${vdo_release} ]; then + vdo_pkg=vdo +else + vdo_pkg=${brew_base_url}/vdo/${vdo_version}/${vdo_release}/${arch}/vdo-${vdo_version}-${vdo_release}.${arch}.rpm +fi + +rlJournalStart + +rlPhaseStartSetup "Create backing device" + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlRun "df ." + + # If we end up with less than 10G of available space, then we can't + # create a VDO volume sufficient for testing. We should bail out as a + # result. + loopbackSize=$(($(df --sync --output=avail / | tail -1) * 1024 - 1024*1024*1024)) + if [ ${loopbackSize} -lt $((1024*1024*1024*10)) ]; then + rlDie "Not enough space to create loopback device." + fi + rlRun "truncate -s ${loopbackSize} $TmpDir/loop0.bin" 0 "Laying out loopfile backing" + rlRun "losetup /dev/loop0 $TmpDir/loop0.bin" 0 "Creating loopdevice" + rlRun "mkdir -p /mnt/testmount" 0 "Creating test mountpoint dir" +rlPhaseEnd + +rlPhaseStartSetup "Install software" + if ! rlCheckRpm kmod-kvdo + then + rlRun "yum install -y ${kvdo_pkg}" 0 "Installing kmod-kvdo" || rlDie "Unable to install 'kmod-kvdo' package" + rlAssertRpm kmod-kvdo + fi + if ! rlCheckRpm vdo + then + rlRun "yum install -y ${vdo_pkg}" 0 "Installing vdo" || rlDie "Unable to install 'vdo' package" + rlAssertRpm vdo + fi +rlPhaseEnd + +rlPhaseStartTest "Gather Relevant Info" + # Gather some system information for debug purposes + rlRun "uname -a" + rlRun "find /lib/modules -name kvdo.ko" + rlRun "modinfo uds" || insertModuleWithDMesgOutput uds + rlRun "modinfo kvdo" || insertModuleWithDMesgOutput kvdo +rlPhaseEnd + +rlPhaseStartTest "Generate Test Data" + # Write some data, check statistics + rlRun "dd if=/dev/urandom of=${TmpDir}/urandom_fill_file bs=1M count=100" + rlRun "ls -lh ${TmpDir}/urandom_fill_file" +rlPhaseEnd + +for partition_type in "raw" "lvm" "part" +do + case $partition_type in + "raw"*) + backing_device=/dev/loop0 + ;; + "lvm"*) + rlPhaseStartTest "Create LVM backing device" + rlRun "pvcreate /dev/loop0" 0 "Creating PV" + rlRun "vgcreate vdo_base /dev/loop0" 0 "Creating VG" + rlRun "lvcreate -n vdo_base -l100%FREE vdo_base" 0 "Creating LV" + rlPhaseEnd + backing_device=/dev/vdo_base/vdo_base + ;; + "part"*) + rlPhaseStartTest "Create partitioned backing device" + rlRun "parted -s /dev/loop0 mklabel msdos" 0 "Creating label" + rlRun 'parted -s /dev/loop0 mkpart primary "" 1M -- -1M' 0 "Creating partition" + rlPhaseEnd + backing_device=/dev/loop0p1 + ;; + *) + ;; + esac + + rlPhaseStartTest "Smoke Test" + # Create the VDO volume and get the initial statistics + rlRun "vdo create --name=vdo1 --device=${backing_device} --verbose" 0 "Creating VDO volume vdo1" + rlRun "vdostats vdo1" + + # Create a filesystem and mount the device, check statistics + rlRun "mkfs.xfs -K /dev/mapper/vdo1" 0 "Making xfs filesystem on VDO volume" + rlRun "mount -o discard /dev/mapper/vdo1 /mnt/testmount" 0 "Mounting xfs filesystem on VDO volume" + rlRun "df --sync /mnt/testmount" + rlRun "vdostats vdo1" + + # Copy the test data onto VDO volume 4 times to get some deduplication + for i in {1..4} + do + rlRun "cp ${TmpDir}/urandom_fill_file /mnt/testmount/test_file-${i}" + done + rlRun "df --sync /mnt/testmount" + rlRun "vdostats vdo1" + + # Verify the data + for i in {1..4} + do + rlRun "cmp ${TmpDir}/urandom_fill_file /mnt/testmount/test_file-${i}" + done + + # Unmount and stop the volume, check statistics + rlRun "umount /mnt/testmount" 0 "Unmounting testmount" + rlRun "vdostats vdo1" + rlRun "vdo stop --name=vdo1 --verbose" 0 "Stopping VDO volume vdo1" + + # Start the VDO volume, mount it, check statistics, verify data. + rlRun "vdo start --name=vdo1 --verbose" 0 "Starting VDO volume vdo1" + rlRun "mount -o discard /dev/mapper/vdo1 /mnt/testmount" 0 "Mounting xfs filesystem on VDO volume" + + rlRun "df --sync /mnt/testmount" + rlRun "vdostats vdo1" + + # Verify the data + for i in {1..4} + do + rlRun "cmp ${TmpDir}/urandom_fill_file /mnt/testmount/test_file-${i}" + done + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "umount /mnt/testmount" 0 "Unmounting testmount" + rlRun "vdo remove --name=vdo1 --verbose" 0 "Removing VDO volume vdo1" + case $partition_type in + "lvm"*) + rlPhaseStartCleanup + rlRun "lvremove -ff ${backing_device}" 0 "Removing LV" + rlRun "vgremove vdo_base" 0 "Removing VG" + rlRun "pvremove /dev/loop0" 0 "Removing PV" + rlPhaseEnd + ;; + "part"*) + rlPhaseStartCleanup + rlRun "parted -s /dev/loop0 rm 1" 0 "Removing partition" + rlPhaseEnd + ;; + *) + ;; + esac + + rlRun "dd if=/dev/zero of=/dev/loop0 bs=1M count=10 oflag=direct" 0 "Wiping Block Device" + + rlPhaseEnd +done + +rlPhaseStartCleanup + rlRun "losetup -d /dev/loop0" 0 "Deleting loopdevice" + rlRun "rm -f $TmpDir/loop0.bin" 0 "Removing loopfile backing" + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" +rlPhaseEnd + +rlJournalPrintText +rlJournalEnd diff --git a/tests/p_lftp/0_install_lftp.sh b/tests/p_lftp/0_install_lftp.sh new file mode 100755 index 0000000..724e4bf --- /dev/null +++ b/tests/p_lftp/0_install_lftp.sh @@ -0,0 +1,7 @@ +# Author: Piyush Kumar +# Author: Munish Kumar +# Author: Ayush Gupta +# Author: Konark Modi + +t_Log "Running $0 -installing lftp." +t_InstallPackage lftp diff --git a/tests/p_lftp/10_lftp_http_test.sh b/tests/p_lftp/10_lftp_http_test.sh new file mode 100755 index 0000000..a049895 --- /dev/null +++ b/tests/p_lftp/10_lftp_http_test.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Author: Piyush Kumar +# Author: Munish Kumar +# Author: Ayush Gupta +# Author: Konark Modi +# Christoph Galuschka + +t_Log "Running $0 - lftp: HTTP test" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +if [ $SKIP_QA_HARNESS -eq 1 ]; then + URL="http://mirror.centos.org/" +else + URL="http://repo.centos.qa/srv/CentOS/" +fi + +CHECK_FOR="UTC" +FILE="timestamp.txt" + +t_Log "Querying ${URL}${FILE}" + +lftp < +# Author: Munish Kumar +# Author: Ayush Gupta +# Author: Konark Modi +# Christoph Galuschka + +t_Log "Running $0 - installing vsFTPd for local lftp test." +t_InstallPackage vsftpd + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +if [ "$centos_ver" -ge 8 ] ; then +cp -fp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.tf_p_lftp +sed -i 's/anonymous_enable=NO/anonymous_enable=YES/g' /etc/vsftpd/vsftpd.conf +fi +t_ServiceControl vsftpd restart +if [ "$centos_ver" -ge 8 ] ; then +mv -f /etc/vsftpd/vsftpd.conf.tf_p_lftp /etc/vsftpd/vsftpd.conf +fi + +# Destination File +TESTFILE=/tmp/t_functional-lftp-test.txt + +# Source File on FTP server +SOURCE=/var/ftp/ +FILE=lftp-test.txt +cat > $SOURCE$FILE << EOF +t_functional +EOF +URL="ftp://127.0.0.1/" + +t_Log "Running $0 - lftp test with local FTP server." + +lftp -e 'set net:timeout 10; get '${FILE}' -o '$TESTFILE' ; bye' $URL > /dev/null 2>&1 +if [ -f $TESTFILE ] + then + grep -q 't_functional' $TESTFILE + ret_val=$? + else + t_Log "FTP test for lftp failed" + ret_val=$? +fi + +# clean up +rm -f $TESTFILE +rm -f $SOURCE$FILE +t_ServiceControl vsftpd stop + +t_CheckExitStatus $ret_val diff --git a/tests/p_libbpf-tools/0_install_libbpf-tools.sh b/tests/p_libbpf-tools/0_install_libbpf-tools.sh new file mode 100755 index 0000000..cdcc57a --- /dev/null +++ b/tests/p_libbpf-tools/0_install_libbpf-tools.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + +t_Log "Running $0 -installing libbpf-tools." +if [ "$centos_ver" -ge 9 ] ; then + t_InstallPackage libbpf-tools +else + t_Log "Skip on less than EL9" +fi diff --git a/tests/p_libbpf-tools/libbpf-tools_tests.sh b/tests/p_libbpf-tools/libbpf-tools_tests.sh new file mode 100644 index 0000000..a5862d6 --- /dev/null +++ b/tests/p_libbpf-tools/libbpf-tools_tests.sh @@ -0,0 +1,138 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + +t_Log "Running $0 - libbpf tools" + +if [[ "$centos_ver" -le 8 ]]; then + t_Log "Running $0 in EL8 or less -> SKIP" + exit 0 +fi + +version_tests=( +"bpf-bindsnoop -V" +"bpf-biolatency -V" +"bpf-biopattern -V" +"bpf-biosnoop -V" +"bpf-biostacks -V" +"bpf-biotop -V" +"bpf-bitesize -V" +"bpf-btrfsdist -V" +"bpf-btrfsslower -V" +"bpf-cachestat -V" +"bpf-capable -V" +"bpf-cpudist -V" +"bpf-cpufreq -V" +"bpf-drsnoop -V" +"bpf-execsnoop -V" +"bpf-exitsnoop -V" +"bpf-ext4dist -V" +"bpf-ext4slower -V" +"bpf-filelife -V" +"bpf-filetop -V" +"bpf-fsdist -V" +"bpf-fsslower -V" +"bpf-funclatency -V" +"bpf-gethostlatency -V" +"bpf-hardirqs -V" +"bpf-javagc -V" +"bpf-killsnoop -V" +"bpf-klockstat -V" +"bpf-ksnoop -V" +"bpf-llcstat -V" +"bpf-mdflush -V" +"bpf-mountsnoop -V" +"bpf-nfsdist -V" +"bpf-nfsslower -V" +"bpf-numamove -V" +"bpf-offcputime -V" +"bpf-oomkill -V" +"bpf-opensnoop -V" +"bpf-readahead -V" +"bpf-runqlat -V" +"bpf-runqlen -V" +"bpf-runqslower -V" +"bpf-sigsnoop -V" +"bpf-slabratetop -V" +"bpf-softirqs -V" +"bpf-solisten -V" +"bpf-statsnoop -V" +"bpf-syscount -V" +"bpf-tcpconnect -V" +"bpf-tcpconnlat -V" +"bpf-tcplife -V" +"bpf-tcprtt -V" +"bpf-tcpstates -V" +"bpf-tcpsynbl -V" +"bpf-tcptop -V" +"bpf-tcptracer -V" +"bpf-vfsstat -V" +"bpf-wakeuptime -V" +"bpf-xfsdist -V" +"bpf-xfsslower -V" +) + +tracing_tests=( +"bpf-biolatency 1 1" +"bpf-biopattern 1 1" +# IGNORE, CURRENTLY BROKEN: "bpf-biosnoop 1", see https://bugzilla.redhat.com/show_bug.cgi?id=2219196 +"bpf-biostacks 1" +"bpf-biotop 1 1" +"bpf-bitesize 1 1" +"bpf-cachestat 1 1" +"bpf-cpudist 1 1" +# IGNORE, CURRENTLY BROKEN: "bpf-cpufreq -d 1", see https://github.com/iovisor/bcc/issues/4651 +"bpf-drsnoop -d 1" +"bpf-filetop 1 1" +"bpf-fsdist -t $(df -T $(pwd) | tail -1 | awk '{print $2}') 1 1" +"bpf-fsslower -t $(df -T $(pwd) | tail -1 | awk '{print $2}') -d 1" +"bpf-funclatency -i 1 -d 1 vfs_read" +"bpf-hardirqs 1 1" +"bpf-klockstat -d 1" +"bpf-llcstat 1" +"bpf-offcputime 1" +# IGNORE, CURRENTLY BROKEN: "bpf-opensnoop -d 1", see https://bugzilla.redhat.com/show_bug.cgi?id=2219192 +# IGNORE, CURRENTLY BROKEN: "bpf-readahead -d 1", see https://bugzilla.redhat.com/show_bug.cgi?id=2219193 +"bpf-runqlat 1 1" +"bpf-runqlen 1 1" +"bpf-slabratetop 1 1" +"bpf-softirqs 1 1" +"bpf-syscount -d 1 -T 1" +"bpf-tcprtt -d 1 -i 1" +"bpf-tcpsynbl 1 1" +"bpf-tcptop 1 1" +"bpf-vfsstat 1 1" +"bpf-wakeuptime 1" +) + +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + +one_failed=0 + +for cmd in "${version_tests[@]}"; do + t_Log "Running $0 - libbpf-tools test: ${cmd}" + if ! eval "${cmd}" > ${output_file} 2>&1; then + t_Log "FAIL: $0: libbpf-tools test: ${cmd}" + cat ${output_file} + one_failed=1 + else + t_Log "PASS: $0: libbpf-tools test: ${cmd}" + fi +done + +for cmd in "${tracing_tests[@]}"; do + t_Log "Running $0 - libbpf-tools test: ${cmd}" + if ! eval "${cmd}" > ${output_file} 2>&1; then + t_Log "FAIL: $0: libbpf-tools test: ${cmd}" + cat ${output_file} + one_failed=1 + else + t_Log "PASS: $0: libbpf-tools test: ${cmd}" + fi +done + +if [[ "${one_failed}" == "1" ]]; then + t_Log "FAIL: $0: At least one test failed, see logs above" +fi + +exit ${one_failed} diff --git a/tests/p_libbpf/0_install_libbpf.sh b/tests/p_libbpf/0_install_libbpf.sh new file mode 100755 index 0000000..9a90d31 --- /dev/null +++ b/tests/p_libbpf/0_install_libbpf.sh @@ -0,0 +1,12 @@ +# Author: Piyush Kumar +# Author: Munish Kumar +# Author: Ayush Gupta +# Author: Konark Modi + +t_Log "Running $0 -installing libbpf and bcc-tools." +if [ "$centos_ver" -ge 8 ] ; then + t_InstallPackage libbpf + t_InstallPackage bcc-tools +else + t_Log "Skip on less than EL8" +fi diff --git a/tests/p_libbpf/10_test_bcc_tools.sh b/tests/p_libbpf/10_test_bcc_tools.sh new file mode 100755 index 0000000..7344029 --- /dev/null +++ b/tests/p_libbpf/10_test_bcc_tools.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Author: Piyush Kumar +# Author: Munish Kumar +# Author: Ayush Gupta +# Author: Konark Modi +# Christoph Galuschka + + +t_Log "Running $0 - bcc-tools: argdist test" + +if [ -z "$CONTAINERTEST" ] && [ "$centos_ver" -ge 8 ]; then + /usr/share/bcc/tools/argdist -i 1 -n 5 -C 'p:c:umask(u32 mask):u32:mask' +else + t_Log "Running in container -> SKIP" + exit 0 +fi diff --git a/tests/p_libvirt/0-install_libvirt.sh b/tests/p_libvirt/0-install_libvirt.sh new file mode 100755 index 0000000..7ef9db4 --- /dev/null +++ b/tests/p_libvirt/0-install_libvirt.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +if (t_GetArch | grep -qE 'aarch64') + then + echo "Package not included with AArch64, skipping" + exit 0 +fi + +t_Log "Running $0 - installing libvirt" +t_InstallPackage libvirt +service libvirtd restart diff --git a/tests/p_libvirt/libvirt_virsh_test.sh b/tests/p_libvirt/libvirt_virsh_test.sh new file mode 100755 index 0000000..c9541dc --- /dev/null +++ b/tests/p_libvirt/libvirt_virsh_test.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +if (t_GetArch | grep -qE 'aarch64') + then + echo "Package not included with AArch64, skipping" + exit 0 +fi + +t_Log "Running $0 - libvirt: Virsh can talk to local hypervisor." + +virsh -c test:///default list > /dev/null + +t_CheckExitStatus $? diff --git a/tests/p_libxml2-python/0-install-libxml2-python.sh b/tests/p_libxml2-python/0-install-libxml2-python.sh new file mode 100755 index 0000000..c0a67af --- /dev/null +++ b/tests/p_libxml2-python/0-install-libxml2-python.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author Dries Verachtert + +# Install libxml2-python +t_Log "Running $0 - installing libxml2-python." + +if [ "$centos_ver" -ge 8 ] ; then +t_InstallPackage python3 python3-libxml2 +else +t_InstallPackage libxml2-python +fi diff --git a/tests/p_libxml2-python/1-test-XmlTextReader.sh b/tests/p_libxml2-python/1-test-XmlTextReader.sh new file mode 100755 index 0000000..d040b17 --- /dev/null +++ b/tests/p_libxml2-python/1-test-XmlTextReader.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Author: Dries Verachtert + +t_Log "Running $0 - test XmlTextReader of libxml2-python" + +if [ "$centos_ver" -ge 8 ] ; then +PYTHON=python3 +else +PYTHON=python +fi + +cat << 'EOF' | $PYTHON - | grep -q 'test succeeded' +import libxml2 +import sys +try: + from StringIO import StringIO +except ImportError: + from io import StringIO + +# Load a small xml structure +xmlStr = StringIO(""" +val1val2""") +xmlBuf = libxml2.inputBuffer(xmlStr) +xmlReader = xmlBuf.newTextReader("reader") + +def checkRead(reader, name, isEmptyElementVal, nodeTypeVal, hasAttributesVal): + retval = reader.Read() + if retval != 1: + print("Error: bad retval when reading " + name) + sys.exit(1) + if reader.Name() != name: + print("Error: expected=" + name + ", actual=" + reader.Name()) + sys.exit(1) + if reader.NodeType() != nodeTypeVal: + print("Error: node " + name + " has wrong nodetype: " + str(reader.NodeType())) + sys.exit(1) + if reader.IsEmptyElement() != isEmptyElementVal: + print("Error: node " + name + " has wrong isEmptyElement: " + str(reader.IsEmptyElement())) + sys.exit(1) + if reader.HasAttributes() != hasAttributesVal: + print("Error: node " + name + " has wrong hasAttributes: " + str(reader.HasAttributes())) + sys.exit(1) + +# Test one by one each part of the loaded xml structure +checkRead(xmlReader, "tests", 0, 1, 0) # 1 = start of element +checkRead(xmlReader, "test", 0, 1, 1) +checkRead(xmlReader, "key1", 0, 1, 0) +checkRead(xmlReader, "#text", 0, 3, 0) # 3 = text node +checkRead(xmlReader, "key1", 0, 15, 0) # 15 = close tag +checkRead(xmlReader, "key2", 0, 1, 0) +checkRead(xmlReader, "#text", 0, 3, 0) +checkRead(xmlReader, "key2", 0, 15, 0) +checkRead(xmlReader, "key3", 1, 1, 0) +checkRead(xmlReader, "test", 0, 15, 1) +checkRead(xmlReader, "tests", 0, 15, 0) +print ("test succeeded") +EOF diff --git a/tests/p_logrotate/0-install_logrotate.sh b/tests/p_logrotate/0-install_logrotate.sh new file mode 100755 index 0000000..271a10b --- /dev/null +++ b/tests/p_logrotate/0-install_logrotate.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "Running $0 - Installing logrotate" +t_InstallPackage logrotate + diff --git a/tests/p_logrotate/logrotate_test.sh b/tests/p_logrotate/logrotate_test.sh new file mode 100755 index 0000000..9e0e92c --- /dev/null +++ b/tests/p_logrotate/logrotate_test.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - logrotate: is happy with all configs" + +/usr/sbin/logrotate /etc/logrotate.conf + +t_CheckExitStatus $? diff --git a/tests/p_logwatch/0-install_logwatch.sh b/tests/p_logwatch/0-install_logwatch.sh new file mode 100755 index 0000000..7fa7223 --- /dev/null +++ b/tests/p_logwatch/0-install_logwatch.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "$0 - Installing logwatch" +t_InstallPackage logwatch + diff --git a/tests/p_logwatch/logwatch_test.sh b/tests/p_logwatch/logwatch_test.sh new file mode 100755 index 0000000..8370ea0 --- /dev/null +++ b/tests/p_logwatch/logwatch_test.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - logwatch test." + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +if [ "$centos_ver" -ge 7 ] ; then + lw_options="--range Today" +else + lw_options="--range Today --print" +fi + +logwatch ${lw_options}| grep -q 'Logwatch End' + +t_CheckExitStatus $? diff --git a/tests/p_lsb/0-install_redhat-lsb.sh b/tests/p_lsb/0-install_redhat-lsb.sh new file mode 100755 index 0000000..6e1bf50 --- /dev/null +++ b/tests/p_lsb/0-install_redhat-lsb.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Author: Athmane Madjoudj + + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. redhat-lsb not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + + +t_Log "$0 - Installing redhat-lsb" +t_InstallPackage redhat-lsb diff --git a/tests/p_lsb/lsb_release_brand_test.sh b/tests/p_lsb/lsb_release_brand_test.sh new file mode 100755 index 0000000..d5a4d08 --- /dev/null +++ b/tests/p_lsb/lsb_release_brand_test.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. redhat-lsb not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_Log "Running $0 - LSB CentOS branding check." + +lsb_release -i | grep -q "CentOS" && \ +lsb_release -d | grep -q "CentOS" + +t_CheckExitStatus $? diff --git a/tests/p_lsof/0-install_lsof.sh b/tests/p_lsof/0-install_lsof.sh new file mode 100755 index 0000000..b49d3ab --- /dev/null +++ b/tests/p_lsof/0-install_lsof.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Madhurranjan Mohaan + +t_Log "Running $0 - installing lsof" + +# Install lsof +t_InstallPackage lsof diff --git a/tests/p_lsof/10-test_lsof.sh b/tests/p_lsof/10-test_lsof.sh new file mode 100755 index 0000000..c6dc5cc --- /dev/null +++ b/tests/p_lsof/10-test_lsof.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Author: Madhurranjan Mohaan + +t_Log "Running $0 - testing lsof against ssh port" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +sshd_status=`service sshd status | grep running` +if ! [ "$sshd_status" ] +then + service sshd start +fi +t_InstallPackage openssh-server openssh-clients +t_ServiceControl sshd start + +sshd_port_listening=`lsof -i:22 | grep LISTEN` +if [ "$sshd_port_listening" ] +then + t_Log "Ssh port 22 is in the listening mode" + ret_val=0 +else + ret_val=1 +fi +t_CheckExitStatus $ret_val diff --git a/tests/p_lynx/0-install_lynx.sh b/tests/p_lynx/0-install_lynx.sh new file mode 100755 index 0000000..5abad2f --- /dev/null +++ b/tests/p_lynx/0-install_lynx.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "$0 - installing Lynx" + +if [ "$centos_ver" -ge "8" ]; then + t_Log "Package lynx not available in default repos on c8 => SKIP" + exit 0 +fi + +t_InstallPackage lynx + diff --git a/tests/p_lynx/lynx_default_page_centos_test.sh b/tests/p_lynx/lynx_default_page_centos_test.sh new file mode 100755 index 0000000..18be902 --- /dev/null +++ b/tests/p_lynx/lynx_default_page_centos_test.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - check that lynx default page is CentOS welcome page ." + +if [ "$centos_ver" -ge "8" ]; then + t_Log "Package lynx not available in default repos on c8 => SKIP" + exit 0 +fi + + +lynx -dump | grep "Welcome to CentOS" >/dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_lynx/lynx_dump_page_test.sh b/tests/p_lynx/lynx_dump_page_test.sh new file mode 100755 index 0000000..97f02c4 --- /dev/null +++ b/tests/p_lynx/lynx_dump_page_test.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - check that lynx can dump remote page." + +if [ "$centos_ver" -ge "8" ]; then + t_Log "Package lynx not available in default repos on c8 => SKIP" + exit 0 +fi + + +if [ "$SKIP_QA_HARNESS" = "1" ] ; then + URL="http://mirror.centos.org/" + CHECK_FOR="timestamp" +else + URL="http://repo.centos.qa/qa/" + CHECK_FOR="ks_cfg" +fi + +lynx -dump ${URL} | grep "${CHECK_FOR}" >/dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_lzop/0-install_lzop.sh b/tests/p_lzop/0-install_lzop.sh new file mode 100755 index 0000000..d9b6e02 --- /dev/null +++ b/tests/p_lzop/0-install_lzop.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Author: Vivek Dubey +# Akshay Karle +# Christoph Galuschka + +t_Log "Running $0 - installing lzop" + +if [ $centos_ver = 5 ] + then + t_Log "This is a C5 system. Skipping." +elif [ $(t_GetArch) = i686 ] + then + t_Log "Package not available in i386 architecture. Skipping" +else + t_InstallPackage lzop +fi diff --git a/tests/p_lzop/lzop_test.sh b/tests/p_lzop/lzop_test.sh new file mode 100755 index 0000000..e68173a --- /dev/null +++ b/tests/p_lzop/lzop_test.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# Author: Vivek Dubey +# Akshay Karle +# Christoph Galuschka + +t_Log "Running $0 - testing lzop compression and decompression" + +if [ $centos_ver = 5 ] + then + t_Log "This is a C5 system. Skipping." + ret_val=0 +elif [ $(t_GetArch) = i686 ] + then + t_Log "Package not available in i386 architecture. Skipping" + ret_val=0 +else + FILE1=/tmp/testfile.txt + FILE2=/tmp/testfile.lzo + + echo 'CentOS' > ${FILE1} + + # running compression + lzop -9 ${FILE1} -o ${FILE2} + /bin/rm ${FILE1} + + lzop -d ${FILE2} -o ${FILE1} + /bin/rm ${FILE2} + + #checking file content + grep -q 'CentOS' ${FILE1} + ret_val=$? + + #clean up + /bin/rm ${FILE1} +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_mailman/0-install_mailman.sh b/tests/p_mailman/0-install_mailman.sh new file mode 100755 index 0000000..71355e5 --- /dev/null +++ b/tests/p_mailman/0-install_mailman.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. mailman not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_Log "$0 - Installing mailman" +t_InstallPackage mailman + diff --git a/tests/p_mailman/mailman_test.sh b/tests/p_mailman/mailman_test.sh new file mode 100755 index 0000000..18eef26 --- /dev/null +++ b/tests/p_mailman/mailman_test.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. mailman not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_Log "Running $0 - mailman test." + +# Add mailman list +/usr/lib/mailman/bin/newlist -q mailman root@localhost.localdomain password > /dev/null 2>&1 + +# Restart httpd (started in other tests) and start mailman +t_ServiceControl httpd restart +t_ServiceControl mailman start + +curl -s http://localhost/mailman/listinfo | grep -q 'localhost Mailing Lists' +t_CheckExitStatus $? + +t_ServiceControl httpd stop +t_ServiceControl mailman stop diff --git a/tests/p_mdadm/0-install-mdadm.sh b/tests/p_mdadm/0-install-mdadm.sh new file mode 100755 index 0000000..6097db2 --- /dev/null +++ b/tests/p_mdadm/0-install-mdadm.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# mdadm controls Linux md devices (software RAID arrays) +t_InstallPackage mdadm diff --git a/tests/p_mdadm/5-test_mdadm.sh b/tests/p_mdadm/5-test_mdadm.sh new file mode 100755 index 0000000..ca3d5f8 --- /dev/null +++ b/tests/p_mdadm/5-test_mdadm.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +t_Log "Running $0 - checking mdadm utility works and returns non-zero exit status." + +# mdadm utility only available to root +[ ${EUID} -eq 0 ] || { t_Log "Not running as root, skipping this test. Non-fatal."; exit $PASS; } + +MDADM=`which mdadm` + +[ -z "${MDADM}" ] && { t_Log "Failed to find mdadm binary. That ain't good...."; exit $FAIL; } + +# even with no meta devices available, this should still return a 0 exit status +${MDADM} --detail --scan &>/dev/null + +[ $? -eq 0 ] || { t_Log "mdadm exited with non-zero status. That ain't good..."; exit $FAIL; } diff --git a/tests/p_mdadm/readme b/tests/p_mdadm/readme new file mode 100644 index 0000000..a50901c --- /dev/null +++ b/tests/p_mdadm/readme @@ -0,0 +1 @@ +we just need to make sure that the packages are sane, most of the mdadm testing is done in the role tests diff --git a/tests/p_minicom/0-install_minicom.sh b/tests/p_minicom/0-install_minicom.sh new file mode 100755 index 0000000..d8a6d90 --- /dev/null +++ b/tests/p_minicom/0-install_minicom.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Christoph Galuschka + +# Install minicom +t_InstallPackage minicom + + diff --git a/tests/p_minicom/minicom_test.sh b/tests/p_minicom/minicom_test.sh new file mode 100755 index 0000000..0ffd603 --- /dev/null +++ b/tests/p_minicom/minicom_test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Author: Christoph Galuschka + +t_Log "Running $0 - minicom binary load test." + +# FIXME: this test is very basic +minicom -h | grep -q "terminal program" + +t_CheckExitStatus $? diff --git a/tests/p_mod_python/0-install_mod_python.sh b/tests/p_mod_python/0-install_mod_python.sh new file mode 100755 index 0000000..3117d66 --- /dev/null +++ b/tests/p_mod_python/0-install_mod_python.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +if (t_GetPkgRel basesystem | grep -q el5) +then + t_InstallPackage mod_python + service httpd restart +else + echo "Skipped on CentOS 6" +fi + + diff --git a/tests/p_mod_python/mod_python_test.sh b/tests/p_mod_python/mod_python_test.sh new file mode 100755 index 0000000..c12bcd3 --- /dev/null +++ b/tests/p_mod_python/mod_python_test.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - Apache httpd mod_python is functional" +if (t_GetPkgRel basesystem | grep -q el5) +then + + +cat > /etc/httpd/conf.d/tf_mptest.conf < + AddHandler mod_python .py + PythonHandler mptest + PythonDebug On + +EOF + +mkdir -p /var/www/html/mptest/ + +cat > /var/www/html/mptest/mptest.py < + +t_Log "Running $0 - installing mod_wsgi" + +if [[ $centos_ver -lt 6 || $centos_ver -gt 7 ]]; then + t_Log "mod_wsgi not available before CentOS 6 or after CentOS 7 -> SKIP" + exit 0 +fi + +t_InstallPackage mod_wsgi diff --git a/tests/p_mod_wsgi/10-test_mod_wsgi.sh b/tests/p_mod_wsgi/10-test_mod_wsgi.sh new file mode 100755 index 0000000..f0c5c19 --- /dev/null +++ b/tests/p_mod_wsgi/10-test_mod_wsgi.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +t_Log "Running $0 - Apache httpd mod_wsgi is functional" + +if [[ $centos_ver -lt 6 || $centos_ver -gt 7 ]]; then + t_Log "mod_wsgi not available before CentOS 6 or after CentOS 7 -> SKIP" + exit 0 +fi + +cat > /etc/httpd/conf.d/tfapp.conf << EOF +WSGIScriptAlias /tfapp /var/www/html/tfapp.wsgi +EOF + +cat > /var/www/html/tfapp.wsgi << EOF +def application(environ, start_response): + status = '200 OK' + output = 't_functional_mod_wsgi_test'.encode() + response_headers = [ + ('Content-type', 'text/plain'), + ('Content-Length', str(len(output))) + ] + start_response(status, response_headers) + return [output] +EOF + +if [[ $centos_ver -ge 7 ]]; then + systemctl restart httpd +else + service httpd restart +fi + +curl -s http://localhost/tfapp | grep -q 't_functional_mod_wsgi_test' +t_CheckExitStatus $? + +if [[ $centos_ver -ge 7 ]]; then + systemctl stop httpd +else + service httpd stop +fi + +rm /etc/httpd/conf.d/tfapp.conf /var/www/html/tfapp.wsgi diff --git a/tests/p_mod_wsgi/20-remove_mod_wsgi.sh b/tests/p_mod_wsgi/20-remove_mod_wsgi.sh new file mode 100755 index 0000000..690b3ac --- /dev/null +++ b/tests/p_mod_wsgi/20-remove_mod_wsgi.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +t_Log "Running $0 - removing mod_wsgi" + +if [[ $centos_ver -lt 6 || $centos_ver -gt 7 ]]; then + t_Log "mod_wsgi not available before CentOS 6 or after CentOS 7 -> SKIP" + exit 0 +fi + +t_RemovePackage mod_wsgi diff --git a/tests/p_mtr/0-install_mtr.sh b/tests/p_mtr/0-install_mtr.sh new file mode 100644 index 0000000..b386c5e --- /dev/null +++ b/tests/p_mtr/0-install_mtr.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - installing package mtr" +t_InstallPackage mtr + diff --git a/tests/p_mtr/mtr_test.sh b/tests/p_mtr/mtr_test.sh new file mode 100644 index 0000000..bf6e3fa --- /dev/null +++ b/tests/p_mtr/mtr_test.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# Author: Christoph Galuschka + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +TEST=mtr + +# Testing availability of network +if [ $SKIP_QA_HARNESS -eq 1 ]; then + HOST="www.centos.org" +else + HOST="www.centos.org" +fi + +t_Log "Running $0 - running ${TEST} to ${HOST}" +ret_val=1 +FILE=/var/tmp/mtr_result + +IP=$(dig +short ${HOST} A ${HOST} AAAA) + +# getting IP-address of default gateway as a fall back +defgw=$(ip route list | grep default | cut -d' ' -f3) + +if [[ ! -z "$IP" ]] +then + mtr -nr -c1 ${HOST} > ${FILE} + COUNT=$(echo "$IP" | grep -cf - ${FILE}) + GW=$(grep -c ${defgw} ${FILE}) + if [ $COUNT = 1 ] + then + t_Log "${TEST} reached ${HOST}" + ret_val=0 + elif ([ $COUNT = 0 ] && [ $GW -gt 0 ]) + then + t_Log "${TEST} didn't reach ${HOST} (maybe because of ACLs on the network), but at least the Default Gateway ${defgw} was reached. Treating as SUCCESS." + ret_val=0 + else + t_Log "${TEST} didn't reach ${HOST}" + ret_val=1 + fi +fi + +/bin/rm ${FILE} +t_CheckExitStatus $ret_val diff --git a/tests/p_mysql/0-install_mysqld.sh b/tests/p_mysql/0-install_mysqld.sh new file mode 100755 index 0000000..1a5d1ba --- /dev/null +++ b/tests/p_mysql/0-install_mysqld.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - installing and starting mysql server." + +# MySQL +# starting with 5.10, we have to add mysql55 + +if [ "$centos_ver" -ge 7 ] ; then + my_packages="mariadb mariadb-server nc" + mysql_service="mariadb" +elif [ "$centos_ver" = "5" ] ;then + my_packages="mysql mysql-server nc mysql55-mysql-server" + mysql_service="mysqld" +else + my_packages="mysql mysql-server nc" + mysql_service="mysqld" +fi + +t_InstallPackage ${my_packages} + +t_ServiceControl ${mysql_service} start >/dev/null 2>&1 diff --git a/tests/p_mysql/10_mysqld_conn_test.sh b/tests/p_mysql/10_mysqld_conn_test.sh new file mode 100755 index 0000000..a30642d --- /dev/null +++ b/tests/p_mysql/10_mysqld_conn_test.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +t_Log "Running $0 - mysqld client can talk to mysql server." + + +HostName=$(hostname -s) +MySqlHostName=$(mysql -N -B -u root -e "show variables like 'hostname'" | cut -f 2 | cut -d . -f 1) +# printing both variables for debugging purposes +echo $HostName +echo ${MySqlHostName} +if [ "$HostName" = "${MySqlHostName}" ]; then + ret_val=0 +else + ret_val=1 +fi +t_CheckExitStatus $ret_val + +t_Log "Running $0 - mysqld listening test." +grep 'skip-networking' /etc/my.cnf > /dev/null +if [ $? -eq 1 ]; then + # FIXME: Test is very basic + >/dev/null 2>&1 >/dev/tcp/localhost/3306 + t_CheckExitStatus $? +else + t_Log "Skipped, looks like networking is disabled for mysql" +fi diff --git a/tests/p_mysql/15_mysqld_create_db.sh b/tests/p_mysql/15_mysqld_create_db.sh new file mode 100755 index 0000000..af32bda --- /dev/null +++ b/tests/p_mysql/15_mysqld_create_db.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - MySQL create database test" + +mysql -u root -e 'create database mysql_test' >/dev/null 2>&1 +t_CheckExitStatus $? diff --git a/tests/p_mysql/20_mysqld_drop_db.sh b/tests/p_mysql/20_mysqld_drop_db.sh new file mode 100755 index 0000000..a1cea19 --- /dev/null +++ b/tests/p_mysql/20_mysqld_drop_db.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - MySQL drop database test." + +mysql -u root -e 'drop database mysql_test' >/dev/null 2>&1 +t_CheckExitStatus $? diff --git a/tests/p_mysql/25_mysqld_grant_test.sh b/tests/p_mysql/25_mysqld_grant_test.sh new file mode 100755 index 0000000..da21c00 --- /dev/null +++ b/tests/p_mysql/25_mysqld_grant_test.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - MySQL GRANT privileges test" + +mysql -u root -e 'create database mysql_test;' > /dev/null 2>&1 +mysql -u root -e "grant all on mysql_test.* to mysql_test@localhost identified by 'mysqltest'" > /dev/null 2>&1 +mysql -u root -e "flush privileges;" > /dev/null 2>&1 +mysql -u mysql_test -pmysqltest mysql_test -e 'create table test_table(id int);' > /dev/null 2>&1 +ret_val=$? + +# Clean up +mysql -u root -e 'drop database mysql_test;' > /dev/null 2>&1 + +t_CheckExitStatus $ret_val diff --git a/tests/p_mysql/50_switch_to_mysql55.sh b/tests/p_mysql/50_switch_to_mysql55.sh new file mode 100755 index 0000000..aaf5634 --- /dev/null +++ b/tests/p_mysql/50_switch_to_mysql55.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - switching to mysql55 on C5." + +if [ $centos_ver = 5 ] +then + t_ServiceControl mysqld stop + t_ServiceControl mysql55-mysqld start >/dev/null 2>&1 +else + t_Log "This is not a C5 system - skipping" +fi diff --git a/tests/p_mysql/60_mysqld55_conn_test.sh b/tests/p_mysql/60_mysqld55_conn_test.sh new file mode 100755 index 0000000..7b98ade --- /dev/null +++ b/tests/p_mysql/60_mysqld55_conn_test.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +t_Log "Running $0 - mysqld client can talk to mysql55 server." + +if [ $centos_ver -gt 5 ] +then + t_Log 'mysql55 is only avialable on C5, skipping' + t_CheckExitStatus 0 + exit 0 +fi + +HostName=$(hostname -s) +MySqlHostName=$(mysql -N -B -u root -e "show variables like 'hostname'" | cut -f 2 | cut -d . -f 1) +if [ $HostName = ${MySqlHostName} ]; then + ret_val=0 +else + ret_val=1 +fi +t_CheckExitStatus $ret_val + +t_Log "Running $0 - mysqld listening test." +grep 'skip-networking' /etc/my.cnf > /dev/null +if [ $? -eq 1 ]; then + # FIXME: Test is very basic + nc -d -w 1 localhost 3306 >/dev/null 2>&1 + t_CheckExitStatus $? +else + t_Log "Skipped, looks like networking is disabled for mysql" +fi diff --git a/tests/p_mysql/65_mysqld55_create_db.sh b/tests/p_mysql/65_mysqld55_create_db.sh new file mode 100755 index 0000000..43b15bc --- /dev/null +++ b/tests/p_mysql/65_mysqld55_create_db.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - MySQL55 create database test" + +if [ $centos_ver -gt 5 ] +then + t_Log 'mysql55 is only supported on C5, skipping' + t_CheckExitStatus 0 + exit 0 +fi + +mysql -u root -e 'create database mysql_test' >/dev/null 2>&1 +t_CheckExitStatus $? diff --git a/tests/p_mysql/70_mysqld55_drop_db.sh b/tests/p_mysql/70_mysqld55_drop_db.sh new file mode 100755 index 0000000..177b907 --- /dev/null +++ b/tests/p_mysql/70_mysqld55_drop_db.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - MySQL55 drop database test." + +if [ $centos_ver -gt 5 ] +then + t_Log 'mysql55 is only supported on C5, skipping' + t_CheckExitStatus 0 + exit 0 +fi + +mysql -u root -e 'drop database mysql_test' >/dev/null 2>&1 +t_CheckExitStatus $? diff --git a/tests/p_mysql/75_mysqld55_grant_test.sh b/tests/p_mysql/75_mysqld55_grant_test.sh new file mode 100755 index 0000000..ff2cb94 --- /dev/null +++ b/tests/p_mysql/75_mysqld55_grant_test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - MySQL55 GRANT privileges test" + +if [ $centos_ver -gt 5 ] +then + t_Log 'mysql55 is only supported on C5, skipping' + t_CheckExitStatus 0 + exit 0 +fi + +mysql -u root -e 'create database mysql_test;' > /dev/null 2>&1 +mysql -u root -e "grant all on mysql_test.* to mysql_test@localhost identified by 'mysqltest'" > /dev/null 2>&1 +mysql -u root -e "flush privileges;" > /dev/null 2>&1 +mysql -u mysql_test -pmysqltest mysql_test -e 'create table test_table(id int);' > /dev/null 2>&1 +ret_val=$? + +# Clean up +mysql -u root -e 'drop database mysql_test;' > /dev/null 2>&1 + +t_CheckExitStatus $ret_val diff --git a/tests/p_net-snmp/0-install_snmpd.sh b/tests/p_net-snmp/0-install_snmpd.sh new file mode 100755 index 0000000..413c167 --- /dev/null +++ b/tests/p_net-snmp/0-install_snmpd.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - attempting to install net-snmp, net-snmp-utils" + +# Install net-snmp and net-snmp-utils +t_InstallPackage net-snmp net-snmp-utils + +# start daemon with default settings +t_ServiceControl snmpd start + diff --git a/tests/p_net-snmp/snmpv1_test.sh b/tests/p_net-snmp/snmpv1_test.sh new file mode 100755 index 0000000..8c9bbfb --- /dev/null +++ b/tests/p_net-snmp/snmpv1_test.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Snmpwal failing. Fix later. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + + +t_Log "Running $0 - snmpv1 test" + +snmpwalk -v 1 -c public 127.0.0.1 > /dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_net-snmp/snmpv2c_test.sh b/tests/p_net-snmp/snmpv2c_test.sh new file mode 100755 index 0000000..ff61830 --- /dev/null +++ b/tests/p_net-snmp/snmpv2c_test.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Author: Christoph Galuschka + + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Snmpwal failing. Fix later. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_Log "Running $0 - snmpv2c test" + +snmpwalk -v 2c -c public 127.0.0.1 > /dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_net-snmp/snmpv3_test.sh b/tests/p_net-snmp/snmpv3_test.sh new file mode 100755 index 0000000..16efe25 --- /dev/null +++ b/tests/p_net-snmp/snmpv3_test.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Author: Christoph Galuschka + + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Snmpwal failing. Fix later. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_Log "Running $0 - snmpv3 test" + +# Make Backup of snmpd.conf and add V3-settings +/bin/cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig +echo 'rouser centosro' >> /etc/snmp/snmpd.conf +echo 'createUser centosro MD5 centosro DES centosro' >> /etc/snmp/snmpd.conf + +# Restart Service +service snmpd restart + +#Run test +snmpget -v 3 -u centosro -n "" -l authPriv -a MD5 -A centosro -x DES -X centosro 127.0.0.1 sysUpTime.0 > /dev/null 2>&1 +ret_val=$? + +# Restore settings +/bin/cp /etc/snmp/snmpd.conf.orig /etc/snmp/snmpd.conf +service snmpd restart + +t_CheckExitStatus $ret_val diff --git a/tests/p_network/network_device_test.sh b/tests/p_network/network_device_test.sh new file mode 100755 index 0000000..ef7369c --- /dev/null +++ b/tests/p_network/network_device_test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - Check if a least one network device is available." + +ifconfig | grep -q ether + +export eth_int=$(ip addr|grep -B 1 "link/ether"|head -n 1|awk '{print $2}'|tr -d ':') + +t_CheckExitStatus $? diff --git a/tests/p_network/networking_enabled_test.sh b/tests/p_network/networking_enabled_test.sh new file mode 100755 index 0000000..7524fd4 --- /dev/null +++ b/tests/p_network/networking_enabled_test.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - Check if networking is enabled." + +if [ "$centos_ver" -ge 7 ] ; then + t_Log "CentOS $centos_ver -> SKIP" + exit 0 +else + grep -Eqi "NETWORKING=.*yes" /etc/sysconfig/network + t_CheckExitStatus $? +fi diff --git a/tests/p_network/networking_vlan_test.sh b/tests/p_network/networking_vlan_test.sh new file mode 100755 index 0000000..6f0fe1c --- /dev/null +++ b/tests/p_network/networking_vlan_test.sh @@ -0,0 +1,65 @@ +#!/bin/sh +# Author: Christoph Galuschka + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +t_Log "Running $0 - create VLAN IF, assign IP on VLAN IF and tear down VLAN IF using IP command test (not on C5)" +ret_val=0 + +if [ $centos_ver -lt 6 ] +then + t_Log ' This is a C5 system, skipping test' + exit 0 +fi + +t_Log 'This is no C5-system, commencing test' + +export eth_int=$(ip addr|grep -B 1 "link/ether"|head -n 1|awk '{print $2}'|tr -d ':') + +# create VLAN-IF 10 on ethernet device +ip link add dev ${eth_int}.10 link ${eth_int} type vlan id 10 +ip addr list | grep -q ${eth_int}.10 +if [ $? == 1 ] + then + t_Log "VLAN-IF creation failed" + ret_val=1 +else + t_Log "VLAN-IF successfully created" +fi + +#assign IP address on VLAN-IF +ip address add 172.16.30.1/32 dev ${eth_int}.10 +ip addr list | grep -q 172.16.30.1 +if [ $? == 1 ] + then + t_Log "IP address assignment on ${eth_int}.10 failed" + ret_val=1 +else + t_Log "IP address successfully assigned on ${eth_int}.10" +fi + +#testing address with ping +ping -c 4 -q 172.16.30.1 | grep -q '4 received' +if [ $? == 1 ] + then + t_Log "pinging on ${eth_int}.10 failed" + ret_val=1 +else + t_Log "local ping on VLAN IF worked" +fi + +# delete VLAN-IF 10 on ethernet interface +ip link delete ${eth_int}.10 +ip addr list | grep -q ${eth_int}.10 +if [ $? == 0 ] + then + t_Log "Removing VLAN IF failed" + ret_val=1 +else + t_Log "Removing of VLAN IF worked" +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_nfs/0-install_nfs.sh b/tests/p_nfs/0-install_nfs.sh new file mode 100755 index 0000000..091f42c --- /dev/null +++ b/tests/p_nfs/0-install_nfs.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +# NFS +t_InstallPackage nfs-utils + +if [ "$centos_ver" = "5" ] ; then + t_serviceControl portmap restart +else + t_ServiceControl rpcbind restart +fi + +if [ "$centos_ver" -ge 8 ] ; then +t_ServiceControl nfs-server start +else +# Restart because usualy NFS is enabled by default on CentOS-5 +t_ServiceControl nfs restart +fi diff --git a/tests/p_nfs/nfs_share_rw.sh b/tests/p_nfs/nfs_share_rw.sh new file mode 100755 index 0000000..c9fb535 --- /dev/null +++ b/tests/p_nfs/nfs_share_rw.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - NFS writable share test." + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +cp /etc/exports /etc/exports.orig +echo '/srv/nfs *(rw,sync,no_root_squash)' >/etc/exports +mkdir -p /srv/nfs +exportfs -ar + +# Fix SELinux boolean +setsebool allow_nfsd_anon_write 1 + +# Mount the share +mkdir /mnt/nfs +mount -t nfs 127.0.0.1:/srv/nfs /mnt/nfs || exit 1 +echo 'NFS test file' > /mnt/nfs/test.txt + +# Test twice +(cat /mnt/nfs/test.txt | grep 'NFS test file' > /dev/null 2>&1) && \ +(cat /srv/nfs/test.txt | grep 'NFS test file' > /dev/null 2>&1) +ret_val=$? + +# Clean up +umount /mnt/nfs +/bin/rm -fr /mnt/nfs +mv /etc/exports.orig /etc/exports + +t_CheckExitStatus $ret_val diff --git a/tests/p_nmap/0_install_nmap.sh b/tests/p_nmap/0_install_nmap.sh new file mode 100755 index 0000000..4782b77 --- /dev/null +++ b/tests/p_nmap/0_install_nmap.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - install package nmap" +t_InstallPackage nmap + diff --git a/tests/p_nmap/nmap_test_eth0.sh b/tests/p_nmap/nmap_test_eth0.sh new file mode 100755 index 0000000..74c01a0 --- /dev/null +++ b/tests/p_nmap/nmap_test_eth0.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - nmap querys eth0 and checks for open ssh-port" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +# Grabing IP of eth0 +IP=$(ip -f inet addr list eth0 | grep 'inet ') +regex='.*inet\ (.*)\/.*' +if [[ $IP =~ $regex ]] + then + t_Log "Found eth0 IP - starting nmap test" + nmap ${BASH_REMATCH[1]} | grep -iq ssh +fi + +t_CheckExitStatus $? diff --git a/tests/p_nmap/nmap_test_lo.sh b/tests/p_nmap/nmap_test_lo.sh new file mode 100755 index 0000000..6e8de22 --- /dev/null +++ b/tests/p_nmap/nmap_test_lo.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Author: Christoph Galuschka + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +t_Log "Running $0 - nmap querys loopback and checks for open ssh port" + +nmap 127.0.0.1 | grep -qi ssh + +t_CheckExitStatus $? diff --git a/tests/p_ntp/0-install_ntp.sh b/tests/p_ntp/0-install_ntp.sh new file mode 100755 index 0000000..6e92183 --- /dev/null +++ b/tests/p_ntp/0-install_ntp.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) + +if [ "$centos_ver" -ge 8 ] ; then + t_Log "no ntp in CentOS $centos_ver ... SKIP" + exit 0 +fi +# NTPd +t_InstallPackage ntp diff --git a/tests/p_ntp/5-start-check.sh b/tests/p_ntp/5-start-check.sh new file mode 100755 index 0000000..f64083d --- /dev/null +++ b/tests/p_ntp/5-start-check.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) + +if [ "$centos_ver" -ge 8 ] ; then + exit 0 +fi +# Start NTPd services and confirm it's running. +t_ServiceControl ntpd start + +NTPD_PID=$(pidof ntpd) + +[ "$NTPD_PID" ] || { t_Log "FAIL: couldn't find 'ntpd' in the process list."; exit $FAIL; } diff --git a/tests/p_ntp/ntp_centos_servers.sh b/tests/p_ntp/ntp_centos_servers.sh new file mode 100755 index 0000000..8ccb248 --- /dev/null +++ b/tests/p_ntp/ntp_centos_servers.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Ref.: http://bugs.centos.org/view.php?id=4943 + +if [ "$centos_ver" -ge 8 ] ; then + exit 0 +fi +t_Log "Running $0 - NTP is using CentOS server pool test." + +grep ".centos.pool.ntp.org" /etc/ntp.conf > /dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_openssh/0-install_sshd.sh b/tests/p_openssh/0-install_sshd.sh new file mode 100755 index 0000000..31079dd --- /dev/null +++ b/tests/p_openssh/0-install_sshd.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +# expect is needed by the test +t_InstallPackage openssh-server openssh-clients expect +t_ServiceControl sshd start diff --git a/tests/p_openssh/_helper_sshd_user_login-with-key.expect b/tests/p_openssh/_helper_sshd_user_login-with-key.expect new file mode 100755 index 0000000..7e01d18 --- /dev/null +++ b/tests/p_openssh/_helper_sshd_user_login-with-key.expect @@ -0,0 +1,7 @@ +#!/usr/bin/expect -f +# Author: Athmane Madjoudj + +set timeout 2 +spawn ssh -o StrictHostKeyChecking=no sshtest@localhost /bin/cat ssh_test_file +send -- "\r" +expect eof diff --git a/tests/p_openssh/_helper_sshd_user_login.expect b/tests/p_openssh/_helper_sshd_user_login.expect new file mode 100755 index 0000000..802f7b7 --- /dev/null +++ b/tests/p_openssh/_helper_sshd_user_login.expect @@ -0,0 +1,10 @@ +#!/usr/bin/expect -f +# Author: Athmane Madjoudj + +set timeout 2 +spawn ssh -o StrictHostKeyChecking=no sshtest@localhost /bin/ls +match_max 6000 +expect "*?assword:*" +send -- "sshtest\r" +send -- "\r" +expect eof diff --git a/tests/p_openssh/sshd_conn_test.sh b/tests/p_openssh/sshd_conn_test.sh new file mode 100755 index 0000000..d1014b7 --- /dev/null +++ b/tests/p_openssh/sshd_conn_test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +# FIXME: Test is very basic + +t_Log "Running $0 - SSHD is listening test." + +>/dev/null 2>&1 >/dev/tcp/localhost/22 + +t_CheckExitStatus $? diff --git a/tests/p_openssh/sshd_user_login-with-key.sh b/tests/p_openssh/sshd_user_login-with-key.sh new file mode 100755 index 0000000..8663906 --- /dev/null +++ b/tests/p_openssh/sshd_user_login-with-key.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +keytypes="rsa" +if [ "$centos_ver" -lt 8 ] ; then +keytypes="$keytypes dsa" +fi + +for KeyType in $keytypes; do + userdel -rf sshtest; useradd sshtest && echo sshtest | passwd --stdin sshtest + if [ $centos_ver -ge 8 ]; then + runuser -l sshtest -c "echo | ssh-keygen -q -t ${KeyType} -b 2048 -f ~/.ssh/id_${KeyType}" > /dev/null + else + runuser -l sshtest -c "echo | ssh-keygen -q -t ${KeyType} -b 1024 -f ~/.ssh/id_${KeyType}" > /dev/null + fi + runuser -l sshtest -c "cat ~/.ssh/*pub > ~/.ssh/authorized_keys && chmod 600 ~/.ssh/*keys" > /dev/null + cp ./tests/p_openssh/_helper_sshd_user_login-with-key.expect /home/sshtest/ && chmod +x /home/sshtest/*.expect + + # Create a test file + TestString=$( mktemp -u ) + echo $TestString > /home/sshtest/ssh_test_file + + t_Log "Running $0 - SSH User can login using ${KeyType} key." + runuser -l sshtest -c "~/_helper_sshd_user_login-with-key.expect" | grep ${TestString} > /dev/null 2>&1 + t_CheckExitStatus $? + userdel -rf sshtest +done diff --git a/tests/p_openssh/sshd_user_login.sh b/tests/p_openssh/sshd_user_login.sh new file mode 100755 index 0000000..6c0d373 --- /dev/null +++ b/tests/p_openssh/sshd_user_login.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +userdel -rf sshtest; useradd sshtest && echo sshtest | passwd --stdin sshtest + +# Create a test file +touch /home/sshtest/ssh_test_file + +t_Log "Running $0 - SSH Interactive user login test." + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +if [ `egrep "^PasswordAuthentication" /etc/ssh/sshd_config | tail -n1 | egrep "\syes$" | wc -l ` -gt 0 ]; then + ./tests/p_openssh/_helper_sshd_user_login.expect | grep "ssh_test_file" > /dev/null 2>&1 + t_CheckExitStatus $? + userdel -rf sshtest +else + t_Log 'Skipped' +fi diff --git a/tests/p_openssl/0_install_openssl.sh b/tests/p_openssl/0_install_openssl.sh new file mode 100755 index 0000000..0fd46e4 --- /dev/null +++ b/tests/p_openssl/0_install_openssl.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - attempting to install openssl." +t_InstallPackage openssl + diff --git a/tests/p_openssl/10-openssl-cert-test.sh b/tests/p_openssl/10-openssl-cert-test.sh new file mode 100755 index 0000000..a8cdb97 --- /dev/null +++ b/tests/p_openssl/10-openssl-cert-test.sh @@ -0,0 +1,105 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - openssl create self signed certificate, build symlink and verify certificate test." + +ret_val=0 + +# create working-dir +TESTDIR='/var/tmp/openssl-test' + +mkdir -p $TESTDIR + +#create private key +if (t_GetPkgRel basesystem | grep -q el6) + then + openssl genpkey -algorithm rsa -out $TESTDIR/server.key.secure -pkeyopt rsa_keygen_bits:2048 > /dev/null 2>&1 +else + openssl genrsa -passout pass:centos -des3 -rand file1:file2:file3:file4:file5 -out $TESTDIR/server.key.secure 2048 > /dev/null 2>&1 +fi +if [ $? == 1 ] + then t_Log "Creation of private key failed." + ret_val=1 + exit +fi + +#create default answer file +cat > $TESTDIR/openssl_answers< /dev/null 2>&1 +else + openssl rsa -passin pass:centos -in $TESTDIR/server.key.secure -out $TESTDIR/server.key > /dev/null 2>&1 +fi +if [ $? == 1 ] + then t_Log "Creation of server key failed." + ret_val=1 + exit +fi + +openssl req -batch -config $TESTDIR/openssl_answers -new -key $TESTDIR/server.key -out $TESTDIR/server.csr > /dev/null 2>&1 +if [ $? == 1 ] + then t_Log "Creation of CSR failed." + ret_val=1 + exit +fi + +openssl x509 -req -days 3600 -in $TESTDIR/server.csr -signkey $TESTDIR/server.key -out $TESTDIR/server.crt > /dev/null 2>&1 +if [ $? == 1 ] + then t_Log "Creation of CRT failed." + ret_val=1 + exit +fi + +# get openssl-Path +sslvar=$(openssl version -d) +regex='OPENSSLDIR\:\ \"(.*)\"' +if [[ $sslvar =~ $regex ]] + then + sslpath=${BASH_REMATCH[1]} +else + t_Log "Could not find openssl config directory" + ret_val=1 + exit +fi + +# prepare verification of certificate +cp $TESTDIR/server.crt $sslpath/certs/ +HASH=$(openssl x509 -noout -hash -in $sslpath/certs/server.crt) +if [ $? == 1 ] + then t_Log "Creation of Certificate HASH failed." + ret_val=1 + exit +fi + +#Link Hash to Cert +ln -s $sslpath/certs/server.crt $sslpath/certs/${HASH}.0 + +#do verification +openssl verify /var/tmp/openssl-test/server.crt |grep -cq OK +if [ $? == 1 ] + then t_Log "Self signed Cert verification failed." + ret_val=1 + exit +fi +t_CheckExitStatus $ret_val + +#reversing changes +/bin/rm -rf $TESTDIR $sslpath/certs/server.crt $sslpath/certs/${HASH}* diff --git a/rpm_tests/p_osinfo-db/001-prepare_environment.sh b/tests/p_osinfo-db/001-prepare_environment.sh similarity index 100% rename from rpm_tests/p_osinfo-db/001-prepare_environment.sh rename to tests/p_osinfo-db/001-prepare_environment.sh diff --git a/rpm_tests/p_osinfo-db/01-msvsphere-present.sh b/tests/p_osinfo-db/01-msvsphere-present.sh similarity index 88% rename from rpm_tests/p_osinfo-db/01-msvsphere-present.sh rename to tests/p_osinfo-db/01-msvsphere-present.sh index e815bc0..e0916f1 100755 --- a/rpm_tests/p_osinfo-db/01-msvsphere-present.sh +++ b/tests/p_osinfo-db/01-msvsphere-present.sh @@ -1,10 +1,12 @@ -#!/bin/bash -x +#!/bin/bash + +set -e echo "Тест наличия MSVSphere ОС в БД osinfo" echo "=====================================" echo "" -source ../../library/sh_lib.sh +source library/sh_lib.sh check=0 diff --git a/rpm_tests/p_osinfo-db/02-image-os_name.sh b/tests/p_osinfo-db/02-image-os_name.sh similarity index 73% rename from rpm_tests/p_osinfo-db/02-image-os_name.sh rename to tests/p_osinfo-db/02-image-os_name.sh index d4e1095..ce68cdf 100755 --- a/rpm_tests/p_osinfo-db/02-image-os_name.sh +++ b/tests/p_osinfo-db/02-image-os_name.sh @@ -1,16 +1,22 @@ #!/bin/bash +set -e + echo "Тест получения названия MSVSphere ОС из ISO образа" echo "==================================================" echo "" -source ../../library/sh_lib.sh +source library/sh_lib.sh check=0 -ISO_IMAGES_URLS_FILE='files/msvsphereiso_url.txt' +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +# echo "Script dir: ${SCRIPT_DIR}" + +ISO_IMAGES_URLS_FILE="${SCRIPT_DIR}/files/msvsphereiso_url.txt" EXPECTED_MESSAGE="Media is bootable. Media is an installer for OS 'MSVSphere 9 (x86_64)'" + while read LINE; do curl -LJs -r 0-1048576 -o img.iso $LINE OUTPUT="$(/usr/bin/osinfo-detect img.iso 2>&1)" diff --git a/rpm_tests/p_osinfo-db/03-check-image-sha256.sh b/tests/p_osinfo-db/03-check-image-sha256.sh similarity index 95% rename from rpm_tests/p_osinfo-db/03-check-image-sha256.sh rename to tests/p_osinfo-db/03-check-image-sha256.sh index 835fcf3..87d2bf2 100755 --- a/rpm_tests/p_osinfo-db/03-check-image-sha256.sh +++ b/tests/p_osinfo-db/03-check-image-sha256.sh @@ -1,12 +1,14 @@ #!/bin/bash +set -e + echo "Тест проверки целостности ISO образов MSVSphere ОС" echo "==================================================" echo "" -source ../../library/sh_lib.sh +source library/sh_lib.sh -echo "ATTENSION: Test tomporarely skipped." +echo "ATTENSION: Test temporarely skipped." exit 0 check=0 diff --git a/rpm_tests/p_osinfo-db/files/msvsphereiso_local.txt b/tests/p_osinfo-db/files/msvsphereiso_local.txt similarity index 100% rename from rpm_tests/p_osinfo-db/files/msvsphereiso_local.txt rename to tests/p_osinfo-db/files/msvsphereiso_local.txt diff --git a/rpm_tests/p_osinfo-db/files/msvsphereiso_url.txt b/tests/p_osinfo-db/files/msvsphereiso_url.txt similarity index 100% rename from rpm_tests/p_osinfo-db/files/msvsphereiso_url.txt rename to tests/p_osinfo-db/files/msvsphereiso_url.txt diff --git a/tests/p_passwd/0_install_passwd b/tests/p_passwd/0_install_passwd new file mode 100755 index 0000000..62e1bba --- /dev/null +++ b/tests/p_passwd/0_install_passwd @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Iain Douglas + +# Ensure packages we use are installed +t_Log "Running $0 installing required packages" +t_InstallPackage passwd expect diff --git a/tests/p_passwd/10_passwd_basic_test b/tests/p_passwd/10_passwd_basic_test new file mode 100755 index 0000000..d33545b --- /dev/null +++ b/tests/p_passwd/10_passwd_basic_test @@ -0,0 +1,8 @@ +#!/bin/bash +#Author: Iain Douglas +# +t_Log "Running $0 - Basic passwd functionality checks" + +userdel -rf passtest; useradd passtest &>/dev/null +echo passtest | passwd --stdin passtest &>/dev/null +t_CheckExitStatus $? diff --git a/tests/p_passwd/20_root_tests b/tests/p_passwd/20_root_tests new file mode 100755 index 0000000..078d0f1 --- /dev/null +++ b/tests/p_passwd/20_root_tests @@ -0,0 +1,126 @@ +#!/bin/bash +# Author: Iain Douglas +# + +function ExitFail +{ + t_Log "FAIL" + exit $FAIL +} +# +# Test the command line options for passwd that are restricted to root. +# + +t_Log "Running $0 - Check root only actions" +t_Log "Create test user passtest" +userdel -rf passtest; useradd passtest && echo passtest | passwd --stdin passtest &>/dev/null +t_CheckExitStatus $? + +# Check that passwd -l locks the password - the field in /etc/shadow has +# a ! prepended +t_Log "Check account can be locked" +passwd -l passtest &>/dev/null + +if [ $? -eq "0" ] +then + getent shadow passtest | cut -f2 -d: | grep '^!' &>/dev/null + t_CheckExitStatus $? +else + ExitFail +fi + +# Check that passwd -u will unlock the account - removes the ! from the +# start of the password field in /etc/shadow +t_Log "Check account can be unlocked" +passwd -u passtest &>/dev/null + +if [ $? -eq "0" ] +then + getent shadow passtest | cut -f2 -d: | grep -v '^!' &>/dev/null + t_CheckExitStatus $? +else + ExitFail +fi + +# Check that passwd -e expires an account. Field 3 of /etc/shadow is set to 0 +t_Log "Check password can be expired" +if [ $centos_ver == '5' ] + then + t_Log 'This is a C5 system - option -e does not exist - skipping' +else + passwd -e passtest &>/dev/null + if [ $? -eq "0" ] + then + getent shadow passtest | cut -f3 -d: | grep '^0' &>/dev/null + t_CheckExitStatus $? + echo passtest | passwd --stdin passtest &>/dev/null + else + ExitFail + fi +fi + +# Check that passwd -n, -x, -w -i set the mindays, maxdays, warndays and +# inactive fields (4-7) in /etc/shadow +t_Log "Check password aging data can be set" +passwd -n 11 -x 22 -w 33 -i 44 passtest &>/dev/null + +if [ $? -eq "0" ] +then + getent shadow passtest | cut -f4-7 -d: | grep '^11:22:33:44' &>/dev/null + t_CheckExitStatus $? +else + ExitFail +fi + +# Check that passwd -d deletes the password - the field in /etc/shadow is +# cleared +t_Log "Check password can be deleted" +passwd -d passtest &>/dev/null + +if [ $? -eq "0" ] +then + password=$(getent shadow passtest | cut -f2 -d:) + if [ -z "${password}" ] + then + t_Log "PASS" + else + ExitFail + fi +else + ExitFail +fi + +# Passwd won't, without being forced, unlock an account with a blank password +# so check this is the case. +t_Log "Check blank password cannot be unlocked" +passwd -l passtest &>/dev/null +passwd -u passtest &>/dev/null + +if [ $? -ne "0" ] +then + t_Log PASS +else + ExitFail +fi + +# Force passwd to unlock an account with a blank password passwd -uf. +t_Log "Check blank password can be force unlocked" +passwd -uf passtest &>/dev/null +t_CheckExitStatus $? + +# Check the output of passwd -S at this point it should be +# passtest NP YYYY-MM-DD 11 22 33 44 (Empty password.) +# It's possible that this will run on a different side of midnight to earlier +# commands so if checking the output for today fails check yesterday too +t_Log "Check output of passwd -S" + +expected="passtest NP "$(date +'%F')" 11 22 33 44 (Empty password.)" +passwd -S passtest | grep "$expected" &>/dev/null +if [ $? -eq "0" ] +then + t_Log "PASS" +else + expected="passtest NP "$(date +'%F' -d yesterday)" 11 22 33 44 (Empty password.)" + passwd -S passtest | grep "$expected" &>/dev/null + t_CheckExitStatus $? +fi diff --git a/tests/p_passwd/30_user_tests b/tests/p_passwd/30_user_tests new file mode 100755 index 0000000..b9714ec --- /dev/null +++ b/tests/p_passwd/30_user_tests @@ -0,0 +1,82 @@ +#!/bin/bash +# Author: Iain Douglas +# + +function ExitFail { + t_Log "FAIL" + exit $FAIL +} + +t_Log "Runing $0 - normal user password tests" +# Check that the passtest user cannot use the root only options + +t_Log "Checking a normal user cannot use root options" + +su passtest -c "passwd -l passtest" &>/dev/null && ExitFail +su passtest -c "passwd -u passtest" &>/dev/null && ExitFail +su passtest -c "passwd -e passtest" &>/dev/null && ExitFail +su passtest -c "passwd -n 10 passtest" &>/dev/null && ExitFail +su passtest -d "passwd -d passtest" &>/dev/null && ExitFail +su passtest -d "passwd -S passtest" &>/dev/null && ExitFail +t_Log "Pass" + +# Check the user can change their own password. Reset it to passtest and +# turn off min change days before trying. Password becomes ano24ther + +t_Log "Test user can change own password" + +echo "passtest" | passwd --stdin passtest &>/dev/null +passwd -n 0 passtest &>/dev/null +./tests/p_passwd/_user_password.expect &>/dev/null +t_CheckExitStatus $? + +# Check that sending the wrong current password fails we send passtest + +t_Log "Check sending incorrect current password fails" +./tests/p_passwd/_user_password.expect &>/dev/null + +if [ $? -eq "3" ] +then + t_Log "PASS" +else + ExitFail +fi + +# Check that user cannot immediately change password if minimum password +# lifeftime is enabled. + +t_Log "Testing Minimum password lifetine is enforced" +echo "passtest" | passwd --stdin passtest &>/dev/null +passwd -n 1 passtest &>/dev/null +./tests/p_passwd/_user_password.expect &>/dev/null + +if [ $? -eq "2" ] +then + t_Log "PASS" +else + ExitFail +fi + +# Password complexity tests +echo "passtest" | passwd --stdin passtest &>/dev/null +passwd -n 0 passtest &>/dev/null + +# Check very short password is rejected (single letter) +t_Log "Test very short password is rejected (1 character)" +./tests/p_passwd/_password_complexity.expect a &>/dev/null +t_CheckExitStatus $? + +# Check a short password is rejected (4 chars) +t_Log "Test short password is rejected (4 charaters)" +./tests/p_passwd/_password_complexity.expect athe &>/dev/null +t_CheckExitStatus $? + +# Check password is rejected with insufficient complexity +t_Log "Test insufficiently complex password is rejected" +./tests/p_passwd/_password_complexity.expect betabeta &>/dev/null +t_CheckExitStatus $? + +# Check palindromic password is rejected +t_Log "Check palindromic password is rejected" +./tests/p_passwd/_password_complexity.expect qwe123321ewq &>/dev/null +t_CheckExitStatus $? diff --git a/tests/p_passwd/TODO b/tests/p_passwd/TODO new file mode 100644 index 0000000..b49d195 --- /dev/null +++ b/tests/p_passwd/TODO @@ -0,0 +1,3 @@ +# I don't understand what -k is supposed to do. +# Without changing the date and time I can't think of a way to test +# that -x -w and -i are working diff --git a/tests/p_passwd/_password_complexity.expect b/tests/p_passwd/_password_complexity.expect new file mode 100755 index 0000000..abd65ad --- /dev/null +++ b/tests/p_passwd/_password_complexity.expect @@ -0,0 +1,25 @@ +#!/usr/bin/expect -f +# Author: Iain Douglas +# + +set testpassword [lindex $argv 0] +set timeout 10 +match_max 6000 + +spawn su passtest -c passwd +expect -re "(UNIX|Current) password:" { send -- "passtest\r" } +expect { + "password:" { + send "$testpassword\r" + expect { + "BAD PASSWORD: is a palindrome" { exit 0 } + "BAD PASSWORD: The password is a palindrome" { exit 0 } + "BAD PASSWORD: it is WAY too short" { exit 0 } + "BAD PASSWORD: The password is shorter than 8 characters" { exit 0 } + "BAD PASSWORD: it is too short" { exit 0 } + "BAD PASSWORD: it does not contain enough DIFFERENT characters" { exit 0 } + "BAD PASSWORD: The password fails the dictionary check - it does not contain enough DIFFERENT characters" { exit 0 } + } + } +} +exit 1 diff --git a/tests/p_passwd/_user_password.expect b/tests/p_passwd/_user_password.expect new file mode 100755 index 0000000..e0dac1e --- /dev/null +++ b/tests/p_passwd/_user_password.expect @@ -0,0 +1,34 @@ +#!/usr/bin/expect -d +# Author: Iain Douglas + +set timeout 10 +match_max 6000 +spawn su passtest -c passwd +expect -re "(UNIX|Current) password:" { send -- "passtest\r" } +expect { + "You must wait longer to change your password" + { + exit 2 + } + "Authentication token manipulation error" + { + exit 3 + } + "Current Password:" { + send -- "passtest\r" + expect { + "Authentication token manipulation error" + { + exit 3 + } + } + } + "password:" + { + send -- "ano24ther\r" + expect "*?\[pP]assword:*" + send -- "ano24ther\r" + expect eof + } +} + diff --git a/tests/p_perf/00_install_perf.sh b/tests/p_perf/00_install_perf.sh new file mode 100644 index 0000000..ed9381b --- /dev/null +++ b/tests/p_perf/00_install_perf.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + +t_Log "Running $0 -installing perf" +t_InstallPackage perf diff --git a/tests/p_perf/01_perf_version.sh b/tests/p_perf/01_perf_version.sh new file mode 100644 index 0000000..dc515d8 --- /dev/null +++ b/tests/p_perf/01_perf_version.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + + +t_Log "Running $0" + +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + +if ! perf version > ${output_file} 2>&1; then + cat ${output_file} + t_CheckExitStatus 1 +fi + +t_CheckExitStatus 0 diff --git a/tests/p_perf/02_perf_functionality.sh b/tests/p_perf/02_perf_functionality.sh new file mode 100644 index 0000000..4837617 --- /dev/null +++ b/tests/p_perf/02_perf_functionality.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + + +t_Log "Running $0" + +output_file=$(mktemp) +trap "rm -f ${output_file}; rm -f perf.data" EXIT + +t_Log "Running $0: perf record" +if ! perf record -F 49 -a -g -- sleep 1 > ${output_file} 2>&1; then + cat ${output_file} + t_CheckExitStatus 1 +fi + +t_Log "Running $0: perf report" +if ! perf report --stats > ${output_file} 2>&1; then + cat ${output_file} + t_CheckExitStatus 1 +fi + +t_CheckExitStatus 0 diff --git a/tests/p_perl/0-install_perl.sh b/tests/p_perl/0-install_perl.sh new file mode 100755 index 0000000..3ac8c7e --- /dev/null +++ b/tests/p_perl/0-install_perl.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Madhurranjan Mohaan + +t_Log "Running $0 - installing perl" + +# Install perl +t_InstallPackage perl diff --git a/tests/p_perl/10-test_perl.sh b/tests/p_perl/10-test_perl.sh new file mode 100755 index 0000000..4523964 --- /dev/null +++ b/tests/p_perl/10-test_perl.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Madhurranjan Mohaan + +# Check perl installation + +t_Log "Running $0 - checking perl installation" + +perl --version &>/dev/null +t_CheckExitStatus $? diff --git a/tests/p_perl/20-run_perl_script.sh b/tests/p_perl/20-run_perl_script.sh new file mode 100755 index 0000000..856b6ae --- /dev/null +++ b/tests/p_perl/20-run_perl_script.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Author: Madhurranjan Mohaan + +t_Log "Running $0 - Testing perl by running it against a basic file" + +echo 'print "helloworld perlpackage"' > testfile +perl testfile | grep -q helloworld + +t_CheckExitStatus $? diff --git a/tests/p_php/0_install_php-cli.sh b/tests/p_php/0_install_php-cli.sh new file mode 100755 index 0000000..92bf070 --- /dev/null +++ b/tests/p_php/0_install_php-cli.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - attempting to install php-cli." +t_SkipReleaseGreaterThan 7 'use module-aware tests instead' +t_InstallPackage php-cli + diff --git a/tests/p_php/10-php-test.sh b/tests/p_php/10-php-test.sh new file mode 100755 index 0000000..6508534 --- /dev/null +++ b/tests/p_php/10-php-test.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Author: Christoph Galuschka + +t_Log "Running $0 - php test: looking for Zend Engine in phpinfo()." +t_SkipReleaseGreaterThan 7 'use module-aware tests instead' + +FILE='/var/tmp/php-test.php' + +cat > $FILE < +EOF + +# setting timezone for phpinfo +sed -i 's/\;date\.timezone\ \=/date\.timezone = \"Europe\/Berlin\"/' /etc/php.ini + +php $FILE | grep -q 'Zend Engine' + +t_CheckExitStatus $? + +#reversing changes +/bin/rm $FILE +sed -i 's/\date\.timezone\ \=\ \"Europe\/Berlin\"/\;date\.timezone\ \=/' /etc/php.ini diff --git a/tests/p_php/20-php-mysql-test.sh b/tests/p_php/20-php-mysql-test.sh new file mode 100755 index 0000000..f827e49 --- /dev/null +++ b/tests/p_php/20-php-mysql-test.sh @@ -0,0 +1,88 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Author: Christoph Galuschka +# reusing the script from LAMP-Tests + +t_Log "Running $0 - php-cli basic interaction with mysql test." +t_SkipReleaseGreaterThan 7 'use module-aware tests instead' + +# Install php-mysql/php-mysqld module depending on version +# we need a working and running mysql server +#starting with 5.10 we need to reflect mysql55 +if [ $centos_ver = 5 ] +then + t_InstallPackage mysql-server mysql55-mysql-server nc php-mysql + t_ServiceControl mysql55-mysqld stop + t_ServiceControl mysqld start >/dev/null 2>&1 +elif [ $centos_ver = 6 ] +then + t_InstallPackage mysql-server nc php-mysql + t_ServiceControl mysqld start >/dev/null 2>&1 +else + t_InstallPackage mariadb-server nc php-mysqlnd + t_ServiceControl mariadb start >/dev/null 2>&1 +fi + +#create a little DB to use +CREATE='/var/tmp/mysql-php-QA.sql' + +cat >$CREATE <$INSERT < +EOF + +php $INSERT +if [ $? -ne 0 ] + then + t_Log "Inserting into DB failed" + exit 1 +fi + +# create PHP script to read from DB +READ='/var/tmp/read.php' +cat >$READ < +EOF + +# If we execute the script and get '1' it works (1 entry should be in the DB) +php $READ | grep -q '1' + +t_CheckExitStatus $? + +#cleaning up +/bin/rm $READ $CREATE $INSERT +mysql -u root -e 'drop database phptests' >/dev/null 2>&1 diff --git a/tests/p_php/25-php-mysql55-test.sh b/tests/p_php/25-php-mysql55-test.sh new file mode 100755 index 0000000..d655617 --- /dev/null +++ b/tests/p_php/25-php-mysql55-test.sh @@ -0,0 +1,83 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Author: Christoph Galuschka +# reusing the script from LAMP-Tests + +t_Log "Running $0 - php-cli basic interaction with mysql55 test." +if [ $centos_ver != 5 ] +then + t_Log "This is not a C5-system - skipping" + exit 0 +fi + +# Install php-mysql-module +t_InstallPackage php-mysql + +# we need a working and running mysql server +#starting with 5.10 we need to reflect mysql55 +t_ServiceControl mysqld stop +t_ServiceControl mysql55-mysqld start >/dev/null 2>&1 + +#create a little DB to use +CREATE='/var/tmp/mysql-php-QA.sql' + +cat >$CREATE <$INSERT < +EOF + +php $INSERT +if [ $? -ne 0 ] + then + t_Log "Inserting into DB failed" + exit 1 +fi + +# create PHP script to read from DB +READ='/var/tmp/read.php' +cat >$READ < +EOF + +# If we execute the script and get '1' it works (1 entry should be in the DB) +php $READ | grep -q '1' + +t_CheckExitStatus $? + +#cleaning up +/bin/rm $READ $CREATE $INSERT +mysql -u root -e 'drop database phptests' >/dev/null 2>&1 diff --git a/tests/p_php_7.2/10_php_api.sh b/tests/p_php_7.2/10_php_api.sh new file mode 100755 index 0000000..6f40769 --- /dev/null +++ b/tests/p_php_7.2/10_php_api.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +t_Log "Running $0 - verify PHP API in phpinfo()" +t_SkipReleaseLessThan 8 'no modularity' + +API='20170718' + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Php 7.2 module not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_EnableModuleStream php:7.2 + +t_InstallPackage php-cli + +t_Log "Executing phpinfo()" +output=$(php -d 'date.timezone=UTC' -r 'phpinfo();') +t_CheckExitStatus $? + + +t_Log "Verifying PHP API matches $API" +grep -q "PHP API => $API" <<< $output +t_CheckExitStatus $? + +t_RemovePackage php-cli +t_ResetModule php httpd nginx diff --git a/tests/p_php_7.2/20_php_mariadb.sh b/tests/p_php_7.2/20_php_mariadb.sh new file mode 100755 index 0000000..9034d08 --- /dev/null +++ b/tests/p_php_7.2/20_php_mariadb.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Php module not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_Log "Running $0 - PHP/MariaDB interaction" +t_SkipReleaseLessThan 8 'no modularity' + +t_EnableModuleStream php:7.2 +t_InstallPackageMinimal php-cli php-mysqlnd mariadb-server + +t_Log "starting mariadb service" +systemctl --quiet start mariadb +t_CheckExitStatus $? + +t_Log "create a test database" +mysql << EOF +DROP DATABASE IF EXISTS phptests; +CREATE DATABASE phptests; +USE phptests; +CREATE TABLE tests (name VARCHAR(20)); +GRANT ALL ON phptests.* TO 'centos'@'localhost' IDENTIFIED BY 'qa'; +FLUSH PRIVILEGES; +EOF +t_CheckExitStatus $? + +t_Log "write to test database via PHP" +php << EOF &> /dev/null + +EOF +t_CheckExitStatus $? + +t_Log "read from test database via PHP" +php << EOF | grep -q '1' + +EOF +t_CheckExitStatus $? + +t_Log "stopping mariadb service" +systemctl --quiet stop mariadb +t_CheckExitStatus $? + +t_Log "deleting database files" +find /var/lib/mysql -mindepth 1 -delete +t_CheckExitStatus $? + +t_RemovePackage php-cli php-mysqlnd mariadb-server +t_ResetModule php httpd nginx mariadb diff --git a/tests/p_php_7.3/10_php_api.sh b/tests/p_php_7.3/10_php_api.sh new file mode 100755 index 0000000..a1aefe1 --- /dev/null +++ b/tests/p_php_7.3/10_php_api.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Modular php not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_Log "Running $0 - verify PHP API in phpinfo()" +t_SkipReleaseLessThan 8 'no modularity' + +t_EnableModuleStream php:7.3 +t_InstallPackage php-cli + +t_Log "Executing phpinfo()" +output=$(php -d 'date.timezone=UTC' -r 'phpinfo();') +t_CheckExitStatus $? + +API='20180731' + +t_Log "Verifying PHP API matches $API" +grep -q "PHP API => $API" <<< $output +t_CheckExitStatus $? + +t_RemovePackage php-cli +t_ResetModule php httpd nginx diff --git a/tests/p_php_7.3/20_php_mariadb.sh b/tests/p_php_7.3/20_php_mariadb.sh new file mode 100755 index 0000000..c74dd1b --- /dev/null +++ b/tests/p_php_7.3/20_php_mariadb.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Modular php not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_Log "Running $0 - PHP/MariaDB interaction" +t_SkipReleaseLessThan 8 'no modularity' + +t_EnableModuleStream php:7.3 +t_InstallPackageMinimal php-cli php-mysqlnd mariadb-server + +t_Log "starting mariadb service" +systemctl --quiet start mariadb +t_CheckExitStatus $? + +t_Log "create a test database" +mysql << EOF +DROP DATABASE IF EXISTS phptests; +CREATE DATABASE phptests; +USE phptests; +CREATE TABLE tests (name VARCHAR(20)); +GRANT ALL ON phptests.* TO 'centos'@'localhost' IDENTIFIED BY 'qa'; +FLUSH PRIVILEGES; +EOF +t_CheckExitStatus $? + +t_Log "write to test database via PHP" +php << EOF &> /dev/null + +EOF +t_CheckExitStatus $? + +t_Log "read from test database via PHP" +php << EOF | grep -q '1' + +EOF +t_CheckExitStatus $? + +t_Log "stopping mariadb service" +systemctl --quiet stop mariadb +t_CheckExitStatus $? + +t_Log "deleting database files" +find /var/lib/mysql -mindepth 1 -delete +t_CheckExitStatus $? + +t_RemovePackage php-cli php-mysqlnd mariadb-server +t_ResetModule php httpd nginx mariadb diff --git a/tests/p_podman/00_install_podman.sh b/tests/p_podman/00_install_podman.sh new file mode 100755 index 0000000..5f2b76d --- /dev/null +++ b/tests/p_podman/00_install_podman.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + +t_Log "Running $0 - installing podman." + +if [ "$centos_ver" -lt 8 ] ; then + t_Log "SKIP $0: only install in centos stream 8 or greater" + exit 0 +fi + +t_InstallPackage podman diff --git a/tests/p_podman/10_podman_tests.sh b/tests/p_podman/10_podman_tests.sh new file mode 100755 index 0000000..32c61c9 --- /dev/null +++ b/tests/p_podman/10_podman_tests.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + +t_Log "Running $0 - podman tests" + +if [ "$centos_ver" -lt 8 ] ; then + t_Log "SKIP $0: only run on centos stream 8 or greater" + exit 0 +fi + +tests_in_order=( + "podman version" + "podman info" + "podman run --rm quay.io/centos/centos:stream${centos_ver} bash -c 'echo HELLO' | grep -q -e 'HELLO'" + "podman system service -t 1" + "touch ${HOME}/test.txt && \ + podman run --rm --privileged -v ${HOME}/test.txt:/test.txt quay.io/centos/centos:stream${centos_ver} bash -c 'echo HELLO > /test.txt' && \ + grep -q -e 'HELLO' ${HOME}/test.txt && \ + rm -f ${HOME}/test.txt" + "printf \"FROM quay.io/centos/centos:stream${centos_ver}\nCMD echo 'HELLO'\n\" > ${HOME}/Containerfile && \ + podman build -t test:latest -f ${HOME}/Containerfile && \ + podman image rm localhost/test:latest && \ + rm -rf ${HOME}/Containerfile" +) + +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + +for cmd in "${tests_in_order[@]}"; do + t_Log "Running $0: ${cmd}" + if ! eval "${cmd}" > ${output_file} 2>&1; then + t_Log "FAIL: $0: ${cmd}" + cat ${output_file} + exit 1 + else + t_Log "PASS: $0: ${cmd}" + fi +done + diff --git a/tests/p_podman/15_podman_socket_tests.sh b/tests/p_podman/15_podman_socket_tests.sh new file mode 100755 index 0000000..c890e36 --- /dev/null +++ b/tests/p_podman/15_podman_socket_tests.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Author: Carlos Rodriguez-Fernandez + +t_Log "Running $0 - podman socket tests" + +if [ "$centos_ver" -lt 8 ] ; then + t_Log "SKIP $0: only run on centos stream 8 or greater" + exit 0 +fi + +useradd podman-remote-test +loginctl enable-linger podman-remote-test +output_file=$(mktemp) +trap "loginctl terminate-user podman-remote-test && loginctl disable-linger podman-remote-test && sleep 1 && userdel -r podman-remote-test && rm -f ${output_file}" EXIT + +# give time to loginctl linger +sleep 3 + +su -l podman-remote-test > ${output_file} 2>&1 < + +t_Log "Running $0 - remove unused MTAs and install postfix" + +# Remove other MTAs +t_ServiceControl sendmail stop +t_ServiceControl exim stop +sleep 3 +t_RemovePackage sendmail exim + +# Postfix +t_InstallPackage postfix nc rsyslog +t_ServiceControl postfix start +t_ServiceControl rsyslog start + diff --git a/tests/p_postfix/10_postfix_smtp.sh b/tests/p_postfix/10_postfix_smtp.sh new file mode 100755 index 0000000..c1a01fd --- /dev/null +++ b/tests/p_postfix/10_postfix_smtp.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - Postfix SMTP test." + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +echo "helo test" | nc -w 3 127.0.0.1 25 | grep -q '250' + +t_CheckExitStatus $? diff --git a/tests/p_postfix/20_postfix_mta.sh b/tests/p_postfix/20_postfix_mta.sh new file mode 100755 index 0000000..3b134aa --- /dev/null +++ b/tests/p_postfix/20_postfix_mta.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - postfix can accept and deliver local email." + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +ret_val=1 + +# send mail to localhost +mail=$(echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 127.0.0.1 25 | grep queued) +MTA_ACCEPT=$? +if [ $MTA_ACCEPT == 0 ] + then + t_Log 'Mail has been queued successfully' +fi + +sleep 1 + +if [ "$centos_ver" -eq "8" ]; then + t_Log "Dumping journalctl to /var/log/maillog" + journalctl -u postfix >> /var/log/maillog +fi + +regex='250\ 2\.0\.0\ Ok\:\ queued\ as\ ([0-9A-Z]*).*' +if [[ $mail =~ $regex ]] + then + grep -q "${BASH_REMATCH[1]}: removed" /var/log/maillog + DELIVERED=$? +fi + +if ([ $MTA_ACCEPT == 0 ] && [ $DELIVERED == 0 ]) + then + ret_val=0 + t_Log 'Mail has been delivered and removed from queue.' +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_postfix/30_postfix_mta_ehlo.sh b/tests/p_postfix/30_postfix_mta_ehlo.sh new file mode 100755 index 0000000..b0fa446 --- /dev/null +++ b/tests/p_postfix/30_postfix_mta_ehlo.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - postfix can accept and deliver local email using ESMTP." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi +ret_val=1 + +# send mail to localhost +mail=$(echo -e "ehlo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 127.0.0.1 25 | grep queued) +MTA_ACCEPT=$? +if [ $MTA_ACCEPT == 0 ] + then + t_Log 'Mail has been queued successfully' +fi + +sleep 1 + +if [ "$centos_ver" -eq "8" ]; then + t_Log "Dumping journalctl to /var/log/maillog" + journalctl -u postfix >> /var/log/maillog +fi + +regex='250\ 2\.0\.0\ Ok\:\ queued\ as\ ([0-9A-Z]*).*' +if [[ $mail =~ $regex ]] + then + grep -q "${BASH_REMATCH[1]}: removed" /var/log/maillog + DELIVERED=$? +fi + +if ([ $MTA_ACCEPT == 0 ] && [ $DELIVERED == 0 ]) + then + ret_val=0 + t_Log 'Mail has been delivered and removed from queue.' +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_postfix/40_postfix_sasl.sh b/tests/p_postfix/40_postfix_sasl.sh new file mode 100755 index 0000000..568e147 --- /dev/null +++ b/tests/p_postfix/40_postfix_sasl.sh @@ -0,0 +1,98 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - Postfix plain SASL test." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi +t_Log "Installing prerequisits" + +t_InstallPackage dovecot + +#creating backups of changed files +cp -a /etc/postfix/main.cf /etc/postfix/main.cf_testing +if [ $centos_ver = 5 ] + then + cp -a /etc/dovecot.conf /etc/dovecot.conf_testing +else + cp -a /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf_testing +fi + +#adding parameters to postfix +cat >> /etc/postfix/main.cf < /etc/dovecot.conf <> /etc/dovecot/dovecot.conf < + +t_Log "Running $0 - Postfix plain SASL test." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi +t_Log "Installing prerequisits" + +t_InstallPackage openssl + +#creating backups of changed files +cp -a /etc/postfix/main.cf /etc/postfix/main.cf_testing +if [ $centos_ver = 5 ] + then + cp -a /etc/dovecot.conf /etc/dovecot.conf_testing +else + cp -a /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf_testing +fi + +#creating certificates +TESTDIR='/var/tmp/openssl-test' +mkdir $TESTDIR +t_Log "creating private key" +if [ $centos_ver = 6 ] + then + openssl genpkey -algorithm rsa -out $TESTDIR/server.key.secure -pkeyopt rsa_keygen_bits:2048 > /dev/null 2>&1 +else + openssl genrsa -passout pass:centos -des3 -rand file1:file2:file3:file4:file5 -out $TESTDIR/server.key.secure 2048 > /dev/null 2>&1 +fi +if [ $? == 1 ] + then t_Log "Creation of private key failed." + ret_val=1 + exit +fi + +#create default answer file +cat > $TESTDIR/openssl_answers< /dev/null 2>&1 +else + openssl rsa -passin pass:centos -in $TESTDIR/server.key.secure -out $TESTDIR/server.key > /dev/null 2>&1 +fi +if [ $? == 1 ] + then t_Log "Creation of server key failed." + ret_val=1 + exit +fi + +openssl req -batch -config $TESTDIR/openssl_answers -new -key $TESTDIR/server.key -out $TESTDIR/server.csr > /dev/null 2>&1 +if [ $? == 1 ] + then t_Log "Creation of CSR failed." + ret_val=1 + exit +fi + +t_Log "creating server certificate" +openssl x509 -req -days 3600 -in $TESTDIR/server.csr -signkey $TESTDIR/server.key -out $TESTDIR/server.crt > /dev/null 2>&1 +if [ $? == 1 ] + then t_Log "Creation of CRT failed." + ret_val=1 + exit +fi + +#copy files to destinations +cp -a $TESTDIR/server.crt /etc/pki/tls/certs/ +cp -a $TESTDIR/server.key /etc/pki/tls/private/ + +#adding parameters to postfix +cat >> /etc/postfix/main.cf < /etc/dovecot.conf <> /etc/dovecot/dovecot.conf < +# Christoph Galuschka + +t_Log "Running $0 - initializing and starting PostgreSQL" + +t_Log "Initialize PostgreSQL DB " +if [ $centos_ver -ge 8 ]; then + postgresql-setup --initdb +elif (t_GetPkgRel postgresql | grep -q el7) then + postgresql-setup initdb +elif (t_GetPkgRel postgresql | grep -q el6) then + service postgresql initdb +fi + +t_ServiceControl postgresql start +sleep 15 + + + diff --git a/tests/p_postgresql/postgresql_create_db.sh b/tests/p_postgresql/postgresql_create_db.sh new file mode 100755 index 0000000..86f4177 --- /dev/null +++ b/tests/p_postgresql/postgresql_create_db.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - PostgreSQL create database test" +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. Postgres needs to be initialized." + /usr/bin/postgresql-setup --initdb +fi + +su - postgres -c 'createdb pg_testdb' +t_CheckExitStatus $? diff --git a/tests/p_postgresql/postgresql_create_user_test.sh b/tests/p_postgresql/postgresql_create_user_test.sh new file mode 100755 index 0000000..3af7278 --- /dev/null +++ b/tests/p_postgresql/postgresql_create_user_test.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - PostgreSQL create user test" + +su - postgres -c 'createuser -S -R -D test_user' > /dev/null 2>&1 + + +t_CheckExitStatus $? diff --git a/tests/p_postgresql/postgresql_drop_db.sh b/tests/p_postgresql/postgresql_drop_db.sh new file mode 100755 index 0000000..e964e82 --- /dev/null +++ b/tests/p_postgresql/postgresql_drop_db.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - PostgreSQL drop database test." +su - postgres -c 'dropdb pg_testdb' > /dev/null 2>&1 +t_CheckExitStatus $? diff --git a/tests/p_postgresql/postgresql_drop_user_test.sh b/tests/p_postgresql/postgresql_drop_user_test.sh new file mode 100755 index 0000000..a0debe3 --- /dev/null +++ b/tests/p_postgresql/postgresql_drop_user_test.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - PostgreSQL drop user test" + +su - postgres -c 'dropuser test_user' > /dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_procinfo/0-install_procinfo.sh b/tests/p_procinfo/0-install_procinfo.sh new file mode 100755 index 0000000..868c8a6 --- /dev/null +++ b/tests/p_procinfo/0-install_procinfo.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) +# Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - attempting to install procinfo" + +if [ "$centos_ver" -gt "5" ] ; then + t_Log "It seems to be a CentOS $centos_ver system, this test will be disabled -> SKIP" + exit 0 +else + # ProcInfo Utility Package + t_InstallPackage procinfo +fi diff --git a/tests/p_procinfo/5-test_procinfo.sh b/tests/p_procinfo/5-test_procinfo.sh new file mode 100755 index 0000000..67fba24 --- /dev/null +++ b/tests/p_procinfo/5-test_procinfo.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) +# Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - checking procinfo runs and returns non-zero exit status." + +if [ "$centos_ver" -gt "5" ] ; then + t_Log "It seems to be a CentOS $centos_ver system, this test will be disabled -> SKIP" + exit 0 +else + if [ $SKIP_QA_HARNESS -eq 1 ]; then + t_Log "Skip, seems to fail on CI ..." + else + + PROCINFO=`which procinfo` + + $PROCINFO &>/dev/null + + t_CheckExitStatus $? + fi +fi diff --git a/tests/p_python-iniparse/0-install-python-iniparse.sh b/tests/p_python-iniparse/0-install-python-iniparse.sh new file mode 100755 index 0000000..860bd44 --- /dev/null +++ b/tests/p_python-iniparse/0-install-python-iniparse.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author Dries Verachtert + +# Install python-iniparse: required by yum so a quite important package in CentOS +t_Log "Running $0 - installing python-iniparse." + +if [ "$centos_ver" -ge 8 ] ; then +t_InstallPackage python3 python3-iniparse +else +t_InstallPackage python-iniparse +fi diff --git a/tests/p_python-iniparse/1-test-python-iniparse.sh b/tests/p_python-iniparse/1-test-python-iniparse.sh new file mode 100755 index 0000000..848117d --- /dev/null +++ b/tests/p_python-iniparse/1-test-python-iniparse.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# Author: Dries Verachtert + +t_Log "Running $0 - test python-iniparse" + +if [ "$centos_ver" -ge 8 ] ; then +PYTHON=python3 +else +PYTHON=python +fi + +TESTINI=`mktemp` + +# Test contents: a part of /etc/yum.conf +cat > $TESTINI <<'EOF' +[main] +cachedir=/var/cache/yum/$basearch/$releasever +keepcache=0 +debuglevel=2 +logfile=/var/log/yum.log +EOF + +cat << EOF | $PYTHON - $TESTINI | grep -q '/var/log/yum.log' +import sys +from iniparse import INIConfig + +cfg = INIConfig(open(sys.argv[1])) +print (cfg.main.logfile) +EOF +t_CheckExitStatus $? + +# A second test with multiple sections +cat > $TESTINI <<'EOF' +# comment 1 +[section1] +# comment 2 +section1var1=val1 +[section2] +# comment 3 +[section3] +section3var1=val2 +section3var2=val3 +EOF + +cat << EOF | $PYTHON - $TESTINI | grep -q "\['section1', 'section2', 'section3'\] val1 val2 val3" +import sys +from iniparse import INIConfig + +cfg = INIConfig(open(sys.argv[1])) +print (str(list(cfg)) + ' ' + cfg.section1.section1var1 + ' ' + cfg.section3.section3var1 + ' ' + cfg.section3.section3var2) +EOF + +t_CheckExitStatus $? + +rm -f $TESTINI diff --git a/tests/p_python/0-install-python.sh b/tests/p_python/0-install-python.sh new file mode 100755 index 0000000..8ef539d --- /dev/null +++ b/tests/p_python/0-install-python.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Christoph Galuschka + +# Install python +t_Log "Running $0 - installing python." + +if [ "$centos_ver" -ge 8 ] ; then +t_InstallPackage python3 +else +t_InstallPackage python +fi diff --git a/tests/p_python/10-test_python.sh b/tests/p_python/10-test_python.sh new file mode 100755 index 0000000..57fec65 --- /dev/null +++ b/tests/p_python/10-test_python.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# Author: Christoph Galuschka +# Athmane Madjodj + +t_Log "Running $0 - python can print Hello World" + +if [ "$centos_ver" -ge 8 ] ; then +PYTHON=python3 +else +PYTHON=python +fi + +# creating source file +FILE='/var/tmp/python-test.py' + +cat > $FILE < +# Author: Christoph Galuschka + +t_Log "Running $0 - python can retrieve mysql-server version information." + +if [ "$centos_ver" -ge 8 ] ; then +PYTHON=python3 +else +PYTHON=python +fi +# we need a working and running mysql server +# starting with 5.10, we have to differ between mysql55 and mysql + +if [ "$centos_ver" -ge 7 ] ; then + my_packages="mariadb mariadb-server nc" + mysql_service="mariadb" +elif [ "$centos_ver" = "5" ] ;then + my_packages="mysql mysql-server nc mysql55-mysql-server" + mysql_service="mysqld" +else + my_packages="mysql mysql-server nc" + mysql_service="mysqld" +fi + +t_InstallPackage ${my_packages} +t_ServiceControl ${mysql_service} start >/dev/null 2>&1 + +# Installing additional python/mysql module +if [ "$centos_ver" -ge 8 ] ; then +t_InstallPackage python3-PyMySQL +importcomponent="pymysql" +else +t_InstallPackage MySQL-python +importcomponent="MySQLdb" +fi + +# create python Scrip +SCRIPT='/var/tmp/test.py' + +cat >$SCRIPT < +# Author: Christoph Galuschka + +t_Log "Running $0 - python can retrieve mysql55-mysql-server version information." + +# we need a working and running mysql server +# starting with 5.10, we have to differ between mysql55 and mysql + +if [ $centos_ver = 5 ] +then + t_ServiceControl mysqld stop + t_ServiceControl mysql55-mysqld start +else + exit 0 +fi + +# Installing additional python/mysql module +t_InstallPackage MySQL-python + +# create python Scrip +SCRIPT='/var/tmp/test.py' + +cat >$SCRIPT < SKIP" + exit 0 +fi + +t_InstallPackage python3-mod_wsgi diff --git a/tests/p_python3-mod_wsgi/10-test_python3-mod_wsgi.sh b/tests/p_python3-mod_wsgi/10-test_python3-mod_wsgi.sh new file mode 100755 index 0000000..20a9b3e --- /dev/null +++ b/tests/p_python3-mod_wsgi/10-test_python3-mod_wsgi.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +t_Log "Running $0 - Apache httpd python3-mod_wsgi is functional" + +if [[ $centos_ver -lt 8 ]]; then + t_Log "python3-mod_wsgi doesn't exist before CentOS 8 -> SKIP" + exit 0 +fi + +cat > /etc/httpd/conf.d/tfapp.conf << EOF +WSGIScriptAlias /tfapp /var/www/html/tfapp.wsgi +EOF + +cat > /var/www/html/tfapp.wsgi << EOF +def application(environ, start_response): + status = '200 OK' + output = 't_functional_mod_wsgi_test'.encode() + response_headers = [ + ('Content-type', 'text/plain'), + ('Content-Length', str(len(output))) + ] + start_response(status, response_headers) + return [output] +EOF + +systemctl restart httpd + +curl -s http://localhost/tfapp | grep -q 't_functional_mod_wsgi_test' +t_CheckExitStatus $? + +systemctl stop httpd + +rm /etc/httpd/conf.d/tfapp.conf /var/www/html/tfapp.wsgi diff --git a/tests/p_python3-mod_wsgi/20-remove_python3-mod_wsgi.sh b/tests/p_python3-mod_wsgi/20-remove_python3-mod_wsgi.sh new file mode 100755 index 0000000..975dfa0 --- /dev/null +++ b/tests/p_python3-mod_wsgi/20-remove_python3-mod_wsgi.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +t_Log "Running $0 - removing python3-mod_wsgi" + +if [[ $centos_ver -lt 8 ]]; then + t_Log "python3-mod_wsgi doesn't exist before CentOS 8 -> SKIP" + exit 0 +fi + +t_RemovePackage python3-mod_wsgi diff --git a/tests/p_python38-mod_wsgi/0-install_python38-mod_wsgi.sh b/tests/p_python38-mod_wsgi/0-install_python38-mod_wsgi.sh new file mode 100755 index 0000000..d9bad28 --- /dev/null +++ b/tests/p_python38-mod_wsgi/0-install_python38-mod_wsgi.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +t_Log "Running $0 - installing python38-mod_wsgi" + + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. python38-mod-wsgi not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + + +if [[ $centos_ver -lt 8 ]]; then + t_Log "python38-mod_wsgi doesn't exist before CentOS 8 -> SKIP" + exit 0 +fi + +# TODO: remove after 8.2 rebuild +if [[ $centos_stream == "no" ]]; then + t_Log "python38-mod_wsgi is only in CentOS Stream -> SKIP" + exit 0 +fi + +t_InstallPackage python38-mod_wsgi diff --git a/tests/p_python38-mod_wsgi/10-test_python38-mod_wsgi.sh b/tests/p_python38-mod_wsgi/10-test_python38-mod_wsgi.sh new file mode 100755 index 0000000..101825b --- /dev/null +++ b/tests/p_python38-mod_wsgi/10-test_python38-mod_wsgi.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +t_Log "Running $0 - Apache httpd python38-mod_wsgi is functional" + + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. python3-mod_wsgi not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + + +if [[ $centos_ver -lt 8 ]]; then + t_Log "python38-mod_wsgi doesn't exist before CentOS 8 -> SKIP" + exit 0 +fi + +# TODO: remove after 8.2 rebuild +if [[ $centos_stream == "no" ]]; then + t_Log "python38-mod_wsgi is only in CentOS Stream -> SKIP" + exit 0 +fi + +cat > /etc/httpd/conf.d/tfapp.conf << EOF +WSGIScriptAlias /tfapp /var/www/html/tfapp.wsgi +EOF + +cat > /var/www/html/tfapp.wsgi << EOF +def application(environ, start_response): + status = '200 OK' + output = 't_functional_mod_wsgi_test'.encode() + response_headers = [ + ('Content-type', 'text/plain'), + ('Content-Length', str(len(output))) + ] + start_response(status, response_headers) + return [output] +EOF + +systemctl restart httpd + +curl -s http://localhost/tfapp | grep -q 't_functional_mod_wsgi_test' +t_CheckExitStatus $? + +systemctl stop httpd + +rm /etc/httpd/conf.d/tfapp.conf /var/www/html/tfapp.wsgi diff --git a/tests/p_python38-mod_wsgi/20-remove_python38-mod_wsgi.sh b/tests/p_python38-mod_wsgi/20-remove_python38-mod_wsgi.sh new file mode 100755 index 0000000..2a1e857 --- /dev/null +++ b/tests/p_python38-mod_wsgi/20-remove_python38-mod_wsgi.sh @@ -0,0 +1,24 @@ +#!/bin/bash + + +if (t_GetPkgRel basesystem | grep -q el9) +then + t_Log "This is a C9 system. python38-mod_wsgi not present. Skipping." + t_CheckExitStatus 0 + exit $PASS +fi + +t_Log "Running $0 - removing python38-mod_wsgi" + +if [[ $centos_ver -lt 8 ]]; then + t_Log "python38-mod_wsgi doesn't exist before CentOS 8 -> SKIP" + exit 0 +fi + +# TODO: remove after 8.2 rebuild +if [[ $centos_stream == "no" ]]; then + t_Log "python38-mod_wsgi is only in CentOS Stream -> SKIP" + exit 0 +fi + +t_RemovePackage python38-mod_wsgi diff --git a/tests/p_rootfiles/0-install-rootfiles b/tests/p_rootfiles/0-install-rootfiles new file mode 100755 index 0000000..8e83618 --- /dev/null +++ b/tests/p_rootfiles/0-install-rootfiles @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "$0 - installing rootfiles" +t_InstallPackage rootfiles diff --git a/tests/p_rootfiles/10-rootfiles b/tests/p_rootfiles/10-rootfiles new file mode 100755 index 0000000..24e9e8f --- /dev/null +++ b/tests/p_rootfiles/10-rootfiles @@ -0,0 +1,15 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0 test rootfiles exist" + +# +# Simply test that the files in the package exist in /root +# + +for file in .bash_logout .bash_profile .bashrc .cshrc .tcshrc +do + echo "Checking $file" + [ -e /root/$file ] || { t_Log "FAIL: $file is missing"; exit $FAIL; } + t_Log "PASS" +done diff --git a/tests/p_rpm/rpm_remove_pkg_test.sh b/tests/p_rpm/rpm_remove_pkg_test.sh new file mode 100755 index 0000000..ab85c7c --- /dev/null +++ b/tests/p_rpm/rpm_remove_pkg_test.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - rpm remove package test." + +# Install zsh pkg +t_InstallPackage zsh + +rpm -e zsh && \ +rpm -q zsh | grep -q 'package zsh is not installed' + +t_CheckExitStatus $? + +t_Log "Clean yum metadata / cache" +yum -y clean all diff --git a/tests/p_rrdtool/0-install_rrdtool.sh b/tests/p_rrdtool/0-install_rrdtool.sh new file mode 100755 index 0000000..3614363 --- /dev/null +++ b/tests/p_rrdtool/0-install_rrdtool.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Author: Christoph Galuschka +# Athmane Madjoudj + +if [ $centos_ver -ge 6 ] +then + # Install rrdtool + t_InstallPackage rrdtool +else + echo "Skipped on CentOS 5" +fi + diff --git a/tests/p_rrdtool/rrdtool_test.sh b/tests/p_rrdtool/rrdtool_test.sh new file mode 100755 index 0000000..f04654d --- /dev/null +++ b/tests/p_rrdtool/rrdtool_test.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Author: Christoph Galuschka +# RRD-sample from http://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html + +if [ $centos_ver -ge 6 ] +then + t_Log "Running $0 - rrdtool: create rrd, write values and retrieve values test." + + # creating test RRD + + FILE="/var/tmp/temperature.rrd" + + rrdtool create $FILE --step 1 DS:temp:GAUGE:600:-273:5000 RRA:AVERAGE:0.5:1:1200 + + # insert value + rrdtool update $FILE N:30 + + # retrieve value and check + WORKING=$(rrdtool fetch $FILE AVERAGE -s -80 |grep -c '3.0000000000e+01') + + # if $WORKING > 0 -> update and retrieval works + if [ $WORKING > 0 ]; then ret_val=0; + fi + + #remove RRD-File + /bin/rm $FILE + + t_CheckExitStatus $ret_val +else + echo "Skipped on CentOS 5" +fi diff --git a/tests/p_rsync/0-install-rsync.sh b/tests/p_rsync/0-install-rsync.sh new file mode 100755 index 0000000..311ef89 --- /dev/null +++ b/tests/p_rsync/0-install-rsync.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - installing rsync and xinetd." + +if [ "$centos_ver" -ge 8 ]; then + t_InstallPackage rsync rsync-daemon +else + t_InstallPackage xinetd rsync +fi + +# Restart in case previous tests allready installed xinetd +if [ "$centos_ver" -ge 7 ]; then + systemctl start rsyncd.service +else + # enable rsync in /etc/xinet.d/rsync + sed -i 's/\(disable\s*=\ \)yes/\1no/' /etc/xinetd.d/rsync + t_ServiceControl xinetd restart +fi diff --git a/tests/p_rsync/10-rsync-test.sh b/tests/p_rsync/10-rsync-test.sh new file mode 100755 index 0000000..b53c5bf --- /dev/null +++ b/tests/p_rsync/10-rsync-test.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Author: Christoph Galuschka + +t_Log "Running $0 - rsyncd can rsync from/to local machine." + +# create settings to run test + +PATH2FILE='/var/tmp/rsync' +mkdir -p $PATH2FILE +FILE='rsync-test' +cat > $PATH2FILE/$FILE < /etc/rsyncd.conf < +# Author: Sahil Muthoo +# Author: Sahil Aggarwal +# Author: Saager Mhatre + +t_Log "Running $0 - attempting to install ruby, ruby-irb, ruby-ri and ruby-rdoc4" +if [ "$centos_ver" -ge 8 ] ; then +t_InstallPackage ruby ruby-irb rubygem-rdoc +else +t_InstallPackage ruby ruby-irb ruby-ri ruby-rdoc +fi + diff --git a/tests/p_ruby/10-ruby-installed-test.sh b/tests/p_ruby/10-ruby-installed-test.sh new file mode 100755 index 0000000..cf3783e --- /dev/null +++ b/tests/p_ruby/10-ruby-installed-test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Author: Nikhil Lanjewar +# Author: Sahil Muthoo +# Author: Sahil Aggarwal +# Author: Saager Mhatre + +t_Log "Running $0 - Check successful installation of ruby." +ruby -v +t_CheckExitStatus $? + diff --git a/tests/p_ruby/20-ruby-version-test.sh b/tests/p_ruby/20-ruby-version-test.sh new file mode 100755 index 0000000..e1e3415 --- /dev/null +++ b/tests/p_ruby/20-ruby-version-test.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# Author: Nikhil Lanjewar +# Author: Sahil Muthoo +# Author: Sahil Aggarwal +# Author: Saager Mhatre +# Christoph Galuschka + +t_Log "Running $0 - Check version of ruby." + +if [ "$centos_ver" -ge 9 ] ; then + ruby -v | grep -q '3.' + ret_val=$? +elif [ "$centos_ver" = "8" ] ; then + ruby -v | grep -q '2.5' + ret_val=$? +elif [ "$centos_ver" = "7" ] ; then + ruby -v | grep -q '2.0' + ret_val=$? +elif [ "$centos_ver" = "6" ] ; then + ruby -v | grep -q '1.8.7' + ret_val=$? +else + ruby -v | grep -q '1.8.5' + ret_val=$? +fi + +t_CheckExitStatus $ret_val + diff --git a/tests/p_ruby/25_ruby_hello-world.sh b/tests/p_ruby/25_ruby_hello-world.sh new file mode 100755 index 0000000..b2e21cf --- /dev/null +++ b/tests/p_ruby/25_ruby_hello-world.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - ruby can run 'hello world'" + +# create ruby script +FILE=/var/tmp/test.rb +cat > $FILE < +# Author: Sahil Muthoo +# Author: Sahil Aggarwal +# Author: Saager Mhatre +# Christoph Galuschka + +t_Log "Running $0 - Check version of irb." + +#allready prepared just in case versions should change between C5 and C6 +if [ "$centos_ver" -ge "9" ] ; then + irb -v | grep -q 'irb' + ret_val=$? +elif [ "$centos_ver" = "7" -o "$centos_ver" = "8" ] ; then + irb -v | grep -q '0.9.6' + ret_val=$? +else + irb -v | grep -q '0.9.5' + ret_val=$? +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_ruby/40-ri-version-test.sh b/tests/p_ruby/40-ri-version-test.sh new file mode 100755 index 0000000..e680c55 --- /dev/null +++ b/tests/p_ruby/40-ri-version-test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Author: Nikhil Lanjewar +# Author: Sahil Muthoo +# Author: Sahil Aggarwal +# Author: Saager Mhatre +# Christoph Galuschka + +t_Log "Running $0 - Check version of ruby ri." + +#allready prepared just in case versions should change between C5 and C6 +if [ "$centos_ver" -ge "8" ] ; then + ri -v | grep -q '6.' + ret_val=$? +elif [ "$centos_ver" = "7" ] ; then + ri -v | grep -q '4.0' + ret_val=$? +else + ri -v | grep -q '1.0.1' + ret_val=$? +fi + +t_CheckExitStatus $ret_val + diff --git a/tests/p_ruby/50-rdoc-version-test.sh b/tests/p_ruby/50-rdoc-version-test.sh new file mode 100755 index 0000000..e9262e1 --- /dev/null +++ b/tests/p_ruby/50-rdoc-version-test.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# Author: Nikhil Lanjewar +# Author: Sahil Muthoo +# Author: Sahil Aggarwal +# Author: Saager Mhatre +# Christoph Galuschka + +t_Log "Running $0 - Check version of rdoc." + +#allready prepared just in case versions should change between C5 and C6 +if [ "$centos_ver" -ge 8 ] ; then + rdoc -v | grep -q '6.' + ret_val=$? +elif [ "$centos_ver" = "7" ] ; then + t_Log "CentOS $centos_ver rdoc has no version in cli -> SKIP" + t_CheckExitStatus 0 + exit 0 +else + rdoc -v | grep -q '1.0.1' + ret_val=$? +fi + +t_CheckExitStatus $ret_val + diff --git a/tests/p_samba/0-install_samba.sh b/tests/p_samba/0-install_samba.sh new file mode 100755 index 0000000..16f6081 --- /dev/null +++ b/tests/p_samba/0-install_samba.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +t_InstallPackage samba samba-client cifs-utils + +t_ServiceControl smb start diff --git a/tests/p_samba/samba_share_test.sh b/tests/p_samba/samba_share_test.sh new file mode 100755 index 0000000..f2e6f86 --- /dev/null +++ b/tests/p_samba/samba_share_test.sh @@ -0,0 +1,51 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +t_Log "Running $0 - Samba share test." + +cp /etc/samba/smb.conf /etc/samba/smb.conf.orig +cat > /etc/samba/smb.conf < /srv/smb/test.txt +mkdir /mnt/smb + +# Fix SELinux context +chcon -R -t samba_share_t /srv/smb + +# Mount the share +mount -t cifs -o guest,ro //127.0.0.1/testshare /mnt/smb +sleep 1 + +# Test +cat /mnt/smb/test.txt | grep 'SMB test file' > /dev/null 2>&1 + +ret_val=$? + +# Clean up +umount /mnt/smb +/bin/rm -fr /mnt/smb + +t_CheckExitStatus $ret_val + diff --git a/tests/p_screen/0-install_screen.sh b/tests/p_screen/0-install_screen.sh new file mode 100755 index 0000000..931c8bc --- /dev/null +++ b/tests/p_screen/0-install_screen.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# GNU Screen +t_Log "Running $0 - installing screen" +if [ "$centos_ver" -ge 8 ] ; then + t_Log "CentOS $centos_ver -> SKIP" + exit 0 +fi +t_InstallPackage screen diff --git a/tests/p_selinux/0_install_tools.sh b/tests/p_selinux/0_install_tools.sh new file mode 100755 index 0000000..0243836 --- /dev/null +++ b/tests/p_selinux/0_install_tools.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Fabian Arrotin + +t_Log "Running $0 - install package selinux policycoreutils tools" +if [ "$centos_ver" = "6" ] ; then + t_InstallPackage policycoreutils-python +elif [ "$centos_ver" -ge 8 ] ; then + t_InstallPackage python3-libselinux +else + t_InstallPackage libselinux-python +fi diff --git a/tests/p_selinux/selinux_alerts.sh b/tests/p_selinux/selinux_alerts.sh new file mode 100755 index 0000000..de2c0ce --- /dev/null +++ b/tests/p_selinux/selinux_alerts.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "Running $0 - check for SELinux alerts (AVC)" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +grep -v "AVC" /var/log/audit/audit.log > /dev/null 2>&1 + +t_CheckExitStatus $? + diff --git a/tests/p_selinux/selinux_enforce.sh b/tests/p_selinux/selinux_enforce.sh new file mode 100755 index 0000000..0a065e1 --- /dev/null +++ b/tests/p_selinux/selinux_enforce.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "Running $0 - check if SELinux is in enforcing mode" + +if [ "$centos_ver" -ge 7 ] ; then + selinux_file=/sys/fs/selinux/enforce +else + selinux_file=/selinux/enforce +fi + +if [ "$SKIP_QA_HARNESS" = "1" ] ; then + t_Log "Skipping this test ..." +else + cat $selinux_file | grep 1 > /dev/null 2>&1 + t_CheckExitStatus $? +fi + diff --git a/tests/p_selinux/selinux_policy_mismatch.sh b/tests/p_selinux/selinux_policy_mismatch.sh new file mode 100755 index 0000000..1375308 --- /dev/null +++ b/tests/p_selinux/selinux_policy_mismatch.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +if [ "$centos_ver" -ge 8 ] ; then +PYTHON=python3 +else +PYTHON=python +fi + +t_Log "Running $0 - Testing audit2why for policy mismatch ..." + + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +cat << __EOF__ | $PYTHON - +import sys +import selinux.audit2why as audit2why + +try: + audit2why.init() +except: + sys.exit(1) +sys.exit(0) +__EOF__ + +t_CheckExitStatus $? diff --git a/tests/p_sendmail/0-install_sendmail.sh b/tests/p_sendmail/0-install_sendmail.sh new file mode 100755 index 0000000..8e76c94 --- /dev/null +++ b/tests/p_sendmail/0-install_sendmail.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "Running $0 - remove unused MTAs and install sendmail" + +t_InstallPackage sendmail nc + +# Remove other MTAs +t_ServiceControl postfix stop +t_ServiceControl exim stop +sleep 3 +t_RemovePackage postfix exim + +t_ServiceControl sendmail start diff --git a/tests/p_sendmail/10_sendmail_smtp.sh b/tests/p_sendmail/10_sendmail_smtp.sh new file mode 100755 index 0000000..651124d --- /dev/null +++ b/tests/p_sendmail/10_sendmail_smtp.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +t_Log "Running $0 - Sendmail SMTP test." + +echo "helo test" | nc -4 -w 3 localhost 25 | grep -q '250' + +t_CheckExitStatus $? diff --git a/tests/p_sendmail/15-test-sendmail.sh b/tests/p_sendmail/15-test-sendmail.sh new file mode 100755 index 0000000..142955c --- /dev/null +++ b/tests/p_sendmail/15-test-sendmail.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - testing if /usr/sbin/sendmail for sendmail is sane." + +mta=$(ls -H /usr/sbin/sendmail) + +if [ $mta == '/usr/sbin/sendmail' ] + then + t_Log "link to sendmail seems to be sane" + ret_val=0 +else + t_Log "link to sendmail seems to be wrong" + ret_val=1 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_sendmail/20_sendmail_mta.sh b/tests/p_sendmail/20_sendmail_mta.sh new file mode 100755 index 0000000..2e24960 --- /dev/null +++ b/tests/p_sendmail/20_sendmail_mta.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - sendmail can accept and deliver local email." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi +ret_val=1 + +# send mail to localhost +mail=$(echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 127.0.0.1 25 | grep accepted) +MTA_ACCEPT=$? +if [ $MTA_ACCEPT == 0 ] + then + t_Log 'Mail has been queued successfully' +fi + +sleep 1 + +if [ "$centos_ver" -eq "8" ]; then + t_Log "Dumping journalctl to /var/log/maillog" + journalctl -u sendmail >> /var/log/maillog +fi +regex='250\ 2\.0\.0\ ([0-9A-Za-z]*)\ Message\ accepted\ for\ delivery' +if [[ $mail =~ $regex ]] + then + egrep -q "${BASH_REMATCH[1]}\:.*stat\=Sent" /var/log/maillog + DELIVERED=$? +fi + +if ([ $MTA_ACCEPT == 0 ] && [ $DELIVERED == 0 ]) + then + ret_val=0 + t_Log 'Mail has been delivered and removed from queue.' +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_sendmail/30_sendmail_mta_ehlo.sh b/tests/p_sendmail/30_sendmail_mta_ehlo.sh new file mode 100755 index 0000000..bd5b309 --- /dev/null +++ b/tests/p_sendmail/30_sendmail_mta_ehlo.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - sendmail can accept and deliver local email." +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi +ret_val=1 + +# send mail to localhost +mail=$(echo -e "ehlo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 127.0.0.1 25 | grep accepted) +MTA_ACCEPT=$? +if [ $MTA_ACCEPT == 0 ] + then + t_Log 'Mail has been queued successfully' +fi + +sleep 1 + +if [ "$centos_ver" -eq "8" ]; then + t_Log "Dumping journalctl to /var/log/maillog" + journalctl -u sendmail >> /var/log/maillog +fi + +regex='250\ 2\.0\.0\ ([0-9A-Za-z]*)\ Message\ accepted\ for\ delivery' +if [[ $mail =~ $regex ]] + then + egrep -q "${BASH_REMATCH[1]}\:.*stat\=Sent" /var/log/maillog + DELIVERED=$? +fi + +if ([ $MTA_ACCEPT == 0 ] && [ $DELIVERED == 0 ]) + then + ret_val=0 + t_Log 'Mail has been delivered and removed from queue.' +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_setup/group_file_test.sh b/tests/p_setup/group_file_test.sh new file mode 100755 index 0000000..edd5c6c --- /dev/null +++ b/tests/p_setup/group_file_test.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - group file sanity check." + +if [ "$centos_ver" -ge 8 ] ;then + nobody_grpid="65534" +else + nobody_grpid="99" +fi + +grep -q 'root:x:0' /etc/group && \ +grep -q 'bin:x:1' /etc/group && \ +grep -q 'daemon:x:2' /etc/group && \ +grep -q "nobody:x:${nobody_grpid}" /etc/group + + +t_CheckExitStatus $? diff --git a/tests/p_setup/passwd_file_test.sh b/tests/p_setup/passwd_file_test.sh new file mode 100755 index 0000000..1ac33d8 --- /dev/null +++ b/tests/p_setup/passwd_file_test.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - passwd file sanity check." + +if [ "$centos_ver" -ge 8 ] ;then + nobody_grpid="65534" +else + nobody_grpid="99" +fi + +grep -q 'root:x:0' /etc/passwd && \ +grep -q "nobody:x:${nobody_grpid}" /etc/passwd + + +t_CheckExitStatus $? diff --git a/tests/p_setup/shells_file_test.sh b/tests/p_setup/shells_file_test.sh new file mode 100755 index 0000000..a5c3a96 --- /dev/null +++ b/tests/p_setup/shells_file_test.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - shells file sanity check." + +grep -q 'bash' /etc/shells + + +t_CheckExitStatus $? diff --git a/tests/p_shadow-utils/0-install_shadow_utils b/tests/p_shadow-utils/0-install_shadow_utils new file mode 100755 index 0000000..68660e7 --- /dev/null +++ b/tests/p_shadow-utils/0-install_shadow_utils @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Iain Douglas +# Ensure the packages we require are available + +t_Log "Running $0 installing required packages" +t_InstallPackage shadow-utils diff --git a/tests/p_shadow-utils/10-basic_test b/tests/p_shadow-utils/10-basic_test new file mode 100755 index 0000000..a8371b4 --- /dev/null +++ b/tests/p_shadow-utils/10-basic_test @@ -0,0 +1,13 @@ +#!/bin/bash +# Author: Iain Douglas +# +# Basic tests for the shadow utils package. Check that the /etc/default +# directory and /etc/default/useradd files exist. + +t_Log "Running $0 Basic tests" + +echo "Check packace files exist" +[[ -d /etc/default ]] || { t_Log "FAIL: /etc/default missing"; exit $FAIL; } +[[ -e /etc/default/useradd ]] || { t_Log "FAIL: /etc/default/useradd missing"; exit $FAIL; } +[[ -e /etc/login.defs ]] || { t_Log "FAIL: /etc/login.defs missing"; exit $FAIL; } +t_Log "PASS" diff --git a/tests/p_shadow-utils/11-useradd_tests b/tests/p_shadow-utils/11-useradd_tests new file mode 100755 index 0000000..10f8fd8 --- /dev/null +++ b/tests/p_shadow-utils/11-useradd_tests @@ -0,0 +1,14 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0" + +grep -q "^shadowuser" /etc/passwd && userdel -r shadowuser + +# Basic useradd tests +echo "Add user shadowuser" +useradd shadowuser +t_CheckExitStatus $? +echo "Check user was created" +grep -q "^shadowuser" /etc/passwd +t_CheckExitStatus $? \ No newline at end of file diff --git a/tests/p_shadow-utils/12-usermod_tests b/tests/p_shadow-utils/12-usermod_tests new file mode 100755 index 0000000..17a86c5 --- /dev/null +++ b/tests/p_shadow-utils/12-usermod_tests @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0 - Modify user shadowuser" + +usermod -c "Comment plugh" shadowuser +t_CheckExitStatus $? +echo "Check /etc/passwd was modified" +grep "^shadowuser" /etc/passwd | grep -q "Comment plugh" +t_CheckExitStatus $? + diff --git a/tests/p_shadow-utils/13-chpasswd_tests b/tests/p_shadow-utils/13-chpasswd_tests new file mode 100755 index 0000000..cb47fc5 --- /dev/null +++ b/tests/p_shadow-utils/13-chpasswd_tests @@ -0,0 +1,12 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0 - Checking chpasswd" + +chpasswd -e < + +t_Log "Running $0 - Testing newusers" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +grep -q "^xyssy" /etc/passwd && { t_Log "FAIL: user xyssy alredy exists"; exit $FAIL; } +newusers < + +t_Log "Running $0 - Checking lastlog" +lastlog -u shadowuser | grep -q '**Never logged in**' +t_CheckExitStatus $? diff --git a/tests/p_shadow-utils/19-userdel_tests b/tests/p_shadow-utils/19-userdel_tests new file mode 100755 index 0000000..096d68c --- /dev/null +++ b/tests/p_shadow-utils/19-userdel_tests @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0 - Delete user shadowuser" +userdel -r shadowuser +t_CheckExitStatus $? +echo "Check user was deleted" +grep -q "^shadowuser" /etc/passwd && { t_Log "FAIL: shadowuser not deletd"; exit $FAIL;} +t_Log "PASS" diff --git a/tests/p_shadow-utils/20-chage_tests b/tests/p_shadow-utils/20-chage_tests new file mode 100755 index 0000000..5f85c97 --- /dev/null +++ b/tests/p_shadow-utils/20-chage_tests @@ -0,0 +1,15 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0" + +userdel -rf testshadow; useradd testshadow +echo "testshadow" | passwd --stdin testshadow + +echo "Set last date passwd changed to 2013-01-01" +chage -d 2013-01-01 testshadow +t_CheckExitStatus $? + +echo "Check that last passwd change is reported correctly" +chage -l testshadow | grep Last | grep -q "Jan 01, 2013" +t_CheckExitStatus $? diff --git a/tests/p_shadow-utils/30-groupadd_tests b/tests/p_shadow-utils/30-groupadd_tests new file mode 100755 index 0000000..79f4617 --- /dev/null +++ b/tests/p_shadow-utils/30-groupadd_tests @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Iain Douglas +t_Log "Running $0 group add tests" + +# Delete any info from previous runs, use sed because we haven't yet tested +# groupdel +sed -i /testgroup/d /etc/group + +echo "Create a new group" +groupadd -g 1010 testgroup +t_CheckExitStatus $? diff --git a/tests/p_shadow-utils/31-gpasswd_tests b/tests/p_shadow-utils/31-gpasswd_tests new file mode 100755 index 0000000..179d61c --- /dev/null +++ b/tests/p_shadow-utils/31-gpasswd_tests @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Iain Douglas +t_Log "Running $0 - gpasswd tests" + +echo "Add a user to testgroup and create /etc/gshadow" +gpasswd -a testshadow testgroup +t_CheckExitStatus $? diff --git a/tests/p_shadow-utils/32-groupmems_tests b/tests/p_shadow-utils/32-groupmems_tests new file mode 100755 index 0000000..7e3cc90 --- /dev/null +++ b/tests/p_shadow-utils/32-groupmems_tests @@ -0,0 +1,8 @@ +#!/bin/bash +# Author: Iain Douglas +[ $centos_ver == '5' ] && exit +t_Log "Running $0 - group add tests" + +echo "Simple groupmems test" +groupmems -g testgroup -l | grep -q "testshadow" +t_CheckExitStatus $? diff --git a/tests/p_shadow-utils/33-newgrp_tests b/tests/p_shadow-utils/33-newgrp_tests new file mode 100755 index 0000000..41c1da2 --- /dev/null +++ b/tests/p_shadow-utils/33-newgrp_tests @@ -0,0 +1,16 @@ +#!/bin/bash +# Author: Iain Douglas + +# Check that the user can change their primary group. This relies on the +# observation that the current primary group is printed first +# +t_Log "Running $0 - Basic newgrp test" +groups testshadow | grep -q "testshadow testgroup" || { t_Log "FAIL: Default testshadow user group information incorrect"; exit $FAIL; } +echo OK +echo $( su - testshadow < + +t_Log "Running $0" + +# Check that the testgroup exists with GID 1010 +grep -q "testgroup:x:1010:testshadow" /etc/group || { t_Log "FAIL Test group doesn't exist"; exit $FAIL; } + +echo "Changing GID for group testgroup to 1011" +groupmod -g 1011 testgroup +t_CheckExitStatus $? diff --git a/tests/p_shadow-utils/35-grpck-tests b/tests/p_shadow-utils/35-grpck-tests new file mode 100755 index 0000000..e48b68d --- /dev/null +++ b/tests/p_shadow-utils/35-grpck-tests @@ -0,0 +1,23 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0" + +# If we're on C5 delete the group 990991 which was added by newusers +if (( $centos_ver == 5 )) +then + sed -i /990991/d /etc/group +fi +echo "Testing valid files" +[[ -e /etc/group ]] || { t_Log { "FAIL: /etc/group doesn't exist"; exit $FAIL; } +#Check system files +echo "Checking /etc files are correect" +grpck +t_CheckExitStatus $? +echo "Checking malformed files are detected" + +echo "test:x::" >/var/tmp/gshadow +echo ":test:x:0::" >/var/tmp/group +grpck -r /var/tmp/group /var/tmp/gshadow && { t_Log "FAIL: Malformed files not detected"; exit $FAIL; } +t_Log "PASS" +rm /var/tmp/group /var/tmp/gshadow diff --git a/tests/p_shadow-utils/36-groupdel-tests b/tests/p_shadow-utils/36-groupdel-tests new file mode 100755 index 0000000..8677902 --- /dev/null +++ b/tests/p_shadow-utils/36-groupdel-tests @@ -0,0 +1,34 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0" + +# Check that we can delete the testgroup +echo "Check we can delete the group 'testgroup'" + +grep -q testgroup /etc/group || { t_Log "FAIL: testgroup doesn't exist"; exit $FAIL; } +groupdel testgroup +t_CheckExitStatus $? + +# Try and remove the same group shoudl fail +echo "Additional tests - non existent group" +groupdel testgroup +if (( $? == 6 )) +then + t_Log "PASS" +else + t_Log "Fail" + exit $FAIL +fi + +# Try and remove a user's primary group - should fail +echo "Additional tests - users primary group" +groupdel testshadow +if (( $? == 8 )) +then + t_Log "PASS" +else + t_Log "Fail" + exit $FAIL +fi + diff --git a/tests/p_shadow-utils/37-grpconv-tests b/tests/p_shadow-utils/37-grpconv-tests new file mode 100755 index 0000000..52dfa81 --- /dev/null +++ b/tests/p_shadow-utils/37-grpconv-tests @@ -0,0 +1,28 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0" +# Test grpconv +cleanup() { +echo "Reverting files to original state" +[[ -e /var/tmp/grpconv/gshadow ]] && cp /var/tmp/grpconv/* /etc && rm -r /var/tmp/grpconv +} + +# Check we have a group file to work with and exit if not +[[ -e /etc/group ]] || { t_Log "Fail: /etc/group does not exist"; exit $FAIL; } + +mkdir -p /var/tmp/grpconv &>/dev/null + +# If it exists, save the /etc/gshadow file then delete it +[[ -e /etc/gshadow ]] && cp /etc/gshadow /var/tmp/gconv || { t_Log "FAIL: unable to make a safe copy of /etc/gshadow"; exit $FAIL; } + +[[ -e /etc/gshadow ]] && rm /etc/gshadow || { t_Log "FAIL: unable to remove /etc/gshadow"; exit $FAIL;} + +trap cleanup EXIT +echo "Test grpconv creates a new /etc/gshadow" +grpconv +t_CheckExitStatus $? +echo "Check format is correct with grpck" +grpck +t_CheckExitStatus $? + diff --git a/tests/p_shadow-utils/38-grpunconv-tests b/tests/p_shadow-utils/38-grpunconv-tests new file mode 100755 index 0000000..76eec52 --- /dev/null +++ b/tests/p_shadow-utils/38-grpunconv-tests @@ -0,0 +1,24 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0" +cleanup() { +echo "Reverting files to original state" +[[ -d /var/tmp/grpunconv ]] && cp /var/tmp/grpunconv/* /etc && rm -r /var/tmp/grpunconv +} + +# Test grpunconv +# Check we have both /etc/group and /etc/gshadow then save them +[[ -e /etc/group && -e /etc/gshadow ]] || { t_Log "FAIL: missing source file"; exit $FAIL; } + +mkdir -p /var/tmp/grpunconv || { t_Log "FAIL: Unable to create directory to save source files in "; exit $FAIL; } +cp /etc/group /etc/gshadow /var/tmp/grpunconv || { t_Log "FAIL: Unable to save source files"; exit $FAIL; } + +#Check the source files are sane +echo "Checking source files are sane" +grpck +t_CheckExitStatus $? +trap cleanup EXIT +echo "Converting /etc/group and /etc/gshadow to merged /etc/group" +grpunconv +t_CheckExitStatus $? diff --git a/tests/p_shadow-utils/39-sg_tests b/tests/p_shadow-utils/39-sg_tests new file mode 100755 index 0000000..c25b873 --- /dev/null +++ b/tests/p_shadow-utils/39-sg_tests @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Iain Douglas +t_Log "Running $0 - Testing sg" +sg testshadow "touch /var/tmp/sg" +t_CheckExitStatus $? +echo "Check sg worked" +ls -l /var/tmp/sg | grep -q testshadow +t_CheckExitStatus $? +rm /var/tmp/sg diff --git a/tests/p_shadow-utils/40-pwck_tests b/tests/p_shadow-utils/40-pwck_tests new file mode 100755 index 0000000..ac27fe3 --- /dev/null +++ b/tests/p_shadow-utils/40-pwck_tests @@ -0,0 +1,22 @@ +#!/bin/bash +# Author: Iain Douglas + +# Even on a completely new clean system pwck fails because some accounts +# (e.g. adm) aren't created correctly so all we can really test is dummy +# files. + +t_Log "Running $0" + +echo "Check pwck passes correctly formed files" +echo "test:x:500:500::/tmp:/bin/bash" >/var/tmp/passwd +echo "test:$6$.vxxSAQB$4hvumoZoQ/83Z9PGKFYnFyEzFztcYky6zLUBKf/40MUTJzfzjWCHd/0bVdYXWc8OgyA31.:15656:0:99999:7:::" >/var/tmp/shadow +pwck -rq /var/tmp/passwd /var/tmp/shadow +t_CheckExitStatus "$?" + +# Check for malformed files +echo "Checking pwck detects malformed files" +echo ":test:x:500:500::/tmp:/bin/bash" >/var/tmp/passwd +echo "test:$6$.vxxSAQB$4hvumoZoQ/83Z9PGKFYnFyEzFztcYky6zLUBKf/40MUTJzfzjWCHd/0bVdYXWc8OgyA31.:15656:0:99999:7:::" >/var/tmp/shadow +pwck -rq /var/tmp/passwd /var/tmp/shadow && { t_Log "FAIL: Malformed files not detected"; exit $FAIL; } +t_Log "PASS" +rm /var/tmp/passwd /var/tmp/shadow diff --git a/tests/p_shadow-utils/41-pwconv_tests b/tests/p_shadow-utils/41-pwconv_tests new file mode 100755 index 0000000..5b8b4eb --- /dev/null +++ b/tests/p_shadow-utils/41-pwconv_tests @@ -0,0 +1,25 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0" +echo "*****************************************************************" +echo "Note: The original /etc/passwd and /etc/shadow files are saved to" +echo "directory /var/tmp/pwconv". +echo "*****************************************************************" + +cleanup(){ +echo "Reverting files to original state" +[[ -d /var/tmp/pwconv ]] && cp /var/tmp/pwconv/* /etc +t_CheckExitStatus $? +} + +# check that /etc/passwd and /etc/shadow exist before continuing. +[[ -e /etc/passwd && -e /etc/shadow ]] || { t_Log "FAIL: missing source file"; exit $FAIL; } + +mkdir -p /var/tmp/pwconv || { t_Log "FAIL: Unable to create directory to save source files in "; exit $FAIL; } +cp /etc/passwd /etc/shadow /var/tmp/pwconv || { t_Log "FAIL: Unable to save source files"; exit $FAIL; } +trap cleanup EXIT +echo "Running pwconv" +pwconv +t_CheckExitStatus $? + diff --git a/tests/p_shadow-utils/42-pwunconv_tests b/tests/p_shadow-utils/42-pwunconv_tests new file mode 100755 index 0000000..6c00213 --- /dev/null +++ b/tests/p_shadow-utils/42-pwunconv_tests @@ -0,0 +1,25 @@ +#!/bin/bash +# Author: Iain Douglas + +t_Log "Running $0" +echo "*****************************************************************" +echo "Note: The original /etc/passwd and /etc/shadow files are saved to" +echo "directory /var/tmp/pwunconv". +echo "*****************************************************************" + +cleanup(){ +echo "Reverting files to original state" +[[ -d /var/tmp/pwunconv ]] && cp /var/tmp/pwunconv/* /etc +t_CheckExitStatus $? +} + +# check that /etc/passwd and /etc/shadow exist before continuing. +[[ -e /etc/passwd && -e /etc/shadow ]] || { t_Log "FAIL: missing source file"; exit $FAIL; } + +mkdir -p /var/tmp/pwunconv || { t_Log "FAIL: Unable to create directory to save source files in "; exit $FAIL; } +cp /etc/passwd /etc/shadow /var/tmp/pwunconv || { t_Log "FAIL: Unable to save source files"; exit $FAIL; } +trap cleanup EXIT +echo "Running pwunconv" +pwunconv +t_CheckExitStatus $? + diff --git a/tests/p_shadow-utils/99-cleanup b/tests/p_shadow-utils/99-cleanup new file mode 100755 index 0000000..c188788 --- /dev/null +++ b/tests/p_shadow-utils/99-cleanup @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Iain Douglas + +# Have a go at cleaning up the temporary files and accounts etc +userdel -r xyssy &>/dev/null +userdel -r testshadow &>/dev/null +rm -r /var/tmp/pwconv +rm -r /var/tmp/grpconv +rm -r /var/tmp/pwunconv + + diff --git a/tests/p_shim/01_shim_secureboot_signed.sh b/tests/p_shim/01_shim_secureboot_signed.sh new file mode 100755 index 0000000..7da667f --- /dev/null +++ b/tests/p_shim/01_shim_secureboot_signed.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# This test will verify that shim.efi is correctly signed with correct cert in the CA chain + +t_Log "Running $0 - Verifying that shim.efi is correctly signed with correct cert" + +if [[ "$centos_ver" = "7" && "$arch" = "x86_64" ]] ; then + t_InstallPackage pesign shim + pesign --show-signature --in /boot/efi/EFI/centos/shim.efi|grep -q 'Microsoft Windows UEFI Driver Publisher' + t_CheckExitStatus $? +elif [[ "$centos_ver" -ge "8" && "$arch" = "x86_64" ]] ; then + t_InstallPackage pesign shim + pesign --show-signature --in /boot/efi/EFI/centos/shimx64.efi |grep -q 'Microsoft Windows UEFI Driver Publisher' + t_CheckExitStatus $? +else + t_Log "previous versions than CentOS 7 - or not x86_64 arch - aren't using shim/secureboot ... skipping" + exit 0 +fi + diff --git a/tests/p_spamassassin/0-install_spamassassin.sh b/tests/p_spamassassin/0-install_spamassassin.sh new file mode 100755 index 0000000..8338751 --- /dev/null +++ b/tests/p_spamassassin/0-install_spamassassin.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_InstallPackage spamassassin + diff --git a/tests/p_spamassassin/spamassassin_test.sh b/tests/p_spamassassin/spamassassin_test.sh new file mode 100755 index 0000000..f4435c3 --- /dev/null +++ b/tests/p_spamassassin/spamassassin_test.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - check that spamassassin can detect spam." + +if [ "$centos_ver" -lt 8 ] ; then +VERSION=-`t_GetPkgVer spamassassin` +fi +spamassassin --lint &&\ +spamassassin < /usr/share/doc/spamassassin${VERSION}/sample-spam.txt | grep -q 'X-Spam-Flag: YES' + +t_CheckExitStatus $? diff --git a/tests/p_sphere-gpg-keys/01-check_gpg_key_presence.sh b/tests/p_sphere-gpg-keys/01-check_gpg_key_presence.sh new file mode 100755 index 0000000..cf5d644 --- /dev/null +++ b/tests/p_sphere-gpg-keys/01-check_gpg_key_presence.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +echo "$0: Тест наличия GPG ключей" + +source library/sh_lib.sh + +check=0 + +ls -l /etc/pki/rpm-gpg/RPM-GPG-KEY-MSVSphere-9 + +check=$(eq_is_success ${check} 0) + +check_test_status ${check} "$0" +exit ${check} diff --git a/tests/p_sqlite/0-install_sqlite.sh b/tests/p_sqlite/0-install_sqlite.sh new file mode 100755 index 0000000..5775872 --- /dev/null +++ b/tests/p_sqlite/0-install_sqlite.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_InstallPackage sqlite + diff --git a/tests/p_sqlite/sqlite_1-create_db_table.sh b/tests/p_sqlite/sqlite_1-create_db_table.sh new file mode 100755 index 0000000..2dbd733 --- /dev/null +++ b/tests/p_sqlite/sqlite_1-create_db_table.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - check that sqlite can create database and tables." + +sqlite3 /tmp/tf_test.db 'drop table if exists tf_table;' +sqlite3 /tmp/tf_test.db 'create table tf_table(text, id INTEGER);' + +t_CheckExitStatus $? diff --git a/tests/p_sqlite/sqlite_2-insert_table.sh b/tests/p_sqlite/sqlite_2-insert_table.sh new file mode 100755 index 0000000..20c93e8 --- /dev/null +++ b/tests/p_sqlite/sqlite_2-insert_table.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - check that sqlite can insert into table." + +sqlite3 /tmp/tf_test.db "insert into tf_table values ('tf_sample_text',1);" + +t_CheckExitStatus $? diff --git a/tests/p_sqlite/sqlite_dump_db.sh b/tests/p_sqlite/sqlite_dump_db.sh new file mode 100755 index 0000000..ba1d0c0 --- /dev/null +++ b/tests/p_sqlite/sqlite_dump_db.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - check that sqlite can dump database." + +sqlite3 /tmp/tf_test.db ".dump" | grep -q 'tf_sample_text' + +t_CheckExitStatus $? diff --git a/tests/p_sqlite/sqlite_select_table.sh b/tests/p_sqlite/sqlite_select_table.sh new file mode 100755 index 0000000..3f26544 --- /dev/null +++ b/tests/p_sqlite/sqlite_select_table.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - check that sqlite can select from table." + +sqlite3 /tmp/tf_test.db "select * from tf_table;" | grep -q 'tf_sample_text' + +t_CheckExitStatus $? diff --git a/tests/p_squid/0-install_squid.sh b/tests/p_squid/0-install_squid.sh new file mode 100755 index 0000000..4ba3691 --- /dev/null +++ b/tests/p_squid/0-install_squid.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "$0 - installing Squid" +t_InstallPackage squid + +# Add host entry +echo "127.0.0.1 `hostname`" >> /etc/hosts + +service squid restart +t_CheckForPort 3128 + diff --git a/tests/p_squid/squid_test.sh b/tests/p_squid/squid_test.sh new file mode 100755 index 0000000..ba81826 --- /dev/null +++ b/tests/p_squid/squid_test.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - Squid test." + +if [ $SKIP_QA_HARNESS -eq 1 ]; then + URL="http://mirror.centos.org/" + CHECK_FOR="timestamp" +else + URL="http://repo.centos.qa/qa/" + CHECK_FOR="ks_cfg" +fi + +squidclient -T 2 ${URL} | grep "${CHECK_FOR}" >/dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_squirrelmail/0-install_squirrelmail.sh b/tests/p_squirrelmail/0-install_squirrelmail.sh new file mode 100755 index 0000000..36ea64e --- /dev/null +++ b/tests/p_squirrelmail/0-install_squirrelmail.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +# NOTE: squirrelmail rpm has require: httpd php php-mbstring +# Squirellmail has been removed from el6 + +t_Log "Running $0 - install squirrelmail" +if [ "$centos_ver" -gt "5" ] ;then + t_Log "It seems to be a CentOS $centos_ver system, this test will be disabled -> SKIP" + exit 0 +else + t_InstallPackage squirrelmail + t_ServiceControl httpd restart +fi diff --git a/tests/p_squirrelmail/squirrelmail_test.sh b/tests/p_squirrelmail/squirrelmail_test.sh new file mode 100755 index 0000000..5971c9e --- /dev/null +++ b/tests/p_squirrelmail/squirrelmail_test.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Athmane Madjoudj +t_Log "Running $0 - test SquirrelMail URL" + +if [ "$centos_ver" -gt "5" ] ;then + t_Log "It seems to be a CentOS $centos_ver system, this test will be disabled -> SKIP" + exit 0 +else + curl -s http://localhost/webmail/src/login.php | grep 'SquirrelMail' > /dev/null 2>&1 +fi + +t_CheckExitStatus $? diff --git a/tests/p_strace/0-install_strace.sh b/tests/p_strace/0-install_strace.sh new file mode 100755 index 0000000..792b964 --- /dev/null +++ b/tests/p_strace/0-install_strace.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) + +# Strace stack tracer package +t_InstallPackage strace diff --git a/tests/p_strace/5-test_strace.sh b/tests/p_strace/5-test_strace.sh new file mode 100755 index 0000000..3ecfbc7 --- /dev/null +++ b/tests/p_strace/5-test_strace.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +t_Log "Running $0 - checking strace runs and returns non-zero exit status." + +STRACE=`which strace` + +[ "$STRACE" ] || { t_Log "Failed to find strace. Cannot continue."; exit $FAIL; } + +$STRACE ls &>/dev/null + +[ $? -eq 0 ] || { t_Log "Strace exited with non-zero status. That ain't good..."; exit $FAIL; } diff --git a/tests/p_subversion/0-install_subversion.sh b/tests/p_subversion/0-install_subversion.sh new file mode 100755 index 0000000..5a84e37 --- /dev/null +++ b/tests/p_subversion/0-install_subversion.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Madhurranjan Mohaan + +t_Log "Running $0 - installing subversion" + +# Install subversion subversion +t_InstallPackage subversion diff --git a/tests/p_subversion/10-test_subversion.sh b/tests/p_subversion/10-test_subversion.sh new file mode 100755 index 0000000..be6b0ff --- /dev/null +++ b/tests/p_subversion/10-test_subversion.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Author: Madhurranjan Mohaan + +# Check subversion installation + +t_Log "Running $0 - checking subversion installation" + +svn --version &>/dev/null +t_CheckExitStatus $? diff --git a/tests/p_subversion/15-test_subversion.sh b/tests/p_subversion/15-test_subversion.sh new file mode 100755 index 0000000..841c721 --- /dev/null +++ b/tests/p_subversion/15-test_subversion.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Author: Madhurranjan Mohaan + +t_Log "Running $0 - testing a local subversion repository creation operation" + +temp_dir="/tmp/svnrepo" +temp_repo="tmprepo" +rm -rf $temp_dir/$temp_repo +mkdir -p $temp_dir +cd $temp_dir +svnadmin create $temp_repo + +#verify repo using svnadmin +if [ "svnadmin verify $temp_dir/$temp_repo | grep 'Verified revision 0'" ] +then + ret_val=0 +else + ret_val=1 +fi +t_CheckExitStatus $ret_val diff --git a/tests/p_syslog/syslog_logging.sh b/tests/p_syslog/syslog_logging.sh new file mode 100755 index 0000000..617ea70 --- /dev/null +++ b/tests/p_syslog/syslog_logging.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "Running $0 - check if syslog deamon is working" + +logger "t_functional_logging_test" + +sleep 2 + +if [ "$centos_ver" -ge 8 ]; then + t_Log "Dumping journalctl to /var/log/maillog" + journalctl >> /var/log/messages +fi + +grep "t_functional_logging_test" /var/log/messages > /dev/null 2>&1 + +t_CheckExitStatus $? + diff --git a/tests/p_sysstat/00-install_sysstat.sh b/tests/p_sysstat/00-install_sysstat.sh new file mode 100644 index 0000000..3da2a5f --- /dev/null +++ b/tests/p_sysstat/00-install_sysstat.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) + +# SysStat Performance Monitoring Tools for Linux +t_InstallPackage sysstat + +if [ "$centos_ver" -lt 8 ] ; then + t_InstallPackage psmisc +fi + + diff --git a/tests/p_sysstat/05-iostat-cpu-basic.sh b/tests/p_sysstat/05-iostat-cpu-basic.sh new file mode 100644 index 0000000..bcf8cf6 --- /dev/null +++ b/tests/p_sysstat/05-iostat-cpu-basic.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) + +# A simple iostat test to verify cpu loads are being recorded + +t_Log "Running $0 - a basic iostat test to verify cpu measurement" + +# Save our iostat output +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + +# Clear out the pagecache to get an accurate reading +echo 1 > /proc/sys/vm/drop_caches + +# Capture a storage device name +drive=$(fdisk -l|grep -Po -m1 '^/dev/[\D]+') + +# Run iostat on the cpu +/usr/bin/iostat -c 1 5 >${output_file} 2>&1 & + +# Time for iostat booting +sleep 1 + +# Give the CPU something to chew on +/bin/dd if=$drive bs=4k count=25000 2>/dev/null|sha1sum -b - &>/dev/null + +# Give iostat a chance to log our task +sleep 6 + +# Extract the CPU utilisation (user field, percentage) +cpu_user_percent=$(awk '$1 ~ /[0-9]/ {$1>a ? a=$1 : $1} END {print int(a)}' ${output_file}) + +# Confirm the CPU registered some level of user activity + +if [ "$cpu_user_percent" -eq 0 ]; then + t_Log "FAIL: ${0}: no cpu activity registered" + cat ${output_file} + t_CheckExitStatus 1 +fi + +t_CheckExitStatus 0 diff --git a/tests/p_sysstat/10-iostat-disk-basic.sh b/tests/p_sysstat/10-iostat-disk-basic.sh new file mode 100644 index 0000000..6146e62 --- /dev/null +++ b/tests/p_sysstat/10-iostat-disk-basic.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) + +# A simple iostat test to verify transfers are being recorded + +t_Log "Running $0 - a basic iostat test to verify disk measurement" + +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + +# dd options +bs=4196 +count=10100 +sum=$(expr $bs \* $count / 1024) + + +# Clear out the pagecache to get an accurate reading +echo 1 > /proc/sys/vm/drop_caches + +# Capture a storage device name +drive=$(fdisk -l|grep -Po -m1 '^/dev/[\D]+') + +# Run iostat on the device +/usr/bin/iostat -d 1 5 $drive >${output_file} 2>&1 & + +# Time for iostat booting +sleep 1 + +# Generate some read traffic +/bin/dd if=$drive of=/dev/null bs=$bs count=$count &>/dev/null + +# Give iostat a chance to log our traffic +sleep 6 + +# Confirm our read bytes are >0, excluding the first +# line since that's the average since boot. +kbytes_read=$(awk '$6 ~ /[0-9]/ {NR>1 && sum+=$6} END {print int(sum)}' ${output_file}) + +if [ "$kbytes_read" -eq 0 ]; then + t_Log "FAIL: ${0}: no io activity registered" + cat ${output_file} + t_CheckExitStatus 1 +fi + +t_CheckExitStatus 0 diff --git a/tests/p_sysstat/15-mpstat-basic.sh b/tests/p_sysstat/15-mpstat-basic.sh new file mode 100644 index 0000000..bedcaaa --- /dev/null +++ b/tests/p_sysstat/15-mpstat-basic.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) + +# A simple mpstat test to verify cpu load is being measured + +t_Log "Running $0 - a simple mpstat test to verify cpu load is being measured" + +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + +n_cpu=$(nproc) +load=$((${n_cpu}/2)) +if [ "${load}" -eq 0 ]; then + load=1 +fi + +/usr/bin/mpstat 1 5 >${output_file} 2>&1 & + +# Time for iostat booting +sleep 1 + +# Give the CPU something to chew on +for i in $(seq 1 ${load}); do + sha1sum /dev/zero & +done + +# Give mpstat a chance to log our task +sleep 6 + +killall sha1sum + +cpu_user_percent=$(awk '$4 ~ /[0-9]\./ {$4>a ? a=$4 : $4} END {print int(a)}' ${output_file}) + +if [ "$cpu_user_percent" -eq 0 ]; then + t_Log "FAIL: ${0}: no cpu activity registered" + cat ${output_file} + t_CheckExitStatus 1 +fi + +t_CheckExitStatus 0 diff --git a/tests/p_sysstat/20-pidstat-basic.sh b/tests/p_sysstat/20-pidstat-basic.sh new file mode 100644 index 0000000..00b13a5 --- /dev/null +++ b/tests/p_sysstat/20-pidstat-basic.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + +t_Log "Running $0 - pidstat test" + +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + +if ! pidstat 1 1 > ${output_file} 2>&1; then + cat ${output_file} + exit 1 +fi diff --git a/tests/p_sysstat/25-sa-tests.sh b/tests/p_sysstat/25-sa-tests.sh new file mode 100644 index 0000000..87bae44 --- /dev/null +++ b/tests/p_sysstat/25-sa-tests.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Author: Carlos Rodriguez-Fernandez + +t_Log "Running $0 - sa tests" + +tests_in_order=( + "/usr/lib64/sa/sa1 --boot" + "sar -u | grep -q -e 'LINUX RESTART'" + "/usr/lib64/sa/sa1 1 1" + "sleep 3 && /usr/lib64/sa/sa1 1 1 && sar -u | grep -q -e 'Average'" + "/usr/lib64/sa/sa2 -A" +) + +output_file=$(mktemp) +trap "rm -f ${output_file}" EXIT + +for cmd in "${tests_in_order[@]}"; do + t_Log "Running $0 - sa test: ${cmd}" + if ! eval "${cmd}" > ${output_file} 2>&1; then + t_Log "FAIL: $0: sa test: ${cmd}" + cat ${output_file} + exit 1 + else + t_Log "PASS: $0: sa test: ${cmd}" + fi +done diff --git a/tests/p_systemd/10-systemctl_list_services.sh b/tests/p_systemd/10-systemctl_list_services.sh new file mode 100755 index 0000000..35c4359 --- /dev/null +++ b/tests/p_systemd/10-systemctl_list_services.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Rene Diepstraten + +t_Log "Running $0 - Checking if systemctl can check if a service is enabled" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +[ ${centos_ver} -lt 7 ] && { t_Log "Systemd is part of el since el7, skipping systemd tests..." ; exit ; } + +# auditd is used as example because it's standard with minimal install + +systemctl is-enabled auditd.service > /dev/null + +t_CheckExitStatus $? \ No newline at end of file diff --git a/tests/p_systemd/15-systemctl_list_non-native-services.sh b/tests/p_systemd/15-systemctl_list_non-native-services.sh new file mode 100755 index 0000000..2656aa1 --- /dev/null +++ b/tests/p_systemd/15-systemctl_list_non-native-services.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Rene Diepstraten + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +[ ${centos_ver} -lt 7 ] && exit +t_Log "Running $0 - Checking if systemctl can check if a non-native service is enabled" + +systemctl is-enabled kdump.service 2> /dev/null | grep -q -E 'enabled|disabled' + +t_CheckExitStatus $? diff --git a/tests/p_systemd/20-systemctl_list-service-status.sh b/tests/p_systemd/20-systemctl_list-service-status.sh new file mode 100755 index 0000000..7a5ac70 --- /dev/null +++ b/tests/p_systemd/20-systemctl_list-service-status.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Author: Rene Diepstraten + +[ ${centos_ver} -lt 7 ] && exit +t_Log "Running $0 - checking if systemctl can check a service status" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +systemctl is-active auditd.service > /dev/null + +t_CheckExitStatus $? \ No newline at end of file diff --git a/tests/p_systemd/25-journalctl.sh b/tests/p_systemd/25-journalctl.sh new file mode 100755 index 0000000..8325a00 --- /dev/null +++ b/tests/p_systemd/25-journalctl.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Author: Rene Diepstraten + +[ ${centos_ver} -lt 7 ] && exit +t_Log "Running $0 - Testing journalctl for teststring" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +teststring=098f6bcd4621d373cade4e832627b4f6 +timenow=$(date +'%T') +echo ${teststring} > /dev/kmsg +sleep 1 +journalctl --since ${timenow} | grep -q ${teststring} + +t_CheckExitStatus $? diff --git a/tests/p_tar/0_install_tar.sh b/tests/p_tar/0_install_tar.sh new file mode 100755 index 0000000..a897dbf --- /dev/null +++ b/tests/p_tar/0_install_tar.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - attempting to install tar." +t_InstallPackage tar + diff --git a/tests/p_tar/10-tar-test.sh b/tests/p_tar/10-tar-test.sh new file mode 100755 index 0000000..660a2c6 --- /dev/null +++ b/tests/p_tar/10-tar-test.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Author: Christoph Galuschka + +t_Log "Running $0 - tar create and extract archive test." + +# create dir and two files +TARDIR='/var/tmp/tar-test' +FILE1=$TARDIR/file1.txt +FILE2=$TARDIR/file2.txt + +mkdir -p $TARDIR +cat > $FILE1 < $FILE2 < /dev/null 2>&1 +/bin/rm -rf $TARDIR +if [ -e $TARDIR ] + then + t_Log "something went wrong with deleting $TARDIR" + exit +fi + +#reextract from tar +tar -C / -xf /var/tmp/tarfile.tar +#checking file contents +grep -q 'file #1' $FILE1 +RESULT1=$? +grep -q 'file #2' $FILE2 +RESULT2=$? + +if ([ $RESULT1 == 0 ] && [ $RESULT2 == 0 ]) + then + ret_val=0 +fi + +t_CheckExitStatus $ret_val + +#reversing changes +/bin/rm -rf /var/tmp/tarfile.tar $TARDIR diff --git a/tests/p_tcl/0-install_tcl.sh b/tests/p_tcl/0-install_tcl.sh new file mode 100755 index 0000000..4670ec7 --- /dev/null +++ b/tests/p_tcl/0-install_tcl.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Madhurranjan Mohaan + +t_Log "$0 - installing Tcl" +t_InstallPackage tcl + diff --git a/tests/p_tcl/10-test_tclsh.sh b/tests/p_tcl/10-test_tclsh.sh new file mode 100755 index 0000000..46511ff --- /dev/null +++ b/tests/p_tcl/10-test_tclsh.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Author: Madhurranjan Mohaan + +t_Log "Running $0 - Testing tclsh by running it with a basic file" + +echo 'puts "helloworld tclpackage"' > testfile +tclsh testfile + +t_CheckExitStatus $? diff --git a/tests/p_tcpdump/00_install_tcpdump.sh b/tests/p_tcpdump/00_install_tcpdump.sh new file mode 100755 index 0000000..b8a4035 --- /dev/null +++ b/tests/p_tcpdump/00_install_tcpdump.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - install package tcpdump and psmisc" +t_InstallPackage tcpdump psmisc + diff --git a/tests/p_tcpdump/01_tcpdump_nic.sh b/tests/p_tcpdump/01_tcpdump_nic.sh new file mode 100755 index 0000000..bddf9c7 --- /dev/null +++ b/tests/p_tcpdump/01_tcpdump_nic.sh @@ -0,0 +1,49 @@ +#!/bin/sh +# Author: Christoph Galuschka +# Athmane Madjoudj + +t_Log "Running $0 - TCPdump test to Default-GW with IPv4" + +# Grabing Default-Router if NIC +def_gw=$(ip route list default|grep "default via"|head -n 1|awk '{print $3}') +eth_int=$(ip addr|grep -B 1 "link/ether"|head -n 1|awk '{print $2}'|tr -d ':') + + t_Log "Found Default-GW - starting tcpdump test" + #Dumping 4 pings via NIC to file + FILE='/var/tmp/nic_test.pcap' + COUNT='4' + tcpdump -i $eth_int -q -n -p -w $FILE & + # If we don't wait a short time, the first paket will be missed by tcpdump + sleep 1 + ping -q -c $COUNT -i 0.25 ${def_gw} > /dev/null 2>&1 + sleep 1 + killall -s SIGINT tcpdump + sleep 1 + # reading from file, for each ping we should see two pakets + WORKING=$( tcpdump -r $FILE | grep -ci icmp ) + if [ $SKIP_QA_HARNESS -eq 1 ] + then + # treat qa-harness and non qa-harness differently, + # the script will always succeed outside qa, but will log results + ret_val=0 + if [ $WORKING != $[COUNT*2] ] + then + t_Log "ping to Default-Gateway did not return the number of pakets we expect. "$WORKING" of "$[COUNT*2]" pakets were dumped to file" + else + t_Log "ping to Default-Gateway looks OK. "$WORKING" of "$[COUNT*2]" pakets were dumped to file" + fi + else + # in qa-harness, which is a controlled environment, the script will fail at odd results + if [ $WORKING == $[COUNT*2] ] || [ $WORKING -gt $[COUNT*2] ] + then + t_Log "QA-harness: ping to Default-Gateway looks OK. At least "$[COUNT*2]" pakets ("$WORKING") were dumped to file" + ret_val=0 + else + t_Log "QA-harness: ping to Default-Gateway droped pakets!! Only "$WORKING" of "$[COUNT*2]" entries were found!!" + ret_val=1 + fi + fi +# Remove file afterwards +/bin/rm $FILE + +t_CheckExitStatus $ret_val diff --git a/tests/p_tcpdump/02_tcpdump_lo.sh b/tests/p_tcpdump/02_tcpdump_lo.sh new file mode 100755 index 0000000..4be9aad --- /dev/null +++ b/tests/p_tcpdump/02_tcpdump_lo.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# Author: Christoph Galuschka +# Athmane Madjoudj + +t_Log "Running $0 - TCPdump test to lo" + + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +#Dumping pings to loopback to file +FILE='/var/tmp/lo_test.pcap' +COUNT='4' + +tcpdump -q -n -p -i lo -w $FILE & +# If we don't wait a short time, the first paket will be missed by tcpdump +sleep 1 +ping -q -c $COUNT -i 0.25 127.0.0.1 > /dev/null 2>&1 +sleep 1 +killall -s SIGINT tcpdump +sleep 1 +# reading from file, for each ping we should see two pakets +WORKING=$( tcpdump -r $FILE | grep -ci icmp ) +if [ $WORKING == $[COUNT*2] ] + then + ret_val=0 +else + t_Log "ping to loopback droped pakets!! This should not happen on loopback" + ret_val=1 +fi + +# Remove file afterwards +/bin/rm $FILE + +t_CheckExitStatus $ret_val diff --git a/tests/p_tcpdump/03_tcpdump_lo_ipv6.sh b/tests/p_tcpdump/03_tcpdump_lo_ipv6.sh new file mode 100755 index 0000000..6114c7c --- /dev/null +++ b/tests/p_tcpdump/03_tcpdump_lo_ipv6.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# Author: Christoph Galuschka +# Athmane Madjoudj + +t_Log "Running $0 - TCPdump test IPv6 to lo" + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +# Grabing IPv6 address of lo to check if IPv6 is enabled +IP=$(ip addr list lo | grep 'inet6 ') +regex='\t*inet6\ (.*)\/.*' +if [[ $IP =~ $regex ]] + then + t_Log "IPv6 seems to be enabled - runing test" + FILE='/var/tmp/lo_test6.pcap' + COUNT='4' + #Dumping ping6s to loopback to file + tcpdump -q -n -p -i lo -w $FILE & + # If we don't wait a short time, the first paket will be missed by tcpdump + sleep 1 + ping6 -q -c $COUNT -i 0.25 ::1 > /dev/null 2>&1 + sleep 1 + killall -s SIGINT tcpdump + sleep 1 + + # reading from file, for each ping we should see two pakets + WORKING=$( tcpdump -r $FILE | grep -ci icmp6 ) + if [ $WORKING == $[COUNT*2] ]; then + ret_val=0 + else + t_Log "ping6 to loopback droped pakets!! This should not happen on loopback" + ret_val=1 + fi + # Remove file afterwards + /bin/rm $FILE +else + t_Log "IPv6 seems to be disabled - skipping test" + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_telnet/0-install_telnet.sh b/tests/p_telnet/0-install_telnet.sh new file mode 100755 index 0000000..efc877d --- /dev/null +++ b/tests/p_telnet/0-install_telnet.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Madhurranjan Mohaan + +t_Log "Running $0 - installing telnet" + +# Install Telnet +t_InstallPackage telnet diff --git a/tests/p_telnet/10-test_telnet.sh b/tests/p_telnet/10-test_telnet.sh new file mode 100755 index 0000000..5e42684 --- /dev/null +++ b/tests/p_telnet/10-test_telnet.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Author: Madhurranjan Mohaan + +t_Log "Running $0 - testing telnet against ssh port" +t_Log "Making sure port 22 is listening by calling ssh installer" + +t_InstallPackage openssh-server openssh-clients +t_ServiceControl sshd start + +telnet_port_22=`telnet 127.0.0.1 22 << EOH +EOH` +echo $telnet_port_22 | grep "Escape character is '^]'" +t_CheckExitStatus $? diff --git a/tests/p_tftp-server/0-install_tftp-server.sh b/tests/p_tftp-server/0-install_tftp-server.sh new file mode 100755 index 0000000..848f582 --- /dev/null +++ b/tests/p_tftp-server/0-install_tftp-server.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_InstallPackage tftp-server tftp +if [ "$centos_ver" -le "8" ] ; then +t_InstallPackage xinetd +fi + +# Enable tftp +if [ "$centos_ver" -ge "8" ] ; then +cat <<__EOF__ >/etc/xinetd.d/tftp +service tftp +{ + socket_type = dgram + protocol = udp + wait = yes + user = root + server = /usr/sbin/in.tftpd + server_args = -s /var/lib/tftpboot + disable = no + per_source = 11 + cps = 100 2 + flags = IPv4 +} +__EOF__ +else +sed -i 's/\(disable\s*=\ \)yes/\1no/' /etc/xinetd.d/tftp +fi + +if [ "$centos_ver" -le "8" ] ; then +t_ServiceControl xinetd restart +else +service tftp start +fi diff --git a/tests/p_tftp-server/10-tftp-server_get-test.sh b/tests/p_tftp-server/10-tftp-server_get-test.sh new file mode 100755 index 0000000..59db0ea --- /dev/null +++ b/tests/p_tftp-server/10-tftp-server_get-test.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - tftp-server get file test." + +if [ "$centos_ver" -gt "5" ] ; then + TFTP_DIR=/var/lib/tftpboot +else + TFTP_DIR=/tftpboot +fi + +chmod 777 $TFTP_DIR +echo "t_functional_test" > $TFTP_DIR/tftp_test +tftp 127.0.0.1 -c get tftp_test + +cat tftp_test | grep -q 't_functional_test' +ret_val=$? + +/bin/rm -f tftp_test + +t_CheckExitStatus $ret_val diff --git a/tests/p_tftp-server/20-tftp-server_put-test.sh b/tests/p_tftp-server/20-tftp-server_put-test.sh new file mode 100755 index 0000000..48795ae --- /dev/null +++ b/tests/p_tftp-server/20-tftp-server_put-test.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Christoph Galuschka +# Fabian Arrotin + +t_Log "Running $0 - tftp-server put file test." + +if [ "$centos_ver" -gt "5" ]; then + setsebool tftp_anon_write 1 + TFTP_DIR=/var/lib/tftpboot +else + setsebool allow_tftp_anon_write 1 + chcon -R -t tftpdir_rw_t /tftpboot/ + TFTP_DIR=/tftpboot +fi + + +chmod 777 $TFTP_DIR +echo "t_functional_test" > put_test +touch $TFTP_DIR/put_test +chmod 666 $TFTP_DIR/put_test + + +tftp 127.0.0.1 -c put put_test + +# needed as caught by 7.5.1804 : allowing filesystem to flush to disk otherwise it fails +sleep 2 + +cat $TFTP_DIR/put_test | grep -q 't_functional_test' +ret_val=$? + +#cleaning up +/bin/rm -f put_test +/bin/rm -f $TFTP_DIR/put_test + +t_CheckExitStatus $ret_val diff --git a/tests/p_tmpwatch/0-install_tmpwatch.sh b/tests/p_tmpwatch/0-install_tmpwatch.sh new file mode 100755 index 0000000..e41da59 --- /dev/null +++ b/tests/p_tmpwatch/0-install_tmpwatch.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "$0 - Installing tmpwatch" +t_InstallPackage tmpwatch + diff --git a/tests/p_tmpwatch/tmpwatch_test.sh b/tests/p_tmpwatch/tmpwatch_test.sh new file mode 100755 index 0000000..01dc7dc --- /dev/null +++ b/tests/p_tmpwatch/tmpwatch_test.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - tmpwatch test." + +# create a junk file +touch -t '200001010000' /tmp/tf_test + +tmpwatch 24 /tmp + +[ ! -f /tmp/tf_test ] + +t_CheckExitStatus $? diff --git a/tests/p_tomcat/0-install_tomcat.sh b/tests/p_tomcat/0-install_tomcat.sh new file mode 100755 index 0000000..0fa1984 --- /dev/null +++ b/tests/p_tomcat/0-install_tomcat.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +if [ "$centos_ver" -ge "8" ] ; then + t_Log "Tomcat is not available in CentOS$centos_ver. SKIP" + exit 0 +fi +yum -y remove java\* + +if [ "$centos_ver" = "7" ] ;then + tomcat_packages="tomcat tomcat-admin-webapps tomcat-webapps" +elif [ "$centos_ver" = "6" ]; then + tomcat_packages="tomcat6 tomcat6-admin-webapps tomcat6-webapps" +else + tomcat_packages="tomcat5 tomcat5-admin-webapps tomcat5-webapps" +fi + +t_Log "$0 - installing Tomcat packages" +t_InstallPackage ${tomcat_packages} diff --git a/tests/p_tomcat/1-config_tomcat.sh b/tests/p_tomcat/1-config_tomcat.sh new file mode 100755 index 0000000..40ae553 --- /dev/null +++ b/tests/p_tomcat/1-config_tomcat.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Author: Athmane Madjoudj +if [ "$centos_ver" -ge "8" ] ; then + exit 0 +fi +uname_arch=$(uname -m) + +t_Log "$0 - Configuring Tomcat" + +if [ "$centos_ver" = "7" ] ;then + TOMCAT_SRV_NAME=tomcat + TOMCAT_CONF_DIR=/etc/tomcat/ +elif [ "$centos_ver" = "6" ] ; then + TOMCAT_SRV_NAME=tomcat6 + TOMCAT_CONF_DIR=/etc/tomcat6/ +else + TOMCAT_SRV_NAME=tomcat5 + TOMCAT_CONF_DIR=/etc/tomcat5/ +fi + +if [ "$centos_ver" = "7" ] ;then + sed -i 's/<\/tomcat-users>/\n<\/tomcat-users>/' $TOMCAT_CONF_DIR/tomcat-users.xml +else + sed -i 's/<\/tomcat-users>/\n<\/tomcat-users>/' $TOMCAT_CONF_DIR/tomcat-users.xml +fi + +service $TOMCAT_SRV_NAME restart + +# we need extra sec for tomcat (and even more time for armhfp) +if [ "$uname_arch" == "armv7l" ] ; then + sleep_time="300" +else + sleep_time="10" +fi + +t_Log "Sleeping $sleep_time seconds for $uname_arch" +sleep $sleep_time diff --git a/tests/p_tomcat/tomcat_manager_test.sh b/tests/p_tomcat/tomcat_manager_test.sh new file mode 100755 index 0000000..9ea95f0 --- /dev/null +++ b/tests/p_tomcat/tomcat_manager_test.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# Author: Athmane Madjoudj +if [ "$centos_ver" -ge "8" ] ; then + exit 0 +fi +#uname_arch=$(uname -m) +#if [ "$uname_arch" == "i686" ] ; then +#t_Log "Skipping $0 on $uname_arch" +#exit 0 +#else +t_Log "Running $0 - Tomcat Web Application Manager test." +#fi +curl -u admin:admin -s http://localhost:8080/manager/html | grep "Tomcat Web Application Manager" >/dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_tomcat/tomcat_test.sh b/tests/p_tomcat/tomcat_test.sh new file mode 100755 index 0000000..352d088 --- /dev/null +++ b/tests/p_tomcat/tomcat_test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +if [ "$centos_ver" -ge "8" ] ; then + exit 0 +fi +uname_arch=$(uname -m) +#if [ "$uname_arch" == "i686" ] ; then +#t_Log "Skipping $0 on $uname_arch" +#exit 0 +#else +t_Log "Running $0 - Tomcat basic test." +#fi + +if [ "$centos_ver" = "7" ] ; then + string_tosearch="you've successfully installed Tomcat. Congratulations!" +else + string_tosearch="you've setup Tomcat successfully. Congratulations!" +fi + +curl -s http://localhost:8080/ | grep "${string_tosearch}" >/dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_traceroute/0-install_traceroute.sh b/tests/p_traceroute/0-install_traceroute.sh new file mode 100644 index 0000000..e14bca8 --- /dev/null +++ b/tests/p_traceroute/0-install_traceroute.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - installing package traceroute" +t_InstallPackage traceroute + diff --git a/tests/p_traceroute/traceroute_test.sh b/tests/p_traceroute/traceroute_test.sh new file mode 100644 index 0000000..b6a3a13 --- /dev/null +++ b/tests/p_traceroute/traceroute_test.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# Author: Christoph Galuschka + +TEST=traceroute + +# Testing availability of network +if [ $SKIP_QA_HARNESS -eq 1 ]; then + HOST="www.centos.org" +else + HOST="www.centos.org" +fi + +t_Log "Running $0 - running ${TEST} to ${HOST}" + +IP=$(dig +short ${HOST} A ${HOST} AAAA) +FILE=/var/tmp/traceroute_result +ret_val=1 +# getting IP-address of default gateway as a fall back +defgw=$(ip route list | grep default | cut -d' ' -f3) + +if [[ ! -z "$IP" ]] +then + traceroute -n ${HOST} > ${FILE} + COUNT=$(echo "$IP" | grep -cf - ${FILE}) + TTL=$(egrep -c '30 \* \* \*' ${FILE}) + GW=$(grep -c ${defgw} ${FILE}) + if [ $COUNT = 2 ] + then + t_Log "${TEST} reached ${HOST}" + ret_val=0 + elif ([ $COUNT != 2 ] && [ $TTL = 1 ]) + then + t_Log "${TEST} didn't reach ${HOST} because of too many hops/blocked traceroute by ISP. This is treated as SUCCESS." + ret_val=0 + elif ([ $COUNT != 2 ] && [ $GW -gt 0 ]) + then + t_Log "${TEST} didn't reach ${HOST} (maybe because of ACLs on the network), but at least the Default Gateway ${defgw} was reached. Treating as SUCCESS." + ret_val=0 + else + t_Log "${TEST} didn't return anything we expect - FAILING" + ret_val=1 + fi +fi + +/bin/rm ${FILE} +t_CheckExitStatus $ret_val diff --git a/tests/p_valac/0-install_valac.sh b/tests/p_valac/0-install_valac.sh new file mode 100755 index 0000000..85db198 --- /dev/null +++ b/tests/p_valac/0-install_valac.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Lz + +if [ "$centos_ver" -ne "7" ];then + t_Log "Package not included in CentOS $centos_ver => SKIP" + exit 0 +fi + +t_Log "$0 - installing valac" +t_InstallPackage vala + diff --git a/tests/p_valac/10-test_valac.sh b/tests/p_valac/10-test_valac.sh new file mode 100755 index 0000000..b38b498 --- /dev/null +++ b/tests/p_valac/10-test_valac.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Author: Lz + +if [ "$centos_ver" -ne "7" ];then + t_Log "Package not included in CentOS $centos_ver => SKIP" + exit 0 +fi + +t_Log "Running $0 - Testing valac by running it with a basic file" + +# creating source code +FILE='/var/tmp/valac-test.vala' +EXE='/var/tmp/valac-test' + +cat > $FILE < + +if [ $centos_ver -lt 7 ] +then + # Install vconfig + t_InstallPackage vconfig +else + t_Log 'vconfig is only supported on C5 and C6, skipping' +fi diff --git a/tests/p_vconfig/10_test_vconfig.sh b/tests/p_vconfig/10_test_vconfig.sh new file mode 100755 index 0000000..900d6bb --- /dev/null +++ b/tests/p_vconfig/10_test_vconfig.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# Author: Christoph Galuschka +# Athmane Madjoudj + +t_Log "Running $0 - create VLAN IF, assign IP on VLAN IF and tear down VLAN IF test" +ret_val=0 + +if [ $centos_ver -gt 6 ] +then + t_Log 'vconfig is only supported on C5 and C6, skipping' + t_CheckExitStatus $ret_val + exit 0 +fi + +# create VLAN-IF 10 on eth0 +vconfig add eth0 10 +ip addr list | grep -q eth0.10 +if [ $? == 1 ] + then + t_Log "VLAN-IF creation failed" + ret_val=1 +else + t_Log "VLAN-IF successfully created" +fi + +#assign IP address on VLAN-IF +ifconfig eth0.10 172.16.30.1 netmask 255.255.255.255 +ip addr list | grep -q 172.16.30.1 +if [ $? == 1 ] + then + t_Log "IP address assignment on eth0.10 failed" + ret_val=1 +else + t_Log "IP address successfully assigned on eth0.10" +fi + +#testing address with ping +ping -c 4 -q 172.16.30.1 | grep -q '4 received' +if [ $? == 1 ] + then + t_Log "pinging on eth0.10 failed" + ret_val=1 +else + t_Log "local ping on VLAN IF worked" +fi + +# delete VLAN-IF 10 on eth0 +vconfig rem eth0.10 +ip addr list | grep -q eth0.10 +if [ $? == 0 ] + then + t_Log "Removing VLAN IF failed" + ret_val=1 +else + t_Log "Removing of VLAN IF worked" +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_vsftpd/0-install_vsftpd.sh b/tests/p_vsftpd/0-install_vsftpd.sh new file mode 100755 index 0000000..274b2bc --- /dev/null +++ b/tests/p_vsftpd/0-install_vsftpd.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "Running $0 - installing vsFTPd." +t_InstallPackage vsftpd +if [ "$centos_ver" -ge 8 ] ; then +cp -fp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.tf_p_vsftpd +sed -i 's/anonymous_enable=NO/anonymous_enable=YES/g' /etc/vsftpd/vsftpd.conf +fi +t_ServiceControl vsftpd restart +if [ "$centos_ver" -ge 8 ] ; then +mv -f /etc/vsftpd/vsftpd.conf.tf_p_vsftpd /etc/vsftpd/vsftpd.conf +fi diff --git a/tests/p_vsftpd/vsftpd_anonymous_login.sh b/tests/p_vsftpd/vsftpd_anonymous_login.sh new file mode 100755 index 0000000..54ed7a4 --- /dev/null +++ b/tests/p_vsftpd/vsftpd_anonymous_login.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - vsFTPd anonymous can login test." + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +echo -e "user anonymous\npass password\nquit" | nc localhost 21 | grep -q "230 Login successful." + +t_CheckExitStatus $? diff --git a/tests/p_vsftpd/vsftpd_localusers_login.sh b/tests/p_vsftpd/vsftpd_localusers_login.sh new file mode 100755 index 0000000..9e33ed4 --- /dev/null +++ b/tests/p_vsftpd/vsftpd_localusers_login.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - vsFTPd local user can login test." + +if [ "$CONTAINERTEST" -eq "1" ]; then + t_Log "Running in container -> SKIP" + exit 0 +fi + +# Add a test ftp user +{ userdel -rf ftptest; useradd ftptest && echo ftptest | passwd --stdin ftptest; } &>/dev/null + +# Fix SELinux boolean +setsebool ftp_home_dir 1 + +echo -e "user ftptest\npass ftptest\nquit" | nc localhost 21 | grep -q "230 Login successful." + +t_CheckExitStatus $? + +userdel -rf ftptest diff --git a/tests/p_webalizer/0-install_webalizer.sh b/tests/p_webalizer/0-install_webalizer.sh new file mode 100755 index 0000000..49a247a --- /dev/null +++ b/tests/p_webalizer/0-install_webalizer.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "Running $0 - attempting to install webalizer" + +if [ "$centos_ver" -ge 7 ] ; then + t_Log "No webalizer package for CentOS $centos_ver -> SKIP" + t_CheckExitStatus 0 + exit 0 +fi + +t_InstallPackage webalizer +t_InstallPackage httpd +t_ServiceControl httpd stop +ps ax | grep -v grep | grep -q httpd +if [ $? = 0 ] +then + t_Log "httpd still running - killing" + killall -9 httpd +fi +sleep 1 +t_ServiceControl httpd start + diff --git a/tests/p_webalizer/webalizer_test.sh b/tests/p_webalizer/webalizer_test.sh new file mode 100755 index 0000000..d914faa --- /dev/null +++ b/tests/p_webalizer/webalizer_test.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - Webalizer test." + +if [ "$centos_ver" -ge 7 ] ; then + t_Log "No webalizer package for CentOS $centos_ver -> SKIP" + t_CheckExitStatus 0 + exit 0 +fi + +# Run some requests +for i in `seq 10` +do + curl http://localhost/ > /dev/null 2>&1 +done + +# Trigger webalizer cron manualy +/etc/cron.daily/00webalizer + +# Run the test +curl -s http://localhost/usage/ | grep 'Usage Statistics for' > /dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_wget/0-install_wget.sh b/tests/p_wget/0-install_wget.sh new file mode 100755 index 0000000..1bd8eea --- /dev/null +++ b/tests/p_wget/0-install_wget.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "$0 - installing wget" +t_InstallPackage wget diff --git a/tests/p_wget/wget_test.sh b/tests/p_wget/wget_test.sh new file mode 100755 index 0000000..aab40bd --- /dev/null +++ b/tests/p_wget/wget_test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - wget can access http-host and download index.html." +FILE=/var/tmp/index.html + + +if [ $SKIP_QA_HARNESS -eq 1 ]; then + CHECK_FOR="timestamp" + URL="http://mirror.centos.org/" +else + CHECK_FOR="CentOS" + URL="http://repo.centos.qa/srv/CentOS/" +fi + +t_Log "Querying ${URL}" +wget -q --output-document=${FILE} ${URL} +grep -q "${CHECK_FOR}" ${FILE} +ret_val=$? + +/bin/rm ${FILE} +t_CheckExitStatus $ret_val diff --git a/tests/p_which/0-install_which.sh b/tests/p_which/0-install_which.sh new file mode 100755 index 0000000..6e678c9 --- /dev/null +++ b/tests/p_which/0-install_which.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "$0 - installing which" +t_InstallPackage which diff --git a/tests/p_which/which_basic.sh b/tests/p_which/which_basic.sh new file mode 100755 index 0000000..af0a2f1 --- /dev/null +++ b/tests/p_which/which_basic.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "Running $0 - Checking which can find itself" +/usr/bin/which which | grep -E -q '^(/usr)?/bin/which$' +t_CheckExitStatus $? diff --git a/tests/p_which/which_fail.sh b/tests/p_which/which_fail.sh new file mode 100755 index 0000000..a3420b6 --- /dev/null +++ b/tests/p_which/which_fail.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "Running $0 - Checking which can fails on non-existing commands" +which abc123 2> /dev/null +[ $? -eq 1 ] || { t_Log "Which should have exited with 1 for a non-existing file"; exit $FAIL; } +t_CheckExitStatus $? diff --git a/tests/p_xorg-x11-server/00_install-Xorg.sh b/tests/p_xorg-x11-server/00_install-Xorg.sh new file mode 100755 index 0000000..d89b138 --- /dev/null +++ b/tests/p_xorg-x11-server/00_install-Xorg.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +t_Log "Running $0 - installing Xorg (base package)" +t_InstallPackage xorg-x11-server-Xorg + diff --git a/tests/p_xorg-x11-server/01_Xorg-centos-branding-test.sh b/tests/p_xorg-x11-server/01_Xorg-centos-branding-test.sh new file mode 100755 index 0000000..03d94d9 --- /dev/null +++ b/tests/p_xorg-x11-server/01_Xorg-centos-branding-test.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: Athmane Madjoudj + +# Ref: http://bugs.centos.org/view.php?id=6809 +t_Log "Running $0 - Testing that Xorg has been patched to use CentOS bugtracker for support" + +if [ $centos_ver = 6 ] +then + X --wrong-arg 2>&1 | grep -q 'wiki.centos.org' +else + t_Log "CentOS 5 Xorg does not need checking" +fi + + +t_CheckExitStatus $? + + diff --git a/tests/p_yum-plugin-fastestmirror/0_install_yum-plugin-fastestmirror.sh b/tests/p_yum-plugin-fastestmirror/0_install_yum-plugin-fastestmirror.sh new file mode 100755 index 0000000..f81829f --- /dev/null +++ b/tests/p_yum-plugin-fastestmirror/0_install_yum-plugin-fastestmirror.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +t_Log "Running $0 - package should already be installed" + +if [ "$centos_ver" -ge "8" ] ; then + t_Log "yum is replaced by dnf on el8. SKIP" + exit 0 +fi +rpm -qa | egrep -q 'yum-.*fastestmirror' +t_CheckExitStatus $? + +t_Log "Running $0 - yum should have a hard Requires on yum-plugin-fastestmirror" +rpm -q --requires yum | egrep -q 'yum-.*fastestmirror' +t_CheckExitStatus $? diff --git a/tests/p_yum-plugin-fastestmirror/10-fastestmirror.sh b/tests/p_yum-plugin-fastestmirror/10-fastestmirror.sh new file mode 100644 index 0000000..95653b1 --- /dev/null +++ b/tests/p_yum-plugin-fastestmirror/10-fastestmirror.sh @@ -0,0 +1,56 @@ +#!/bin/sh + +# Ensure plugin is enabled : + +if [ "$centos_ver" -ge "8" ] ; then + t_Log "yum is replaced by dnf on el8. SKIP" + exit 0 +fi + + +isAltArch=$(uname -m|egrep -q 'armv7l|aarch64|ppc64|ppc64le'|| echo 1 && echo 0) + +if [ "$isAltArch" = "0" ] && [ $centos_ver -lt 7 ] ; then + t_Log "Skipping for altarch, using only mirror.centos.org" + t_Log "SKIP" + exit 0 +fi + +t_Log "Running $0 - is y-p-fastestmirror enabled." +grep 'enabled=1' /etc/yum/pluginconf.d/fastestmirror.conf > /dev/null +t_CheckExitStatus $? + +# timedhosts file ends up in different places on c5 and c6 +if [ $centos_ver == 5 ]; then + BaseDir=/var/cache/yum/ +else + BaseArch=`uname -i` + if [ "$BaseArch" == "armv7l" ];then + BaseArch="armhfp" + fi + BaseDir=/var/cache/yum/$BaseArch/$centos_ver +fi + +t_Log "Running $0 - Ensure we have mirrorlist enabled." +egrep '^mirrorlist' /etc/yum.repos.d/*.repo > /dev/null +t_CheckExitStatus $? + +t_Log "Running $0 - y-p-fastestmirror can get hosts from mirrorlist" +find $BaseDir -type f -name timedhosts.txt -exec rm -f {} \; +yum -d0 list kernel > /dev/null + +hostsfound=`cat $BaseDir/timedhosts.txt | wc -l` > /dev/null + +# we need to make sure the file was recreated +if [ -f ${BaseDir}/timedhosts.txt ]; then + if [ $hostsfound -lt 1 ]; then + retval=1 + else + retval=0 + fi +else + retval=1 +fi +t_CheckExitStatus $retval + +t_Log "Running $0 - number of hosts y-p-fastestmirror can get: $( wc -l ${BaseDir}/timedhosts.txt )" diff --git a/tests/p_yum/yum_bugtracker.sh b/tests/p_yum/yum_bugtracker.sh new file mode 100755 index 0000000..09ec68a --- /dev/null +++ b/tests/p_yum/yum_bugtracker.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - Yum is using CentOS' bugtracker test." + +if [ "$centos_ver" -ge "8" ] ; then + t_Log "CentOS$ver, SKIP" + exit 0 +fi +grep "http://bugs.centos.org" /etc/yum.conf >/dev/null 2>&1 + +t_CheckExitStatus $? diff --git a/tests/p_yum/yum_distroverpkg.sh b/tests/p_yum/yum_distroverpkg.sh new file mode 100755 index 0000000..92cafc9 --- /dev/null +++ b/tests/p_yum/yum_distroverpkg.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +t_Log "Running $0 - Yum configuration has the correct distroverpkg value test." + +if [ "$centos_ver" -ge "8" ] ; then + t_Log "CentOS$ver, SKIP" + exit 0 +fi +#add centos-userland-release for armhfp +uname_arch=$(uname -m) +if [ "$uname_arch" == "armv7l" ]; then + rel_string="centos-userland-release" +else + rel_string="centos-release" +fi + +ProvierTag=$(grep distroverpkg /etc/yum.conf | cut -f2 -d'=') +rpm -q --whatprovides ${ProvierTag} | grep "$rel_string" > /dev/null +t_CheckExitStatus $? diff --git a/tests/p_yum/yum_remove_pkg_test.sh b/tests/p_yum/yum_remove_pkg_test.sh new file mode 100755 index 0000000..ca1a38f --- /dev/null +++ b/tests/p_yum/yum_remove_pkg_test.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - yum remove package test." + +# Install zsh pkg +t_InstallPackage zsh + +yum -d0 -y remove zsh && \ +rpm -q zsh | grep -q 'package zsh is not installed' + +t_CheckExitStatus $? diff --git a/tests/p_zip/0_install_zip.sh b/tests/p_zip/0_install_zip.sh new file mode 100755 index 0000000..692e313 --- /dev/null +++ b/tests/p_zip/0_install_zip.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - attempting to install zip." +t_InstallPackage zip unzip + diff --git a/tests/p_zip/10-zip-test.sh b/tests/p_zip/10-zip-test.sh new file mode 100755 index 0000000..959c1ef --- /dev/null +++ b/tests/p_zip/10-zip-test.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# Author: Athmane Madjoudj +# Author: Christoph Galuschka + +t_Log "Running $0 - zip create and extract archive test." + +# create dir and two files +ZIPDIR='/var/tmp/zip-test' +FILE1=$ZIPDIR/file1.txt +FILE2=$ZIPDIR/file2.txt + +mkdir -p $ZIPDIR +cat > $FILE1 < $FILE2 < +# Note: This test is only for Pre Updates testing prior to releasing on CentOS + +uname_arch=$(uname -m) + + ret_val=0 + if [ "$centos_ver" = "7" ] ; then + + t_Log "Running $0 - Checking current repositories for .el7.centos on modified files" + uname_arch=$(uname -m) + yum clean all + for pkg in $(cat tests/r_check_mod_packages/c72-mod-packages.lst.$uname_arch|grep -v '^#') + do + has_centos=$(yum list $pkg | grep '.el7.centos') + if [ "$has_centos" == "" ]; then + echo $pkg missing .el7.centos + ret_val=1 + fi + done + else + t_Log "Skipping $0 - This test only for CentOS-7, skipping Modified Packages test ..." + ret_val=0 + fi + + + t_CheckExitStatus $ret_val diff --git a/tests/r_check_mod_packages/c72-mod-packages.lst.aarch64 b/tests/r_check_mod_packages/c72-mod-packages.lst.aarch64 new file mode 100644 index 0000000..e014975 --- /dev/null +++ b/tests/r_check_mod_packages/c72-mod-packages.lst.aarch64 @@ -0,0 +1,25 @@ +PackageKit +abrt +apache-commons-net +basesystem +centos-indexhtml +centos-logos +centos-release +dhcp +firefox +grub2 +httpd +ipa-client +kabi-yum-plugins +kde-settings +libreport +ntp +pcs +scap-security-guide +sos +subscription-manager +system-config-date +system-config-kdump +thunderbird +xulrunner +yum diff --git a/tests/r_check_mod_packages/c72-mod-packages.lst.armv7l b/tests/r_check_mod_packages/c72-mod-packages.lst.armv7l new file mode 100644 index 0000000..e9835d1 --- /dev/null +++ b/tests/r_check_mod_packages/c72-mod-packages.lst.armv7l @@ -0,0 +1,32 @@ +PackageKit +abrt +apache-commons-net +anaconda +basesystem +centos-indexhtml +centos-logos +centos-userland-release +#compat-glibc (not available in armhfp) +dhcp +firefox +#grub2 (not available yet in armhfp) +httpd +initial-setup +ipa-client +#kabi-yum-plugins (not available in armhfp) +kde-settings +libreport +ntp +#openssl098e (not available in armhfp) +pcs +plymouth +redhat-rpm-config +redhat-lsb +scap-security-guide +sos +subscription-manager +system-config-date +system-config-kdump +thunderbird +#xulrunner (currently has the wrong disttag, will be fixed on the next update) +yum diff --git a/tests/r_check_mod_packages/c72-mod-packages.lst.ppc64 b/tests/r_check_mod_packages/c72-mod-packages.lst.ppc64 new file mode 100644 index 0000000..6868fb7 --- /dev/null +++ b/tests/r_check_mod_packages/c72-mod-packages.lst.ppc64 @@ -0,0 +1,30 @@ +PackageKit +abrt +apache-commons-net +anaconda +basesystem +centos-indexhtml +centos-logos +centos-release +compat-glibc +dhcp +firefox +grub2 +httpd +initial-setup +ipa-client +kabi-yum-plugins +kde-settings +libreport +ntp +openssl098e +plymouth +redhat-rpm-config +redhat-lsb +scap-security-guide +sos +subscription-manager +system-config-date +system-config-kdump +xulrunner +yum diff --git a/tests/r_check_mod_packages/c72-mod-packages.lst.ppc64le b/tests/r_check_mod_packages/c72-mod-packages.lst.ppc64le new file mode 100644 index 0000000..b6f6d44 --- /dev/null +++ b/tests/r_check_mod_packages/c72-mod-packages.lst.ppc64le @@ -0,0 +1,30 @@ +PackageKit +abrt +apache-commons-net +anaconda +basesystem +centos-indexhtml +centos-logos +centos-release +dhcp +firefox +grub2 +httpd +initial-setup +ipa-client +kabi-yum-plugins +kde-settings +libreport +ntp +pcs +plymouth +redhat-rpm-config +redhat-lsb +scap-security-guide +sos +subscription-manager +system-config-date +system-config-kdump +thunderbird +xulrunner +yum diff --git a/tests/r_check_mod_packages/c72-mod-packages.lst.x86_64 b/tests/r_check_mod_packages/c72-mod-packages.lst.x86_64 new file mode 100644 index 0000000..141b6e4 --- /dev/null +++ b/tests/r_check_mod_packages/c72-mod-packages.lst.x86_64 @@ -0,0 +1,32 @@ +PackageKit +abrt +apache-commons-net +anaconda +basesystem +centos-indexhtml +centos-logos +centos-release +compat-glibc +dhcp +firefox +grub2 +httpd +initial-setup +ipa-client +kabi-yum-plugins +kde-settings +libreport +ntp +openssl098e +pcs +plymouth +redhat-rpm-config +redhat-lsb +scap-security-guide +sos +subscription-manager +system-config-date +system-config-kdump +thunderbird +xulrunner +yum diff --git a/tests/r_lamp/0_lamp_install.sh b/tests/r_lamp/0_lamp_install.sh new file mode 100755 index 0000000..75b3d7d --- /dev/null +++ b/tests/r_lamp/0_lamp_install.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Author: Steve Barnes (steve@echo.id.au) +# Christoph Galuschka + +t_Log "Running $0 - attempting to install LAMP stack." + +# MySQL +# starting with 5.10, we have to differ between mysql55 and mysql +if [ $centos_ver = 5 ] +then + t_InstallPackage mysql-server mysql55-mysql-server httpd php +elif [ $centos_ver -ge 8 ] +then + t_InstallPackage mariadb-server httpd php php-cli +else + t_InstallPackage mysql-server httpd php +fi + +t_ServiceControl httpd stop +ps ax | grep -v grep | grep -q httpd +if [ $? = 0 ] +then + t_Log "httpd still running - killing" + killall -9 httpd +fi +sleep 1 +t_ServiceControl httpd start diff --git a/tests/r_lamp/1_lamp_check.sh b/tests/r_lamp/1_lamp_check.sh new file mode 100755 index 0000000..ea7b034 --- /dev/null +++ b/tests/r_lamp/1_lamp_check.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Author: Steve Barnes (steve@echo.id.au) +# Christoph Galuschka +# Filename: 1_lamp_check.sh +# Version: 0.2 +# Last Updated: Saturday, 09 November 2013 2:23 +# Description: A simple Bash script to start LAMP daemons (httpd, mysqld), and confirm PHP is working. + +if [ "$centos_ver" -ge "7" ] ; then + readonly DAEMONS=( httpd mariadb ) +else + readonly DAEMONS=( httpd mysqld ) +fi + +readonly SERVICE=/sbin/service +readonly PHP_BIN=/usr/bin/php +readonly PHP_CHECK=/tmp/check.php + +# Make sure we cleanup after ourselves. +trap "/bin/rm -f $PHP_CHECK" EXIT + +t_Log "Running $0 - starting LAMP daemon startup test" + +# Iterate through our daemons, start each and check for the presence of each process +for D in "${DAEMONS[@]}" +do + t_ServiceControl $D restart +done + +# Finally, a basic check to see if PHP is working correctly. + +t_Log "Performing php script check..." + +cat < $PHP_CHECK + +EOL + +$PHP_BIN $PHP_CHECK &>/dev/null +RETVAL="$?" + +if [ "$RETVAL" -ne "0" ]; then + + t_Log "FAIL: php_info() check failed ($RETVAL)" + +fi + +t_CheckExitStatus $RETVAL diff --git a/tests/r_lamp/40_basic_lamp.sh b/tests/r_lamp/40_basic_lamp.sh new file mode 100755 index 0000000..11a20a8 --- /dev/null +++ b/tests/r_lamp/40_basic_lamp.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Author: Karanbir Singh +# Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - install a minimal lamp stack, and test it" + +# MySQL +# starting with 5.10, we have to differ between mysql55 and mysql +if [ $centos_ver = 5 ] +then + t_InstallPackage mysql55-mysql-server httpd mysql55-mysql php php-mysql wget + t_ServiceControl mysql55-mysqld stop +elif [ $centos_ver = 6 ] +then + t_InstallPackage httpd mysql mysql-server php php-mysql wget +elif [ $centos_ver = 7 ] +then + t_InstallPackage httpd mysql mysql-server php php-mysqlnd wget +else + t_InstallPackage httpd mariadb mariadb-server php php-mysqlnd wget +fi +t_ServiceControl mysqld restart +t_ServiceControl httpd restart + +# Initializing a small MySQL db +cat >/tmp/mysql-QA.sql </var/www/html/mysql.php < +EOF + +#################################################### +# testing +#################################################### + +curl -s http://localhost/mysql.php + +t_Log "Performing basic LAMP test" +content=`echo "select * from qatests.tests where name='mysqltest'"|mysql -B --skip-column-names` + +# Clean up +mysql -u root -e 'drop database qatests;' +service httpd stop + +if [ "$content" = "mysqltest" ] ; then + ret_val=0; +else + ret_val=1; +fi + +t_CheckExitStatus $ret_val diff --git a/tests/r_lamp/45_basic_lamp_mysql55.sh b/tests/r_lamp/45_basic_lamp_mysql55.sh new file mode 100755 index 0000000..0c8ecbc --- /dev/null +++ b/tests/r_lamp/45_basic_lamp_mysql55.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +# Author: Karanbir Singh +# Athmane Madjoudj +# Christoph Galuschka + +t_Log "Running $0 - install a minimal lamp stack, and test it" + +# MySQL +# starting with 5.10, we have to differ between mysql55 and mysql +if [ $centos_ver = 5 ] +then + t_ServiceControl mysqld stop + t_ServiceControl mysql55-mysqld start +else + exit 0 +fi +t_ServiceControl httpd restart + +# Initializing a small MySQL db +cat >/tmp/mysql-QA.sql </var/www/html/mysql.php < +EOF + +#################################################### +# testing +#################################################### + +curl -s http://localhost/mysql.php + +t_Log "Performing basic LAMP test" +content=`echo "select * from qatests.tests where name='mysqltest'"|mysql -B --skip-column-names` + +# Clean up +mysql -u root -e 'drop database qatests;' +service httpd stop + +if [ "$content" = "mysqltest" ] ; then + ret_val=0; +else + ret_val=1; +fi + +t_CheckExitStatus $ret_val diff --git a/tests/r_lamp/50_lamp_check_mysql55.sh b/tests/r_lamp/50_lamp_check_mysql55.sh new file mode 100755 index 0000000..064f066 --- /dev/null +++ b/tests/r_lamp/50_lamp_check_mysql55.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# Author: Steve Barnes (steve@echo.id.au) +# Christoph Galuschka +# Filename: 1_lamp_check.sh +# Version: 0.2 +# Last Updated: Saturday, 09 November 2013 2:23 +# Description: A simple Bash script to start LAMP daemons (httpd, mysqld), and confirm PHP is working. + +# starting with 5.10, we have to differ between mysql55 and mysql + +if [ "$centos_ver" -ge 7 ] ; then + t_Log "no mysql55 on CentOS 7 ... SKIP" + exit 0 +fi + + +if [ $centos_ver = 5 ] +then + readonly DAEMONS=( httpd mysql55-mysqld ) +else + readonly DAEMONS=( httpd mysqld ) +fi +readonly DAEMONSPID=( httpd mysqld ) + +readonly SERVICE=/sbin/service +readonly PHP_BIN=/usr/bin/php +readonly PHP_CHECK=/tmp/check.php + +# Make sure we cleanup after ourselves. +trap "/bin/rm -f $PHP_CHECK" EXIT + +t_Log "Running $0 - starting LAMP daemon startup test" + +# Iterate through our daemons, start each and check for the presence of each process +for D in "${DAEMONS[@]}" +do + t_Log "Attempting startup of '$D'" + + $SERVICE $D start &>/dev/null + + RETVAL=$? + + if [ $RETVAL -ne 0 ]; then + + t_Log "FAIL: service startup for '$D' failed ($RETVAL)" + exit $FAIL + + fi +done +for D in "${DAEMONSPID[@]}" +do + + # See if our process exists + PIDS=$(pidof $D) + + if [ -z "$PIDS" ]; then + + t_Log "FAIL: couldn't find '$D' in the process list." + exit $FAIL + fi + + echo "OK" +done + + +# Finally, a basic check to see if PHP is working correctly. + +t_Log "Performing php script check..." + +cat < $PHP_CHECK + +EOL + +RETVAL=$PHP_BIN $PHP_CHECK &>/dev/null + +if [ $RETVAL -ne 0 ]; then + + t_Log "FAIL: php_info() check failed ($RETVAL)" + +fi + +t_CheckExitStatus $RETVAL diff --git a/tests/r_lamp/package_deps b/tests/r_lamp/package_deps new file mode 100644 index 0000000..c9c2aed --- /dev/null +++ b/tests/r_lamp/package_deps @@ -0,0 +1,5 @@ +# list of package names that this role def depends on +# the tests here will only be triggered if one of these packages is built +php +mysql +httpd diff --git a/tests/r_pdf/00_install_requirements.sh b/tests/r_pdf/00_install_requirements.sh new file mode 100755 index 0000000..bb51bc8 --- /dev/null +++ b/tests/r_pdf/00_install_requirements.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Christoph Galuschka + +t_Log "Running $0 - install package enscript, ghostscript and pdftotext" + +# Workarround for post scriptlet non-fatal errors +yum -y remove bitstream-vera* liberation* +# +t_InstallPackage fontconfig @fonts +t_InstallPackage enscript ghostscript poppler-utils + diff --git a/tests/r_pdf/01_pdf-test.sh b/tests/r_pdf/01_pdf-test.sh new file mode 100755 index 0000000..9a3cf46 --- /dev/null +++ b/tests/r_pdf/01_pdf-test.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - Create PDF from postscript from text, and convert PDF back to text and check contents" + +if [ "$centos_ver" = "5" ] ;then + FILE=/etc/redhat-release +else + FILE=/etc/centos-release +fi +FIND='CentOS' +PS_FILE=/var/tmp/test.ps +PDF_FILE=/var/tmp/test.pdf +TEST_FILE=/var/tmp/result + +# generate postscript file +enscript -q -p $PS_FILE $FILE + +# check-file +t_Log 'Check created PS-File' +grep -q $FIND $PS_FILE +t_CheckExitStatus $? + +# convert to PDF +ps2pdf $PS_FILE $PDF_FILE + +# read file and check +pdftotext -q $PDF_FILE $TEST_FILE +t_Log 'Check Textfile after conversion' +grep -q $FIND $TEST_FILE +t_CheckExitStatus $? + +#clean up +rm -rf $PDF_FILE $TEST_FILE $PS_FILE diff --git a/tests/r_raid-0/package_deps b/tests/r_raid-0/package_deps new file mode 100644 index 0000000..494a144 --- /dev/null +++ b/tests/r_raid-0/package_deps @@ -0,0 +1,2 @@ +kernel +mdadm diff --git a/tests/z_centos_pkg/centos_rpm_checker.py b/tests/z_centos_pkg/centos_rpm_checker.py new file mode 100644 index 0000000..61a7ffe --- /dev/null +++ b/tests/z_centos_pkg/centos_rpm_checker.py @@ -0,0 +1,50 @@ +#!/usr/bin/python +# Author: Athmane Madjoudj +# A script that search for CentOS branding issues in installed rpm +from __future__ import print_function + +import rpm +import sys +import re + +def is_valid_changelog_entry(entry): + regex = re.compile(r"\w+\ ?\w*\ ?<\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b>\ ?-?\ ?[\w_\.]+-[\w_\.]+") + if regex.match(entry) is None: + return False + else: + return True + +def main(): + ts=rpm.ts() + mi=ts.dbMatch() + # Comment the following line to check all rpms + mi.pattern("release", rpm.RPMMIRE_GLOB, "*centos*") + ret=True + print("Searching for CentOS branding issues in installed rpm...") + for hdr in mi: + if hdr['buildhost'][-11:] != '.centos.org': + print(" Build host is not centos.org machine in: %s" % hdr['name']) + ret=False + if hdr['vendor'] != 'CentOS': + print(" Vendor is not CentOS in: %s" % hdr['name']) + ret=False + if hdr['packager'] != 'CentOS BuildSystem ': + print(" Packager is not CentOS BuildSystem in: %s" % hdr['name']) + ret=False + try: + changelog = hdr['changelogname'][0] + if not is_valid_changelog_entry(changelog): + print(" Bad changelog entry in: %s" % hdr['name']) + ret=False + except Exception, e: + print(" Errors found when reading changelog entry of: %s" % hdr['name']) + ret=False + return ret + +if __name__ == "__main__": + if main(): + print "All tests PASSED" + sys.exit(0) + else: + print "Some tests FAILED" + sys.exit(1) diff --git a/tests/z_cr_test/cr-test.sh b/tests/z_cr_test/cr-test.sh new file mode 100644 index 0000000..68c0c64 --- /dev/null +++ b/tests/z_cr_test/cr-test.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# determining which packages we need to install from Base+Updates before trying the update against CR + +# generate local cache +/tmp/t_functional/tests/0_common/00_qa_repo_config.sh +mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.disabled +yum --enablerepo=qa-cr list >/dev/null 2>&1 +sqlite3 $(find /var/cache/yum/$(t_GetArch)/$(t_DistCheck)/qa-cr/ -iname '*.sqlite*') 'select name from packages;' > /tmp/packages.list +t_Log "Installing needed packages from Base" +yum install -y -d0 $(cat /tmp/packages.list) 1>/dev/null +t_CheckExitStatus $? +# remove centos-release-cr from the packages list +yum remove -y -d0 centos-release-cr + +t_Log "Updating packages with the CR repo" +t_InstallPackage yum-presto +yum install --enablerepo=qa-cr -y -d0 $(cat /tmp/packages.list) +t_CheckExitStatus $? +yum remove -y -d0 centos-release-cr +mv /etc/yum.repos.d/CentOS-Base.repo.disabled /etc/yum.repos.d/CentOS-Base.repo +mv /etc/yum.repos.d/CentOS-QA.repo /etc/yum.repos.d/CentOS-QA.repo.disabled diff --git a/tests/z_cr_test/readme b/tests/z_cr_test/readme new file mode 100644 index 0000000..6981292 --- /dev/null +++ b/tests/z_cr_test/readme @@ -0,0 +1,5 @@ +This test is disabled by default, but can be launched from the CDevQA provision script +when we need to test the packages from the CR repository +It will fetch packages names from the cr repo, install those packages from base+updates +and then will try the update process. +After that, all the usual functional tests will be launched diff --git a/tests/z_install-tree/install-tree_test.sh b/tests/z_install-tree/install-tree_test.sh new file mode 100644 index 0000000..01408d3 --- /dev/null +++ b/tests/z_install-tree/install-tree_test.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - check if the packages tree is installable." + +yum --skip-broken -y install \* > /tmp/yum_install_tree.log 2>&1 +ret_val=$? +# print the output of yum when it fails +[ $ret_val -ne 0 ] && tail /tmp/yum_install_tree.log + +t_CheckExitStatus $ret_val diff --git a/tests/z_install-tree/readme b/tests/z_install-tree/readme new file mode 100644 index 0000000..5aa2122 --- /dev/null +++ b/tests/z_install-tree/readme @@ -0,0 +1,2 @@ +This test was disabled because of disk space limitation +chmod 755 to reenable diff --git a/tests/z_repoclosure/repoclosure_test.sh b/tests/z_repoclosure/repoclosure_test.sh new file mode 100755 index 0000000..6f9390c --- /dev/null +++ b/tests/z_repoclosure/repoclosure_test.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - repoclosure test ." + +if [ "$centos_ver" -ge 8 ] ; then + t_Log "Skip this test in versions greater than 8, because repoclosure doesn't work with modules enabled" +else + + t_InstallPackage yum-utils + + t_Log "Running repoclosure test ..." + + repoclosure > /tmp/repoclosure.log 2>&1 + grep -q 'unresolved deps' /tmp/repoclosure.log + if [ $? -eq 0 ] ; then + ret_val=1 + else + ret_val=0 + fi + + # print the output of repoclosure when it fails + [ $ret_val -eq 1 ] && cat /tmp/repoclosure.log + + t_CheckExitStatus $ret_val +fi diff --git a/tests/z_rpminfo/README b/tests/z_rpminfo/README new file mode 100644 index 0000000..815c601 --- /dev/null +++ b/tests/z_rpminfo/README @@ -0,0 +1,11 @@ +Adding an rpminfo check override for a package can be done in 2 ways: +- Modifying required_attrs in check-rpminfo.py + - should be done for packages specified by name (i.e. overrides for _all_ versions of that package) +- Adding an NVR line in special_overrides.txt + - should be done for specific NVRs + - in the form: --: + +Adding an attribute to check: +- modify the required_attrs dict in check-rpminfo.py + - the key is the name of the attribute to check + - the value is a shell-style glob of what the attribute should be diff --git a/tests/z_rpminfo/check-rpminfo.py b/tests/z_rpminfo/check-rpminfo.py new file mode 100644 index 0000000..e218291 --- /dev/null +++ b/tests/z_rpminfo/check-rpminfo.py @@ -0,0 +1,90 @@ +#!/usr/bin/python -tt +''' +Author: Brian Stinson +Check rpminfo attributes that must be set before release in the repositories (e.g. Vendor, Packager) +''' + +from __future__ import print_function, with_statement +import os +import sys +import yum + +from datetime import datetime +from fnmatch import fnmatch + + +def log(methodstring): + localtime = datetime.now() + print("[+] {0} -> {1}".format(localtime.strftime("%a %b %e %H:%M:%S %Z %Y"), methodstring)) + + +def fail(failstring): + log('FAIL {0}'.format(failstring)) + + +def skip(skipstring): + log('SKIP {0}'.format(skipstring)) + +log('Running check-rpminfo.py - Check rpminfo Attributes') + +# Set the required attributes and their values here. You may use shell-style +# globs in the value if necessary. +required_attrs = { + 'vendor': 'CentOS', + 'packager': '*centos.org*', + } + +# special_overrides is a dictionary of packages and a list of attributes +# to ignore for that package. When updating this list add a comment to +# the line describing why the override is in place +special_overrides = { + 'epel-release': ['vendor', 'packager'], #Rebuilt directly from Fedora, so the vendor remains Fedora Project + 'elrepo-release': ['vendor', 'packager'], #Imported from elrepo, so the vendor remains "The ELRepo Project" + 'redhat-support-lib-python': ['vendor'], + 'redhat-support-tool': ['vendor'], + } + +# you can also add the NVR, and the attribute to ignore to the special_overrides.txt file +with open(os.path.join(sys.path[0],'special_overrides.txt'),'r') as thefile: + for line in thefile.readlines(): + if not line.strip() or line.startswith('#'): + continue + pkg, ignoreattr = map(str.strip,line.split(':')) + special_overrides.setdefault(pkg, []).append(ignoreattr) + +yb = yum.YumBase() +yb.conf.cache = 0 + +yb.repos.doSetup() +log("Checking repos: {0}".format(', '.join([r.name for r in yb.repos.listEnabled()]))) + +sack = yb.pkgSack + +finalret = 0 +for pkg in sack: + for attr, val in required_attrs.iteritems(): + nvr = '{0}-{1}-{2}'.format(pkg['name'], pkg['version'], pkg['release']) + nvra = '{0}-{1}-{2}.{3}'.format(pkg['name'], pkg['version'], pkg['release'], pkg['arch']) + if pkg.name in special_overrides: + if attr in special_overrides[pkg.name]: + skip('{0}: {1} listed in special_overrides'.format(pkg.remote_path, attr)) + continue + elif nvr in special_overrides: + if attr in special_overrides[nvr]: + skip('{0}: {1} listed in special_overrides'.format(pkg.remote_path, attr)) + continue + elif nvra in special_overrides: + if attr in special_overrides[nvra]: + skip('{0}: {1} listed in special_overrides'.format(pkg.remote_path, attr)) + continue + + if not pkg[attr]: + fail('{0}: Missing {1}'.format(pkg.remote_path, attr)) + finalret = 1 + continue + + if not fnmatch(str.upper(pkg[attr]), str.upper(val)): + fail('{0}: {1}: {2} does not match {3}'.format(pkg.remote_path, attr, pkg[attr], val)) + finalret = 1 + +sys.exit(finalret) diff --git a/tests/z_rpminfo/check-rpminfo.sh b/tests/z_rpminfo/check-rpminfo.sh new file mode 100755 index 0000000..f9d13ce --- /dev/null +++ b/tests/z_rpminfo/check-rpminfo.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Author: Brian Stinson +# Runner script for checking rpminfo so we can fail gracefully on EL5 + +if [ "$centos_ver" -ge "8" ]; then + t_Log "check-rpminfo.py not python3/dnf ready on c8 => SKIP" + exit 0 +fi + +if [[ $centos_ver != 5 ]] +then + python "$(dirname "$(readlink -f "$0")")/check-rpminfo.py" + t_CheckExitStatus $? +else + echo "Skipped on CentOS 5" +fi diff --git a/tests/z_rpminfo/special_overrides.txt b/tests/z_rpminfo/special_overrides.txt new file mode 100644 index 0000000..a9887b4 --- /dev/null +++ b/tests/z_rpminfo/special_overrides.txt @@ -0,0 +1,543 @@ +kernel-plus-3.10.0-229.1.2.el7.centos.plus: packager +kernel-plus-3.10.0-229.1.2.el7.centos.plus: vendor +kernel-plus-3.10.0-229.11.1.el7.centos.plus: packager +kernel-plus-3.10.0-229.11.1.el7.centos.plus: vendor +kernel-plus-3.10.0-229.4.2.el7.centos.plus: packager +kernel-plus-3.10.0-229.4.2.el7.centos.plus: vendor +kernel-plus-3.10.0-229.7.2.el7.centos.plus: packager +kernel-plus-3.10.0-229.7.2.el7.centos.plus: vendor +kernel-plus-3.10.0-229.el7.centos.plus: packager +kernel-plus-3.10.0-229.el7.centos.plus: vendor +kernel-plus-abi-whitelists-3.10.0-229.1.2.el7.centos.plus: packager +kernel-plus-abi-whitelists-3.10.0-229.1.2.el7.centos.plus: vendor +kernel-plus-abi-whitelists-3.10.0-229.11.1.el7.centos.plus: packager +kernel-plus-abi-whitelists-3.10.0-229.11.1.el7.centos.plus: vendor +kernel-plus-abi-whitelists-3.10.0-229.4.2.el7.centos.plus: packager +kernel-plus-abi-whitelists-3.10.0-229.4.2.el7.centos.plus: vendor +kernel-plus-abi-whitelists-3.10.0-229.7.2.el7.centos.plus: packager +kernel-plus-abi-whitelists-3.10.0-229.7.2.el7.centos.plus: vendor +kernel-plus-abi-whitelists-3.10.0-229.el7.centos.plus: packager +kernel-plus-abi-whitelists-3.10.0-229.el7.centos.plus: vendor +kernel-plus-devel-3.10.0-229.1.2.el7.centos.plus: packager +kernel-plus-devel-3.10.0-229.1.2.el7.centos.plus: vendor +kernel-plus-devel-3.10.0-229.11.1.el7.centos.plus: packager +kernel-plus-devel-3.10.0-229.11.1.el7.centos.plus: vendor +kernel-plus-devel-3.10.0-229.4.2.el7.centos.plus: packager +kernel-plus-devel-3.10.0-229.4.2.el7.centos.plus: vendor +kernel-plus-devel-3.10.0-229.7.2.el7.centos.plus: packager +kernel-plus-devel-3.10.0-229.7.2.el7.centos.plus: vendor +kernel-plus-devel-3.10.0-229.el7.centos.plus: packager +kernel-plus-devel-3.10.0-229.el7.centos.plus: vendor +kernel-plus-doc-3.10.0-229.1.2.el7.centos.plus: packager +kernel-plus-doc-3.10.0-229.1.2.el7.centos.plus: vendor +kernel-plus-doc-3.10.0-229.11.1.el7.centos.plus: packager +kernel-plus-doc-3.10.0-229.11.1.el7.centos.plus: vendor +kernel-plus-doc-3.10.0-229.4.2.el7.centos.plus: packager +kernel-plus-doc-3.10.0-229.4.2.el7.centos.plus: vendor +kernel-plus-doc-3.10.0-229.7.2.el7.centos.plus: packager +kernel-plus-doc-3.10.0-229.7.2.el7.centos.plus: vendor +kernel-plus-doc-3.10.0-229.el7.centos.plus: packager +kernel-plus-doc-3.10.0-229.el7.centos.plus: vendor +kernel-plus-headers-3.10.0-229.1.2.el7.centos.plus: packager +kernel-plus-headers-3.10.0-229.1.2.el7.centos.plus: vendor +kernel-plus-headers-3.10.0-229.11.1.el7.centos.plus: packager +kernel-plus-headers-3.10.0-229.11.1.el7.centos.plus: vendor +kernel-plus-headers-3.10.0-229.4.2.el7.centos.plus: packager +kernel-plus-headers-3.10.0-229.4.2.el7.centos.plus: vendor +kernel-plus-headers-3.10.0-229.7.2.el7.centos.plus: packager +kernel-plus-headers-3.10.0-229.7.2.el7.centos.plus: vendor +kernel-plus-headers-3.10.0-229.el7.centos.plus: packager +kernel-plus-headers-3.10.0-229.el7.centos.plus: vendor +kernel-plus-tools-3.10.0-229.1.2.el7.centos.plus: packager +kernel-plus-tools-3.10.0-229.1.2.el7.centos.plus: vendor +kernel-plus-tools-3.10.0-229.11.1.el7.centos.plus: packager +kernel-plus-tools-3.10.0-229.11.1.el7.centos.plus: vendor +kernel-plus-tools-3.10.0-229.4.2.el7.centos.plus: packager +kernel-plus-tools-3.10.0-229.4.2.el7.centos.plus: vendor +kernel-plus-tools-3.10.0-229.7.2.el7.centos.plus: packager +kernel-plus-tools-3.10.0-229.7.2.el7.centos.plus: vendor +kernel-plus-tools-3.10.0-229.el7.centos.plus: packager +kernel-plus-tools-3.10.0-229.el7.centos.plus: vendor +kernel-plus-tools-libs-3.10.0-229.1.2.el7.centos.plus: packager +kernel-plus-tools-libs-3.10.0-229.1.2.el7.centos.plus: vendor +kernel-plus-tools-libs-3.10.0-229.11.1.el7.centos.plus: packager +kernel-plus-tools-libs-3.10.0-229.11.1.el7.centos.plus: vendor +kernel-plus-tools-libs-3.10.0-229.4.2.el7.centos.plus: packager +kernel-plus-tools-libs-3.10.0-229.4.2.el7.centos.plus: vendor +kernel-plus-tools-libs-3.10.0-229.7.2.el7.centos.plus: packager +kernel-plus-tools-libs-3.10.0-229.7.2.el7.centos.plus: vendor +kernel-plus-tools-libs-3.10.0-229.el7.centos.plus: packager +kernel-plus-tools-libs-3.10.0-229.el7.centos.plus: vendor +kernel-plus-tools-libs-devel-3.10.0-229.1.2.el7.centos.plus: packager +kernel-plus-tools-libs-devel-3.10.0-229.1.2.el7.centos.plus: vendor +kernel-plus-tools-libs-devel-3.10.0-229.11.1.el7.centos.plus: packager +kernel-plus-tools-libs-devel-3.10.0-229.11.1.el7.centos.plus: vendor +kernel-plus-tools-libs-devel-3.10.0-229.4.2.el7.centos.plus: packager +kernel-plus-tools-libs-devel-3.10.0-229.4.2.el7.centos.plus: vendor +kernel-plus-tools-libs-devel-3.10.0-229.7.2.el7.centos.plus: packager +kernel-plus-tools-libs-devel-3.10.0-229.7.2.el7.centos.plus: vendor +kernel-plus-tools-libs-devel-3.10.0-229.el7.centos.plus: packager +kernel-plus-tools-libs-devel-3.10.0-229.el7.centos.plus: vendor +perf-3.10.0-229.1.2.el7.centos.plus: packager +perf-3.10.0-229.1.2.el7.centos.plus: vendor +perf-3.10.0-229.11.1.el7.centos.plus: packager +perf-3.10.0-229.11.1.el7.centos.plus: vendor +perf-3.10.0-229.4.2.el7.centos.plus: packager +perf-3.10.0-229.4.2.el7.centos.plus: vendor +perf-3.10.0-229.7.2.el7.centos.plus: packager +perf-3.10.0-229.7.2.el7.centos.plus: vendor +perf-3.10.0-229.el7.centos.plus: packager +perf-3.10.0-229.el7.centos.plus: vendor +python-perf-3.10.0-229.1.2.el7.centos.plus: packager +python-perf-3.10.0-229.1.2.el7.centos.plus: vendor +python-perf-3.10.0-229.11.1.el7.centos.plus: packager +python-perf-3.10.0-229.11.1.el7.centos.plus: vendor +python-perf-3.10.0-229.4.2.el7.centos.plus: packager +python-perf-3.10.0-229.4.2.el7.centos.plus: vendor +python-perf-3.10.0-229.7.2.el7.centos.plus: packager +python-perf-3.10.0-229.7.2.el7.centos.plus: vendor +python-perf-3.10.0-229.el7.centos.plus: packager +python-perf-3.10.0-229.el7.centos.plus: vendor +grub2-2.02-0.33.el7.centos.1: packager +grub2-2.02-0.33.el7.centos.1: vendor +grub2-2.02-0.34.el7.centos: packager +grub2-2.02-0.34.el7.centos: vendor +grub2-efi-2.02-0.33.el7.centos.1: packager +grub2-efi-2.02-0.33.el7.centos.1: vendor +grub2-efi-2.02-0.34.el7.centos: packager +grub2-efi-2.02-0.34.el7.centos: vendor +grub2-efi-modules-2.02-0.33.el7.centos.1: packager +grub2-efi-modules-2.02-0.33.el7.centos.1: vendor +grub2-efi-modules-2.02-0.34.el7.centos: packager +grub2-efi-modules-2.02-0.34.el7.centos: vendor +grub2-tools-2.02-0.33.el7.centos.1: packager +grub2-tools-2.02-0.33.el7.centos.1: vendor +grub2-tools-2.02-0.34.el7.centos: packager +grub2-tools-2.02-0.34.el7.centos: vendor +kernel-3.10.0-327.10.1.el7: packager +kernel-3.10.0-327.10.1.el7: vendor +kernel-3.10.0-327.13.1.el7: packager +kernel-3.10.0-327.13.1.el7: vendor +kernel-3.10.0-327.18.2.el7: packager +kernel-3.10.0-327.18.2.el7: vendor +kernel-3.10.0-327.3.1.el7: packager +kernel-3.10.0-327.3.1.el7: vendor +kernel-3.10.0-327.4.4.el7: packager +kernel-3.10.0-327.4.4.el7: vendor +kernel-3.10.0-327.4.5.el7: packager +kernel-3.10.0-327.4.5.el7: vendor +kernel-abi-whitelists-3.10.0-327.10.1.el7: packager +kernel-abi-whitelists-3.10.0-327.10.1.el7: vendor +kernel-abi-whitelists-3.10.0-327.13.1.el7: packager +kernel-abi-whitelists-3.10.0-327.13.1.el7: vendor +kernel-abi-whitelists-3.10.0-327.18.2.el7: packager +kernel-abi-whitelists-3.10.0-327.18.2.el7: vendor +kernel-abi-whitelists-3.10.0-327.3.1.el7: packager +kernel-abi-whitelists-3.10.0-327.3.1.el7: vendor +kernel-abi-whitelists-3.10.0-327.4.4.el7: packager +kernel-abi-whitelists-3.10.0-327.4.4.el7: vendor +kernel-abi-whitelists-3.10.0-327.4.5.el7: packager +kernel-abi-whitelists-3.10.0-327.4.5.el7: vendor +kernel-debug-3.10.0-327.10.1.el7: packager +kernel-debug-3.10.0-327.10.1.el7: vendor +kernel-debug-3.10.0-327.13.1.el7: packager +kernel-debug-3.10.0-327.13.1.el7: vendor +kernel-debug-3.10.0-327.18.2.el7: packager +kernel-debug-3.10.0-327.18.2.el7: vendor +kernel-debug-3.10.0-327.3.1.el7: packager +kernel-debug-3.10.0-327.3.1.el7: vendor +kernel-debug-3.10.0-327.4.4.el7: packager +kernel-debug-3.10.0-327.4.4.el7: vendor +kernel-debug-3.10.0-327.4.5.el7: packager +kernel-debug-3.10.0-327.4.5.el7: vendor +kernel-debug-devel-3.10.0-327.10.1.el7: packager +kernel-debug-devel-3.10.0-327.10.1.el7: vendor +kernel-debug-devel-3.10.0-327.13.1.el7: packager +kernel-debug-devel-3.10.0-327.13.1.el7: vendor +kernel-debug-devel-3.10.0-327.18.2.el7: packager +kernel-debug-devel-3.10.0-327.18.2.el7: vendor +kernel-debug-devel-3.10.0-327.3.1.el7: packager +kernel-debug-devel-3.10.0-327.3.1.el7: vendor +kernel-debug-devel-3.10.0-327.4.4.el7: packager +kernel-debug-devel-3.10.0-327.4.4.el7: vendor +kernel-debug-devel-3.10.0-327.4.5.el7: packager +kernel-debug-devel-3.10.0-327.4.5.el7: vendor +kernel-devel-3.10.0-327.10.1.el7: packager +kernel-devel-3.10.0-327.10.1.el7: vendor +kernel-devel-3.10.0-327.13.1.el7: packager +kernel-devel-3.10.0-327.13.1.el7: vendor +kernel-devel-3.10.0-327.18.2.el7: packager +kernel-devel-3.10.0-327.18.2.el7: vendor +kernel-devel-3.10.0-327.3.1.el7: packager +kernel-devel-3.10.0-327.3.1.el7: vendor +kernel-devel-3.10.0-327.4.4.el7: packager +kernel-devel-3.10.0-327.4.4.el7: vendor +kernel-devel-3.10.0-327.4.5.el7: packager +kernel-devel-3.10.0-327.4.5.el7: vendor +kernel-doc-3.10.0-327.10.1.el7: packager +kernel-doc-3.10.0-327.10.1.el7: vendor +kernel-doc-3.10.0-327.13.1.el7: packager +kernel-doc-3.10.0-327.13.1.el7: vendor +kernel-doc-3.10.0-327.18.2.el7: packager +kernel-doc-3.10.0-327.18.2.el7: vendor +kernel-doc-3.10.0-327.3.1.el7: packager +kernel-doc-3.10.0-327.3.1.el7: vendor +kernel-doc-3.10.0-327.4.4.el7: packager +kernel-doc-3.10.0-327.4.4.el7: vendor +kernel-doc-3.10.0-327.4.5.el7: packager +kernel-doc-3.10.0-327.4.5.el7: vendor +kernel-headers-3.10.0-327.10.1.el7: packager +kernel-headers-3.10.0-327.10.1.el7: vendor +kernel-headers-3.10.0-327.13.1.el7: packager +kernel-headers-3.10.0-327.13.1.el7: vendor +kernel-headers-3.10.0-327.18.2.el7: packager +kernel-headers-3.10.0-327.18.2.el7: vendor +kernel-headers-3.10.0-327.3.1.el7: packager +kernel-headers-3.10.0-327.3.1.el7: vendor +kernel-headers-3.10.0-327.4.4.el7: packager +kernel-headers-3.10.0-327.4.4.el7: vendor +kernel-headers-3.10.0-327.4.5.el7: packager +kernel-headers-3.10.0-327.4.5.el7: vendor +kernel-tools-3.10.0-327.10.1.el7: packager +kernel-tools-3.10.0-327.10.1.el7: vendor +kernel-tools-3.10.0-327.13.1.el7: packager +kernel-tools-3.10.0-327.13.1.el7: vendor +kernel-tools-3.10.0-327.18.2.el7: packager +kernel-tools-3.10.0-327.18.2.el7: vendor +kernel-tools-3.10.0-327.3.1.el7: packager +kernel-tools-3.10.0-327.3.1.el7: vendor +kernel-tools-3.10.0-327.4.4.el7: packager +kernel-tools-3.10.0-327.4.4.el7: vendor +kernel-tools-3.10.0-327.4.5.el7: packager +kernel-tools-3.10.0-327.4.5.el7: vendor +kernel-tools-libs-3.10.0-327.10.1.el7: packager +kernel-tools-libs-3.10.0-327.10.1.el7: vendor +kernel-tools-libs-3.10.0-327.13.1.el7: packager +kernel-tools-libs-3.10.0-327.13.1.el7: vendor +kernel-tools-libs-3.10.0-327.18.2.el7: packager +kernel-tools-libs-3.10.0-327.18.2.el7: vendor +kernel-tools-libs-3.10.0-327.3.1.el7: packager +kernel-tools-libs-3.10.0-327.3.1.el7: vendor +kernel-tools-libs-3.10.0-327.4.4.el7: packager +kernel-tools-libs-3.10.0-327.4.4.el7: vendor +kernel-tools-libs-3.10.0-327.4.5.el7: packager +kernel-tools-libs-3.10.0-327.4.5.el7: vendor +kernel-tools-libs-devel-3.10.0-327.10.1.el7: packager +kernel-tools-libs-devel-3.10.0-327.10.1.el7: vendor +kernel-tools-libs-devel-3.10.0-327.13.1.el7: packager +kernel-tools-libs-devel-3.10.0-327.13.1.el7: vendor +kernel-tools-libs-devel-3.10.0-327.18.2.el7: packager +kernel-tools-libs-devel-3.10.0-327.18.2.el7: vendor +kernel-tools-libs-devel-3.10.0-327.3.1.el7: packager +kernel-tools-libs-devel-3.10.0-327.3.1.el7: vendor +kernel-tools-libs-devel-3.10.0-327.4.4.el7: packager +kernel-tools-libs-devel-3.10.0-327.4.4.el7: vendor +kernel-tools-libs-devel-3.10.0-327.4.5.el7: packager +kernel-tools-libs-devel-3.10.0-327.4.5.el7: vendor +perf-3.10.0-327.10.1.el7: packager +perf-3.10.0-327.10.1.el7: vendor +perf-3.10.0-327.13.1.el7: packager +perf-3.10.0-327.13.1.el7: vendor +perf-3.10.0-327.18.2.el7: packager +perf-3.10.0-327.18.2.el7: vendor +perf-3.10.0-327.3.1.el7: packager +perf-3.10.0-327.3.1.el7: vendor +perf-3.10.0-327.4.4.el7: packager +perf-3.10.0-327.4.4.el7: vendor +perf-3.10.0-327.4.5.el7: packager +perf-3.10.0-327.4.5.el7: vendor +python-perf-3.10.0-327.10.1.el7: packager +python-perf-3.10.0-327.10.1.el7: vendor +python-perf-3.10.0-327.13.1.el7: packager +python-perf-3.10.0-327.13.1.el7: vendor +python-perf-3.10.0-327.18.2.el7: packager +python-perf-3.10.0-327.18.2.el7: vendor +python-perf-3.10.0-327.3.1.el7: packager +python-perf-3.10.0-327.3.1.el7: vendor +python-perf-3.10.0-327.4.4.el7: packager +python-perf-3.10.0-327.4.4.el7: vendor +python-perf-3.10.0-327.4.5.el7: packager +python-perf-3.10.0-327.4.5.el7: vendor +grub2-2.02-0.29.el7.centos: packager +grub2-efi-2.02-0.29.el7.centos: packager +grub2-efi-modules-2.02-0.29.el7.centos: packager +grub2-tools-2.02-0.29.el7.centos: packager +kernel-3.10.0-327.el7: packager +kernel-abi-whitelists-3.10.0-327.el7: packager +kernel-debug-3.10.0-327.el7: packager +kernel-debug-devel-3.10.0-327.el7: packager +kernel-devel-3.10.0-327.el7: packager +kernel-doc-3.10.0-327.el7: packager +kernel-headers-3.10.0-327.el7: packager +kernel-tools-3.10.0-327.el7: packager +kernel-tools-libs-3.10.0-327.el7: packager +kernel-tools-libs-devel-3.10.0-327.el7: packager +mokutil-0.9-2.el7: packager +perf-3.10.0-327.el7: packager +python-perf-3.10.0-327.el7: packager +shim-0.9-2.el7: packager +shim-unsigned-0.9-1.el7.centos: packager +grub2-2.02-0.29.el7.centos: vendor +grub2-efi-2.02-0.29.el7.centos: vendor +grub2-efi-modules-2.02-0.29.el7.centos: vendor +grub2-tools-2.02-0.29.el7.centos: vendor +kernel-3.10.0-327.el7: vendor +kernel-abi-whitelists-3.10.0-327.el7: vendor +kernel-debug-3.10.0-327.el7: vendor +kernel-debug-devel-3.10.0-327.el7: vendor +kernel-devel-3.10.0-327.el7: vendor +kernel-doc-3.10.0-327.el7: vendor +kernel-headers-3.10.0-327.el7: vendor +kernel-tools-3.10.0-327.el7: vendor +kernel-tools-libs-3.10.0-327.el7: vendor +kernel-tools-libs-devel-3.10.0-327.el7: vendor +mokutil-0.9-2.el7: vendor +perf-3.10.0-327.el7: vendor +python-perf-3.10.0-327.el7: vendor +shim-0.9-2.el7: vendor +shim-unsigned-0.9-1.el7.centos: vendor +qpid-qmf-0.14-14.el6_3: vendor +rome-0.9-4.2.el6: packager +rome-0.9-4.2.el6: vendor +rome-javadoc-0.9-4.2.el6: vendor +rome-javadoc-0.9-4.2.el6: packager +ruby-qpid-qmf-0.14-14.el6_3: vendor +qpid-qmf-0.14-14.el6_3: vendor +python-qpid-qmf-0.14-14.el6_3: vendor +kernel-plus-3.10.0-327.10.1.el7.centos.plus: packager +kernel-plus-3.10.0-327.10.1.el7.centos.plus: vendor +kernel-plus-3.10.0-327.13.1.el7.centos.plus: packager +kernel-plus-3.10.0-327.13.1.el7.centos.plus: vendor +kernel-plus-3.10.0-327.18.2.el7.centos.plus: packager +kernel-plus-3.10.0-327.18.2.el7.centos.plus: vendor +kernel-plus-3.10.0-327.3.1.el7.centos.plus: packager +kernel-plus-3.10.0-327.3.1.el7.centos.plus: vendor +kernel-plus-3.10.0-327.4.4.el7.centos.plus: packager +kernel-plus-3.10.0-327.4.4.el7.centos.plus: vendor +kernel-plus-3.10.0-327.4.5.el7.centos.plus: packager +kernel-plus-3.10.0-327.4.5.el7.centos.plus: vendor +kernel-plus-3.10.0-327.el7.centos.plus: packager +kernel-plus-3.10.0-327.el7.centos.plus: vendor +kernel-plus-abi-whitelists-3.10.0-327.10.1.el7.centos.plus: packager +kernel-plus-abi-whitelists-3.10.0-327.10.1.el7.centos.plus: vendor +kernel-plus-abi-whitelists-3.10.0-327.13.1.el7.centos.plus: packager +kernel-plus-abi-whitelists-3.10.0-327.13.1.el7.centos.plus: vendor +kernel-plus-abi-whitelists-3.10.0-327.18.2.el7.centos.plus: packager +kernel-plus-abi-whitelists-3.10.0-327.18.2.el7.centos.plus: vendor +kernel-plus-abi-whitelists-3.10.0-327.3.1.el7.centos.plus: packager +kernel-plus-abi-whitelists-3.10.0-327.3.1.el7.centos.plus: vendor +kernel-plus-abi-whitelists-3.10.0-327.4.5.el7.centos.plus: packager +kernel-plus-abi-whitelists-3.10.0-327.4.5.el7.centos.plus: vendor +kernel-plus-abi-whitelists-3.10.0-327.el7.centos.plus: packager +kernel-plus-abi-whitelists-3.10.0-327.el7.centos.plus: vendor +kernel-plus-devel-3.10.0-327.10.1.el7.centos.plus: packager +kernel-plus-devel-3.10.0-327.10.1.el7.centos.plus: vendor +kernel-plus-devel-3.10.0-327.13.1.el7.centos.plus: packager +kernel-plus-devel-3.10.0-327.13.1.el7.centos.plus: vendor +kernel-plus-devel-3.10.0-327.18.2.el7.centos.plus: packager +kernel-plus-devel-3.10.0-327.18.2.el7.centos.plus: vendor +kernel-plus-devel-3.10.0-327.3.1.el7.centos.plus: packager +kernel-plus-devel-3.10.0-327.3.1.el7.centos.plus: vendor +kernel-plus-devel-3.10.0-327.4.4.el7.centos.plus: packager +kernel-plus-devel-3.10.0-327.4.4.el7.centos.plus: vendor +kernel-plus-devel-3.10.0-327.4.5.el7.centos.plus: packager +kernel-plus-devel-3.10.0-327.4.5.el7.centos.plus: vendor +kernel-plus-devel-3.10.0-327.el7.centos.plus: packager +kernel-plus-devel-3.10.0-327.el7.centos.plus: vendor +kernel-plus-doc-3.10.0-327.10.1.el7.centos.plus: packager +kernel-plus-doc-3.10.0-327.10.1.el7.centos.plus: vendor +kernel-plus-doc-3.10.0-327.13.1.el7.centos.plus: packager +kernel-plus-doc-3.10.0-327.13.1.el7.centos.plus: vendor +kernel-plus-doc-3.10.0-327.18.2.el7.centos.plus: packager +kernel-plus-doc-3.10.0-327.18.2.el7.centos.plus: vendor +kernel-plus-doc-3.10.0-327.3.1.el7.centos.plus: packager +kernel-plus-doc-3.10.0-327.3.1.el7.centos.plus: vendor +kernel-plus-doc-3.10.0-327.4.5.el7.centos.plus: packager +kernel-plus-doc-3.10.0-327.4.5.el7.centos.plus: vendor +kernel-plus-doc-3.10.0-327.el7.centos.plus: packager +kernel-plus-doc-3.10.0-327.el7.centos.plus: vendor +kernel-plus-headers-3.10.0-327.10.1.el7.centos.plus: packager +kernel-plus-headers-3.10.0-327.10.1.el7.centos.plus: vendor +kernel-plus-headers-3.10.0-327.13.1.el7.centos.plus: packager +kernel-plus-headers-3.10.0-327.13.1.el7.centos.plus: vendor +kernel-plus-headers-3.10.0-327.18.2.el7.centos.plus: packager +kernel-plus-headers-3.10.0-327.18.2.el7.centos.plus: vendor +kernel-plus-headers-3.10.0-327.3.1.el7.centos.plus: packager +kernel-plus-headers-3.10.0-327.3.1.el7.centos.plus: vendor +kernel-plus-headers-3.10.0-327.4.4.el7.centos.plus: packager +kernel-plus-headers-3.10.0-327.4.4.el7.centos.plus: vendor +kernel-plus-headers-3.10.0-327.4.5.el7.centos.plus: packager +kernel-plus-headers-3.10.0-327.4.5.el7.centos.plus: vendor +kernel-plus-headers-3.10.0-327.el7.centos.plus: packager +kernel-plus-headers-3.10.0-327.el7.centos.plus: vendor +kernel-plus-tools-3.10.0-327.10.1.el7.centos.plus: packager +kernel-plus-tools-3.10.0-327.10.1.el7.centos.plus: vendor +kernel-plus-tools-3.10.0-327.13.1.el7.centos.plus: packager +kernel-plus-tools-3.10.0-327.13.1.el7.centos.plus: vendor +kernel-plus-tools-3.10.0-327.18.2.el7.centos.plus: packager +kernel-plus-tools-3.10.0-327.18.2.el7.centos.plus: vendor +kernel-plus-tools-3.10.0-327.3.1.el7.centos.plus: packager +kernel-plus-tools-3.10.0-327.3.1.el7.centos.plus: vendor +kernel-plus-tools-3.10.0-327.4.4.el7.centos.plus: packager +kernel-plus-tools-3.10.0-327.4.4.el7.centos.plus: vendor +kernel-plus-tools-3.10.0-327.4.5.el7.centos.plus: packager +kernel-plus-tools-3.10.0-327.4.5.el7.centos.plus: vendor +kernel-plus-tools-3.10.0-327.el7.centos.plus: packager +kernel-plus-tools-3.10.0-327.el7.centos.plus: vendor +kernel-plus-tools-libs-3.10.0-327.10.1.el7.centos.plus: packager +kernel-plus-tools-libs-3.10.0-327.10.1.el7.centos.plus: vendor +kernel-plus-tools-libs-3.10.0-327.13.1.el7.centos.plus: packager +kernel-plus-tools-libs-3.10.0-327.13.1.el7.centos.plus: vendor +kernel-plus-tools-libs-3.10.0-327.18.2.el7.centos.plus: packager +kernel-plus-tools-libs-3.10.0-327.18.2.el7.centos.plus: vendor +kernel-plus-tools-libs-3.10.0-327.3.1.el7.centos.plus: packager +kernel-plus-tools-libs-3.10.0-327.3.1.el7.centos.plus: vendor +kernel-plus-tools-libs-3.10.0-327.4.4.el7.centos.plus: packager +kernel-plus-tools-libs-3.10.0-327.4.4.el7.centos.plus: vendor +kernel-plus-tools-libs-3.10.0-327.4.5.el7.centos.plus: packager +kernel-plus-tools-libs-3.10.0-327.4.5.el7.centos.plus: vendor +kernel-plus-tools-libs-3.10.0-327.el7.centos.plus: packager +kernel-plus-tools-libs-3.10.0-327.el7.centos.plus: vendor +kernel-plus-tools-libs-devel-3.10.0-327.10.1.el7.centos.plus: packager +kernel-plus-tools-libs-devel-3.10.0-327.10.1.el7.centos.plus: vendor +kernel-plus-tools-libs-devel-3.10.0-327.13.1.el7.centos.plus: packager +kernel-plus-tools-libs-devel-3.10.0-327.13.1.el7.centos.plus: vendor +kernel-plus-tools-libs-devel-3.10.0-327.18.2.el7.centos.plus: packager +kernel-plus-tools-libs-devel-3.10.0-327.18.2.el7.centos.plus: vendor +kernel-plus-tools-libs-devel-3.10.0-327.3.1.el7.centos.plus: packager +kernel-plus-tools-libs-devel-3.10.0-327.3.1.el7.centos.plus: vendor +kernel-plus-tools-libs-devel-3.10.0-327.4.4.el7.centos.plus: packager +kernel-plus-tools-libs-devel-3.10.0-327.4.4.el7.centos.plus: vendor +kernel-plus-tools-libs-devel-3.10.0-327.4.5.el7.centos.plus: packager +kernel-plus-tools-libs-devel-3.10.0-327.4.5.el7.centos.plus: vendor +kernel-plus-tools-libs-devel-3.10.0-327.el7.centos.plus: packager +kernel-plus-tools-libs-devel-3.10.0-327.el7.centos.plus: vendor +mokutil-12-2.el7: packager +mokutil-12-2.el7: vendor +perf-3.10.0-327.10.1.el7.centos.plus: packager +perf-3.10.0-327.10.1.el7.centos.plus: vendor +perf-3.10.0-327.13.1.el7.centos.plus: packager +perf-3.10.0-327.13.1.el7.centos.plus: vendor +perf-3.10.0-327.18.2.el7.centos.plus: packager +perf-3.10.0-327.18.2.el7.centos.plus: vendor +perf-3.10.0-327.3.1.el7.centos.plus: packager +perf-3.10.0-327.3.1.el7.centos.plus: vendor +perf-3.10.0-327.4.4.el7.centos.plus: packager +perf-3.10.0-327.4.4.el7.centos.plus: vendor +perf-3.10.0-327.4.5.el7.centos.plus: packager +perf-3.10.0-327.4.5.el7.centos.plus: vendor +perf-3.10.0-327.el7.centos.plus: packager +perf-3.10.0-327.el7.centos.plus: vendor +python-perf-3.10.0-327.10.1.el7.centos.plus: packager +python-perf-3.10.0-327.10.1.el7.centos.plus: vendor +python-perf-3.10.0-327.13.1.el7.centos.plus: packager +python-perf-3.10.0-327.13.1.el7.centos.plus: vendor +python-perf-3.10.0-327.18.2.el7.centos.plus: packager +python-perf-3.10.0-327.18.2.el7.centos.plus: vendor +python-perf-3.10.0-327.3.1.el7.centos.plus: packager +python-perf-3.10.0-327.3.1.el7.centos.plus: vendor +python-perf-3.10.0-327.4.4.el7.centos.plus: packager +python-perf-3.10.0-327.4.4.el7.centos.plus: vendor +python-perf-3.10.0-327.4.5.el7.centos.plus: packager +python-perf-3.10.0-327.4.5.el7.centos.plus: vendor +python-perf-3.10.0-327.el7.centos.plus: packager +python-perf-3.10.0-327.el7.centos.plus: vendor +certmonger-0.77.5-2.el6: packager +certmonger-0.77.5-2.el6: vendor +openssl-1.0.1e-48.el6: packager +openssl-1.0.1e-48.el6: vendor +openssl-1.0.1e-48.el6: packager +openssl-1.0.1e-48.el6: vendor +openssl-devel-1.0.1e-48.el6: packager +openssl-devel-1.0.1e-48.el6: vendor +openssl-devel-1.0.1e-48.el6: packager +openssl-devel-1.0.1e-48.el6: vendor +openssl-perl-1.0.1e-48.el6: packager +openssl-perl-1.0.1e-48.el6: vendor +openssl-static-1.0.1e-48.el6: packager +openssl-static-1.0.1e-48.el6: vendor +shim-ia32-12-2.el7: packager +shim-ia32-12-2.el7: vendor +shim-unsigned-ia32-12-2.el7: packager +shim-unsigned-ia32-12-2.el7: vendor +shim-unsigned-x64-12-2.el7: packager +shim-unsigned-x64-12-2.el7: vendor +shim-x64-12-2.el7: packager +shim-x64-12-2.el7: vendor +xmlgraphics-commons-1.3.1-1.2.el6: packager +xmlgraphics-commons-1.3.1-1.2.el6: vendor +xmlgraphics-commons-javadoc-1.3.1-1.2.el6: packager +xmlgraphics-commons-javadoc-1.3.1-1.2.el6: vendor +nss_wrapper-1.1.3-1.el7: packager +nss_wrapper-1.1.3-1.el7: vendor +redhat-access-insights-1.0.13-2.el7: vendor +kernel-abi-whitelists-4.14.0-49.el7: packager +kernel-abi-whitelists-4.14.0-49.el7: vendor +kernel-doc-4.14.0-49.el7: packager +kernel-doc-4.14.0-49.el7: vendor +tog-pegasus-2.14.1-5.el7: packager +tog-pegasus-2.14.1-5.el7: vendor +tog-pegasus-devel-2.14.1-5.el7: packager +tog-pegasus-devel-2.14.1-5.el7: vendor +tog-pegasus-libs-2.14.1-5.el7: packager +tog-pegasus-libs-2.14.1-5.el7: vendor +tog-pegasus-test-2.14.1-5.el7: packager +tog-pegasus-test-2.14.1-5.el7: vendor +vulkan-1.0.61.1-2.el7: packager +vulkan-1.0.61.1-2.el7: vendor +vulkan-devel-1.0.61.1-2.el7: packager +vulkan-devel-1.0.61.1-2.el7: vendor +fwupdate-9-8.el7.centos: packager +fwupdate-9-8.el7.centos: vendor +fwupdate-devel-9-8.el7.centos: packager +fwupdate-devel-9-8.el7.centos: vendor +fwupdate-efi-9-8.el7.centos: packager +fwupdate-efi-9-8.el7.centos: vendor +fwupdate-libs-9-8.el7.centos: packager +fwupdate-libs-9-8.el7.centos: vendor +ruby-2.0.0.648-33.el7_4.armv7hl: packager +ruby-2.0.0.648-33.el7_4.armv7hl: vendor +ruby-devel-2.0.0.648-33.el7_4.armv7hl: packager +ruby-devel-2.0.0.648-33.el7_4.armv7hl: vendor +ruby-libs-2.0.0.648-33.el7_4.armv7hl: packager +ruby-libs-2.0.0.648-33.el7_4.armv7hl: vendor +ruby-tcltk-2.0.0.648-33.el7_4.armv7hl: packager +ruby-tcltk-2.0.0.648-33.el7_4.armv7hl: vendor +rubygem-bigdecimal-1.2.0-33.el7_4.armv7hl: packager +rubygem-bigdecimal-1.2.0-33.el7_4.armv7hl: vendor +rubygem-io-console-0.4.2-33.el7_4.armv7hl: packager +rubygem-io-console-0.4.2-33.el7_4.armv7hl: vendor +rubygem-json-1.7.7-33.el7_4.armv7hl: packager +rubygem-json-1.7.7-33.el7_4.armv7hl: vendor +rubygem-psych-2.0.0-33.el7_4.armv7hl: packager +rubygem-psych-2.0.0-33.el7_4.armv7hl: vendor +cockpit-160-1.el7.centos.armv7hl: packager +cockpit-160-1.el7.centos.armv7hl: vendor +cockpit-bridge-160-1.el7.centos.armv7hl: packager +cockpit-bridge-160-1.el7.centos.armv7hl: vendor +cockpit-dashboard-160-1.el7.centos.armv7hl: packager +cockpit-dashboard-160-1.el7.centos.armv7hl: vendor +cockpit-doc-160-1.el7.centos.armv7hl: packager +cockpit-doc-160-1.el7.centos.armv7hl: vendor +cockpit-docker-160-1.el7.centos.armv7hl: packager +cockpit-docker-160-1.el7.centos.armv7hl: vendor +cockpit-machines-160-1.el7.centos.armv7hl: packager +cockpit-machines-160-1.el7.centos.armv7hl: vendor +cockpit-packagekit-160-1.el7.centos.armv7hl: packager +cockpit-packagekit-160-1.el7.centos.armv7hl: vendor +cockpit-pcp-160-1.el7.centos.armv7hl: packager +cockpit-pcp-160-1.el7.centos.armv7hl: vendor +cockpit-tests-160-1.el7.centos.armv7hl: packager +cockpit-tests-160-1.el7.centos.armv7hl: vendor +cockpit-ws-160-1.el7.centos.armv7hl: packager +cockpit-ws-160-1.el7.centos.armv7hl: vendor +python-cheetah-2.4.4-5.el7.armv7hl: packager +python-cheetah-2.4.4-5.el7.armv7hl: vendor +centos-release-azure-1.0-2.el6.centos.noarch: packager +centos-release-azure-1.0-2.el6.centos.noarch: vendor +centos-release-azure-1.0-2.el7.noarch: packager +centos-release-azure-1.0-2.el7.noarch: vendor +epel-release-7-11.noarch: packager +epel-release-7-11.noarch: vendor +elrepo-release-7.0-4.el7.elrepo.noarch: packager +elrepo-release-7.0-4.el7.elrepo.noarch: vendor