SquashFS compressed filesystem reader in pure OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): E331 make_image rename, E705 fuzz .mli files, E718 space-wire fuzz runner

+6 -11
+6 -11
test/test_squashfs.ml
··· 271 271 (* ---- xattr tests ---- *) 272 272 273 273 (* Helper: build a minimal SquashFS image using the writer *) 274 - let make_image f = 274 + let image f = 275 275 let fs = Squashfs.Writer.v () in 276 276 f fs; 277 277 match Squashfs.of_string (Squashfs.Writer.finalize fs) with ··· 281 281 (* has_xattrs returns false for a plain image (no xattr table) *) 282 282 let test_has_xattrs_false () = 283 283 let t = 284 - make_image (fun fs -> 285 - Squashfs.Writer.add_file fs "hello.txt" ~mode:0o644 "hi") 284 + image (fun fs -> Squashfs.Writer.add_file fs "hello.txt" ~mode:0o644 "hi") 286 285 in 287 286 Alcotest.(check bool) "no xattrs" false (Squashfs.has_xattrs t) 288 287 289 288 (* xattr returns Ok None for inode with no xattrs (xattr_id = 0xFFFFFFFF) *) 290 289 let test_xattr_no_xattr_table () = 291 290 let t = 292 - make_image (fun fs -> Squashfs.Writer.add_file fs "f" ~mode:0o644 "data") 291 + image (fun fs -> Squashfs.Writer.add_file fs "f" ~mode:0o644 "data") 293 292 in 294 293 let root = Squashfs.root t in 295 294 match Squashfs.xattr t root "user.foo" with ··· 299 298 300 299 (* list_xattrs returns Ok [] for inode with no xattrs *) 301 300 let test_list_xattrs_empty () = 302 - let t = 303 - make_image (fun fs -> Squashfs.Writer.add_directory fs "d" ~mode:0o755) 304 - in 301 + let t = image (fun fs -> Squashfs.Writer.add_directory fs "d" ~mode:0o755) in 305 302 let root = Squashfs.root t in 306 303 match Squashfs.list_xattrs t root with 307 304 | Ok [] -> () ··· 311 308 (* xattr on a symlink inode with no xattrs returns Ok None *) 312 309 let test_xattr_symlink_no_xattrs () = 313 310 let t = 314 - make_image (fun fs -> 311 + image (fun fs -> 315 312 Squashfs.Writer.add_file fs "target" ~mode:0o644 "x"; 316 313 Squashfs.Writer.add_symlink fs "link" "target") 317 314 in ··· 494 491 let test_xattr_bad_table_start () = 495 492 (* A valid image normally has xattr_table_start = 0xFFFFFFFFFFFFFFFF (no xattrs). 496 493 We can't easily craft one with a bad table, but we can test the has_xattrs path. *) 497 - let t = 498 - make_image (fun fs -> Squashfs.Writer.add_file fs "f" ~mode:0o644 "x") 499 - in 494 + let t = image (fun fs -> Squashfs.Writer.add_file fs "f" ~mode:0o644 "x") in 500 495 (* has_xattrs is false for writer-generated images *) 501 496 Alcotest.(check bool) "has_xattrs false" false (Squashfs.has_xattrs t); 502 497 (* xattr on root (no xattr_id) is Ok None *)