Compare commits
113 Commits
master
...
distribute
Author | SHA1 | Date |
---|---|---|
Louwrentius | 0869dc92ac | |
Louwrentius | 05945843f0 | |
Louwrentius | a4b5fdc7c1 | |
Louwrentius | 43e68825a3 | |
Louwrentius | 204537cd04 | |
Louwrentius | 297f5eacb8 | |
Louwrentius | f3666a49d6 | |
Louwrentius | 3abe84f218 | |
Louwrentius | 24b368e734 | |
Louwrentius | 7d0815528e | |
Louwrentius | f2ccafefc6 | |
Louwrentius | 20e520e820 | |
Louwrentius | fffccc3e04 | |
Louwrentius | e91f54932c | |
Louwrentius | fedd72bf1c | |
Louwrentius | e4bdd59475 | |
Louwrentius | 1b16eb62ee | |
Louwrentius | d08dc38761 | |
Louwrentius | cd4545d0c3 | |
Louwrentius | 05801b6773 | |
Louwrentius | 722b3b4ea6 | |
Louwrentius | 4d28218ce4 | |
Louwrentius | b1af50040f | |
Louwrentius | 5b840d33c3 | |
Louwrentius | 207e875727 | |
Louwrentius | 4a682daaae | |
Louwrentius | 276e721c7e | |
Louwrentius | 239e422354 | |
Louwrentius | fd7f32668e | |
Louwrentius | e7f158235a | |
Louwrentius | 7a578ff88b | |
Louwrentius | e24cf063e9 | |
Louwrentius | fb3905ad11 | |
Louwrentius | 9a880c313d | |
Louwrentius | 3a8257e519 | |
Louwrentius | e402fa6936 | |
Louwrentius | 24bdb33583 | |
Louwrentius | d2e6bf7c54 | |
Louwrentius | 95eb2e0d07 | |
Louwrentius | 1da1de4b18 | |
Louwrentius | 7ca08b87cf | |
Louwrentius | 815bb952c9 | |
Louwrentius | 9b0e5fdec5 | |
Louwrentius | ebd7ca55b7 | |
Louwrentius | 04847e14db | |
Louwrentius | 64486cb710 | |
Louwrentius | e6d3539b51 | |
Louwrentius | a4f1107863 | |
Louwrentius | ac7192cfde | |
Louwrentius | 7ae3f7c512 | |
Louwrentius | 9e4a89e95f | |
Louwrentius | 62059e887e | |
Louwrentius | 66e04d8806 | |
Louwrentius | 113f4d31cb | |
Louwrentius | 64edfe79c1 | |
Louwrentius | be217ac168 | |
Louwrentius | 49d54913f7 | |
Louwrentius | 2f5b38aedd | |
Louwrentius | 1e26cef172 | |
Louwrentius | 046ba029dc | |
Louwrentius | e5dcc81930 | |
Louwrentius | d523525eca | |
Louwrentius | 8b1e5fed9a | |
Louwrentius | bd75afbf41 | |
Louwrentius | b3ba085fbe | |
Louwrentius | d2a8a6e08d | |
Louwrentius | 964648de7f | |
Louwrentius | 3f6343318a | |
Louwrentius | 71e8d829d9 | |
Louwrentius | aaae2dc713 | |
Louwrentius | 3e5fbfd38f | |
Louwrentius | b1fa580a3e | |
Louwrentius | 954d8632c1 | |
Louwrentius | c6161eb4b4 | |
Louwrentius | 04f13096a4 | |
Louwrentius | 244cfce933 | |
Louwrentius | c8f4a2caa0 | |
Louwrentius | 4b45db3169 | |
Louwrentius | d0a2413f64 | |
Louwrentius | c0d58e6752 | |
Louwrentius | 5317a82ac4 | |
Louwrentius | d8c73dba4b | |
Louwrentius | f6062bfdaf | |
Louwrentius | 979b1cc0a4 | |
Louwrentius | ffeaf1ccf6 | |
Louwrentius | 808d14e08c | |
Louwrentius | 73d49b125b | |
Louwrentius | c3975dd64a | |
Louwrentius | 0a35341033 | |
Louwrentius | 1bdfe61490 | |
Louwrentius | 02f0d7b4fa | |
Louwrentius | 21114ec54a | |
Louwrentius | cca01f27fd | |
Louwrentius | f83f916c57 | |
Louwrentius | 628e93c904 | |
Louwrentius | c231b8e05a | |
Louwrentius | 6bd4d48a76 | |
Louwrentius | 66a8983a3e | |
Louwrentius | aa15c6f868 | |
Louwrentius | f6b9fad83a | |
Louwrentius | af1eda73d4 | |
Louwrentius | 7c16a77860 | |
Louwrentius | ed55ae5137 | |
Louwrentius | 39c1ecf542 | |
Louwrentius | 2edb204c4c | |
Louwrentius | bca4fda670 | |
Louwrentius | cacb489c14 | |
Louwrentius | fc5d48b73c | |
Louwrentius | 2e76e5e34e | |
Louwrentius | 0090a68d70 | |
Louwrentius | a8bb31a575 | |
Louwrentius | 04501ea92a | |
Louwrentius | f7c2f34cb5 |
|
@ -0,0 +1,223 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DEBUG="$1"
|
||||||
|
VERSION=2.55
|
||||||
|
TMP_DIR="ppss"
|
||||||
|
PPSS=ppss
|
||||||
|
PPSS_DIR=ppss_dir
|
||||||
|
|
||||||
|
cleanup () {
|
||||||
|
|
||||||
|
for x in $REMOVEFILES
|
||||||
|
do
|
||||||
|
if [ -e ./$x ]
|
||||||
|
then
|
||||||
|
rm -r ./$x
|
||||||
|
fi
|
||||||
|
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}`
|
||||||
|
SPECIALTESTFILES="\'file-!@#$%^&*()_+=-0987654321~\' \'file-/\<>?:;'{}[]\' file-/\/\:\/!@#$%^&*()_+=-0987654321~ file-/\<>?:;'{}[] http://www.google.nl ftp://storage.nl"
|
||||||
|
JOBLOG=./$PPSS_DIR/job_log
|
||||||
|
INPUTFILENORMAL=test-normal.input
|
||||||
|
INPUTFILESPECIAL=test-special.input
|
||||||
|
LOCALOUTPUT=ppss_dir/PPSS_LOCAL_OUTPUT
|
||||||
|
|
||||||
|
REMOVEFILES="$INPUTFILENORMAL $INPUTFILESPECIAL $PPSS_DIR test-ppss-*"
|
||||||
|
|
||||||
|
cleanup
|
||||||
|
|
||||||
|
for x in $NORMALTESTFILES
|
||||||
|
do
|
||||||
|
echo "$x" >> "$INPUTFILENORMAL"
|
||||||
|
done
|
||||||
|
|
||||||
|
for x in $SPECIALTESTFILES
|
||||||
|
do
|
||||||
|
echo $x >> "$INPUTFILESPECIAL"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
testVersion () {
|
||||||
|
|
||||||
|
RES=`./$PPSS -v`
|
||||||
|
|
||||||
|
for x in $RES
|
||||||
|
do
|
||||||
|
echo "$x" | grep [0-9] >> /dev/null
|
||||||
|
if [ "$?" == "0" ]
|
||||||
|
then
|
||||||
|
assertEquals "Version mismatch!" "$VERSION" "$x"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
rename-ppss-dir () {
|
||||||
|
|
||||||
|
TEST="$1"
|
||||||
|
|
||||||
|
if [ -e "$PPSS_DIR" ] && [ -d "$PPSS_DIR" ] && [ ! -z "$TEST" ]
|
||||||
|
then
|
||||||
|
mv "$PPSS_DIR" test-ppss-"$TEST"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
oneTimeTearDown () {
|
||||||
|
|
||||||
|
if [ ! "$DEBUG" == "debug" ]
|
||||||
|
then
|
||||||
|
cleanup
|
||||||
|
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 -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 -f "$INPUTFILESPECIAL" -c 'echo ' >> /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
|
||||||
|
|
||||||
|
RES=`find ppss_dir/PPSS_LOCAL_OUTPUT | wc -l | sed 's/\ //g'`
|
||||||
|
assertEquals "To many lock files..." "7" "$RES"
|
||||||
|
|
||||||
|
RES1=`ls -1 $JOBLOG`
|
||||||
|
RES2=`ls -1 $LOCALOUTPUT`
|
||||||
|
|
||||||
|
assertEquals "RES1 $RES1 is not the same as RES2 $RES2" "$RES1" "$RES2"
|
||||||
|
|
||||||
|
rename-ppss-dir $FUNCNAME
|
||||||
|
}
|
||||||
|
|
||||||
|
testSkippingOfProcessedItems () {
|
||||||
|
|
||||||
|
createDirectoryWithSomeFiles
|
||||||
|
|
||||||
|
RES=$( { ./$PPSS -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 -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_dir/* >> /dev/null 2>&1
|
||||||
|
assertEquals "Skipping of items went wrong." 0 "$?"
|
||||||
|
|
||||||
|
rename-ppss-dir $FUNCNAME-1
|
||||||
|
|
||||||
|
RES=$( { ./$PPSS -f $INPUTFILESPECIAL -c 'echo ' >> /dev/null ; } 2>&1 )
|
||||||
|
assertEquals "PPSS did not execute properly." 0 "$?"
|
||||||
|
assertNull "PPSS retured some errors..." "$RES"
|
||||||
|
|
||||||
|
RES=$( { ./$PPSS -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_dir/* >> /dev/null 2>&1
|
||||||
|
assertEquals "Skipping of items went wrong." 0 "$?"
|
||||||
|
|
||||||
|
rm -rf "/tmp/$TMP_DIR"
|
||||||
|
rename-ppss-dir $FUNCNAME-2
|
||||||
|
}
|
||||||
|
|
||||||
|
testExistLogFiles () {
|
||||||
|
|
||||||
|
./$PPSS -f "$INPUTFILENORMAL" -c 'echo "$ITEM"' >> /dev/null
|
||||||
|
assertEquals "PPSS did not execute properly." 0 "$?"
|
||||||
|
|
||||||
|
for x in $NORMALTESTFILES
|
||||||
|
do
|
||||||
|
assertTrue "[ -e $JOBLOG/$x ]"
|
||||||
|
done
|
||||||
|
|
||||||
|
rename-ppss-dir $FUNCNAME
|
||||||
|
}
|
||||||
|
|
||||||
|
getStatusOfJob () {
|
||||||
|
|
||||||
|
EXPECTED="$1"
|
||||||
|
|
||||||
|
if [ "$EXPECTED" == "SUCCESS" ]
|
||||||
|
then
|
||||||
|
./$PPSS -f "$INPUTFILENORMAL" -c 'echo ' >> /dev/null
|
||||||
|
assertEquals "PPSS did not execute properly." 0 "$?"
|
||||||
|
elif [ "$EXPECTED" == "FAILURE" ]
|
||||||
|
then
|
||||||
|
./$PPSS -f "$INPUTFILENORMAL" -c 'thiscommandfails ' >> /dev/null
|
||||||
|
assertEquals "PPSS did not execute properly." 0 "$?"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for x in $NORMALTESTFILES
|
||||||
|
do
|
||||||
|
STATUS=`parseJobStatus "$x"`
|
||||||
|
assertEquals "FAILED WITH STATUS $STATUS." "$EXPECTED" "$STATUS"
|
||||||
|
done
|
||||||
|
|
||||||
|
rename-ppss-dir "$FUNCNAME-$EXPECTED"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
testErrorHandlingOK () {
|
||||||
|
|
||||||
|
getStatusOfJob SUCCESS
|
||||||
|
}
|
||||||
|
|
||||||
|
testErrorHandlingFAIL () {
|
||||||
|
|
||||||
|
getStatusOfJob FAILURE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
. ./shunit2
|
Loading…
Reference in New Issue