-
Notifications
You must be signed in to change notification settings - Fork 414
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
Add a test about dune-sites where plugin links extra libary. #4348
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f5abfce
Add a test about dune-sites where plugin links extra libary.
dc5324d
[Sites] Move the tests to sites tests directories
bobot 022389a
[Sites] Add failing tests with library result as dependency
bobot 4ffa404
[Sites] Add missing -linkall when linking dune-sites.plugins
bobot 5e09dd5
[Sites] Makes the tests about thread more interesting
bobot 37e9465
[Sites] Give a specific error for the loading of the thread library
bobot 3c9b4e0
[Sites] Tests also in the working case
bobot f01c1ce
[Sites] Minimize test a little bit
da4bf15
[sites] Complicate the test: tring to load same library twice
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
(cram | ||
(applies_to :whole_subtree) | ||
(deps | ||
(package dune) | ||
(package dune-site))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
(executable | ||
(public_name app) | ||
(modules sites app) | ||
(libraries | ||
app.register | ||
dune-site | ||
dune-site.plugins | ||
;TOREMOVE threads | ||
)) | ||
|
||
(library | ||
(public_name app.register) | ||
(name registration) | ||
(modules registration)) | ||
|
||
(generate_sites_module | ||
(module sites) | ||
(plugins | ||
(app plugins))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 result threads)) | ||
|
||
(plugin | ||
(name plugin1) | ||
(libraries threads plugin1.plugin1_impl) | ||
(site (app plugins))) |
7 changes: 7 additions & 0 deletions
7
otherlibs/site/test/plugin_require_thread.t/plugin/dune-project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
20
otherlibs/site/test/plugin_require_thread.t/plugin/plugin1.opam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | ||
] | ||
] |
8 changes: 8 additions & 0 deletions
8
otherlibs/site/test/plugin_require_thread.t/plugin/plugin1_impl.ml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
let () = | ||
let open Result in | ||
print_endline "Registration of Plugin1"; | ||
Queue.add (fun () -> | ||
let th = Thread.create (fun () -> | ||
print_endline "Plugin1 is doing something...") () in | ||
Thread.join th | ||
) Registration.todo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(env | ||
(_ | ||
(flags -w -33))) | ||
|
||
(library | ||
(public_name plugin2.plugin2_impl) | ||
(name plugin2_impl) | ||
(modules plugin2_impl) | ||
(libraries app.MyControls app.register result threads)) | ||
|
||
(plugin | ||
(name plugin2) | ||
(libraries threads plugin2.plugin2_impl) | ||
(site | ||
(app plugins))) |
8 changes: 8 additions & 0 deletions
8
otherlibs/site/test/plugin_require_thread.t/plugin2/dune-project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(lang dune 2.8) | ||
|
||
(using dune_site 0.1) | ||
|
||
(generate_opam_files true) | ||
|
||
(package | ||
(name plugin2)) |
3 changes: 3 additions & 0 deletions
3
otherlibs/site/test/plugin_require_thread.t/plugin2/plugin2_impl.ml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
let () = | ||
print_endline "Registration of Plugin2"; | ||
Queue.add (fun () -> print_endline "Plugin2 is doing something...") Registration.todo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let todo : (unit -> unit) Queue.t = Queue.create () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
$ dune build ./app.exe @install | ||
$ dune exec ./app.exe | ||
The library is being used by two plugins finished initialization | ||
Fatal error: exception Dune_site_plugins__Plugins.Thread_library_required_by_plugin_but_not_required_by_main_executable | ||
[2] | ||
|
||
$ sed -i -e "s/;TOREMOVE//" dune | ||
|
||
$ dune build ./app.exe @install | ||
$ dune exec ./app.exe | ||
The library is being used by two plugins finished initialization | ||
Registration of Plugin1 | ||
Registration of Plugin2 | ||
Main app starts... | ||
Plugin1 is doing something... | ||
Plugin2 is doing something... |
1 change: 1 addition & 0 deletions
1
otherlibs/site/test/plugin_require_thread.t/stubs/MyControls.ml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let () = print_endline "The library is being used by two plugins finished initialization" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(library | ||
(public_name app.MyControls) | ||
(name MyControls) | ||
(modules MyControls) | ||
(libraries)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test fails with a crash for me locally:
Could you do something about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have something like "backtrace printing is always activated"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'm not sure what "backtrace printing is always activated" means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something like
export OCAMLRUNPARAM=b
in~/.bashrc
...For my your problem is not easily reproducible too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kakadu I see. That may well be it: my
~/.bashrc
collects settings from various sources, and I wouldn't be surprised if one of them does what you say.