Browse Source

Actually error out if the test mount fails.

Peter Pentchev 13 years ago
parent
commit
41b709614f
3 changed files with 33 additions and 0 deletions
  1. 4
    0
      mount.sh
  2. 25
    0
      test.sh
  3. 4
    0
      umount.sh

+ 4
- 0
mount.sh View File

@@ -1,3 +1,7 @@
1
+#!/bin/sh
2
+
3
+set -e
4
+
1 5
 ulimit -c unlimited
2 6
 touch testmnt.txt
3 7
 ./filejoinfs test.txt testmnt.txt

+ 25
- 0
test.sh View File

@@ -1,7 +1,32 @@
1
+#!/bin/sh
2
+
3
+set -e
4
+
1 5
 ./mount.sh
2 6
 cat testmnt.txt
3 7
 head -c 20 testmnt.txt
4 8
 tail -c 20 testmnt.txt
5 9
 head -c 160 testmnt.txt | tail -n 1
6 10
 echo
11
+
12
+cnt1=`wc -c test1 | (read a b; echo "$a")`
13
+if ! expr "x$cnt1" : 'x[0-9][0-9]*$' > /dev/null; then
14
+	echo 'Could not count the characters in the test1 file'
15
+	exit 1
16
+fi
17
+cnt2=`wc -c test2 | (read a b; echo "$a")`
18
+if ! expr "x$cnt2" : 'x[0-9][0-9]*$' > /dev/null; then
19
+	echo 'Could not count the characters in the test1 file'
20
+	exit 1
21
+fi
22
+cnt3=`wc -c test3 | (read a b; echo "$a")`
23
+if ! expr "x$cnt3" : 'x[0-9][0-9]*$' > /dev/null; then
24
+	echo 'Could not count the characters in the test1 file'
25
+	exit 1
26
+fi
27
+
28
+head -c "$cnt1" testmnt.txt | diff -u test1 -
29
+tail -c "$cnt3" testmnt.txt | diff -u test3 -
30
+cat test1 test2 test3 | diff -u - testmnt.txt
31
+
7 32
 ./umount.sh

+ 4
- 0
umount.sh View File

@@ -1,2 +1,6 @@
1
+#!/bin/sh
2
+
3
+set -e
4
+
1 5
 fusermount -u testmnt.txt
2 6
 rm testmnt.txt

Loading…
Cancel
Save