Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions test/blackbox-tests/test-cases/ctypes/exe-vendored.t/dune
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
(rule
(targets libexample.a dllexample%{ext_dll})
(deps (source_tree vendor))
(action
(no-infer
(progn
(copy vendor/libexample.a libexample.a)
(copy vendor/libexample%{ext_dll} dllexample%{ext_dll})))))

(executable
(name example)
(flags (:standard -w -9-27))
(foreign_archives example)
(ctypes
(external_library_name examplelib)
(deps (source_tree vendor))
Expand Down
7 changes: 5 additions & 2 deletions test/blackbox-tests/test-cases/ctypes/exe-vendored.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ With Ctypes 0.3, the final executable link runs outside a sandbox.
> | processes
> | select((.args.target_files // [])
> | index("_build/default/example.exe"))
> | (.args.dir | contains(".sandbox"))
> | { sandbox: (.args.dir | contains(".sandbox"))
> , example_flags:
> ([.args.process_args[] | select(. == "-lexample")] | length)
> }
> ][0]'
false
{"sandbox":false,"example_flags":1}

The Ctypes headers found through its implicit include directory are not rule
dependencies.
Expand Down
24 changes: 16 additions & 8 deletions test/blackbox-tests/test-cases/ctypes/lib-vendored.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,25 @@ This is the version that builds into a library.
$ LIBEX=$(realpath "$PWD/../libexample")
$ TARGET=./stubgen/vendor
$ mkdir -p $TARGET && install $LIBEX/*example* $TARGET
$ dune exec ./example.exe
$ DYLD_LIBRARY_PATH="$TARGET" LD_LIBRARY_PATH="$TARGET" dune exec ./example.exe
4

With Ctypes 0.3, the C stubs library link runs outside a sandbox.

$ dune trace cat | jq_dune -sc '
> [ .[]
> | processes
> | select((.args.target_files // [])
> | any(contains("dllexamplelib_stubs")))
> | (.args.dir | contains(".sandbox"))
> ][0]'
false
> [.[] | processes] as $processes
> | { sandbox:
> ([$processes[]
> | select((.args.target_files // [])
> | any(contains("dllexamplelib_stubs")))
> | (.args.dir | contains(".sandbox"))
> ][0])
> , example_flags:
> ([$processes[]
> | select((.args.target_files // [])
> | index("_build/default/stubgen/examplelib.cmxa"))
> | [.args.process_args[] | select(. == "-lexample")] | length
> ][0])
> }'
{"sandbox":false,"example_flags":1}

Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
(rule
(targets libexample.a dllexample%{ext_dll})
(deps (source_tree vendor))
(action
(no-infer
(progn
(copy vendor/libexample.a libexample.a)
(copy vendor/libexample%{ext_dll} dllexample%{ext_dll})))))

(library
(name examplelib)
(flags (:standard -w -9-27))
(foreign_archives example)
(ctypes
(external_library_name examplelib)
(deps (source_tree vendor))
Expand All @@ -19,7 +9,7 @@
;; hack: multiple -I directives to work around cc commands being run from
;; different relative directories. Is there a cleaner way to do this?
(c_flags ("-Istubgen/vendor" "-Ivendor"))
(c_library_flags ("-Lstubgen/vendor" "-Lvendor" "-lexample"))))
(c_library_flags ("-Lstubgen/vendor" "-lexample"))))
(headers (include "example.h"))
(type_description
(instance Types)
Expand Down
Loading