More small fixes.

This commit is contained in:
Louwrentius 2009-12-16 20:27:09 +00:00
parent f2ccafefc6
commit 7d0815528e
2 changed files with 78 additions and 3 deletions

View File

@ -2,6 +2,7 @@
DEBUG="$1" DEBUG="$1"
VERSION=2.45 VERSION=2.45
TMP_DIR="ppss"
cleanup () { cleanup () {
@ -14,6 +15,16 @@ cleanup () {
done done
} }
parseJobStatus () {
TMP_FILE="$1"
RES=`grep "Status:" "$JOBLOG/$TMP_FILE"`
STATUS=`echo "$RES" | awk '{ print $2 }'`
echo "$STATUS"
}
oneTimeSetUp () { oneTimeSetUp () {
NORMALTESTFILES=`echo test-{a..z}` NORMALTESTFILES=`echo test-{a..z}`
@ -70,6 +81,39 @@ oneTimeTearDown () {
fi 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 () { testSpecialCharacterHandling () {
RES=$( { ./ppss.sh -f "$INPUTFILESPECIAL" -c 'echo ' >> /dev/null ; } 2>&1 ) RES=$( { ./ppss.sh -f "$INPUTFILESPECIAL" -c 'echo ' >> /dev/null ; } 2>&1 )
@ -92,6 +136,38 @@ testSpecialCharacterHandling () {
rename-ppss-dir $FUNCNAME 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 () { testExistLogFiles () {
./ppss.sh -f "$INPUTFILENORMAL" -c 'echo "$ITEM"' >> /dev/null ./ppss.sh -f "$INPUTFILENORMAL" -c 'echo "$ITEM"' >> /dev/null
@ -121,8 +197,7 @@ getStatusOfJob () {
for x in $NORMALTESTFILES for x in $NORMALTESTFILES
do do
RES=`grep "Status:" "$JOBLOG/$x"` STATUS=`parseJobStatus "$x"`
STATUS=`echo "$RES" | awk '{ print $2 }'`
assertEquals "FAILED WITH STATUS $STATUS." "$EXPECTED" "$STATUS" assertEquals "FAILED WITH STATUS $STATUS." "$EXPECTED" "$STATUS"
done done

View File

@ -1403,7 +1403,7 @@ commando () {
ITEM="./$PPSS_LOCAL_TMPDIR/$ITEM_NO_PATH" ITEM="./$PPSS_LOCAL_TMPDIR/$ITEM_NO_PATH"
fi 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" ITEM_LOG_FILE="$JOB_LOG_DIR/$LOG_FILE_NAME"
OUTPUT_DIR=$PPSS_LOCAL_OUTPUT/"$LOG_FILE_NAME" OUTPUT_DIR=$PPSS_LOCAL_OUTPUT/"$LOG_FILE_NAME"