Skip to content

Commit

Permalink
nix/tests: run test help.sh only if nix is built with documentation
Browse files Browse the repository at this point in the history
tests/functional/help.sh calls nix-* commands with option --help
if nix is built without documentation the option --help throws an error
because the man page it wants to display is missing

(cherry picked from commit 85b0cd3)
  • Loading branch information
emhamm authored and mergify[bot] committed Oct 23, 2024
1 parent 7718688 commit 58428a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ AS_IF(
[test "$ENABLE_FUNCTIONAL_TESTS" == "yes" || test "$ENABLE_DOC_GEN" == "yes"],
[NEED_PROG(jq, jq)])

AS_IF(
[test "$ENABLE_DOC_GEN" == "yes"],
[NEED_PROG(man, man)])

AS_IF([test "$ENABLE_BUILD" == "yes"],[
# Look for boost, a required dependency.
Expand Down
3 changes: 2 additions & 1 deletion package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,10 @@ in {
git
mercurial
openssh
man # for testing `nix-* --help`
] ++ lib.optionals (doInstallCheck || enableManual) [
jq # Also for custom mdBook preprocessor.
] ++ lib.optionals enableManual [
man
] ++ lib.optional stdenv.hostPlatform.isStatic unixtools.hexdump
;

Expand Down
5 changes: 4 additions & 1 deletion tests/functional/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ nix_tests = \
impure-env.sh \
debugger.sh \
extra-sandbox-profile.sh \
help.sh

ifeq ($(HAVE_LIBCPUID), 1)
nix_tests += compute-levels.sh
Expand All @@ -128,6 +127,10 @@ ifeq ($(ENABLE_BUILD), yes)
endif
endif

ifeq ($(ENABLE_DOC_GEN), yes)
nix_tests += help.sh
endif

$(d)/test-libstoreconsumer.sh.test $(d)/test-libstoreconsumer.sh.test-debug: \
$(buildprefix)$(d)/test-libstoreconsumer/test-libstoreconsumer
$(d)/plugins.sh.test $(d)/plugins.sh.test-debug: \
Expand Down

0 comments on commit 58428a4

Please sign in to comment.