summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile63
-rw-r--r--PURPOSE2
-rwxr-xr-xpst (renamed from runtest.sh)108
3 files changed, 95 insertions, 78 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 23c1284..0000000
--- a/Makefile
+++ /dev/null
@@ -1,63 +0,0 @@
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# Makefile of /distribution/all/Sanity/tps
-# Description: Test packages sanity
-# Author: Petr Splichal <psplicha@redhat.com>
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
-#
-# This copyrighted material is made available to anyone wishing
-# to use, modify, copy, or redistribute it subject to the terms
-# and conditions of the GNU General Public License version 2.
-#
-# This program is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with this program; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-export TEST=/distribution/all/Sanity/tps
-export TESTVERSION=1.0
-
-BUILT_FILES=
-
-FILES=$(METADATA) runtest.sh Makefile PURPOSE
-
-.PHONY: all install download clean
-
-run: $(FILES) build
- ./runtest.sh
-
-build: $(BUILT_FILES)
- chmod a+x runtest.sh
-
-clean:
- rm -f *~ $(BUILT_FILES)
-
-
-include /usr/share/rhts/lib/rhts-make.include
-
-$(METADATA): Makefile
- @echo "Owner: Petr Splichal <psplicha@redhat.com>" > $(METADATA)
- @echo "Name: $(TEST)" >> $(METADATA)
- @echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
- @echo "Path: $(TEST_DIR)" >> $(METADATA)
- @echo "Description: Test packages sanity" >> $(METADATA)
- @echo "Type: Sanity" >> $(METADATA)
- @echo "TestTime: 30m" >> $(METADATA)
- @echo "RunFor: all" >> $(METADATA)
- @echo "Requires: yum" >> $(METADATA)
- @echo "Priority: Normal" >> $(METADATA)
- @echo "License: GPLv2" >> $(METADATA)
- @echo "Confidential: no" >> $(METADATA)
- @echo "Destructive: no" >> $(METADATA)
-
- rhts-lint $(METADATA)
diff --git a/PURPOSE b/PURPOSE
index 2ec4d96..4bba34a 100644
--- a/PURPOSE
+++ b/PURPOSE
@@ -13,4 +13,4 @@ package tasks such as: verify, delete, install or downgrade as
well.
For more details see the Test Package Sanity page:
-https://fedoraproject.org/wiki/Test_Package_Sanity
+https://fedoraproject.org/wiki/QA:Package_Sanity_Test_Plan
diff --git a/runtest.sh b/pst
index 5530e3e..f151d9f 100755
--- a/runtest.sh
+++ b/pst
@@ -2,8 +2,7 @@
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
-# runtest.sh of /distribution/all/Sanity/tps
-# Description: Test packages sanity
+# Description: Package Sanity test
# Author: Petr Splichal <psplicha@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -26,35 +25,114 @@
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# Include rhts environment
-. /usr/bin/rhts-environment.sh
+# Include BeakerLib environment
. /usr/lib/beakerlib/beakerlib.sh
-PACKAGE="all"
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# BeakerLib Stuff
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+TEST="PackageSanityTest"
+PACKAGE="AnyPackage"
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# Help Message
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+HelpMessage() {
+ cat <<-EOF
+
+ Usage:
+ pst --rpm /path/to/package [/path/to/package...]
+ pst --yum package-nvr [package-nvr...]
+
+ Options:
+ -r --rpm test local update (provide packages with full path)
+ -y --yum update from the updates-testing repo (nvrs only)
+ -d --dry do nothing, just print what would be done
+ -h --help display this help message
+
+EOF
+}
+
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# Parse Options
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-UpdatesRepo="updates-testing"
+ParseOptions() {
+ local getopt=`getopt -q -o rydh -l rpm,yum,dry,help -- "$@"`
+ eval set -- "$getopt"
-OldPackages="vsftpd-2.0.7-2.fc10"
-NewPackages="vsftpd-2.0.7-3.fc10"
+ OptionDry="false"
+ OptionRpm="false"
+ OptionYum="false"
-#OldPackages="phonon-4.3.1-6.fc10.1.i386 phonon-backend-gstreamer-4.3.1-6.fc10.1.i386"
-#NewPackages="phonon-4.3.1-102.fc10.i386 phonon-backend-gstreamer-4.3.1-102.fc10.i386"
+ while true ; do
+ case "$1" in
+ -h|--help)
+ HelpMessage
+ exit 0;;
+ -d|--dry)
+ OptionDry="true"
+ shift;;
+ -r|--rpm)
+ OptionRpm="true"
+ shift;;
+ -y|--yum)
+ OptionYum="true"
+ shift;;
+ --)
+ shift;
+ break;;
+ *)
+ shift;;
+ esac
+ done
+
+ OptionPackages="$@"
+
+ # check that the mode is specified
+ if ! $OptionRpm && ! $OptionYum; then
+ echo "Need to choose either --rpm or --yum mode"
+ exit 1
+ fi
+ # we need at least one package
+ if [ -z "$OptionPackages" ]; then
+ echo "No packages specified"
+ exit 2
+ fi
+}
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# Checking package presence
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Make sure all the packages from the list are not installed on the system
CheckMissingPackages() {
for package in $@; do
- rlRun "rpm -q --quiet $package" 1 "Check missing: $package"
+ rlAssertNotRpm $package
done
}
# Make sure all the packages from the list are installed on the system
CheckInstalledPackages() {
for package in $@; do
- rlRun "rpm -q --quiet $package" 0 "Check installed: $package"
+ rlAssertRpm $package
done
}
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# Main
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Parse command line options
+ParseOptions "$@"
+
+exit 0
+
rlJournalStart
# setup
rlPhaseStartSetup
@@ -62,12 +140,14 @@ rlJournalStart
rlRun "set -o pipefail"
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
+ rlAssertExists "$OldPackages"
+ rlAssertExists "$NewPackages"
CheckInstalledPackages $OldPackages
rlPhaseEnd
# update
rlPhaseStartTest "Update"
- rlRun "yum --enablerepo=$UpdatesRepo update -y $NewPackages" \
+ rlRun "yum --enablerepo=updates-testing update -y $NewPackages" \
0 "Updating to the new packages"
CheckInstalledPackages $NewPackages
CheckMissingPackages $OldPackages
@@ -96,7 +176,7 @@ rlJournalStart
# install (run only if delete was successful)
if $InstallTest; then
rlPhaseStartTest "Install"
- rlRun "yum --enablerepo=$UpdatesRepo install -y $NewPackages" \
+ rlRun "yum --enablerepo=updates-testing install -y $NewPackages" \
0 "Installing the new packages"
CheckInstalledPackages $NewPackages
CheckMissingPackages $OldPackages