forked from ocaml/dune
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ocaml#766 : enable specifying flags when compiling binaries from inli…
…ne tests Signed-off-by: lubegasimon <[email protected]>
- Loading branch information
1 parent
6d83f12
commit 0d00697
Showing
12 changed files
with
63 additions
and
7 deletions.
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
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
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
12 changes: 12 additions & 0 deletions
12
test/blackbox-tests/test-cases/inline_tests/compile-flags.t/dune-file-with-invalid-flag/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,12 @@ | ||
(library | ||
(name backend_foo_bar) | ||
(modules ()) | ||
(inline_tests.backend | ||
(generate_runner | ||
(echo "let () = print_endline \"backend_foo_bar\"")))) | ||
|
||
(library | ||
(name compile_flags_test_with_invalid_flag) | ||
(inline_tests | ||
(backend backend_foo_bar) | ||
(compile_flags -flag-that-is-not-accepted-by-ocaml))) |
1 change: 1 addition & 0 deletions
1
...ox-tests/test-cases/inline_tests/compile-flags.t/dune-file-with-invalid-flag/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 @@ | ||
(lang dune 2.7) |
12 changes: 12 additions & 0 deletions
12
test/blackbox-tests/test-cases/inline_tests/compile-flags.t/dune-file-with-valid-flag/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,12 @@ | ||
(library | ||
(name backend_foo) | ||
(modules ()) | ||
(inline_tests.backend | ||
(generate_runner | ||
(echo "let () = print_endline \"backend_foo\"")))) | ||
|
||
(library | ||
(name compile_flags_test) | ||
(inline_tests | ||
(backend backend_foo) | ||
(compile_flags -nolabels))) |
1 change: 1 addition & 0 deletions
1
...kbox-tests/test-cases/inline_tests/compile-flags.t/dune-file-with-valid-flag/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 @@ | ||
(lang dune 2.7) |
16 changes: 16 additions & 0 deletions
16
test/blackbox-tests/test-cases/inline_tests/compile-flags.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,16 @@ | ||
This test ensures that compilation fails when an invalid flag is supplied | ||
to compile_flags field. | ||
|
||
First, we pass a valid flag to compile_flags field expecting compilation | ||
to be successful. | ||
|
||
$ dune runtest dune-file-with-valid-flag | ||
inline_test_runner_compile_flags_test alias dune-file-with-valid-flag/runtest | ||
backend_foo | ||
|
||
Lastly, we pass an invalid flag to compile_flags field expecting compilation | ||
to fail. | ||
|
||
$ output=$(dune runtest dune-file-with-invalid-flag 2>&1); result=$?; (echo $output | grep -o "unknown option '-flag-that-is-not-accepted-by-ocaml'."); (exit $result) | ||
unknown option '-flag-that-is-not-accepted-by-ocaml'. | ||
[1] |