Skip to content

Commit

Permalink
Configurator tests: toy pkg-config cleaned and renamed into pkgconf
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Boutillier <pierre.boutillier@laposte.net>
  • Loading branch information
pirbo committed Oct 15, 2024
1 parent 9c5a7bf commit 40f5cce
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(executable
(name pkg_config)
(modules pkg_config))
(name pkgconf)
(modules pkgconf))

(env
(_
(binaries
(./pkg_config.exe as pkg-config))))
(./pkgconf.exe as pkgconf))))

(executable
(name config_test)
Expand All @@ -14,6 +14,6 @@

(rule
(alias default)
(deps %{bin:pkg-config})
(deps %{bin:pkgconf})
(action
(run ./config_test.exe -verbose)))
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ let not_flag x = not ("--print-errors" = x)
let () =
let args = List.tl (Array.to_list Sys.argv) in
let args = List.filter not_flag args in
Format.printf "%a@."
Format.printf "@[<v>%a@]@."
(Format.pp_print_list Format.pp_print_string) args
22 changes: 12 additions & 10 deletions otherlibs/configurator/test/blackbox-tests/pkg-config-args.t/run.t
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
These tests show that setting `PKG_CONFIG_ARGN` passes extra args to `pkg-config`

$ dune build 2>&1 | awk '/run:.*bin\/pkg-config/{a=1}/stderr/{a=0}a'
run: $TESTCASE_ROOT/_build/default/.bin/pkg-config --print-errors dummy-pkg
$ dune build 2>&1 | awk '/run:.*bin\/pkgconf/{a=1}/stderr/{a=0}a'
run: $TESTCASE_ROOT/_build/default/.bin/pkgconf --print-errors dummy-pkg
-> process exited with code 0
-> stdout:
| dummy-pkg
run: $TESTCASE_ROOT/_build/default/.bin/pkg-config --cflags dummy-pkg
run: $TESTCASE_ROOT/_build/default/.bin/pkgconf --cflags dummy-pkg
-> process exited with code 0
-> stdout:
| --cflags
| dummy-pkg
run: $TESTCASE_ROOT/_build/default/.bin/pkg-config --libs dummy-pkg
run: $TESTCASE_ROOT/_build/default/.bin/pkgconf --libs dummy-pkg
-> process exited with code 0
-> stdout:
| --libs
| dummy-pkg

$ dune clean
$ PKG_CONFIG_ARGN="--static" dune build 2>&1 | awk '/run:.*bin\/pkg-config/{a=1}/stderr/{a=0}a'
run: $TESTCASE_ROOT/_build/default/.bin/pkg-config --print-errors dummy-pkg
$ PKG_CONFIG_ARGN="--static" dune build 2>&1 | awk '/run:.*bin\/pkgconf/{a=1}/stderr/{a=0}a'
run: $TESTCASE_ROOT/_build/default/.bin/pkgconf --print-errors dummy-pkg
-> process exited with code 0
-> stdout:
| dummy-pkg
run: $TESTCASE_ROOT/_build/default/.bin/pkg-config --static --cflags dummy-pkg
run: $TESTCASE_ROOT/_build/default/.bin/pkgconf --static --cflags dummy-pkg
-> process exited with code 0
-> stdout:
| --static--cflags
| --static
| --cflags
| dummy-pkg
run: $TESTCASE_ROOT/_build/default/.bin/pkg-config --static --libs dummy-pkg
run: $TESTCASE_ROOT/_build/default/.bin/pkgconf --static --libs dummy-pkg
-> process exited with code 0
-> stdout:
| --static--libs
| --static
| --libs
| dummy-pkg
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ let not_flag x = not ("--print-errors" = x)
let () =
let args = List.tl (Array.to_list Sys.argv) in
let args = List.filter not_flag args in
Format.printf "%a@."
Format.printf "@[<v>%a@]@."
(Format.pp_print_list Format.pp_print_string) args

0 comments on commit 40f5cce

Please sign in to comment.