forked from liangxia2006-zz/cs270-os-filesystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-script.sh
executable file
·56 lines (47 loc) · 885 Bytes
/
test-script.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
#!/bin/bash
# run this script from inside the FS - all paths are relative to the current directory
set -x
# create a dir, cd into it
# cd ~ec2-user/jasen/CS270FS/tmp
mkdir tdir1
cd tdir1
pwd
# write to existing file
touch tfile1
echo test test test > tfile1
cat tfile1
# write to new file
echo test test test test > tfile2
cat tfile2
# make sure deleted files are really deleted
echo rm me > rmfile1
cat rmfile1
rm rmfile1
touch rmfile1
cat rmfile1
# test nested directories
mkdir tdir2
cd tdir2
BASENAME="mfile"
for (( i=0 ; i < 10 ; i++ ))
do
echo test data > $BASENAME$i
done
mkdir tdir3
cd tdir3
for (( i=0 ; i < 10 ; i++ ))
do
echo more test data > $BASENAME$i
done
# cd ~ec2-user/jasen/CS270FS/tmp
cd ../../..
rm -rf tdir1
# test mkdir -p
mkdir -p this/is/a/nice/test
cd this/is/a/nice/test
pwd
# cleanup
cd ../../../../..
rm -rf this
# profit
echo Testing complete.