Commit e8e3f570 authored by Kenneth Ryan Hancock's avatar Kenneth Ryan Hancock
Browse files

Merge branch 'master' into 'master'

Master

See merge request !13
parents d21b0c82 e4426b97
This diff is collapsed.
...@@ -16,7 +16,7 @@ copyin $SCRATCH/1.txt 0 ...@@ -16,7 +16,7 @@ copyin $SCRATCH/1.txt 0
debug debug
copyout 0 $SCRATCH/1.copy copyout 0 $SCRATCH/1.copy
EOF EOF
echo -n "Testing copyin in $SCRATCH/image.5 ... " #echo -n "Testing copyin in $SCRATCH/image.5 ... "
if [ $(md5sum $SCRATCH/1.copy | awk '{print $1}') = '1edec6bc701059c45053cf79e7e16588' ]; then if [ $(md5sum $SCRATCH/1.copy | awk '{print $1}') = '1edec6bc701059c45053cf79e7e16588' ]; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
...@@ -39,7 +39,7 @@ copyout 0 $SCRATCH/3.copy ...@@ -39,7 +39,7 @@ copyout 0 $SCRATCH/3.copy
copyout 1 $SCRATCH/2.copy copyout 1 $SCRATCH/2.copy
debug debug
EOF EOF
echo -n "Testing copyin in $SCRATCH/image.20 ... " #echo -n "Testing copyin in $SCRATCH/image.20 ... "
if [ $(md5sum $SCRATCH/2.copy | awk '{print $1}') = '1adf08d52e0f1a162a3a887a19fcf1f8' ] && if [ $(md5sum $SCRATCH/2.copy | awk '{print $1}') = '1adf08d52e0f1a162a3a887a19fcf1f8' ] &&
[ $(md5sum $SCRATCH/3.copy | awk '{print $1}') = 'd083a4be9fde347b98a8dbdfcc196819' ]; then [ $(md5sum $SCRATCH/3.copy | awk '{print $1}') = 'd083a4be9fde347b98a8dbdfcc196819' ]; then
echo "[RESULT]Success" echo "[RESULT]Success"
...@@ -67,7 +67,7 @@ copyout 0 $SCRATCH/1.copy ...@@ -67,7 +67,7 @@ copyout 0 $SCRATCH/1.copy
copyout 3 $SCRATCH/2.copy copyout 3 $SCRATCH/2.copy
copyout 4 $SCRATCH/9.copy copyout 4 $SCRATCH/9.copy
EOF EOF
echo -n "Testing copyin in $SCRATCH/image.200 ... " #echo -n "Testing copyin in $SCRATCH/image.200 ... "
if [ $(md5sum $SCRATCH/1.copy | awk '{print $1}') = '0af623d6d8cb0a514816e17c7386a298' ] && if [ $(md5sum $SCRATCH/1.copy | awk '{print $1}') = '0af623d6d8cb0a514816e17c7386a298' ] &&
[ $(md5sum $SCRATCH/2.copy | awk '{print $1}') = '307fe5cee7ac87c3b06ea5bda80301ee' ] && [ $(md5sum $SCRATCH/2.copy | awk '{print $1}') = '307fe5cee7ac87c3b06ea5bda80301ee' ] &&
[ $(md5sum $SCRATCH/9.copy | awk '{print $1}') = 'fa4280d88da260281e509296fd2f3ea2' ]; then [ $(md5sum $SCRATCH/9.copy | awk '{print $1}') = 'fa4280d88da260281e509296fd2f3ea2' ]; then
......
...@@ -5,7 +5,7 @@ trap "rm -fr $SCRATCH" INT QUIT TERM EXIT ...@@ -5,7 +5,7 @@ trap "rm -fr $SCRATCH" INT QUIT TERM EXIT
# Test: data/image.5 # Test: data/image.5
echo -n "Testing copyout in data/image.5 ... " #echo -n "Testing copyout in data/image.5 ... "
cat <<EOF | ./bin/sfssh data/image.5 5 > /dev/null 2>&1 cat <<EOF | ./bin/sfssh data/image.5 5 > /dev/null 2>&1
mount mount
copyout 1 $SCRATCH/1.txt copyout 1 $SCRATCH/1.txt
...@@ -24,7 +24,7 @@ copyout 2 $SCRATCH/2.txt ...@@ -24,7 +24,7 @@ copyout 2 $SCRATCH/2.txt
copyout 3 $SCRATCH/3.txt copyout 3 $SCRATCH/3.txt
EOF EOF
echo -n "Testing copyout in data/image.20 ... " #echo -n "Testing copyout in data/image.20 ... "
if [ $(md5sum $SCRATCH/2.txt | awk '{print $1}') = 'bfd6a31563edfd2a943edc29c37366b1' ] && if [ $(md5sum $SCRATCH/2.txt | awk '{print $1}') = 'bfd6a31563edfd2a943edc29c37366b1' ] &&
[ $(md5sum $SCRATCH/3.txt | awk '{print $1}') = 'd083a4be9fde347b98a8dbdfcc196819' ]; then [ $(md5sum $SCRATCH/3.txt | awk '{print $1}') = 'd083a4be9fde347b98a8dbdfcc196819' ]; then
echo "[RESULT]Success" echo "[RESULT]Success"
...@@ -41,7 +41,7 @@ copyout 2 $SCRATCH/2.txt ...@@ -41,7 +41,7 @@ copyout 2 $SCRATCH/2.txt
copyout 9 $SCRATCH/9.txt copyout 9 $SCRATCH/9.txt
EOF EOF
echo -n "Testing copyout in data/image.200 ... " #echo -n "Testing copyout in data/image.200 ... "
if [ $(md5sum $SCRATCH/1.txt | awk '{print $1}') = '0af623d6d8cb0a514816e17c7386a298' ] && if [ $(md5sum $SCRATCH/1.txt | awk '{print $1}') = '0af623d6d8cb0a514816e17c7386a298' ] &&
[ $(md5sum $SCRATCH/2.txt | awk '{print $1}') = '307fe5cee7ac87c3b06ea5bda80301ee' ] && [ $(md5sum $SCRATCH/2.txt | awk '{print $1}') = '307fe5cee7ac87c3b06ea5bda80301ee' ] &&
[ $(md5sum $SCRATCH/9.txt | awk '{print $1}') = 'cc4e48a5fe0ba15b13a98b3fd34b340e' ]; then [ $(md5sum $SCRATCH/9.txt | awk '{print $1}') = 'cc4e48a5fe0ba15b13a98b3fd34b340e' ]; then
......
...@@ -543,7 +543,7 @@ EOF ...@@ -543,7 +543,7 @@ EOF
cp data/image.5 data/image.5.create cp data/image.5 data/image.5.create
trap "rm -f data/image.5.create" INT QUIT TERM EXIT trap "rm -f data/image.5.create" INT QUIT TERM EXIT
echo -n "Testing create in data/image.5.create ... " #echo -n "Testing create in data/image.5.create ... "
if diff -u <(test-input | ./bin/sfssh data/image.5.create 5 2> /dev/null | head -n -2) <(test-output); then if diff -u <(test-input | ./bin/sfssh data/image.5.create 5 2> /dev/null | head -n -2) <(test-output); then
echo "[RESULT]Success" echo "[RESULT]Success"
......
...@@ -10,8 +10,6 @@ SuperBlock: ...@@ -10,8 +10,6 @@ SuperBlock:
Inode 1: Inode 1:
size: 965 bytes size: 965 bytes
direct blocks: 2 direct blocks: 2
2 disk block reads
0 disk block writes
EOF EOF
} }
...@@ -30,8 +28,6 @@ Inode 2: ...@@ -30,8 +28,6 @@ Inode 2:
Inode 3: Inode 3:
size: 9546 bytes size: 9546 bytes
direct blocks: 10 11 12 direct blocks: 10 11 12
4 disk block reads
0 disk block writes
EOF EOF
} }
...@@ -55,8 +51,6 @@ Inode 9: ...@@ -55,8 +51,6 @@ Inode 9:
direct blocks: 22 23 24 25 26 direct blocks: 22 23 24 25 26
indirect block: 28 indirect block: 28
indirect data blocks: 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 76 77 78 79 80 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 indirect data blocks: 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 76 77 78 79 80 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
23 disk block reads
0 disk block writes
EOF EOF
} }
...@@ -65,8 +59,10 @@ test-debug() { ...@@ -65,8 +59,10 @@ test-debug() {
BLOCKS=$2 BLOCKS=$2
OUTPUT=$3 OUTPUT=$3
echo -n "Testing debug on $DISK ... " #echo -n "Testing debug on $DISK ... "
if diff -u <(./bin/sfssh $DISK $BLOCKS <<<debug 2> /dev/null) <($OUTPUT) > test.log; then prog_out=$(./bin/sfssh $DISK $BLOCKS <<<debug 2> /dev/null)
prog_out=$(printf "$prog_out" | grep -v "block reads" | grep -v "block writes")
if diff -u <(printf "$prog_out\n") <($OUTPUT) > test.log; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
echo "[RESULT]Failure" echo "[RESULT]Failure"
......
...@@ -8,8 +8,6 @@ SuperBlock: ...@@ -8,8 +8,6 @@ SuperBlock:
5 blocks 5 blocks
1 inode blocks 1 inode blocks
128 inodes 128 inodes
2 disk block reads
5 disk block writes
EOF EOF
} }
...@@ -21,8 +19,6 @@ SuperBlock: ...@@ -21,8 +19,6 @@ SuperBlock:
20 blocks 20 blocks
2 inode blocks 2 inode blocks
256 inodes 256 inodes
3 disk block reads
20 disk block writes
EOF EOF
} }
...@@ -34,8 +30,6 @@ SuperBlock: ...@@ -34,8 +30,6 @@ SuperBlock:
200 blocks 200 blocks
20 inode blocks 20 inode blocks
2560 inodes 2560 inodes
21 disk block reads
200 disk block writes
EOF EOF
} }
...@@ -52,8 +46,10 @@ test-format() { ...@@ -52,8 +46,10 @@ test-format() {
OUTPUT=$3 OUTPUT=$3
cp $DISK $DISK.formatted cp $DISK $DISK.formatted
echo -n "Testing format on $DISK.formatted ... " #echo -n "Testing format on $DISK.formatted ... "
if diff -u <(test-input | ./bin/sfssh $DISK.formatted $BLOCKS 2> /dev/null) <($OUTPUT) > test.log; then prog_out=$(test-input | ./bin/sfssh $DISK.formatted $BLOCKS 2> /dev/null)
prog_out=$(printf "$prog_out" | grep -v "block reads" | grep -v "block writes")
if diff -u <(printf "$prog_out\n") <($OUTPUT) > test.log; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
echo "[RESULT]Failure" echo "[RESULT]Failure"
......
...@@ -11,8 +11,6 @@ EOF ...@@ -11,8 +11,6 @@ EOF
mount-output() { mount-output() {
cat <<EOF cat <<EOF
disk mounted. disk mounted.
2 disk block reads
0 disk block writes
EOF EOF
} }
...@@ -27,8 +25,6 @@ mount-mount-output() { ...@@ -27,8 +25,6 @@ mount-mount-output() {
cat <<EOF cat <<EOF
disk mounted. disk mounted.
mount failed! mount failed!
2 disk block reads
0 disk block writes
EOF EOF
} }
...@@ -43,16 +39,16 @@ mount-format-output() { ...@@ -43,16 +39,16 @@ mount-format-output() {
cat <<EOF cat <<EOF
disk mounted. disk mounted.
format failed! format failed!
2 disk block reads
0 disk block writes
EOF EOF
} }
test-mount () { test-mount () {
TEST=$1 TEST=$1
echo -n "Testing $TEST on data/image.5 ... " #echo -n "Testing $TEST on data/image.5 ... "
if diff -u <($TEST-input| ./bin/sfssh data/image.5 5 2> /dev/null) <($TEST-output) > test.log; then prog_out=$($TEST-input| ./bin/sfssh data/image.5 5 2> /dev/null)
prog_out=$(printf "$prog_out" | grep -v "block reads" | grep -v "block writes")
if diff -u <(printf "$prog_out\n") <($TEST-output) > test.log; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
echo "[RESULT]Failure" echo "[RESULT]Failure"
...@@ -77,8 +73,6 @@ EOF ...@@ -77,8 +73,6 @@ EOF
bad-mount-output() { bad-mount-output() {
cat <<EOF cat <<EOF
mount failed! mount failed!
1 disk block reads
0 disk block writes
EOF EOF
} }
...@@ -86,8 +80,10 @@ echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x10 0x34 0xf1 0xf0) > $SCRATCH/imag ...@@ -86,8 +80,10 @@ echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x10 0x34 0xf1 0xf0) > $SCRATCH/imag
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x05 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x05 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x01 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x01 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x80 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x80 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n "Testing bad-mount on $SCRATCH/image.5 ... " #echo -n "Testing bad-mount on $SCRATCH/image.5 ... "
if diff -u <(bad-mount-input| ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null) <(bad-mount-output) > $SCRATCH/test.log; then prog_out=$(bad-mount-input| ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null)
prog_out=$(printf "$prog_out" | grep -v "block reads" | grep -v "block writes")
if diff -u <(printf "$prog_out\n") <(bad-mount-output) > $SCRATCH/test.log; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
echo "[RESULT]Failure" echo "[RESULT]Failure"
...@@ -98,8 +94,10 @@ echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x10 0x34 0xf1 0xf0) > $SCRATCH/imag ...@@ -98,8 +94,10 @@ echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x10 0x34 0xf1 0xf0) > $SCRATCH/imag
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x05 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x05 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x01 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x01 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x80 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x80 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n "Testing bad-mount on $SCRATCH/image.5 ... " #echo -n "Testing bad-mount on $SCRATCH/image.5 ... "
if diff -u <(bad-mount-input| ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null) <(bad-mount-output) > $SCRATCH/test.log; then prog_out=$(bad-mount-input| ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null)
prog_out=$(printf "$prog_out" | grep -v "block reads" | grep -v "block writes")
if diff -u <(printf "$prog_out\n") <(bad-mount-output) > $SCRATCH/test.log; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
echo "[RESULT]Failure" echo "[RESULT]Failure"
...@@ -110,8 +108,10 @@ echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x10 0x34 0xf0 0xf0) > $SCRATCH/imag ...@@ -110,8 +108,10 @@ echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x10 0x34 0xf0 0xf0) > $SCRATCH/imag
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x00 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x00 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x01 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x01 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x80 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x80 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n "Testing bad-mount on $SCRATCH/image.5 ... " #echo -n "Testing bad-mount on $SCRATCH/image.5 ... "
if diff -u <(bad-mount-input| ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null) <(bad-mount-output) > $SCRATCH/test.log; then prog_out=$(bad-mount-input| ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null)
prog_out=$(printf "$prog_out" | grep -v "block reads" | grep -v "block writes")
if diff -u <(printf "$prog_out\n") <(bad-mount-output) > $SCRATCH/test.log; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
echo "[RESULT]Failure" echo "[RESULT]Failure"
...@@ -122,8 +122,10 @@ echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x10 0x34 0xf0 0xf0) > $SCRATCH/imag ...@@ -122,8 +122,10 @@ echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x10 0x34 0xf0 0xf0) > $SCRATCH/imag
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x05 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x05 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x02 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x02 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x80 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x80 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n "Testing bad-mount on $SCRATCH/image.5 ... " #echo -n "Testing bad-mount on $SCRATCH/image.5 ... "
if diff -u <(bad-mount-input| ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null) <(bad-mount-output) > $SCRATCH/test.log; then prog_out=$(bad-mount-input| ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null)
prog_out=$(printf "$prog_out" | grep -v "block reads" | grep -v "block writes")
if diff -u <(printf "$prog_out\n") <(bad-mount-output) > $SCRATCH/test.log; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
echo "[RESULT]Failure" echo "[RESULT]Failure"
...@@ -134,8 +136,10 @@ echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x10 0x34 0xf0 0xf0) > $SCRATCH/imag ...@@ -134,8 +136,10 @@ echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x10 0x34 0xf0 0xf0) > $SCRATCH/imag
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x05 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x05 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x01 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x01 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x70 0x00 0x00 0x00) >> $SCRATCH/image.5 echo -n -e $(printf '\\x%x\\x%x\\x%x\\x%x' 0x70 0x00 0x00 0x00) >> $SCRATCH/image.5
echo -n "Testing bad-mount on $SCRATCH/image.5 ... " #echo -n "Testing bad-mount on $SCRATCH/image.5 ... "
if diff -u <(bad-mount-input| ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null) <(bad-mount-output) > $SCRATCH/test.log; then prog_out=$(bad-mount-input| ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null)
prog_out=$(printf "$prog_out" | grep -v "block reads" | grep -v "block writes")
if diff -u <(printf "$prog_out\n") <(bad-mount-output) > $SCRATCH/test.log; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
echo "[RESULT]Failure" echo "[RESULT]Failure"
......
...@@ -68,7 +68,7 @@ EOF ...@@ -68,7 +68,7 @@ EOF
cp data/image.5 $SCRATCH/image.5 cp data/image.5 $SCRATCH/image.5
trap "rm -fr $SCRATCH" INT QUIT TERM EXIT trap "rm -fr $SCRATCH" INT QUIT TERM EXIT
echo -n "Testing remove in $SCRATCH/image.5 ... " #echo -n "Testing remove in $SCRATCH/image.5 ... "
if diff -u <(test-0-input | ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null | head -n -2) <(test-0-output) > $SCRATCH/test.log; then if diff -u <(test-0-input | ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null | head -n -2) <(test-0-output) > $SCRATCH/test.log; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
...@@ -158,7 +158,7 @@ EOF ...@@ -158,7 +158,7 @@ EOF
} }
cp data/image.5 $SCRATCH/image.5 cp data/image.5 $SCRATCH/image.5
echo -n "Testing remove in $SCRATCH/image.5 ... " #echo -n "Testing remove in $SCRATCH/image.5 ... "
if diff -u <(test-1-input | ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null | head -n -2) <(test-1-output) > $SCRATCH/test.log; then if diff -u <(test-1-input | ./bin/sfssh $SCRATCH/image.5 5 2> /dev/null | head -n -2) <(test-1-output) > $SCRATCH/test.log; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
...@@ -230,7 +230,7 @@ EOF ...@@ -230,7 +230,7 @@ EOF
} }
cp data/image.20 $SCRATCH/image.20 cp data/image.20 $SCRATCH/image.20
echo -n "Testing remove in $SCRATCH/image.20 ... " #echo -n "Testing remove in $SCRATCH/image.20 ... "
if diff -u <(test-2-input | ./bin/sfssh $SCRATCH/image.20 20 2> /dev/null | head -n -2) <(test-2-output) > $SCRATCH/test.log; then if diff -u <(test-2-input | ./bin/sfssh $SCRATCH/image.20 20 2> /dev/null | head -n -2) <(test-2-output) > $SCRATCH/test.log; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
......
...@@ -15,8 +15,6 @@ disk mounted. ...@@ -15,8 +15,6 @@ disk mounted.
inode 1 has size 965 bytes. inode 1 has size 965 bytes.
stat failed! stat failed!
stat failed! stat failed!
5 disk block reads
0 disk block writes
EOF EOF
} }
...@@ -35,8 +33,6 @@ disk mounted. ...@@ -35,8 +33,6 @@ disk mounted.
stat failed! stat failed!
inode 2 has size 27160 bytes. inode 2 has size 27160 bytes.
inode 3 has size 9546 bytes. inode 3 has size 9546 bytes.
7 disk block reads
0 disk block writes
EOF EOF
} }
...@@ -57,16 +53,16 @@ inode 1 has size 1523 bytes. ...@@ -57,16 +53,16 @@ inode 1 has size 1523 bytes.
inode 2 has size 105421 bytes. inode 2 has size 105421 bytes.
stat failed! stat failed!
inode 9 has size 409305 bytes. inode 9 has size 409305 bytes.
27 disk block reads
0 disk block writes
EOF EOF
} }
test-stat() { test-stat() {
BLOCKS=$1 BLOCKS=$1
echo -n "Testing stat on data/image.$BLOCKS ... " #echo -n "Testing stat on data/image.$BLOCKS ... "
if diff -u <(image-$BLOCKS-input | ./bin/sfssh data/image.$BLOCKS $BLOCKS 2> /dev/null) <(image-$BLOCKS-output) > test.log; then prog_out=$(image-$BLOCKS-input | ./bin/sfssh data/image.$BLOCKS $BLOCKS 2> /dev/null)
prog_out=$(printf "$prog_out" | grep -v "block reads" | grep -v "block writes")
if diff -u <(printf "$prog_out\n") <(image-$BLOCKS-output) > test.log; then
echo "[RESULT]Success" echo "[RESULT]Success"
else else
echo "[RESULT]Failure" echo "[RESULT]Failure"
......
#!/bin/bash
SCRATCH=$(mktemp -d)
trap "rm -fr $SCRATCH" INT QUIT TERM EXIT
# Test: data/image.200
test-input() {
cat <<EOF
debug
format
debug
mount
create
copyin README.md 0
create
copyin tests/test_cat.sh 1
create
stat 0
stat 1
stat 2
cat 0
cat 1
cat 2
debug
copyout 0 $SCRATCH/1.copy
copyout 1 $SCRATCH/2.copy
copyout 2 $SCRATCH/2.copy
remove 0
remove 1
remove 2
EOF
}
cp data/image.200 $SCRATCH/image.200
echo -n "Testing valgrind on $SCRATCH/image.200 ... "
errors=$(test-input | valgrind --leak-check=full ./bin/sfssh $SCRATCH/image.200 200 |& awk '/ERROR SUMMARY/ { print $4 }')
if [ $errors = 0 ]; then
echo "[RESULT]Success"
else
echo "[RESULT]Failure"
fi
...@@ -5,6 +5,7 @@ TYPE_TEST = "test" ...@@ -5,6 +5,7 @@ TYPE_TEST = "test"
TEST_NUM = 9 TEST_NUM = 9
DEBUG=False DEBUG=False
MARK_ALLOCATION = { MARK_ALLOCATION = {
"test_cat": 10, "test_cat": 10,
"test_copyin": 10, "test_copyin": 10,
...@@ -71,7 +72,8 @@ def mark(tests, helpers, t_type, debug=False): ...@@ -71,7 +72,8 @@ def mark(tests, helpers, t_type, debug=False):
except: except:
if DEBUG: if DEBUG:
print(traceback.format_exc()) print(traceback.format_exc())
cmts.add("Cannot parse assignment log - likely an error in your assignment. Ensure that your output is correctly formatted.")
cmts.add("Cannot parse assignment log - likely an error in your assignment. Ensure that your output is correctly formated.")
return (f"{t_type} Tests", grade, ",".join(cmts)) return (f"{t_type} Tests", grade, ",".join(cmts))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment