From a8a331ee5b0953ee3ca11764e4a6e4f2af8722c9 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Fri, 26 Mar 2021 23:04:15 -0500 Subject: Address PR47386 --- ChangeLog | 15 +++++++++++++++ commands/help.sh | 20 ++++++++++++++++---- testsuite/launcher.all/help.exp | 10 +++++++--- testsuite/lib/launcher.exp | 4 +++- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d46763..f6304cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,20 @@ 2021-03-26 Jacob Bachmeyer + PR47386 + + * testsuite/launcher.all/help.exp: Skip the tests on Solaris, + since Solaris man(1) does not accept explicit filenames. The + manpages will be installed as usual, and the "dejagnu help" + command should work after installation. + + Also set PAGER for testing, since other systems might also ignore + MANPAGER and that would cause the test to hang. + + * testsuite/lib/launcher.exp (dejagnu_run): Send commands run and + copies of the output produced to the log. + + * commands/help.sh: Extend PR47382 fix (below) to this file. + PR47385 * testsuite/lib/runtest.exp: Remove support for automatically diff --git a/commands/help.sh b/commands/help.sh index 7da4d5f..309b7df 100644 --- a/commands/help.sh +++ b/commands/help.sh @@ -1,7 +1,7 @@ #!/bin/sh # help.sh -- "dejagnu help" command # -# Copyright (C) 2018 Free Software Foundation, Inc. +# Copyright (C) 2018, 2021 Free Software Foundation, Inc. # # This file is part of DejaGnu. # @@ -26,6 +26,18 @@ # # -W Passed to man(1) # ##end +# shellcheck disable=SC2003 +# The shellcheck tool complains about use of expr and recommends using +# newer shell features instead. Solaris 10 /bin/sh does not support the +# newer features, so we must use expr in this script. + +# shellcheck disable=SC2006 +# The shellcheck tool complains about the old style backtick command +# substitution. Solaris 10 /bin/sh does not support the new style $() +# command substitution and the usage of command substitution in this script +# is simple enough to work. Most notably, nesting backtick command +# substitution is tricky, but we do not do that. + # This script was written by Jacob Bachmeyer. args= @@ -33,7 +45,7 @@ command=dejagnu verbose=0 for a in "$@"; do case $a in - -v|--v|-verb*|--verb*) verbose=$((verbose + 1)) ;; + -v|--v|-verb*|--verb*) verbose=`expr $verbose + 1` ;; -w|-W|--path) args="${args} ${a}" ;; -*) echo Unrecognized option "\"$a\"" ;; *) command="${command}-${a}" ;; @@ -45,8 +57,8 @@ if expr "$verbose" \> 0 > /dev/null ; then fi ## Get the location of this script and check for nearby "doc" dir. -commdir="$(echo "$0" | sed -e 's@/[^/]*$@@')" -docdir="$(echo "$commdir" | sed -e 's@/[^/]*$@@')/doc" +commdir=`echo "$0" | sed -e 's@/[^/]*$@@'` +docdir=`echo "$commdir" | sed -e 's@/[^/]*$@@'`/doc if expr "$verbose" \> 0 > /dev/null ; then echo Running from "$commdir" diff --git a/testsuite/launcher.all/help.exp b/testsuite/launcher.all/help.exp index 34eb68d..8e128f2 100644 --- a/testsuite/launcher.all/help.exp +++ b/testsuite/launcher.all/help.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2018 Free Software Foundation, Inc. +# Copyright (C) 2018, 2021 Free Software Foundation, Inc. # # This file is part of DejaGnu. # @@ -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} 0 + {help -v} {MANPAGER=echo PAGER=echo} 0 "Forwarding to man \".*doc/dejagnu\\.1\"" } { "dejagnu help help selects dejagnu-help(1) manpage" - {help -v help} {MANPAGER=echo} 0 + {help -v help} {MANPAGER=echo PAGER=echo} 0 "Forwarding to man \".*doc/dejagnu-help\\.1\"" } } @@ -32,6 +32,10 @@ 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 } diff --git a/testsuite/lib/launcher.exp b/testsuite/lib/launcher.exp index c9a40e7..6b4136a 100644 --- a/testsuite/lib/launcher.exp +++ b/testsuite/lib/launcher.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2018 Free Software Foundation, Inc. +# Copyright (C) 2018, 2021 Free Software Foundation, Inc. # # This file is part of DejaGnu. # @@ -44,7 +44,9 @@ proc dejagnu_run { launcher arglist envlist } { # reset errorCode catch { error } + verbose -log "Running \"[lrange $exec_cmd 1 end] $arglist\" ..." catch { eval $exec_cmd $arglist } output + verbose -log $output if { [lindex $errorCode 0] eq "CHILDSTATUS" } { return [list $output [lindex $errorCode 2]] -- cgit v1.1