Skip to content

Commit

Permalink
new test
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Dec 13, 2021
1 parent 3c632e0 commit 2086508
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/cxx-flags.t/dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
(name main)
(libraries quad)
(foreign_stubs (language cxx) (names bazexe))
(modules main))
(modules main))
25 changes: 25 additions & 0 deletions test/blackbox-tests/test-cases/cxx-flags.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,33 @@ With use_standard_c_and_cxx_flags = true
> grep -ce "Main.cmx$GCC_LF_LIB)\|Main.cmx$Clang_LF_LIB)\|Main.cmx$Msvc_LF_LIB)"
1

$ dune clean

$ dune exec ./main.exe
2046
4096
Hello World Baz!
Hello World Bazexe!

$ [ -f _build/default/.dune/ccomp/ccomp ]


ccomp is not computed if not required
=====================================
$ dune clean

$ dune exec ./sub/main_no_stubs.exe
OK

$ [ -f _build/default/.dune/ccomp/ccomp ]
[1]


one can extend link flags in env
================================

$ OTHER=" --other-flag --yet-some-other-flag)"

$ dune rules sub/main.exe --profile some-profile | tr -s '\n' ' ' |
> grep -ce "Main.cmx$GCC_LF_LIB$OTHER\|Main.cmx$Clang_LF_LIB$OTHER\|Main.cmx$Msvc_LF_LIB$OTHER"
1
11 changes: 11 additions & 0 deletions test/blackbox-tests/test-cases/cxx-flags.t/sub/bazexe.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <caml/mlvalues.h>
#include <iostream>

extern "C" value bazexe(value unit) { return Val_int(4096); }

extern "C" void hello_world_bazexe ();

void hello_world_bazexe ()
{
std::cout << "Hello World Bazexe!";
}
12 changes: 12 additions & 0 deletions test/blackbox-tests/test-cases/cxx-flags.t/sub/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

(executable
(name main)
(link_flags (:standard --yet-some-other-flag \ --remove-this-one-later))
(foreign_stubs (language cxx) (names bazexe))
(modules main))

(executable
(name main_no_stubs)
(modules main_no_stubs))

(env (some-profile (link_flags (:standard --other-flag --remove-this-one-later))))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 3.0)
1 change: 1 addition & 0 deletions test/blackbox-tests/test-cases/cxx-flags.t/sub/main.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let () = print_endline "OK"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let () = print_endline "OK"

0 comments on commit 2086508

Please sign in to comment.