Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to dune #79

Merged
merged 4 commits into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions bin/dune
Original file line number Diff line number Diff line change
@@ -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)))
11 changes: 0 additions & 11 deletions bin/jbuild

This file was deleted.

2 changes: 2 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(lang dune 1.0)
(name fat-filesystem)
6 changes: 3 additions & 3 deletions fat-filesystem.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
8 changes: 8 additions & 0 deletions src/dune
Original file line number Diff line number Diff line change
@@ -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)))
9 changes: 0 additions & 9 deletions src/jbuild

This file was deleted.

5 changes: 5 additions & 0 deletions test/dune
Original file line number Diff line number Diff line change
@@ -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)))
10 changes: 0 additions & 10 deletions test/jbuild

This file was deleted.

11 changes: 5 additions & 6 deletions test/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -371,5 +371,4 @@ let suite = [
] @ write_tests

let () =
Unix.chdir "../../../";
Alcotest.run "fat" ["tests", suite]