-
Notifications
You must be signed in to change notification settings - Fork 126
/
setup
executable file
·167 lines (109 loc) · 1.8 KB
/
setup
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/bin/bash
function make_snapshot()
{
mkdir /testsuite/.snapshots/$1
btrfs subvolume snapshot -r /testsuite /testsuite/.snapshots/$1/snapshot
}
function test1()
{
make_snapshot 1
mkdir foo
mkdir foo/bar
echo hello > foo/bar/world
make_snapshot 2
rm foo -rf
}
function test2()
{
make_snapshot 3
mkdir a
mkdir b
echo hello > a/s
echo hello > b/s
echo world > a/n
make_snapshot 4
rm a b -rf
}
function test3()
{
make_snapshot 5
touch foo
ln -s foo bar
make_snapshot 6
rm foo bar
}
function test4()
{
touch foo bar
ln -s foo fubar
make_snapshot 7
ln -sf bar fubar
make_snapshot 8
rm foo bar fubar
}
function test5()
{
mkdir a
mkdir b
echo hello > a/same
echo foo > a/diff
echo new > a/new
sleep 1
echo hello > b/same
echo bar > b/diff
make_snapshot 9
mv a t
mv b a
mv t b
make_snapshot 10
rm a b -rf
}
function test6()
{
mkdir -p a1/a2/a3
mkdir -p b1/b2
echo hello > a1/a2/a3/same
echo foo > a1/a2/a3/diff
echo new > a1/a2/a3/new
mkdir a1/a2/a3/d
echo hello > a1/a2/a3/d/world
sleep 1
echo hello > b1/b2/same
echo bar > b1/b2/diff
make_snapshot 11
mv a1/a2/a3 t
mv b1/b2 a1/a2/a3
mv t b1/b2
make_snapshot 12
rm a1 b1 -rf
}
function test7()
{
touch perm user group
make_snapshot 13
chmod a+rw perm
chown nobody user
chown :nobody group
make_snapshot 14
rm perm user group
}
function test8()
{
touch foo
make_snapshot 15
rm foo
mkdir foo
make_snapshot 16
rmdir foo
}
btrfs subvolume create /testsuite
btrfs subvolume create /testsuite/.snapshots
cd /testsuite
test1
test2
test3
test4
test5
test6
test7
test8