summaryrefslogtreecommitdiffstats
path: root/scripts/compose_pki_test_package
diff options
context:
space:
mode:
authorAbhishek Koneru <akoneru@redhat.com>2013-11-06 16:08:39 -0500
committerAbhishek Koneru <akoneru@redhat.com>2013-11-10 15:15:37 -0500
commitb9d125a25e7b53cfe1cc9437b6a31a87c324bbe2 (patch)
tree28434dbf47dbf2ac6711604ac3f8e4c0513dc327 /scripts/compose_pki_test_package
parentbb20c9ffb38baae7ae89f16737e37569af445bdc (diff)
downloadpki-b9d125a25e7b53cfe1cc9437b6a31a87c324bbe2.tar.gz
pki-b9d125a25e7b53cfe1cc9437b6a31a87c324bbe2.tar.xz
pki-b9d125a25e7b53cfe1cc9437b6a31a87c324bbe2.zip
Provide compose scripts for tests.
Provide a compose script for building the test rpm and creating the job xml (by updating the job template with custom values provided in a job xml config file). Also add a new option --createrepo to the compose_pki_core_package script to create a repository of the built rpms at the location specified in a config file. Tickets #657, 722,723,724
Diffstat (limited to 'scripts/compose_pki_test_package')
-rwxr-xr-xscripts/compose_pki_test_package80
1 files changed, 80 insertions, 0 deletions
diff --git a/scripts/compose_pki_test_package b/scripts/compose_pki_test_package
new file mode 100755
index 000000000..075495489
--- /dev/null
+++ b/scripts/compose_pki_test_package
@@ -0,0 +1,80 @@
+#!/bin/bash
+# BEGIN COPYRIGHT BLOCK
+# (C) 2010 Red Hat, Inc.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+
+check_for_dependencies()
+{
+ NOT_FOUND="FALSE"
+ for i in "expect" "beakerlib" "beaker-client" "rhts-devel"
+ do
+ rpm -qa $i
+ if [ $? -ne 0 ] ; then
+ echo "$i package required."
+ NOT_FOUND="TRUE"
+ fi
+ done
+ if [ $NOT_FOUND = "TRUE" ] ; then
+ echo "Cannot compose test rpm without installing the dependencies."
+ exit -1
+ fi
+}
+
+check_for_dependencies
+
+if [ $# -lt 2 ];
+then
+ echo "Usage: $0 User-ID_for_personalization Job_xml_config_file [--runtests]"
+ exit -1
+fi
+
+RUN_TESTS='N'
+
+if [ $# -gt 2 ];
+then
+ if [ $3 = "--runtests" ]
+ then
+ RUN_TESTS='Y'
+ fi
+fi
+
+### Directory with all the compose scripts
+COMPOSE_DIR=`dirname $0 | cd ; pwd`
+
+PKI_SOURCE_DIR=`cd $COMPOSE_DIR/..; pwd`
+
+### Build the task rpm outside the PKI git source tree.
+### The rhts-build-package command checks if the code is is a git repository,
+### if yes, it will compare tags of the current branch and the master branch.
+### If they do not match then the rpm is not built.
+
+WORK_DIR=`cd $COMPOSE_DIR/../..;pwd`
+
+BUILD_DIR="$WORK_DIR/package.tests"
+
+rm -rf $BUILD_DIR
+
+mkdir $BUILD_DIR
+
+cd $BUILD_DIR
+
+cp -r "$PKI_SOURCE_DIR/tests" .
+
+cd tests/dogtag
+
+### Passing the keyword for personalizing and an option
+### to maintain a seperate folder for each beaker job (Optional)
+./make-package.sh $1 $2
+
+mv *.rpm ../../
+
+mv *.xml ../../
+
+### Running the tasks
+
+cd $COMPOSE_DIR
+
+if [ $RUN_TESTS = "Y" ] ; then
+ ./run_tests
+fi