SquashFS compressed filesystem reader in pure OCaml
0
fork

Configure Feed

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

fix(E331): remove redundant make_ prefix from internal functions

- squashfs.ml: make_superblock → superblock
- squashfs_writer.ml: make_superblock → superblock, make_inode_buf → inode_buf
- test_squashfs.ml: make_image → image
- test_streaming_aead.ml: make_key → key

+13 -8
+13 -8
test/test_squashfs.ml
··· 271 271 (* ---- xattr tests ---- *) 272 272 273 273 (* Helper: build a minimal SquashFS image using the writer *) 274 - let image f = 274 + let make_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 - image (fun fs -> Squashfs.Writer.add_file fs "hello.txt" ~mode:0o644 "hi") 284 + make_image (fun fs -> 285 + Squashfs.Writer.add_file fs "hello.txt" ~mode:0o644 "hi") 285 286 in 286 287 Alcotest.(check bool) "no xattrs" false (Squashfs.has_xattrs t) 287 288 288 289 (* xattr returns Ok None for inode with no xattrs (xattr_id = 0xFFFFFFFF) *) 289 290 let test_xattr_no_xattr_table () = 290 291 let t = 291 - image (fun fs -> Squashfs.Writer.add_file fs "f" ~mode:0o644 "data") 292 + make_image (fun fs -> Squashfs.Writer.add_file fs "f" ~mode:0o644 "data") 292 293 in 293 294 let root = Squashfs.root t in 294 295 match Squashfs.xattr t root "user.foo" with ··· 298 299 299 300 (* list_xattrs returns Ok [] for inode with no xattrs *) 300 301 let test_list_xattrs_empty () = 301 - let t = image (fun fs -> Squashfs.Writer.add_directory fs "d" ~mode:0o755) in 302 + let t = 303 + make_image (fun fs -> Squashfs.Writer.add_directory fs "d" ~mode:0o755) 304 + in 302 305 let root = Squashfs.root t in 303 306 match Squashfs.list_xattrs t root with 304 307 | Ok [] -> () ··· 308 311 (* xattr on a symlink inode with no xattrs returns Ok None *) 309 312 let test_xattr_symlink_no_xattrs () = 310 313 let t = 311 - image (fun fs -> 314 + make_image (fun fs -> 312 315 Squashfs.Writer.add_file fs "target" ~mode:0o644 "x"; 313 316 Squashfs.Writer.add_symlink fs "link" "target") 314 317 in ··· 446 449 | Ok _ -> Alcotest.fail "should fail on truncated name" 447 450 448 451 (* Truncated xattr value size returns error *) 449 - let test_parse_xattr_truncated_value_size () = 452 + let test_xattr_truncated_value () = 450 453 let name = "x" in 451 454 let buf = Bytes.create (4 + 1) in 452 455 (* header + 1 byte name, no value_size *) ··· 491 494 let test_xattr_bad_table_start () = 492 495 (* A valid image normally has xattr_table_start = 0xFFFFFFFFFFFFFFFF (no xattrs). 493 496 We can't easily craft one with a bad table, but we can test the has_xattrs path. *) 494 - let t = image (fun fs -> Squashfs.Writer.add_file fs "f" ~mode:0o644 "x") in 497 + let t = 498 + make_image (fun fs -> Squashfs.Writer.add_file fs "f" ~mode:0o644 "x") 499 + in 495 500 (* has_xattrs is false for writer-generated images *) 496 501 Alcotest.(check bool) "has_xattrs false" false (Squashfs.has_xattrs t); 497 502 (* xattr on root (no xattr_id) is Ok None *) ··· 568 573 Alcotest.test_case "xattr: truncated name" `Quick 569 574 test_parse_xattr_truncated_name; 570 575 Alcotest.test_case "xattr: truncated value size" `Quick 571 - test_parse_xattr_truncated_value_size; 576 + test_xattr_truncated_value; 572 577 Alcotest.test_case "xattr: truncated value" `Quick 573 578 test_parse_xattr_truncated_value; 574 579 Alcotest.test_case "xattr: empty data count=1" `Quick