]> granicus.if.org Git - check/commitdiff
Have tests clean up the log file on success.
authorOren Ben-Kiki <oren@ben-kiki.org>
Mon, 28 Aug 2017 05:21:31 +0000 (08:21 +0300)
committerOren Ben-Kiki <oren@ben-kiki.org>
Mon, 28 Aug 2017 05:21:31 +0000 (08:21 +0300)
tests/test_env_max_msg_size.sh
tests/test_set_max_msg_size.sh

index 0feaed5c978a665ad823f39a18637773de4184ae..97c21e99b25e17050a1b82b4645149122bd69bae 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env sh
 
 UNIT_TEST=./check_set_max_msg_size
-MAX_MESSAGE_LOG_FILE=${UNIT_TEST}.output
+MAX_MESSAGE_LOG_FILE=${UNIT_TEST}.env.output
 TOO_LONG_MESSAGE="Message string too long"
 
 # This test reduces the maximal message size using the environment variable,
@@ -17,8 +17,10 @@ NUM_TOO_LONG_MESSAGES=$(grep "${TOO_LONG_MESSAGE}" ${MAX_MESSAGE_LOG_FILE} | wc
 
 if test ${NUM_TOO_LONG_MESSAGES} -gt 0; then
     echo "Maximal message size was reduced."
+    rm -f ${MAX_MESSAGE_LOG_FILE}
     exit 0
 else
     echo "ERROR: Maximal message size was not reduced."
+    echo "Test output was preserved in ${MAX_MESSAGE_LOG_FILE}"
     exit 1
 fi
index 92a5b499e671b92af8c06cae664af21de3bfb7de..830fb12e24f64694f0c22574889cd6af5058fbbe 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env sh
 
 UNIT_TEST=./check_set_max_msg_size
-MAX_MESSAGE_LOG_FILE=${UNIT_TEST}.output
+MAX_MESSAGE_LOG_FILE=${UNIT_TEST}.set.output
 TOO_LONG_MESSAGE="Message string too long"
 
 # This test reduces the maximal message size using the provided function,
@@ -15,8 +15,10 @@ NUM_TOO_LONG_MESSAGES=$(grep "${TOO_LONG_MESSAGE}" ${MAX_MESSAGE_LOG_FILE} | wc
 
 if test ${NUM_TOO_LONG_MESSAGES} -gt 0; then
     echo "Maximal message size was reduced."
+    rm -f ${MAX_MESSAGE_LOG_FILE}
     exit 0
 else
     echo "ERROR: Maximal message size was not reduced."
+    echo "Test output was preserved in ${MAX_MESSAGE_LOG_FILE}"
     exit 1
 fi