From 29f133f44d01802294f9808a31aa07ae0adbe924 Mon Sep 17 00:00:00 2001 From: ville rantanen Date: Sat, 29 Mar 2014 11:23:13 +0200 Subject: [PATCH] Attempt to run testcases more easily --- anduril/testing/run-component-docs | 49 +++++++++++++++++++ anduril/testing/run-test-component | 68 +++++++++++++++++++++++++++ anduril/testing/run-test-network | 60 +++++++++++++++++++++++ anduril/{ => testing}/testcasecopy.sh | 0 4 files changed, 177 insertions(+) create mode 100755 anduril/testing/run-component-docs create mode 100755 anduril/testing/run-test-component create mode 100755 anduril/testing/run-test-network rename anduril/{ => testing}/testcasecopy.sh (100%) diff --git a/anduril/testing/run-component-docs b/anduril/testing/run-component-docs new file mode 100755 index 0000000..076b99a --- /dev/null +++ b/anduril/testing/run-component-docs @@ -0,0 +1,49 @@ +#!/bin/bash + +function return_error { + echo "$1" + exit 1 +} + +if [ -f "$HOME/Documents/anduril_environment.sh" ] +then . "$HOME/Documents/anduril_environment.sh" + echo Read HOME/Documents/anduril_environment.sh +fi + +[ -d "$ANDURIL_HOME" ] || return_error "ANDURIL_HOME is not set!" +[ -d "$ANDURIL_BUNDLES" ] || return_error "ANDURIL_BUNDLES is not set! (folder of bundles, may also be same as ANDURIL_HOME)" + +echo ANDURIL_HOME="$ANDURIL_HOME" +echo ANDURIL_BUNDLES="$ANDURIL_BUNDLES" + +if [ ! -z "$1" ] +then search=$( echo $1 | tr A-Z a-z ) +fi + +MICROHOME="$ANDURIL_HOME/microarray" +bundles=( ) +echo -n "Looking for bundles: " +for e in $( ls $ANDURIL_BUNDLES ) +do [[ -e ${ANDURIL_BUNDLES}/$e/bundle.xml ]] || continue + bname=$( cat ${ANDURIL_BUNDLES}/$e/bundle.xml | tr -d [:cntrl:] | grep '' | sed 's/.*\(.*\)<\/name>.*/\1/' | tr A-Z a-z ) + bundles+=( $bname ) + echo -n "$bname " + if [ "$search" = "$bname" ] + then BUNDLESTRING="-b ${ANDURIL_BUNDLES}/$e" + fi + if [ "$bname" = "microarray" ] + then MICROHOME="${ANDURIL_BUNDLES}/$e" + fi +done +echo "" + +if [ -z "$1" ] +then return_error "Give bundle name to create component docs!" +fi + +[ -d "$MICROHOME" ] || return_error "Could not find Microarray bundle home: $MICROHOME" +[ -z "$BUNDLESTRING" ] && return_error "Could not find given bundle: $search" + + +echo $ANDURIL_HOME/bin/anduril build-doc doc_${search} --log log_doc "$BUNDLESTRING" -t $MICROHOME/datatypes.xml +eval $ANDURIL_HOME/bin/anduril build-doc doc_${search} --log log_doc "$BUNDLESTRING" -t $MICROHOME/datatypes.xml diff --git a/anduril/testing/run-test-component b/anduril/testing/run-test-component new file mode 100755 index 0000000..7a8eb70 --- /dev/null +++ b/anduril/testing/run-test-component @@ -0,0 +1,68 @@ +#!/bin/bash + +function return_error { + echo "$1" + exit 1 +} + +if [ -f "$HOME/Documents/anduril_environment.sh" ] +then . "$HOME/Documents/anduril_environment.sh" + echo Read HOME/Documents/anduril_environment.sh +fi + +[ -d "$ANDURIL_HOME" ] || return_error "ANDURIL_HOME is not set!" +[ -d "$ANDURIL_BUNDLES" ] || return_error "ANDURIL_BUNDLES is not set! (folder of bundles, may also be same as ANDURIL_HOME)" + +echo ANDURIL_HOME="$ANDURIL_HOME" +echo ANDURIL_BUNDLES="$ANDURIL_BUNDLES" + +echo -n "Looking for bundles: " + b="$ANDURIL_HOME/builtin/bundle.xml" + BUNDLESTRING=" -b $( readlink -f $( dirname ${b} ) )" + bname=$( cat "$b" | tr -d [:cntrl:] | grep '' | sed 's/.*\(.*\)<\/name>.*/\1/' ) + echo -n "$bname " + [ -d "$( dirname ${b} )/components" ] && \ + list=$( find $( dirname ${b} )/components -maxdepth 2 -mindepth 2 -name component.xml -printf '%P\\n' | sed 's,/component.xml,,g' ) + [ -d "$( dirname ${b} )/functions" ] && \ + list=${list}$( find $( dirname ${b} )/functions -maxdepth 2 -mindepth 2 -name component.xml -printf '%P\\n' | sed 's,/component.xml,,g' ) + +for b in $( find -L "$ANDURIL_BUNDLES" -maxdepth 2 -name bundle.xml | grep -v '/testsystem/|/techtest/' ); do + bname=$( cat "$b" | tr -d [:cntrl:] | grep '' | sed 's/.*\(.*\)<\/name>.*/\1/' ) + echo -n "$bname " + [ -d "$( dirname ${b} )/components" ] && \ + list=${list}$( find $( dirname ${b} )/components -maxdepth 2 -mindepth 2 -name component.xml -printf '%P\\n' | sed 's,/component.xml,,g' ) + [ -d "$( dirname ${b} )/functions" ] && \ + list=${list}$( find $( dirname ${b} )/functions -maxdepth 2 -mindepth 2 -name component.xml -printf '%P\\n' | sed 's,/component.xml,,g' ) + BUNDLESTRING=${BUNDLESTRING}" -b $( dirname ${b} )" +done +echo "" +list=( $( echo -e $list | sort )) + +if [ -z "$1" ] +then + for (( n=0; n < ${#list[@]} ; n++ )) + do echo $n: ${list[$n]} + done + echo "all: ALL" + echo "clean: delete log and exec folders" + exit 0 +fi +if [[ "$1" == ?([0-9]*) ]] +then # is numeric + echo test ${list[$1]} + echo $ANDURIL_HOME/bin/anduril test ${list[$1]} --log log_component -d result_component ${BUNDLESTRING} + $ANDURIL_HOME/bin/anduril test ${list[$1]} --log log_component -d result_component ${BUNDLESTRING} +else # is not numeric + if [ $1 = "all" ] + then for (( n=0; n < ${#list[@]} ; n++ )) + do echo running: ${list[$n]} + $ANDURIL_HOME/bin/anduril test ${list[$n]} --log log_component -d result_component ${BUNDLESTRING} + done + elif [ $1 = "clean" ] + then rm -vrf log_component result_component + else + echo test $1 + echo $ANDURIL_HOME/bin/anduril test $1 --log log_component -d result_component ${BUNDLESTRING} + $ANDURIL_HOME/bin/anduril test $1 --log log_component -d result_component ${BUNDLESTRING} + fi +fi diff --git a/anduril/testing/run-test-network b/anduril/testing/run-test-network new file mode 100755 index 0000000..9c72342 --- /dev/null +++ b/anduril/testing/run-test-network @@ -0,0 +1,60 @@ +#!/bin/bash + +function return_error { + echo "$1" + exit 1 +} + +if [ -f "$HOME/Documents/anduril_environment.sh" ] +then . "$HOME/Documents/anduril_environment.sh" + echo Read HOME/Documents/anduril_environment.sh +fi + +[ -d "$ANDURIL_HOME" ] || return_error "ANDURIL_HOME is not set!" +[ -d "$ANDURIL_BUNDLES" ] || return_error "ANDURIL_BUNDLES is not set! (folder of bundles, may also be same as ANDURIL_HOME)" + +echo -n "Looking for bundles: " + b="$ANDURIL_HOME/builtin/bundle.xml" + BUNDLESTRING=" -b $( readlink -f $( dirname ${b} ) )" + bname=$( cat "$b" | tr -d [:cntrl:] | grep '' | sed 's/.*\(.*\)<\/name>.*/\1/' ) + echo -n "$bname " + [ -d "$( dirname ${b} )/test-networks" ] && \ + list=$( find $( dirname ${b} )/test-networks -maxdepth 2 -mindepth 2 -name network.and -printf '%P\\n' | sed 's,/network.and,,g' ) + +for b in $( find -L "$ANDURIL_BUNDLES" -maxdepth 2 -name bundle.xml | grep -v testsystem ); do + BUNDLESTRING=${BUNDLESTRING}" -b $( readlink -f $( dirname ${b} ) )" + bname=$( cat "$b" | tr -d [:cntrl:] | grep '' | sed 's/.*\(.*\)<\/name>.*/\1/' ) + echo -n "$bname " + [ -d "$( dirname ${b} )/test-networks" ] && \ + list=${list}$( find $( dirname ${b} )/test-networks -maxdepth 2 -mindepth 2 -name network.and -printf '%P\\n' | sed 's,/network.and,,g' ) +done +echo "" +list=( $( echo -e $list | sort )) + +if [ -z "$1" ] +then + for (( n=0; n < ${#list[@]} ; n++ )) + do echo $n: ${list[$n]} + done + echo "all: ALL" + echo "clean: delete log and exec folders" + exit 0 +fi +if [[ "$1" == ?([0-9]*) ]] +then # is numeric + echo test ${list[$1]} + echo $ANDURIL_HOME/bin/anduril test-networks ${list[$1]} --log log_network -d result_network ${BUNDLESTRING} + $ANDURIL_HOME/bin/anduril test-networks ${list[$1]} --log log_network -d result_network ${BUNDLESTRING} +else # is not numeric + if [ $1 = "all" ] + then for (( n=0; n < ${#list[@]} ; n++ )) + do echo running: ${list[$n]} + $ANDURIL_HOME/bin/anduril test-networks ${list[$n]} --log log_network -d result_network ${BUNDLESTRING} + done + elif [ $1 = "clean" ] + then rm -vrf log_network result_network + else + echo test $1 + $ANDURIL_HOME/bin/anduril test-networks $1 --log log_network -d result_network ${BUNDLESTRING} + fi +fi diff --git a/anduril/testcasecopy.sh b/anduril/testing/testcasecopy.sh similarity index 100% rename from anduril/testcasecopy.sh rename to anduril/testing/testcasecopy.sh