From 9c2f7724c2a50246ad73796edfda0917a2aaefe3 Mon Sep 17 00:00:00 2001 From: Abhishek Koneru Date: Wed, 20 Nov 2013 02:24:38 -0500 Subject: Maintain seperate scripts for task and jobxml creation. The compose script for creating the test rpm and submitting the job is broken into two scripts, one for creating the test rpm and one for creating the job xml. CI Test Framework --- scripts/compose_pki_test_package | 25 ++++++++++++------------ scripts/create_beaker_job | 42 ++++++++++++++++++++++++++++++++++++++++ scripts/run_tests | 28 --------------------------- 3 files changed, 54 insertions(+), 41 deletions(-) create mode 100755 scripts/create_beaker_job delete mode 100755 scripts/run_tests (limited to 'scripts') diff --git a/scripts/compose_pki_test_package b/scripts/compose_pki_test_package index 879c48a92..517a54040 100755 --- a/scripts/compose_pki_test_package +++ b/scripts/compose_pki_test_package @@ -23,17 +23,17 @@ check_for_dependencies() check_for_dependencies -if [ $# -lt 2 ]; +if [ $# -lt 1 ]; then - echo "Usage: $0 User-ID_for_personalization Job_xml_config_file [--runtests]" + echo "Usage: $0 unique_identifier [--submit-tests]" exit -1 fi RUN_TESTS='N' -if [ $# -gt 2 ]; +if [ $# -gt 1 ]; then - if [ $3 = "--runtests" ] + if [ $2 = "--submit-tests" ] then RUN_TESTS='Y' fi @@ -53,12 +53,14 @@ WORK_DIR=`cd $COMPOSE_DIR/../..;pwd` BUILD_DIR="$WORK_DIR/package.tests" -rm -rf $BUILD_DIR - -mkdir $BUILD_DIR +if [ ! -d $BUILD_DIR ] ; then + mkdir $BUILD_DIR +fi cd $BUILD_DIR +rm -rf *.rpm + cp -r "$PKI_SOURCE_DIR/tests" . ### Compile the java test source ### @@ -79,16 +81,13 @@ cd .. ### Passing the keyword for personalizing and an option ### to maintain a seperate folder for each beaker job (Optional) -./make-package.sh $1 $2 +./make-package.sh $1 mv *.rpm ../../ -mv *.xml ../../ - +cd ../.. ### Running the tasks -cd $COMPOSE_DIR - if [ $RUN_TESTS = "Y" ] ; then - ./run_tests + bkr task-add *.rpm fi diff --git a/scripts/create_beaker_job b/scripts/create_beaker_job new file mode 100755 index 000000000..5184d4883 --- /dev/null +++ b/scripts/create_beaker_job @@ -0,0 +1,42 @@ +#! /bin/bash + +### Exit if there not enough parameters specified. +if [ $# -lt 2 ]; +then + echo "Usage: ./create-beaker-job-xml unique_identifier Job_xml_config_file [--submit-job]" + exit -1 +fi + +user_id=$1 +### Directory with all the compose scripts +COMPOSE_DIR=`dirname $0 | cd ; pwd` + +PKI_SOURCE_DIR=`cd $COMPOSE_DIR/..; pwd` + +WORK_DIR=`cd $COMPOSE_DIR/../..;pwd` + +BUILD_DIR="$WORK_DIR/package.tests" + +if [ ! -d $BUILD_DIR ] ; then + mkdir $BUILD_DIR +fi + +cd $BUILDDIR + +cp -r $PKI_SOURCE_DIR/tests . + +cd tests/dogtag + +sed -e "s|PKI_TEST_USER_ID|${user_id}|g" beakerjob.dogtag.xml.template >> beakerjob.dogtag.xml + +python update_beaker_job.py beakerjob.dogtag.xml $2 + +if [ $# -gt 2 ]; +then + if [ $3 = "--submit-job" ] + then + bkr job-submit beakerjob.dogtag.xml + fi +fi + +mv beakerjob.dogtag.xml ../../ diff --git a/scripts/run_tests b/scripts/run_tests deleted file mode 100755 index 8e4d65e9f..000000000 --- a/scripts/run_tests +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -WAIT_FOR_RESULT='N' -if [ $# -ge 1 ] ; then - if [ "$1" = "--wait-on-beaker-job" ] ; then - WAIT_FOR_RESULT="Y" - else - echo "Unrecognized option. Usage: ./runtests --wait-on-beaker-job(Optional)" - fi -fi -COMPOSE_PWD=`dirname $0 | cd; pwd` - -TEST_PACKAGE=`cd $COMPOSE_PWD/../../package.tests; pwd` - -if [ ! -d $TEST_PACKAGE ] ; then - echo "Cannot run tests on beaker. Please compose the test rpms." - exit -1 -fi - -cd $TEST_PACKAGE - -bkr task-add *.rpm - -if [ "$WAIT_FOR_RESULT" = "Y" ] ; then - bkr job-submit --wait *.xml -else - bkr job-submit *.xml -fi -- cgit