diff --git a/ppss-test.sh b/ppss-test.sh index de7b2f3..a0346dd 100755 --- a/ppss-test.sh +++ b/ppss-test.sh @@ -2,6 +2,7 @@ DEBUG="$1" VERSION=2.45 +TMP_DIR="ppss" cleanup () { @@ -14,6 +15,16 @@ cleanup () { done } +parseJobStatus () { + + TMP_FILE="$1" + + RES=`grep "Status:" "$JOBLOG/$TMP_FILE"` + STATUS=`echo "$RES" | awk '{ print $2 }'` + echo "$STATUS" + +} + oneTimeSetUp () { NORMALTESTFILES=`echo test-{a..z}` @@ -70,6 +81,39 @@ oneTimeTearDown () { fi } +createDirectoryWithSomeFiles () { + + A="File with Spaces" + B="File\With\Slashes" + + mkdir "/tmp/$TMP_DIR" + for x in "$A" "$B" + do + TMP_FILE="/tmp/$TMP_DIR/$x" + touch "$TMP_FILE" + done +} + +testSpacesInFilenames () { + + createDirectoryWithSomeFiles + + RES=$( { ./ppss.sh -d /tmp/$TMP_DIR -c 'ls -alh ' >> /dev/null ; } 2>&1 ) + assertEquals "PPSS did not execute properly." 0 "$?" + + assertNull "PPSS retured some errors..." "$RES" + if [ ! "$?" == "0" ] + then + echo "RES IS $RES" + fi + + grep "SUCCESS" $JOBLOG/* >> /dev/null 2>&1 + assertEquals "Found error with space in filename $TMP_FILE" "0" "$?" + + rm -rf "/tmp/$TMP_DIR" + rename-ppss-dir $FUNCNAME +} + testSpecialCharacterHandling () { RES=$( { ./ppss.sh -f "$INPUTFILESPECIAL" -c 'echo ' >> /dev/null ; } 2>&1 ) @@ -92,6 +136,38 @@ testSpecialCharacterHandling () { rename-ppss-dir $FUNCNAME } +testSkippingOfProcessedItems () { + + createDirectoryWithSomeFiles + + RES=$( { ./ppss.sh -d /tmp/$TMP_DIR -c 'echo ' >> /dev/null ; } 2>&1 ) + assertEquals "PPSS did not execute properly." 0 "$?" + assertNull "PPSS retured some errors..." "$RES" + + RES=$( { ./ppss.sh -d /tmp/$TMP_DIR -c 'echo ' >> /dev/null ; } 2>&1 ) + assertEquals "PPSS did not execute properly." 0 "$?" + assertNull "PPSS retured some errors..." "$RES" + + grep -i skip ./ppss/* >> /dev/null 2>&1 + assertEquals "Skipping of items went wrong." 0 "$?" + + rename-ppss-dir $FUNCNAME-1 + + RES=$( { ./ppss.sh -f $INPUTFILESPECIAL -c 'echo ' >> /dev/null ; } 2>&1 ) + assertEquals "PPSS did not execute properly." 0 "$?" + assertNull "PPSS retured some errors..." "$RES" + + RES=$( { ./ppss.sh -f $INPUTFILESPECIAL -c 'echo ' >> /dev/null ; } 2>&1 ) + assertEquals "PPSS did not execute properly." 0 "$?" + assertNull "PPSS retured some errors..." "$RES" + + grep -i skip ./ppss/* >> /dev/null 2>&1 + assertEquals "Skipping of items went wrong." 0 "$?" + + rm -rf "/tmp/$TMP_DIR" + rename-ppss-dir $FUNCNAME-2 +} + testExistLogFiles () { ./ppss.sh -f "$INPUTFILENORMAL" -c 'echo "$ITEM"' >> /dev/null @@ -121,8 +197,7 @@ getStatusOfJob () { for x in $NORMALTESTFILES do - RES=`grep "Status:" "$JOBLOG/$x"` - STATUS=`echo "$RES" | awk '{ print $2 }'` + STATUS=`parseJobStatus "$x"` assertEquals "FAILED WITH STATUS $STATUS." "$EXPECTED" "$STATUS" done diff --git a/ppss.sh b/ppss.sh index a57b1b7..559edd4 100755 --- a/ppss.sh +++ b/ppss.sh @@ -1403,7 +1403,7 @@ commando () { ITEM="./$PPSS_LOCAL_TMPDIR/$ITEM_NO_PATH" fi - LOG_FILE_NAME=`echo "$ITEM" | sed s/^\\\.//g | sed s/^\\\.\\\.//g | sed s/\\\///g` + LOG_FILE_NAME=`echo "$ITEM" | sed s/^\\\.//g | sed s/^\\\.\\\.//g | sed s/\\\///g | sed s/\\ /_/g` ITEM_LOG_FILE="$JOB_LOG_DIR/$LOG_FILE_NAME" OUTPUT_DIR=$PPSS_LOCAL_OUTPUT/"$LOG_FILE_NAME"