Skip to content

Commit

Permalink
Reduce path size for inline-tests artifacts
Browse files Browse the repository at this point in the history
Signed-off-by: Hugo Heuzard <[email protected]>
  • Loading branch information
hhugo committed Jan 21, 2025
1 parent 1ccb583 commit 6dd5d4f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 2 additions & 0 deletions doc/changes/11307.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Use shorter path for inline-tests artifacts.
(@hhugo, #11307)
3 changes: 1 addition & 2 deletions src/dune_rules/dir_status.ml
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,11 @@ let directory_targets_of_library
| true ->
let dir_target =
let lib_name = Lib_name.Local.to_string (snd name) in
let name = sprintf "inline_test_runner_%s" lib_name in
let inline_test_dir =
let inline_test_name = sprintf "%s.inline-tests" lib_name in
Path.Build.relative dir ("." ^ inline_test_name)
in
Path.Build.relative inline_test_dir (name ^ Js_of_ocaml.Ext.wasm_dir)
Path.Build.relative inline_test_dir ("run" ^ Js_of_ocaml.Ext.wasm_dir)
in
Path.Build.Map.singleton dir_target loc)
>>= when_enabled ~dir ~enabled_if
Expand Down
6 changes: 2 additions & 4 deletions src/dune_rules/inline_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,8 @@ include Sub_system.Register_end_point (struct
sprintf "%s.inline-tests" (Lib_name.Local.to_string lib_name)
in
let inline_test_dir = Path.Build.relative dir ("." ^ inline_test_name) in
let obj_dir = Obj_dir.make_exe ~dir:inline_test_dir ~name:inline_test_name in
let name =
sprintf "inline_test_runner_%s" (Lib_name.Local.to_string (snd lib.name))
in
let name = "run" in
let obj_dir = Obj_dir.make_exe ~dir:inline_test_dir ~name in
let main_module =
let name = Module_name.of_string name in
Module.generated ~kind:Impl ~src_dir:inline_test_dir [ name ]
Expand Down
8 changes: 4 additions & 4 deletions test/blackbox-tests/test-cases/inline_tests/parallel.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ First, build silently to avoid some noise
See that `test1/runtest`, which uses `fake_backend_1, only runs one inline test runner

$ dune build --display short @test1/runtest 2>&1 | grep alias
inline_test_runner_test_lib1 alias test1/runtest
run alias test1/runtest

See that `test2/runtest`, which uses `fake_backend_2`, runs one inline test runner per partition

$ dune build --display short @test2/runtest 2>&1 | grep alias
inline_test_runner_test_lib2 alias test2/runtest
inline_test_runner_test_lib2 alias test2/runtest
inline_test_runner_test_lib2 alias test2/runtest
run alias test2/runtest
run alias test2/runtest
run alias test2/runtest

See that we indeed have 3 partitions

Expand Down
4 changes: 2 additions & 2 deletions test/blackbox-tests/test-cases/inline_tests/simple.t
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
File "dune", line 9, characters 1-40:
9 | (inline_tests (backend backend_simple)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Fatal error: exception File ".foo_simple.inline-tests/inline_test_runner_foo_simple.ml-gen", line 1, characters 40-46: Assertion failed
Fatal error: exception File ".foo_simple.inline-tests/run.ml-gen", line 1, characters 40-46: Assertion failed
[1]

The expected behavior for the following three tests is to output nothing: the tests are disabled or ignored.
Expand All @@ -41,5 +41,5 @@ The expected behavior for the following three tests is to output nothing: the te
File "dune", line 9, characters 1-40:
9 | (inline_tests (backend backend_simple)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Fatal error: exception File ".foo_simple.inline-tests/inline_test_runner_foo_simple.ml-gen", line 1, characters 40-46: Assertion failed
Fatal error: exception File ".foo_simple.inline-tests/run.ml-gen", line 1, characters 40-46: Assertion failed
[1]

0 comments on commit 6dd5d4f

Please sign in to comment.