Skip to content

Commit a8fe370

Browse files
committed
test: Add tests for index generation and aggregation
We use a mock binary in tests Signed-off-by: Ulysse Gérard <[email protected]>
1 parent 5ff8b93 commit a8fe370

File tree

40 files changed

+250
-1
lines changed

40 files changed

+250
-1
lines changed

test/blackbox-tests/test-cases/dune

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
../utils/melc_stdlib_prefix.exe
1010
../utils/refmt.exe
1111
../utils/webserver_oneshot.exe
12-
../utils/sherlodoc.exe)))
12+
../utils/sherlodoc.exe
13+
../utils/ocaml_index.exe)))
1314

1415
(cram
1516
(applies_to pp-cwd)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(lang dune 3.5)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
$ mkdir bin
2+
$ cp $(which ocaml_index) bin/ocaml-index
3+
$ export PATH=bin:$PATH
4+
5+
Building from the workspace folder creates all three indexes:
6+
$ dune build @ocaml-index
7+
$ find . -name '*.ocaml-index' | sort
8+
./_build/default/sub-project/bin/.main.eobjs/cctx.ocaml-index
9+
./_build/default/sub-project/lib/.subprojectlib.objs/cctx.ocaml-index
10+
./_build/default/sub-project2/lib/.subprojectlib2.objs/cctx.ocaml-index
11+
12+
$ dune clean
13+
14+
Building from one of the sub-projects folder also creates all three indexes:
15+
$ cd sub-project
16+
$ export PATH=../bin:$PATH
17+
$ dune build --workspace=../dune-workspace --root=.. @sub-project/ocaml-index
18+
Entering directory '..'
19+
Leaving directory '..'
20+
$ cd ..
21+
22+
$ find . -name '*.ocaml-index' | sort
23+
./_build/default/sub-project/bin/.main.eobjs/cctx.ocaml-index
24+
./_build/default/sub-project/lib/.subprojectlib.objs/cctx.ocaml-index
25+
./_build/default/sub-project2/lib/.subprojectlib2.objs/cctx.ocaml-index
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
(executable
2+
(name main)
3+
(public_name main)
4+
(libraries subprojectlib subprojectlib2))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
print_int Subprojectlib2.subproject_value;
2+
print_endline "test"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(lang dune 3.5)
2+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(library
2+
(name subprojectlib)
3+
(public_name subprojectlib))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
let subproject_value = 42
2+
let () = print_int subproject_value

test/blackbox-tests/test-cases/ocaml-index/different-workspace-root.t/sub-project/subprojectlib.opam

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(lang dune 3.5)
2+

0 commit comments

Comments
 (0)