-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(ctypes): showcase deps field not supporting the full dependency …
…specification Signed-off-by: Louis Roché (Ahrefs) <[email protected]>
- Loading branch information
Showing
9 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions
15
test/blackbox-tests/test-cases/ctypes/deps-full-spec.t/dune
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 @@ | ||
(executable | ||
(name example) | ||
(flags (:standard -w -9-27)) | ||
(ctypes | ||
(external_library_name libexample) | ||
(build_flags_resolver pkg_config) | ||
(deps (:foo_h "foo.h") (:bar_h bar.h) baz.h) | ||
(headers (include "example.h")) | ||
(type_description | ||
(instance Types) | ||
(functor Type_description)) | ||
(function_description | ||
(instance Functions) | ||
(functor Function_description)) | ||
(generated_entry_point C))) |
5 changes: 5 additions & 0 deletions
5
test/blackbox-tests/test-cases/ctypes/deps-full-spec.t/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,5 @@ | ||
(lang dune 3.8) | ||
|
||
(using ctypes 0.3) | ||
|
||
(use_standard_c_and_cxx_flags false) |
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/ctypes/deps-full-spec.t/example.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,2 @@ | ||
let () = | ||
Printf.printf "%d\n" (C.Functions.add2 2) |
Empty file.
8 changes: 8 additions & 0 deletions
8
test/blackbox-tests/test-cases/ctypes/deps-full-spec.t/function_description.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 @@ | ||
open Ctypes | ||
|
||
module Types = Types_generated | ||
|
||
module Functions (F : Ctypes.FOREIGN) = struct | ||
open F | ||
let add2 = foreign "example_add2" (int @-> returning int) | ||
end |
14 changes: 14 additions & 0 deletions
14
test/blackbox-tests/test-cases/ctypes/deps-full-spec.t/run.t
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,14 @@ | ||
Build an example library as a DLL and set up the environment so that it looks | ||
like a system/distro library that can be probed with pkg-config and dynamically | ||
loaded. | ||
|
||
Then generate cstubs for it, build an executable that uses those cstubs, and | ||
run the executable that tests the library through the cstubs. | ||
|
||
$ LIBEX=$(realpath "$PWD/../libexample") | ||
$ DYLD_LIBRARY_PATH="$LIBEX" LD_LIBRARY_PATH="$LIBEX" PKG_CONFIG_PATH="$LIBEX/pkgconfig" PKG_CONFIG_ARGN="--define-prefix" dune exec ./example.exe | ||
File "dune", line 7, characters 8-24: | ||
7 | (deps (:foo_h "foo.h") (:bar_h bar.h) baz.h) | ||
^^^^^^^^^^^^^^^^ | ||
Error: Unexpected list | ||
[1] |
3 changes: 3 additions & 0 deletions
3
test/blackbox-tests/test-cases/ctypes/deps-full-spec.t/type_description.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 @@ | ||
module Types (F : Ctypes.TYPE) = struct | ||
|
||
end |