-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·316 lines (231 loc) · 7.38 KB
/
run.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
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
#!/bin/bash
make clean;
clear;
make;
echo -e "\n\n";
echo "Creating Virtual Disk of size 8192";
rm *driver;
./fs.x make our_driver 8192;
./fs.x make ref_driver 8192;
echo -e "\n\n";
echo "Testing info";
./test-fs.x info our_driver > our_info.txt;
./fs.x info ref_driver > ref_info.txt;
diff our_info.txt ref_info.txt;
rm our_info.txt ref_info.txt;
echo -e "\n\n";
echo "Testing empty ls";
./test-fs.x ls our_driver > our_ls.txt;
./fs.x ls ref_driver > ref_ls.txt;
diff our_ls.txt ref_ls.txt;
rm our_ls.txt ref_ls.txt;
echo -e "\n\n";
echo "Testing small file addition";
./test-fs.x add our_driver file1.txt > our_add.txt;
./fs.x add ref_driver file1.txt > ref_add.txt;
diff our_add.txt ref_add.txt;
rm ref_add.txt our_add.txt;
echo -e "\n\n";
echo "Testing small file read";
./test-fs.x cat our_driver file1.txt > our_read.txt;
./fs.x cat ref_driver file1.txt > ref_read.txt;
diff our_read.txt ref_read.txt;
rm our_read.txt ref_read.txt;
echo -e "\n\n";
echo "Testing large file addition";
./test-fs.x add our_driver shakespeare.txt > our_add.txt;
./fs.x add ref_driver shakespeare.txt > ref_add.txt;
diff our_add.txt ref_add.txt;
rm ref_add.txt our_add.txt;
echo -e "\n\n";
echo "Testing large file read";
./test-fs.x cat our_driver shakespeare.txt > our_read.txt;
./fs.x cat ref_driver shakespeare.txt > ref_read.txt;
diff our_read.txt ref_read.txt;
rm our_read.txt ref_read.txt;
echo -e "\n\n";
echo "Testing invalid file read";
./test-fs.x cat our_driver blank.txt > our_read.txt;
./fs.x cat ref_driver blank.txt > ref_read.txt;
diff our_read.txt ref_read.txt;
rm our_read.txt ref_read.txt;
echo -e "\n\n";
echo "Testing 2 file ls";
./test-fs.x ls our_driver > our_ls.txt;
./fs.x ls ref_driver > ref_ls.txt;
diff our_ls.txt ref_ls.txt;
rm our_ls.txt ref_ls.txt;
echo -e "\n\n";
echo "Testing 1 file removal";
./test-fs.x rm our_driver file1.txt > our_rm.txt;
./fs.x rm ref_driver file1.txt > ref_rm.txt;
diff our_rm.txt ref_rm.txt;
rm our_rm.txt ref_rm.txt;
echo -e "\n\n";
echo "Testing 1 file ls";
./test-fs.x ls our_driver > our_ls.txt;
./fs.x ls ref_driver > ref_ls.txt;
diff our_ls.txt ref_ls.txt;
rm our_ls.txt ref_ls.txt;
echo -e "\n\n";
echo "Testing info";
./test-fs.x info our_driver > our_info.txt;
./fs.x info ref_driver > ref_info.txt;
diff our_info.txt ref_info.txt;
rm our_info.txt ref_info.txt;
echo -e "\n\n";
echo "Testing stat of existing file";
./test-fs.x stat our_driver shakespeare.txt > our_stat.txt;
./fs.x stat ref_driver shakespeare.txt > ref_stat.txt;
diff our_stat.txt ref_stat.txt;
rm our_stat.txt ref_stat.txt;
echo -e "\n\n";
echo "Testing stat of nonexisting file";
./test-fs.x stat our_driver file1.txt > our_stat.txt;
./fs.x stat ref_driver file1.txt > ref_stat.txt;
diff our_stat.txt ref_stat.txt;
rm our_stat.txt ref_stat.txt;
echo -e "\n\n";
echo "Testing final file removal";
./test-fs.x rm our_driver shakespeare.txt > our_rm.txt;
./fs.x rm ref_driver shakespeare.txt > ref_rm.txt;
diff our_rm.txt ref_rm.txt;
rm our_rm.txt ref_rm.txt;
echo -e "\n\n";
echo "Testing invalid file removal";
./test-fs.x rm our_driver shakespeare.txt > our_rm.txt;
./fs.x rm ref_driver shakespeare.txt > ref_rm.txt;
diff our_rm.txt ref_rm.txt;
rm our_rm.txt ref_rm.txt;
echo -e "\n\n";
echo "Testing empty ls";
./test-fs.x ls our_driver > our_ls.txt;
./fs.x ls ref_driver > ref_ls.txt;
diff our_ls.txt ref_ls.txt;
rm our_ls.txt ref_ls.txt;
#------------------------------------------------------------------------
#our tests
echo -e "\n\n";
echo "Testing important file addition";
./test-fs.x add our_driver lock_file1.txt > our_lock_add.txt;
rm our_lock_add.txt;
echo -e "\n\n";
echo "Testing Completed to Driver size 8192";
#------------------------------------------------------------------------
echo -e "\n\n";
echo "Creating Virtual Disk of size 4";
rm our_driver, ref_driver;
./fs.x make our_driver 4;
./fs.x make ref_driver 4;
echo -e "\n\n";
echo "Testing info";
./test-fs.x info our_driver > our_info.txt;
./fs.x info ref_driver > ref_info.txt;
diff our_info.txt ref_info.txt;
rm our_info.txt ref_info.txt;
echo -e "\n\n";
echo "Testing empty ls";
./test-fs.x ls our_driver > our_ls.txt;
./fs.x ls ref_driver > ref_ls.txt;
diff our_ls.txt ref_ls.txt;
rm our_ls.txt ref_ls.txt;
echo -e "\n\n";
echo "Testing small file addition";
./test-fs.x add our_driver file1.txt > our_add.txt;
./fs.x add ref_driver file1.txt > ref_add.txt;
diff our_add.txt ref_add.txt;
rm ref_add.txt our_add.txt;
echo -e "\n\n";
echo "Testing small file read";
./test-fs.x cat our_driver file1.txt > our_read.txt;
./fs.x cat ref_driver file1.txt > ref_read.txt;
diff our_read.txt ref_read.txt;
rm our_read.txt ref_read.txt;
echo -e "\n\n";
echo "Testing large file addition";
./test-fs.x add our_driver shakespeare.txt > our_add.txt;
./fs.x add ref_driver shakespeare.txt > ref_add.txt;
diff our_add.txt ref_add.txt;
rm ref_add.txt our_add.txt;
echo -e "\n\n";
echo "Testing large file read";
./test-fs.x cat our_driver shakespeare.txt > our_read.txt;
./fs.x cat ref_driver shakespeare.txt > ref_read.txt;
diff our_read.txt ref_read.txt;
rm our_read.txt ref_read.txt;
echo -e "\n\n";
echo "Testing invalid file read";
./test-fs.x cat our_driver blank.txt > our_read.txt;
./fs.x cat ref_driver blank.txt > ref_read.txt;
diff our_read.txt ref_read.txt;
rm our_read.txt ref_read.txt;
echo -e "\n\n";
echo "Testing 2 file ls";
./test-fs.x ls our_driver > our_ls.txt;
./fs.x ls ref_driver > ref_ls.txt;
diff our_ls.txt ref_ls.txt;
rm our_ls.txt ref_ls.txt;
echo -e "\n\n";
echo "Testing 1 file removal";
./test-fs.x rm our_driver file1.txt > our_rm.txt;
./fs.x rm ref_driver file1.txt > ref_rm.txt;
diff our_rm.txt ref_rm.txt;
rm our_rm.txt ref_rm.txt;
echo -e "\n\n";
echo "Testing 1 file ls";
./test-fs.x ls our_driver > our_ls.txt;
./fs.x ls ref_driver > ref_ls.txt;
diff our_ls.txt ref_ls.txt;
rm our_ls.txt ref_ls.txt;
echo -e "\n\n";
echo "Testing info";
./test-fs.x info our_driver > our_info.txt;
./fs.x info ref_driver > ref_info.txt;
diff our_info.txt ref_info.txt;
rm our_info.txt ref_info.txt;
echo -e "\n\n";
echo "Testing stat of existing file";
./test-fs.x stat our_driver shakespeare.txt > our_stat.txt;
./fs.x stat ref_driver shakespeare.txt > ref_stat.txt;
diff our_stat.txt ref_stat.txt;
rm our_stat.txt ref_stat.txt;
echo -e "\n\n";
echo "Testing stat of nonexisting file";
./test-fs.x stat our_driver file1.txt > our_stat.txt;
./fs.x stat ref_driver file1.txt > ref_stat.txt;
diff our_stat.txt ref_stat.txt;
rm our_stat.txt ref_stat.txt;
echo -e "\n\n";
echo "Testing final file removal";
./test-fs.x rm our_driver shakespeare.txt > our_rm.txt;
./fs.x rm ref_driver shakespeare.txt > ref_rm.txt;
diff our_rm.txt ref_rm.txt;
rm our_rm.txt ref_rm.txt;
echo -e "\n\n";
echo "Testing invalid file removal";
./test-fs.x rm our_driver shakespeare.txt > our_rm.txt;
./fs.x rm ref_driver shakespeare.txt > ref_rm.txt;
diff our_rm.txt ref_rm.txt;
rm our_rm.txt ref_rm.txt;
echo -e "\n\n";
echo "Testing empty ls";
./test-fs.x ls our_driver > our_ls.txt;
./fs.x ls ref_driver > ref_ls.txt;
diff our_ls.txt ref_ls.txt;
rm our_ls.txt ref_ls.txt;
echo -e "\n\n";
echo "Testing Completed to Driver size 4";
# make
# info
# ls
# add
# rm
# cat
# stat
# now test with really small disk
# set of file to be null?
# open and close and seek and write commands manually?
# read not go past EOC
# edge case when you write as much as you can for file that over whelms the disk
#use stat to get file size whenever you request it.
#use lseek to adjust the new offset.