@@ -8,17 +8,22 @@ defines.FILES = 3
8
8
defines.SIZE = ' (((BLOCK_SIZE-8)*(BLOCK_COUNT-6)) / FILES)'
9
9
defines.GC = [false , true ]
10
10
defines.COMPACT_THRESH = [' -1' , ' 0' , ' BLOCK_SIZE/2' ]
11
+ defines.INFER_BC = [false , true ]
11
12
code = '''
12
13
const char *names[] = {"bacon", "eggs", "pancakes"};
13
14
lfs_file_t files[FILES];
14
15
15
16
lfs_t lfs;
16
17
lfs_format(&lfs, cfg) => 0;
17
- lfs_mount(&lfs, cfg) => 0;
18
+ struct lfs_config cfg_ = *cfg;
19
+ if (INFER_BC) {
20
+ cfg_.block_count = 0;
21
+ }
22
+ lfs_mount(&lfs, &cfg_) => 0;
18
23
lfs_mkdir(&lfs, "breakfast") => 0;
19
24
lfs_unmount(&lfs) => 0;
20
25
21
- lfs_mount(&lfs, cfg ) => 0;
26
+ lfs_mount(&lfs, &cfg_ ) => 0;
22
27
for (int n = 0; n < FILES; n++) {
23
28
char path[1024];
24
29
sprintf(path, "breakfast/%s", names[n]);
@@ -39,7 +44,7 @@ code = '''
39
44
}
40
45
lfs_unmount(&lfs) => 0;
41
46
42
- lfs_mount(&lfs, cfg ) => 0;
47
+ lfs_mount(&lfs, &cfg_ ) => 0;
43
48
for (int n = 0; n < FILES; n++) {
44
49
char path[1024];
45
50
sprintf(path, "breakfast/%s", names[n]);
@@ -62,17 +67,22 @@ defines.FILES = 3
62
67
defines.SIZE = ' (((BLOCK_SIZE-8)*(BLOCK_COUNT-6)) / FILES)'
63
68
defines.GC = [false , true ]
64
69
defines.COMPACT_THRESH = [' -1' , ' 0' , ' BLOCK_SIZE/2' ]
70
+ defines.INFER_BC = [false , true ]
65
71
code = '''
66
72
const char *names[] = {"bacon", "eggs", "pancakes"};
67
73
68
74
lfs_t lfs;
69
75
lfs_format(&lfs, cfg) => 0;
70
- lfs_mount(&lfs, cfg) => 0;
76
+ struct lfs_config cfg_ = *cfg;
77
+ if (INFER_BC) {
78
+ cfg_.block_count = 0;
79
+ }
80
+ lfs_mount(&lfs, &cfg_) => 0;
71
81
lfs_mkdir(&lfs, "breakfast") => 0;
72
82
lfs_unmount(&lfs) => 0;
73
83
74
84
for (int n = 0; n < FILES; n++) {
75
- lfs_mount(&lfs, cfg ) => 0;
85
+ lfs_mount(&lfs, &cfg_ ) => 0;
76
86
char path[1024];
77
87
sprintf(path, "breakfast/%s", names[n]);
78
88
lfs_file_t file;
@@ -91,7 +101,7 @@ code = '''
91
101
lfs_unmount(&lfs) => 0;
92
102
}
93
103
94
- lfs_mount(&lfs, cfg ) => 0;
104
+ lfs_mount(&lfs, &cfg_ ) => 0;
95
105
for (int n = 0; n < FILES; n++) {
96
106
char path[1024];
97
107
sprintf(path, "breakfast/%s", names[n]);
@@ -113,19 +123,24 @@ code = '''
113
123
defines.FILES = 3
114
124
defines.SIZE = ' (((BLOCK_SIZE-8)*(BLOCK_COUNT-6)) / FILES)'
115
125
defines.CYCLES = [1 , 10 ]
126
+ defines.INFER_BC = [false , true ]
116
127
code = '''
117
128
const char *names[] = {"bacon", "eggs", "pancakes"};
118
129
lfs_file_t files[FILES];
119
130
120
131
lfs_t lfs;
121
132
lfs_format(&lfs, cfg) => 0;
133
+ struct lfs_config cfg_ = *cfg;
134
+ if (INFER_BC) {
135
+ cfg_.block_count = 0;
136
+ }
122
137
123
138
for (int c = 0; c < CYCLES; c++) {
124
- lfs_mount(&lfs, cfg ) => 0;
139
+ lfs_mount(&lfs, &cfg_ ) => 0;
125
140
lfs_mkdir(&lfs, "breakfast") => 0;
126
141
lfs_unmount(&lfs) => 0;
127
142
128
- lfs_mount(&lfs, cfg ) => 0;
143
+ lfs_mount(&lfs, &cfg_ ) => 0;
129
144
for (int n = 0; n < FILES; n++) {
130
145
char path[1024];
131
146
sprintf(path, "breakfast/%s", names[n]);
@@ -143,7 +158,7 @@ code = '''
143
158
}
144
159
lfs_unmount(&lfs) => 0;
145
160
146
- lfs_mount(&lfs, cfg ) => 0;
161
+ lfs_mount(&lfs, &cfg_ ) => 0;
147
162
for (int n = 0; n < FILES; n++) {
148
163
char path[1024];
149
164
sprintf(path, "breakfast/%s", names[n]);
@@ -159,7 +174,7 @@ code = '''
159
174
}
160
175
lfs_unmount(&lfs) => 0;
161
176
162
- lfs_mount(&lfs, cfg ) => 0;
177
+ lfs_mount(&lfs, &cfg_ ) => 0;
163
178
for (int n = 0; n < FILES; n++) {
164
179
char path[1024];
165
180
sprintf(path, "breakfast/%s", names[n]);
@@ -175,19 +190,24 @@ code = '''
175
190
defines.FILES = 3
176
191
defines.SIZE = ' (((BLOCK_SIZE-8)*(BLOCK_COUNT-6)) / FILES)'
177
192
defines.CYCLES = [1 , 10 ]
193
+ defines.INFER_BC = [false , true ]
178
194
code = '''
179
195
const char *names[] = {"bacon", "eggs", "pancakes"};
180
196
181
197
lfs_t lfs;
182
198
lfs_format(&lfs, cfg) => 0;
199
+ struct lfs_config cfg_ = *cfg;
200
+ if (INFER_BC) {
201
+ cfg_.block_count = 0;
202
+ }
183
203
184
204
for (int c = 0; c < CYCLES; c++) {
185
- lfs_mount(&lfs, cfg ) => 0;
205
+ lfs_mount(&lfs, &cfg_ ) => 0;
186
206
lfs_mkdir(&lfs, "breakfast") => 0;
187
207
lfs_unmount(&lfs) => 0;
188
208
189
209
for (int n = 0; n < FILES; n++) {
190
- lfs_mount(&lfs, cfg ) => 0;
210
+ lfs_mount(&lfs, &cfg_ ) => 0;
191
211
char path[1024];
192
212
sprintf(path, "breakfast/%s", names[n]);
193
213
lfs_file_t file;
@@ -232,10 +252,15 @@ code = '''
232
252
233
253
# exhaustion test
234
254
[cases .test_alloc_exhaustion ]
255
+ defines.INFER_BC = [false , true ]
235
256
code = '''
236
257
lfs_t lfs;
237
258
lfs_format(&lfs, cfg) => 0;
238
- lfs_mount(&lfs, cfg) => 0;
259
+ struct lfs_config cfg_ = *cfg;
260
+ if (INFER_BC) {
261
+ cfg_.block_count = 0;
262
+ }
263
+ lfs_mount(&lfs, &cfg_) => 0;
239
264
lfs_file_t file;
240
265
lfs_file_open(&lfs, &file, "exhaustion", LFS_O_WRONLY | LFS_O_CREAT);
241
266
size_t size = strlen("exhaustion");
@@ -263,7 +288,7 @@ code = '''
263
288
lfs_file_close(&lfs, &file) => 0;
264
289
lfs_unmount(&lfs) => 0;
265
290
266
- lfs_mount(&lfs, cfg ) => 0;
291
+ lfs_mount(&lfs, &cfg_ ) => 0;
267
292
lfs_file_open(&lfs, &file, "exhaustion", LFS_O_RDONLY);
268
293
size = strlen("exhaustion");
269
294
lfs_file_size(&lfs, &file) => size;
@@ -276,10 +301,15 @@ code = '''
276
301
# exhaustion wraparound test
277
302
[cases .test_alloc_exhaustion_wraparound ]
278
303
defines.SIZE = ' (((BLOCK_SIZE-8)*(BLOCK_COUNT-4)) / 3)'
304
+ defines.INFER_BC = [false , true ]
279
305
code = '''
280
306
lfs_t lfs;
281
307
lfs_format(&lfs, cfg) => 0;
282
- lfs_mount(&lfs, cfg) => 0;
308
+ struct lfs_config cfg_ = *cfg;
309
+ if (INFER_BC) {
310
+ cfg_.block_count = 0;
311
+ }
312
+ lfs_mount(&lfs, &cfg_) => 0;
283
313
284
314
lfs_file_t file;
285
315
lfs_file_open(&lfs, &file, "padding", LFS_O_WRONLY | LFS_O_CREAT);
@@ -317,7 +347,7 @@ code = '''
317
347
lfs_file_close(&lfs, &file) => 0;
318
348
lfs_unmount(&lfs) => 0;
319
349
320
- lfs_mount(&lfs, cfg ) => 0;
350
+ lfs_mount(&lfs, &cfg_ ) => 0;
321
351
lfs_file_open(&lfs, &file, "exhaustion", LFS_O_RDONLY);
322
352
size = strlen("exhaustion");
323
353
lfs_file_size(&lfs, &file) => size;
@@ -330,10 +360,15 @@ code = '''
330
360
331
361
# dir exhaustion test
332
362
[cases .test_alloc_dir_exhaustion ]
363
+ defines.INFER_BC = [false , true ]
333
364
code = '''
334
365
lfs_t lfs;
335
366
lfs_format(&lfs, cfg) => 0;
336
- lfs_mount(&lfs, cfg) => 0;
367
+ struct lfs_config cfg_ = *cfg;
368
+ if (INFER_BC) {
369
+ cfg_.block_count = 0;
370
+ }
371
+ lfs_mount(&lfs, &cfg_) => 0;
337
372
338
373
// find out max file size
339
374
lfs_mkdir(&lfs, "exhaustiondir") => 0;
0 commit comments