diff --git a/Makefile b/Makefile index 2e121f6..86e5278 100644 --- a/Makefile +++ b/Makefile @@ -2,16 +2,16 @@ .PHONY: build clean test build: - jbuilder build @install --dev + dune build test: - jbuilder runtest --dev + dune runtest install: - jbuilder install + dune install uninstall: - jbuilder uninstall + dune uninstall clean: rm -rf _build diff --git a/bin/dune b/bin/dune new file mode 100644 index 0000000..a6887ff --- /dev/null +++ b/bin/dune @@ -0,0 +1,10 @@ +(executables + (names main) + (libraries fat-filesystem mirage-block-unix cmdliner mirage-fs-lwt + io-page-unix)) + +(install + (section bin) + (package fat-filesystem) + (files + (main.exe as fat))) diff --git a/bin/jbuild b/bin/jbuild deleted file mode 100644 index 16c85bb..0000000 --- a/bin/jbuild +++ /dev/null @@ -1,11 +0,0 @@ -(jbuild_version 1) - -(executables - ((names (main)) - (libraries (fat-filesystem mirage-block-unix cmdliner mirage-fs-lwt io-page-unix) -))) - -(install - ((section bin) - (package fat-filesystem) - (files ((main.exe as fat))))) diff --git a/dune-project b/dune-project new file mode 100644 index 0000000..f9f5639 --- /dev/null +++ b/dune-project @@ -0,0 +1,2 @@ +(lang dune 1.0) +(name fat-filesystem) diff --git a/fat-filesystem.opam b/fat-filesystem.opam index d496d16..393e798 100644 --- a/fat-filesystem.opam +++ b/fat-filesystem.opam @@ -7,11 +7,11 @@ dev-repo: "https://github.com/mirage/ocaml-fat.git" doc: "https://mirage.github.io/ocaml-fat/" build: [ - ["jbuilder" "subst" "-p" name "--name" name] {pinned} - ["jbuilder" "build" "-p" name "-j" jobs] + ["dune" "subst"] {pinned} + ["dune" "build" "-p" name "-j" jobs] ] depends: [ - "jbuilder" {build & >="1.0+beta7"} + "dune" {build & >= "1.0"} "cstruct" {>= "3.0.0"} "ppx_tools" {build} "ppx_cstruct" {build} diff --git a/src/dune b/src/dune new file mode 100644 index 0000000..b32f8ef --- /dev/null +++ b/src/dune @@ -0,0 +1,8 @@ +(library + (name fat_filesystem) + (public_name fat-filesystem) + (libraries cstruct re re.str mirage-fs mirage-block-lwt mirage-fs-lwt lwt + result rresult astring) + (wrapped false) + (preprocess + (pps ppx_cstruct))) diff --git a/src/jbuild b/src/jbuild deleted file mode 100644 index f877570..0000000 --- a/src/jbuild +++ /dev/null @@ -1,9 +0,0 @@ -(jbuild_version 1) - -(library - ((name fat_filesystem) - (public_name fat-filesystem) - (libraries (cstruct re re.str mirage-fs mirage-block-lwt mirage-fs-lwt lwt result rresult astring)) - (wrapped false) - (preprocess (pps (ppx_cstruct))) -)) diff --git a/test/dune b/test/dune new file mode 100644 index 0000000..5489e32 --- /dev/null +++ b/test/dune @@ -0,0 +1,5 @@ +(test + (libraries fat-filesystem lwt lwt.unix cstruct alcotest mirage-fs-lwt + mirage-block-unix io-page.unix mirage-block-lwt) + (name test) + (deps (glob_files *.dat))) diff --git a/test/jbuild b/test/jbuild deleted file mode 100644 index 74c65c5..0000000 --- a/test/jbuild +++ /dev/null @@ -1,10 +0,0 @@ -(jbuild_version 1) - -(executables - ((libraries (fat-filesystem lwt lwt.unix cstruct alcotest mirage-fs-lwt mirage-block-unix io-page.unix mirage-block-lwt)) - (names (test)))) - -(alias - ((name runtest) - (deps (test.exe)) - (action (run ${<})))) diff --git a/test/test.ml b/test/test.ml index ad5c576..aa91564 100644 --- a/test/test.ml +++ b/test/test.ml @@ -62,7 +62,7 @@ let print_int_list xs = "[" ^ ( String.concat "; " (List.map string_of_int xs) ) let test_root_list () = let open Fat_name in let t = - read_whole_file "test/root.dat" >>= fun bytes -> + read_whole_file "root.dat" >>= fun bytes -> let all = list bytes in Alcotest.(check int) __LOC__ 5 (List.length all); let x = List.nth all 1 in @@ -108,16 +108,16 @@ let fat_format = Alcotest.testable (Fmt.of_to_string Fat_format.to_string) (=) let test_chains () = let t = let open Fat_boot_sector in - read_sector "test/bootsector.dat" >>= fun bytes -> + read_sector "bootsector.dat" >>= fun bytes -> let boot = match unmarshal bytes with | Error x -> failwith x | Ok x -> x in Alcotest.(check (result fat_format string)) __LOC__ (Ok Fat_format.FAT16) (Fat_boot_sector.detect_format boot); - read_whole_file "test/root.dat" >>= fun bytes -> + read_whole_file "root.dat" >>= fun bytes -> let open Fat_name in let all = list bytes in - read_whole_file "test/fat.dat" >>= fun fat -> + read_whole_file "fat.dat" >>= fun fat -> let expected = [0; 0; 0; 2235; 3] in let actual = List.map (fun x -> (snd (x.dos)).start_cluster) all in @@ -138,7 +138,7 @@ let test_chains () = let test_parse_boot_sector () = let t = let open Fat_boot_sector in - read_sector "test/bootsector.dat" >>= fun bytes -> + read_sector "bootsector.dat" >>= fun bytes -> let x = match unmarshal bytes with | Error x -> failwith x | Ok x -> x in @@ -371,5 +371,4 @@ let suite = [ ] @ write_tests let () = - Unix.chdir "../../../"; Alcotest.run "fat" ["tests", suite]