test_dirs.sh 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. #!/bin/bash
  2. set -eu
  3. LARGESIZE=128
  4. echo "=== Directory tests ==="
  5. rm -rf blocks
  6. tests/test.py << TEST
  7. lfs_format(&lfs, &cfg) => 0;
  8. TEST
  9. echo "--- Root directory ---"
  10. tests/test.py << TEST
  11. lfs_mount(&lfs, &cfg) => 0;
  12. lfs_dir_open(&lfs, &dir[0], "/") => 0;
  13. lfs_dir_close(&lfs, &dir[0]) => 0;
  14. lfs_unmount(&lfs) => 0;
  15. TEST
  16. echo "--- Directory creation ---"
  17. tests/test.py << TEST
  18. lfs_mount(&lfs, &cfg) => 0;
  19. lfs_mkdir(&lfs, "potato") => 0;
  20. lfs_unmount(&lfs) => 0;
  21. TEST
  22. echo "--- File creation ---"
  23. tests/test.py << TEST
  24. lfs_mount(&lfs, &cfg) => 0;
  25. lfs_file_open(&lfs, &file[0], "burito", LFS_O_CREAT | LFS_O_WRONLY) => 0;
  26. lfs_file_close(&lfs, &file[0]) => 0;
  27. lfs_unmount(&lfs) => 0;
  28. TEST
  29. echo "--- Directory iteration ---"
  30. tests/test.py << TEST
  31. lfs_mount(&lfs, &cfg) => 0;
  32. lfs_dir_open(&lfs, &dir[0], "/") => 0;
  33. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  34. strcmp(info.name, ".") => 0;
  35. info.type => LFS_TYPE_DIR;
  36. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  37. strcmp(info.name, "..") => 0;
  38. info.type => LFS_TYPE_DIR;
  39. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  40. strcmp(info.name, "burito") => 0;
  41. info.type => LFS_TYPE_REG;
  42. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  43. strcmp(info.name, "potato") => 0;
  44. info.type => LFS_TYPE_DIR;
  45. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  46. lfs_dir_close(&lfs, &dir[0]) => 0;
  47. lfs_unmount(&lfs) => 0;
  48. TEST
  49. echo "--- Directory failures ---"
  50. tests/test.py << TEST
  51. lfs_mount(&lfs, &cfg) => 0;
  52. lfs_mkdir(&lfs, "potato") => LFS_ERR_EXIST;
  53. lfs_dir_open(&lfs, &dir[0], "tomato") => LFS_ERR_NOENT;
  54. lfs_dir_open(&lfs, &dir[0], "burito") => LFS_ERR_NOTDIR;
  55. lfs_file_open(&lfs, &file[0], "tomato", LFS_O_RDONLY) => LFS_ERR_NOENT;
  56. lfs_file_open(&lfs, &file[0], "potato", LFS_O_RDONLY) => LFS_ERR_ISDIR;
  57. lfs_unmount(&lfs) => 0;
  58. TEST
  59. echo "--- Nested directories ---"
  60. tests/test.py << TEST
  61. lfs_mount(&lfs, &cfg) => 0;
  62. lfs_mkdir(&lfs, "potato/baked") => 0;
  63. lfs_mkdir(&lfs, "potato/sweet") => 0;
  64. lfs_mkdir(&lfs, "potato/fried") => 0;
  65. lfs_unmount(&lfs) => 0;
  66. TEST
  67. tests/test.py << TEST
  68. lfs_mount(&lfs, &cfg) => 0;
  69. lfs_dir_open(&lfs, &dir[0], "potato") => 0;
  70. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  71. strcmp(info.name, ".") => 0;
  72. info.type => LFS_TYPE_DIR;
  73. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  74. strcmp(info.name, "..") => 0;
  75. info.type => LFS_TYPE_DIR;
  76. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  77. strcmp(info.name, "baked") => 0;
  78. info.type => LFS_TYPE_DIR;
  79. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  80. strcmp(info.name, "fried") => 0;
  81. info.type => LFS_TYPE_DIR;
  82. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  83. strcmp(info.name, "sweet") => 0;
  84. info.type => LFS_TYPE_DIR;
  85. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  86. lfs_dir_close(&lfs, &dir[0]) => 0;
  87. lfs_unmount(&lfs) => 0;
  88. TEST
  89. echo "--- Multi-block directory ---"
  90. tests/test.py << TEST
  91. lfs_mount(&lfs, &cfg) => 0;
  92. lfs_mkdir(&lfs, "cactus") => 0;
  93. for (int i = 0; i < $LARGESIZE; i++) {
  94. sprintf((char*)buffer, "cactus/test%03d", i);
  95. lfs_mkdir(&lfs, (char*)buffer) => 0;
  96. }
  97. lfs_unmount(&lfs) => 0;
  98. TEST
  99. tests/test.py << TEST
  100. lfs_mount(&lfs, &cfg) => 0;
  101. lfs_dir_open(&lfs, &dir[0], "cactus") => 0;
  102. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  103. strcmp(info.name, ".") => 0;
  104. info.type => LFS_TYPE_DIR;
  105. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  106. strcmp(info.name, "..") => 0;
  107. info.type => LFS_TYPE_DIR;
  108. for (int i = 0; i < $LARGESIZE; i++) {
  109. sprintf((char*)buffer, "test%03d", i);
  110. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  111. strcmp(info.name, (char*)buffer) => 0;
  112. info.type => LFS_TYPE_DIR;
  113. }
  114. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  115. lfs_unmount(&lfs) => 0;
  116. TEST
  117. echo "--- Directory remove ---"
  118. tests/test.py << TEST
  119. lfs_mount(&lfs, &cfg) => 0;
  120. lfs_remove(&lfs, "potato") => LFS_ERR_NOTEMPTY;
  121. lfs_remove(&lfs, "potato/sweet") => 0;
  122. lfs_remove(&lfs, "potato/baked") => 0;
  123. lfs_remove(&lfs, "potato/fried") => 0;
  124. lfs_dir_open(&lfs, &dir[0], "potato") => 0;
  125. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  126. strcmp(info.name, ".") => 0;
  127. info.type => LFS_TYPE_DIR;
  128. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  129. strcmp(info.name, "..") => 0;
  130. info.type => LFS_TYPE_DIR;
  131. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  132. lfs_dir_close(&lfs, &dir[0]) => 0;
  133. lfs_remove(&lfs, "potato") => 0;
  134. lfs_dir_open(&lfs, &dir[0], "/") => 0;
  135. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  136. strcmp(info.name, ".") => 0;
  137. info.type => LFS_TYPE_DIR;
  138. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  139. strcmp(info.name, "..") => 0;
  140. info.type => LFS_TYPE_DIR;
  141. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  142. strcmp(info.name, "burito") => 0;
  143. info.type => LFS_TYPE_REG;
  144. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  145. strcmp(info.name, "cactus") => 0;
  146. info.type => LFS_TYPE_DIR;
  147. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  148. lfs_dir_close(&lfs, &dir[0]) => 0;
  149. lfs_unmount(&lfs) => 0;
  150. TEST
  151. tests/test.py << TEST
  152. lfs_mount(&lfs, &cfg) => 0;
  153. lfs_dir_open(&lfs, &dir[0], "/") => 0;
  154. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  155. strcmp(info.name, ".") => 0;
  156. info.type => LFS_TYPE_DIR;
  157. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  158. strcmp(info.name, "..") => 0;
  159. info.type => LFS_TYPE_DIR;
  160. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  161. strcmp(info.name, "burito") => 0;
  162. info.type => LFS_TYPE_REG;
  163. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  164. strcmp(info.name, "cactus") => 0;
  165. info.type => LFS_TYPE_DIR;
  166. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  167. lfs_dir_close(&lfs, &dir[0]) => 0;
  168. lfs_unmount(&lfs) => 0;
  169. TEST
  170. echo "--- Directory rename ---"
  171. tests/test.py << TEST
  172. lfs_mount(&lfs, &cfg) => 0;
  173. lfs_mkdir(&lfs, "coldpotato") => 0;
  174. lfs_mkdir(&lfs, "coldpotato/baked") => 0;
  175. lfs_mkdir(&lfs, "coldpotato/sweet") => 0;
  176. lfs_mkdir(&lfs, "coldpotato/fried") => 0;
  177. lfs_unmount(&lfs) => 0;
  178. TEST
  179. tests/test.py << TEST
  180. lfs_mount(&lfs, &cfg) => 0;
  181. lfs_rename(&lfs, "coldpotato", "hotpotato") => 0;
  182. lfs_unmount(&lfs) => 0;
  183. TEST
  184. tests/test.py << TEST
  185. lfs_mount(&lfs, &cfg) => 0;
  186. lfs_dir_open(&lfs, &dir[0], "hotpotato") => 0;
  187. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  188. strcmp(info.name, ".") => 0;
  189. info.type => LFS_TYPE_DIR;
  190. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  191. strcmp(info.name, "..") => 0;
  192. info.type => LFS_TYPE_DIR;
  193. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  194. strcmp(info.name, "baked") => 0;
  195. info.type => LFS_TYPE_DIR;
  196. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  197. strcmp(info.name, "fried") => 0;
  198. info.type => LFS_TYPE_DIR;
  199. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  200. strcmp(info.name, "sweet") => 0;
  201. info.type => LFS_TYPE_DIR;
  202. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  203. lfs_dir_close(&lfs, &dir[0]) => 0;
  204. lfs_unmount(&lfs) => 0;
  205. TEST
  206. tests/test.py << TEST
  207. lfs_mount(&lfs, &cfg) => 0;
  208. lfs_mkdir(&lfs, "warmpotato") => 0;
  209. lfs_mkdir(&lfs, "warmpotato/mushy") => 0;
  210. lfs_rename(&lfs, "hotpotato", "warmpotato") => LFS_ERR_NOTEMPTY;
  211. lfs_remove(&lfs, "warmpotato/mushy") => 0;
  212. lfs_rename(&lfs, "hotpotato", "warmpotato") => 0;
  213. lfs_unmount(&lfs) => 0;
  214. TEST
  215. tests/test.py << TEST
  216. lfs_mount(&lfs, &cfg) => 0;
  217. lfs_dir_open(&lfs, &dir[0], "warmpotato") => 0;
  218. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  219. strcmp(info.name, ".") => 0;
  220. info.type => LFS_TYPE_DIR;
  221. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  222. strcmp(info.name, "..") => 0;
  223. info.type => LFS_TYPE_DIR;
  224. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  225. strcmp(info.name, "baked") => 0;
  226. info.type => LFS_TYPE_DIR;
  227. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  228. strcmp(info.name, "fried") => 0;
  229. info.type => LFS_TYPE_DIR;
  230. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  231. strcmp(info.name, "sweet") => 0;
  232. info.type => LFS_TYPE_DIR;
  233. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  234. lfs_dir_close(&lfs, &dir[0]) => 0;
  235. lfs_unmount(&lfs) => 0;
  236. TEST
  237. tests/test.py << TEST
  238. lfs_mount(&lfs, &cfg) => 0;
  239. lfs_mkdir(&lfs, "coldpotato") => 0;
  240. lfs_rename(&lfs, "warmpotato/baked", "coldpotato/baked") => 0;
  241. lfs_rename(&lfs, "warmpotato/sweet", "coldpotato/sweet") => 0;
  242. lfs_rename(&lfs, "warmpotato/fried", "coldpotato/fried") => 0;
  243. lfs_remove(&lfs, "coldpotato") => LFS_ERR_NOTEMPTY;
  244. lfs_remove(&lfs, "warmpotato") => 0;
  245. lfs_unmount(&lfs) => 0;
  246. TEST
  247. tests/test.py << TEST
  248. lfs_mount(&lfs, &cfg) => 0;
  249. lfs_dir_open(&lfs, &dir[0], "coldpotato") => 0;
  250. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  251. strcmp(info.name, ".") => 0;
  252. info.type => LFS_TYPE_DIR;
  253. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  254. strcmp(info.name, "..") => 0;
  255. info.type => LFS_TYPE_DIR;
  256. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  257. strcmp(info.name, "baked") => 0;
  258. info.type => LFS_TYPE_DIR;
  259. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  260. strcmp(info.name, "fried") => 0;
  261. info.type => LFS_TYPE_DIR;
  262. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  263. strcmp(info.name, "sweet") => 0;
  264. info.type => LFS_TYPE_DIR;
  265. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  266. lfs_dir_close(&lfs, &dir[0]) => 0;
  267. lfs_unmount(&lfs) => 0;
  268. TEST
  269. echo "--- Recursive remove ---"
  270. tests/test.py << TEST
  271. lfs_mount(&lfs, &cfg) => 0;
  272. lfs_remove(&lfs, "coldpotato") => LFS_ERR_NOTEMPTY;
  273. lfs_dir_open(&lfs, &dir[0], "coldpotato") => 0;
  274. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  275. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  276. while (true) {
  277. int err = lfs_dir_read(&lfs, &dir[0], &info);
  278. err >= 0 => 1;
  279. if (err == 0) {
  280. break;
  281. }
  282. strcpy((char*)buffer, "coldpotato/");
  283. strcat((char*)buffer, info.name);
  284. lfs_remove(&lfs, (char*)buffer) => 0;
  285. }
  286. lfs_remove(&lfs, "coldpotato") => 0;
  287. TEST
  288. tests/test.py << TEST
  289. lfs_mount(&lfs, &cfg) => 0;
  290. lfs_dir_open(&lfs, &dir[0], "/") => 0;
  291. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  292. strcmp(info.name, ".") => 0;
  293. info.type => LFS_TYPE_DIR;
  294. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  295. strcmp(info.name, "..") => 0;
  296. info.type => LFS_TYPE_DIR;
  297. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  298. strcmp(info.name, "burito") => 0;
  299. info.type => LFS_TYPE_REG;
  300. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  301. strcmp(info.name, "cactus") => 0;
  302. info.type => LFS_TYPE_DIR;
  303. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  304. lfs_dir_close(&lfs, &dir[0]) => 0;
  305. lfs_unmount(&lfs) => 0;
  306. TEST
  307. echo "--- Multi-block rename ---"
  308. tests/test.py << TEST
  309. lfs_mount(&lfs, &cfg) => 0;
  310. for (int i = 0; i < $LARGESIZE; i++) {
  311. sprintf((char*)buffer, "cactus/test%03d", i);
  312. sprintf((char*)wbuffer, "cactus/tedd%03d", i);
  313. lfs_rename(&lfs, (char*)buffer, (char*)wbuffer) => 0;
  314. }
  315. lfs_unmount(&lfs) => 0;
  316. TEST
  317. tests/test.py << TEST
  318. lfs_mount(&lfs, &cfg) => 0;
  319. lfs_dir_open(&lfs, &dir[0], "cactus") => 0;
  320. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  321. strcmp(info.name, ".") => 0;
  322. info.type => LFS_TYPE_DIR;
  323. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  324. strcmp(info.name, "..") => 0;
  325. info.type => LFS_TYPE_DIR;
  326. for (int i = 0; i < $LARGESIZE; i++) {
  327. sprintf((char*)buffer, "tedd%03d", i);
  328. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  329. strcmp(info.name, (char*)buffer) => 0;
  330. info.type => LFS_TYPE_DIR;
  331. }
  332. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  333. lfs_unmount(&lfs) => 0;
  334. TEST
  335. echo "--- Multi-block remove ---"
  336. tests/test.py << TEST
  337. lfs_mount(&lfs, &cfg) => 0;
  338. lfs_remove(&lfs, "cactus") => LFS_ERR_NOTEMPTY;
  339. for (int i = 0; i < $LARGESIZE; i++) {
  340. sprintf((char*)buffer, "cactus/tedd%03d", i);
  341. lfs_remove(&lfs, (char*)buffer) => 0;
  342. }
  343. lfs_remove(&lfs, "cactus") => 0;
  344. lfs_unmount(&lfs) => 0;
  345. TEST
  346. tests/test.py << TEST
  347. lfs_mount(&lfs, &cfg) => 0;
  348. lfs_dir_open(&lfs, &dir[0], "/") => 0;
  349. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  350. strcmp(info.name, ".") => 0;
  351. info.type => LFS_TYPE_DIR;
  352. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  353. strcmp(info.name, "..") => 0;
  354. info.type => LFS_TYPE_DIR;
  355. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  356. strcmp(info.name, "burito") => 0;
  357. info.type => LFS_TYPE_REG;
  358. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  359. lfs_dir_close(&lfs, &dir[0]) => 0;
  360. lfs_unmount(&lfs) => 0;
  361. TEST
  362. echo "--- Multi-block directory with files ---"
  363. tests/test.py << TEST
  364. lfs_mount(&lfs, &cfg) => 0;
  365. lfs_mkdir(&lfs, "prickly-pear") => 0;
  366. for (int i = 0; i < $LARGESIZE; i++) {
  367. sprintf((char*)buffer, "prickly-pear/test%03d", i);
  368. lfs_file_open(&lfs, &file[0], (char*)buffer,
  369. LFS_O_WRONLY | LFS_O_CREAT) => 0;
  370. size = 6;
  371. memcpy(wbuffer, "Hello", size);
  372. lfs_file_write(&lfs, &file[0], wbuffer, size) => size;
  373. lfs_file_close(&lfs, &file[0]) => 0;
  374. }
  375. lfs_unmount(&lfs) => 0;
  376. TEST
  377. tests/test.py << TEST
  378. lfs_mount(&lfs, &cfg) => 0;
  379. lfs_dir_open(&lfs, &dir[0], "prickly-pear") => 0;
  380. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  381. strcmp(info.name, ".") => 0;
  382. info.type => LFS_TYPE_DIR;
  383. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  384. strcmp(info.name, "..") => 0;
  385. info.type => LFS_TYPE_DIR;
  386. for (int i = 0; i < $LARGESIZE; i++) {
  387. sprintf((char*)buffer, "test%03d", i);
  388. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  389. strcmp(info.name, (char*)buffer) => 0;
  390. info.type => LFS_TYPE_REG;
  391. info.size => 6;
  392. }
  393. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  394. lfs_unmount(&lfs) => 0;
  395. TEST
  396. echo "--- Multi-block rename with files ---"
  397. tests/test.py << TEST
  398. lfs_mount(&lfs, &cfg) => 0;
  399. for (int i = 0; i < $LARGESIZE; i++) {
  400. sprintf((char*)buffer, "prickly-pear/test%03d", i);
  401. sprintf((char*)wbuffer, "prickly-pear/tedd%03d", i);
  402. lfs_rename(&lfs, (char*)buffer, (char*)wbuffer) => 0;
  403. }
  404. lfs_unmount(&lfs) => 0;
  405. TEST
  406. tests/test.py << TEST
  407. lfs_mount(&lfs, &cfg) => 0;
  408. lfs_dir_open(&lfs, &dir[0], "prickly-pear") => 0;
  409. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  410. strcmp(info.name, ".") => 0;
  411. info.type => LFS_TYPE_DIR;
  412. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  413. strcmp(info.name, "..") => 0;
  414. info.type => LFS_TYPE_DIR;
  415. for (int i = 0; i < $LARGESIZE; i++) {
  416. sprintf((char*)buffer, "tedd%03d", i);
  417. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  418. strcmp(info.name, (char*)buffer) => 0;
  419. info.type => LFS_TYPE_REG;
  420. info.size => 6;
  421. }
  422. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  423. lfs_unmount(&lfs) => 0;
  424. TEST
  425. echo "--- Multi-block remove with files ---"
  426. tests/test.py << TEST
  427. lfs_mount(&lfs, &cfg) => 0;
  428. lfs_remove(&lfs, "prickly-pear") => LFS_ERR_NOTEMPTY;
  429. for (int i = 0; i < $LARGESIZE; i++) {
  430. sprintf((char*)buffer, "prickly-pear/tedd%03d", i);
  431. lfs_remove(&lfs, (char*)buffer) => 0;
  432. }
  433. lfs_remove(&lfs, "prickly-pear") => 0;
  434. lfs_unmount(&lfs) => 0;
  435. TEST
  436. tests/test.py << TEST
  437. lfs_mount(&lfs, &cfg) => 0;
  438. lfs_dir_open(&lfs, &dir[0], "/") => 0;
  439. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  440. strcmp(info.name, ".") => 0;
  441. info.type => LFS_TYPE_DIR;
  442. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  443. strcmp(info.name, "..") => 0;
  444. info.type => LFS_TYPE_DIR;
  445. lfs_dir_read(&lfs, &dir[0], &info) => 1;
  446. strcmp(info.name, "burito") => 0;
  447. info.type => LFS_TYPE_REG;
  448. lfs_dir_read(&lfs, &dir[0], &info) => 0;
  449. lfs_dir_close(&lfs, &dir[0]) => 0;
  450. lfs_unmount(&lfs) => 0;
  451. TEST
  452. echo "--- Results ---"
  453. tests/stats.py