#!/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-mk-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" . ### Compile the java test source ### if [ ! -d "$PKI_SOURCE_DIR/build/classes" ] ; then echo "\nThe java tests cannot be compiled since the pki source is not compiled/built.\n" echo "The core sources can be compiled either by eclipse or using the compose scripts.\n" echo "Cannot build the test RPM." exit -1 fi cd tests/dogtag/dev_java_tests rm -rf bin mkdir bin CLASSPATH=$PKI_SOURCE_DIR/build/classes:/usr/share/java/junit4.jar:`pwd`/src:/usr/lib64/jss/jss4.jar:/usr/share/java/httpcomponents/httpclient.jar:/usr/share/java/httpcomponents/httpcore.jar:/usr/share/java/resteasy/jaxrs-api.jar:/usr/share/java/resteasy/resteasy-atom-provider.jar:/usr/share/java/resteasy/resteasy-jaxb-provider.jar:/usr/share/java/resteasy/resteasy-jaxrs.jar:/usr/share/java/resteasy/resteasy-jaxrs-jandex.jar:/usr/share/java/resteasy/resteasy-jettison-provider.jar:/usr/share/java/apache-commons-cli.jar:/usr/share/java/apache-commons-codec.jar:/usr/share/java/apache-commons-logging.jar:/usr/share/java/commons-codec.jar:/usr/share/java/commons-httpclient.jar:/usr/share/java/idm-console-base-1.1.7.jar:/usr/share/java/idm-console-mcc.jar:/usr/share/java/idm-console-nmclf.jar:/usr/share/java/jakarta-commons-httpclient.jar:/usr/share/java/jaxb-api.jar:/usr/share/java/ldapjdk.jar:/usr/share/java/apache-commons-lang.jar:/usr/share/java/istack-commons-runtime.jar:/usr/share/java/scannotation.jar:/usr/share/java/servlet.jar:/usr/share/java/velocity.jar:/usr/share/java/xerces-j2.jar:/usr/share/java/xml-commons-apis.jar:/usr/share/java/tomcat/catalina.jar:/usr/share/java/tomcat/tomcat-util.jar:/usr/share/java/commons-io.jar javac -classpath $CLASSPATH -d bin src/*java ### Building the test rm cd .. ### 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