From cc6b01a96e5bcdb9ace4f0b47d7daff1ed50452c Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Sat, 22 May 2021 22:23:15 -0500 Subject: Add test mode for "dejagnu help" command --- ChangeLog | 7 +++++++ commands/help.sh | 15 +++++++++++++-- testsuite/launcher.all/help.exp | 8 ++------ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index f29b6f3..7daaff9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,13 @@ * config.guess: Import patched version; patches sent upstream. + * commands/help.sh: Add test mode in which man(1) is never + actually invoked. The ability to reference a manpage by absolute + file name seems to be unique to Free systems. + * testsuite/launcher.all/help.exp: Amend test list to use new + testing mode in "dejagnu help" command. This mode should also + work on Solaris, so the logic for skipping the tests is removed. + 2021-05-20 Jacob Bachmeyer * dejagnu: Search for a POSIX Awk and validate that at least a diff --git a/commands/help.sh b/commands/help.sh index 1070ece..b811780 100644 --- a/commands/help.sh +++ b/commands/help.sh @@ -40,6 +40,13 @@ # This script was written by Jacob Bachmeyer. +# For testing and development +in_test_mode=false +if test x"$1" = x--DGTest ; then + in_test_mode=true + shift +fi + args= command=dejagnu verbose=0 @@ -84,7 +91,11 @@ if expr "$verbose" \> 0 > /dev/null ; then echo Forwarding to man $args "\"$command\"" fi -#shellcheck disable=SC2086 -exec man $args "$command" +if $in_test_mode ; then + echo man "$args $command" +else + #shellcheck disable=SC2086 + exec man $args "$command" +fi #EOF diff --git a/testsuite/launcher.all/help.exp b/testsuite/launcher.all/help.exp index 8e128f2..3f989f8 100644 --- a/testsuite/launcher.all/help.exp +++ b/testsuite/launcher.all/help.exp @@ -21,10 +21,10 @@ # each element: { name args envars exit_code output_re... } set tests { { "dejagnu help selects dejagnu(1) manpage" - {help -v} {MANPAGER=echo PAGER=echo} 0 + {help --DGTest -v} {} 0 "Forwarding to man \".*doc/dejagnu\\.1\"" } { "dejagnu help help selects dejagnu-help(1) manpage" - {help -v help} {MANPAGER=echo PAGER=echo} 0 + {help --DGTest -v help} {} 0 "Forwarding to man \".*doc/dejagnu-help\\.1\"" } } @@ -32,10 +32,6 @@ if { ![file isdirectory [file join [file dirname $LAUNCHER] commands]] } { skip_dejagnu_launcher_tests \ "The 'commands' directory is not present in the source tree." \ unsupported $tests -} elseif { [istarget *-*-solaris*] } { - skip_dejagnu_launcher_tests \ - "The 'man' command in Solaris does not work in the source tree." \ - unsupported $tests } else { run_dejagnu_launcher_tests $LAUNCHER $tests } -- cgit v1.2.3