-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
67 lines (65 loc) · 1.27 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
echo "MOUNTING FILE SYSTEM"
./myfs fs
directory="fs/test"
echo "Making directory $directory"
mkdir $directory
sleep 1
echo "UNMOUNTING FILE SYSTEM"
fusermount -u fs
echo "MOUNTING FILE SYSTEM"
./myfs fs
if [ -d $directory ]; then
echo "SUCCESS: Directory was created."
else
echo "ERROR: Directory does not exist."
fi
i=0
while [ $i -lt 10 ]
do
#sleep 1
addr="$directory/file$i.htm"
touch $addr
cp FUSE.htm $addr
echo "File $addr was created."
i=$(( $i + 1 ))
done
./stat
sleep 1
echo "UNMOUNTING FILE SYSTEM"
fusermount -u fs
echo "MOUNTING FILE SYSTEM"
./myfs fs
echo "Checking files:"
i=0
while [ $i -lt 10 ]
do
#sleep 1
addr="$directory/file$i.htm"
echo "Checking $addr:"
if ((diff FUSE.htm $addr) &> /dev/null) && ((diff $addr FUSE.htm) &> /dev/null); then
echo "OK"
else
echo "FAIL"
fi
diff FUSE.htm $addr
diff $addr FUSE.htm
i=$(( $i + 1 ))
done
echo "Removing directory $directory"
rmdir $directory
sleep 1
echo "UNMOUNTING FILE SYSTEM"
fusermount -u fs
echo "MOUNTING FILE SYSTEM"
./myfs fs
# проверяем удаление директории
if [ -d $directory ]; then
echo "ERROR: Directory still exists."
else
echo "SUCCESS: Directory was removed."
fi
./stat
echo "UNMOUNTING FILE SYSTEM"
sleep 1
fusermount -u fs