From e0c6ed1c8370d1dbfd60a294666c50929fe1c8fc Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 18 Nov 2024 16:07:35 +0100 Subject: [PATCH 1/3] Fix help test in dev shell Not sure what the intent was expecting help.sh to fail in the main suite, but it caused `meson test` to fail inside a `nix develop` shell: $ meson test help --print-errorlogs ninja: Entering directory `/home/eelco/Dev/nix-master/build' 1/1 nix-functional-tests:main / help UNEXPECTEDPASS 4.02s --- tests/functional/help.sh | 2 ++ tests/functional/meson.build | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/help.sh b/tests/functional/help.sh index 127cc455b..e195e10eb 100755 --- a/tests/functional/help.sh +++ b/tests/functional/help.sh @@ -2,6 +2,8 @@ source common.sh +[[ $(type -p man) ]] || skipTest "'man' not installed" + # test help output nix-build --help diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 83e08c4f5..dee003e42 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -242,8 +242,6 @@ foreach suite : suites # Used for target dependency/ordering tracking, not adding compiler flags or anything. depends : suite['deps'], workdir : workdir, - # Won't pass until man pages are generated - should_fail : suite['name'] == 'main' and script == 'help.sh' ) endforeach endforeach From 2dae5acf8613169aabe729e8318ca08376d24754 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 22 Jan 2025 21:36:33 +0100 Subject: [PATCH 2/3] Run the 'nix --help' tests early These don't depend on 'man' so we don't need to skip them. --- tests/functional/help.sh | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/functional/help.sh b/tests/functional/help.sh index e195e10eb..88d3c0a4b 100755 --- a/tests/functional/help.sh +++ b/tests/functional/help.sh @@ -2,6 +2,25 @@ source common.sh +function subcommands() { + jq -r ' +def recurse($prefix): + to_entries[] | + ($prefix + [.key]) as $newPrefix | + (if .value | has("commands") then + ($newPrefix, (.value.commands | recurse($newPrefix))) + else + $newPrefix + end); +.args.commands | recurse([]) | join(" ") +' +} + +nix __dump-cli | subcommands | while IFS= read -r cmd; do + # shellcheck disable=SC2086 # word splitting of cmd is intended + nix $cmd --help +done + [[ $(type -p man) ]] || skipTest "'man' not installed" # test help output @@ -51,22 +70,3 @@ nix-daemon --help nix-hash --help nix-instantiate --help nix-prefetch-url --help - -function subcommands() { - jq -r ' -def recurse($prefix): - to_entries[] | - ($prefix + [.key]) as $newPrefix | - (if .value | has("commands") then - ($newPrefix, (.value.commands | recurse($newPrefix))) - else - $newPrefix - end); -.args.commands | recurse([]) | join(" ") -' -} - -nix __dump-cli | subcommands | while IFS= read -r cmd; do - # shellcheck disable=SC2086 # word splitting of cmd is intended - nix $cmd --help -done From 5b43163c6dc911fa1aad52199f6a053696266593 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Jan 2025 14:54:05 +0100 Subject: [PATCH 3/3] Disable 'man' tests --- tests/functional/help.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/functional/help.sh b/tests/functional/help.sh index 88d3c0a4b..2d64c465d 100755 --- a/tests/functional/help.sh +++ b/tests/functional/help.sh @@ -23,6 +23,10 @@ done [[ $(type -p man) ]] || skipTest "'man' not installed" +# FIXME: we don't know whether we built the manpages, so we can't +# reliably test them here. +exit 0 + # test help output nix-build --help