[Example/group1A] Allow to print out out of ssat.sh
authorMyungJoo Ham <myungjoo.ham@gmail.com>
Sat, 23 Jun 2018 13:55:04 +0000 (22:55 +0900)
committerMyungJoo Ham <myungjoo.ham@gmail.com>
Sat, 23 Jun 2018 13:55:04 +0000 (22:55 +0900)
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>
exampleCase/group1A/runTest.sh
ssat-api.sh
ssat.sh

index 56802ff..85a9d39 100755 (executable)
@@ -1,16 +1,32 @@
 #!/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
index 9429bd6..a9b09a1 100644 (file)
@@ -50,6 +50,10 @@ fi
 ResultLog=""
 
 function writef {
+       if [[ "${SILENT}" == "0" ]]
+       then
+               printf "$1\n"
+       fi
        ResultLog="$ResultLog$1\n"
 }
 
diff --git a/ssat.sh b/ssat.sh
index 34ab307..8885a0d 100755 (executable)
--- a/ssat.sh
+++ b/ssat.sh
@@ -105,10 +105,6 @@ do
        pushd $CASEBASEPATH > /dev/null
        output=$(. $file)
        retcode=$?
-       if [[ "${SILENT}" -eq "0" ]]
-       then
-               printf "${output}" | sed '$d'
-       fi
        popd > /dev/null
 
        logfile="${output##*$'\n'}"