When "runTest.sh" is executed independently (out of ssat.sh),
it can now print out its results.
Signed-off-by: MyungJoo Ham <myungjoo.ham@gmail.com>
#!/usr/bin/env bash
-if [[ "$SSATAPILOADED" == "1" ]]
+if [[ "$SSATAPILOADED" != "1" ]]
then
- echo "Loaded"
-else
echo "Not Loaded"
+ SILENT=0
+ search="ssat-api.sh"
+ source $search
+
+ retcode=$?
+ count=0
+ while (( ${retcode} != 0 ))
+ do
+ count=$((count+1))
+ if (( ${count} > 5 ))
+ then
+ break
+ fi
+
+ search="../${search}"
+ source $search
+ retcode=$?
+ done
fi
+
testInit
testResult 1 T1 "Dummy Test 1"
testResult 1 T2 "Dummy Test 2"
testResult 0 T3 "Dummy Test 3" 1
-
report
ResultLog=""
function writef {
+ if [[ "${SILENT}" == "0" ]]
+ then
+ printf "$1\n"
+ fi
ResultLog="$ResultLog$1\n"
}
pushd $CASEBASEPATH > /dev/null
output=$(. $file)
retcode=$?
- if [[ "${SILENT}" -eq "0" ]]
- then
- printf "${output}" | sed '$d'
- fi
popd > /dev/null
logfile="${output##*$'\n'}"