From: Chris Koeritz Date: Thu, 10 May 2012 19:33:33 +0000 (-0400) Subject: added shunit support in variables, made shunit provide run time for whole X-Git-Tag: 2.140.90~1353 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=ccf0ad0ecce7f27f4cd09f4b57061aea19323dc3;p=feisty_meow.git added shunit support in variables, made shunit provide run time for whole test suite, added example script using shunit. --- diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index 1a9d5b39..dd9adc27 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -173,6 +173,11 @@ if [ -z "$NECHUNG" ]; then export PATH="$FEISTY_MEOW_GENERATED:$PATH:/sbin:." ###noise! :/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/lib:/usr/games:/usr/bin:. + ############## + + # set the SHUNIT_DIR so our shunit tests can find the codebase. + export SHUNIT_DIR="$FEIST_MEOW_SCRIPTS/shunit" + ############## if [ ! -z "$SHELL_DEBUG" ]; then echo variables initialization ends....; fi diff --git a/scripts/shunit/example_shunit_test.sh b/scripts/shunit/example_shunit_test.sh index ab3e01c9..f499bf95 100755 --- a/scripts/shunit/example_shunit_test.sh +++ b/scripts/shunit/example_shunit_test.sh @@ -7,7 +7,8 @@ export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory. cd $WORKDIR -SHUNIT_DIR=/home/fred/xsede/xsede_tests/shunit +# this variable needs to be set somewhere. feisty meow scripts will set it. +#SHUNIT_DIR=/home/fred/shunit oneTimeSetUp() { diff --git a/scripts/shunit/shunit2 b/scripts/shunit/shunit2 old mode 100644 new mode 100755 index a56ed4a5..71a3d8c1 --- a/scripts/shunit/shunit2 +++ b/scripts/shunit/shunit2 @@ -862,6 +862,7 @@ _shunit_generateReport() _shunit_msg_="${_shunit_msg_})" fi + echo "Suite ran for $(($suite_end - $suite_start)) seconds." echo echo "$(date): ${_shunit_msg_}" __shunit_reportGenerated=${SHUNIT_TRUE} @@ -1041,6 +1042,9 @@ if [ "${__shunit_mode}" = "${__SHUNIT_MODE_STANDALONE}" ]; then . "`_shunit_prepForSourcing \"${__shunit_script}\"`" fi +# record when the tests started running. +suite_start=$(date +%s) + # execute the oneTimeSetUp function (if it exists) oneTimeSetUp @@ -1063,6 +1067,8 @@ _shunit_execSuite # execute the oneTimeTearDown function (if it exists) oneTimeTearDown +suite_end=$(date +%s) + # generate the report _shunit_generateReport