Skip to content

Commit

Permalink
Add a test about dune-sites where plugin links extra libary.
Browse files Browse the repository at this point in the history
For now this test gives a dynlink error about missiing library. See also
#4320

Signed-off-by: Dmitrii Kosarev <[email protected]>
  • Loading branch information
Dmitrii Kosarev authored and Kakadu committed Sep 1, 2021
1 parent fd4c4ae commit 3bce0da
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/blackbox-tests/test-cases/sites.t/app.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(* load all the available plugins *)
let () = Sites.Plugins.Plugins.load_all ()

let () = print_endline "Main app starts..."
(* Execute the code registered by the plugins *)
let () = Queue.iter (fun f -> f ()) Registration.todo
14 changes: 14 additions & 0 deletions test/blackbox-tests/test-cases/sites.t/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(executable
(public_name app)
(modules sites app)
(libraries app.register dune-site dune-site.plugins ))

(library
(public_name app.register)
;(libraries stdio)
(name registration)
(modules registration))

(generate_sites_module
(module sites)
(plugins (app plugins)))
8 changes: 8 additions & 0 deletions test/blackbox-tests/test-cases/sites.t/dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(lang dune 2.8)
(using dune_site 0.1)

(name app)

(package
(name app)
(sites (lib plugins)))
12 changes: 12 additions & 0 deletions test/blackbox-tests/test-cases/sites.t/plugin/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(env (_ (flags -w -33)))

(library
(public_name plugin1.plugin1_impl)
(name plugin1_impl)
(modules plugin1_impl)
(libraries app.MyControls app.register threads))

(plugin
(name plugin1)
(libraries threads plugin1.plugin1_impl)
(site (app plugins)))
7 changes: 7 additions & 0 deletions test/blackbox-tests/test-cases/sites.t/plugin/dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(lang dune 2.8)
(using dune_site 0.1)

(generate_opam_files true)

(package
(name plugin1))
20 changes: 20 additions & 0 deletions test/blackbox-tests/test-cases/sites.t/plugin/plugin1.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
depends: [
"dune" {>= "2.8"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
4 changes: 4 additions & 0 deletions test/blackbox-tests/test-cases/sites.t/plugin/plugin1_impl.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
let () =
let open Thread in
print_endline "Registration of Plugin1";
Queue.add (fun () -> print_endline "Plugin1 is doing something...") Registration.todo
1 change: 1 addition & 0 deletions test/blackbox-tests/test-cases/sites.t/registration.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let todo : (unit -> unit) Queue.t = Queue.create ()
5 changes: 5 additions & 0 deletions test/blackbox-tests/test-cases/sites.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

$ dune build ./app.exe @install
$ dune exec ./app.exe


1 change: 1 addition & 0 deletions test/blackbox-tests/test-cases/sites.t/stubs/MyControls.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

7 changes: 7 additions & 0 deletions test/blackbox-tests/test-cases/sites.t/stubs/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(library
(public_name app.MyControls)
(name MyControls)

(modules MyControls)
(libraries )
)

0 comments on commit 3bce0da

Please sign in to comment.