diff options
author | Jacob Bachmeyer <jcb@gnu.org> | 2021-06-16 23:13:33 -0500 |
---|---|---|
committer | Jacob Bachmeyer <jcb@gnu.org> | 2021-06-16 23:13:33 -0500 |
commit | be4c9afb6075676822cd5d921281347876e85509 (patch) | |
tree | 6d8d388f993334f1ef324ab02794feef911ecf6d /testsuite | |
parent | 96d3794213fbfb1705861e235b76642f3a42a66d (diff) | |
parent | 54bf1d8028c41f9cd2e840475404f6c4aa4b9736 (diff) | |
download | dejagnu-be4c9afb6075676822cd5d921281347876e85509.zip dejagnu-be4c9afb6075676822cd5d921281347876e85509.tar.gz dejagnu-be4c9afb6075676822cd5d921281347876e85509.tar.bz2 |
Merge fixes from 1.6.3 release branch
Conflicts:
ChangeLog
configure
configure.ac
doc/version.texi
runtest.exp
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/launcher.all/command.exp | 13 | ||||
-rw-r--r-- | testsuite/launcher.all/help.exp | 6 | ||||
-rw-r--r-- | testsuite/lib/launcher.exp | 4 | ||||
-rw-r--r-- | testsuite/lib/runtest.exp | 15 | ||||
-rw-r--r-- | testsuite/report-card.all/onetest.exp | 14 | ||||
-rw-r--r-- | testsuite/runtest.libs/utils.test | 8 | ||||
-rw-r--r-- | testsuite/runtest.main/nested/testsuite/bug.test/pr42399-sub.exp | 3 | ||||
-rw-r--r-- | testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.exp | 4 | ||||
-rw-r--r-- | testsuite/runtest.main/pr42399.exp | 10 | ||||
-rwxr-xr-x | testsuite/runtest.main/pr48155-csh.sh | 8 | ||||
-rw-r--r-- | testsuite/runtest.main/pr48155.exp | 102 | ||||
-rw-r--r-- | testsuite/runtest.main/stats.exp | 1 |
12 files changed, 170 insertions, 18 deletions
diff --git a/testsuite/launcher.all/command.exp b/testsuite/launcher.all/command.exp index 6c400f0..c461b6a 100644 --- a/testsuite/launcher.all/command.exp +++ b/testsuite/launcher.all/command.exp @@ -103,6 +103,19 @@ set tests { { "dejagnu foo --help fails if Tcl variant selected" {foo --help} {EXPECT=true TCLSH=true } 2 "does not contain a help message" } + + { "dejagnu foo --help fails if no POSIX Awk available" + {foo --help} {EXPECT=bogus TCLSH=bogus AWK=bogus GAWK=bogus} 2 + "requires POSIX Awk" } + { "dejagnu foo --help recognizes dummy GNU Awk as Awk" + {foo --help} {EXPECT=bogus TCLSH=bogus AWK=bogus GAWK=true } 2 + "does not contain a help message" } + { + # The above still fails, because true(1) does not actually + # evaluate Awk programs and the Awk program that tests if a help + # message is present returns true if the launcher should abort. + } + } { dejagnu-foo diff --git a/testsuite/launcher.all/help.exp b/testsuite/launcher.all/help.exp index 34eb68d..3f989f8 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 --DGTest -v} {} 0 "Forwarding to man \".*doc/dejagnu\\.1\"" } { "dejagnu help help selects dejagnu-help(1) manpage" - {help -v help} {MANPAGER=echo} 0 + {help --DGTest -v help} {} 0 "Forwarding to man \".*doc/dejagnu-help\\.1\"" } } 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]] diff --git a/testsuite/lib/runtest.exp b/testsuite/lib/runtest.exp index bbb541b..299cb0a 100644 --- a/testsuite/lib/runtest.exp +++ b/testsuite/lib/runtest.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1992-2016, 2018, 2020 Free Software Foundation, Inc. +# Copyright (C) 1992-2016, 2018, 2020, 2021 Free Software Foundation, Inc. # # This file is part of DejaGnu. # @@ -23,7 +23,11 @@ if { ![info exists RUNTEST] } { } if { ![info exists EXPECT] } { - set EXPECT [findfile $base_dir/../../expect/expect $base_dir/../../expect/expect expect] + if { [info exists ::env(EXPECT)] } { + set EXPECT $::env(EXPECT) + } else { + set EXPECT expect + } verbose "EXPECT defaulting to $EXPECT" 2 } @@ -66,6 +70,13 @@ proc runtest_setup_nested_testsuite {} { } } +proc runtest_copy_nested_testsuite_log { tool } { + verbose -log -- "---- ${tool}.log from failed test ----" + spawn -open [open [testsuite file -object -top tmpdir "${tool}.log"]] + expect { .+ { exp_continue } } + verbose -log -- "---- end ${tool}.log ----" +} + proc runtest_cleanup_nested_testsuite {} { upvar 1 tmpdir tmpdir diff --git a/testsuite/report-card.all/onetest.exp b/testsuite/report-card.all/onetest.exp index b2ae814..fcebdf7 100644 --- a/testsuite/report-card.all/onetest.exp +++ b/testsuite/report-card.all/onetest.exp @@ -193,11 +193,17 @@ foreach name $test_names { } # skip the footer expect -re {.+} { exp_continue } - # do the item and totals lines match? - if { $item_line eq $totals_line } { - pass "verify total for $name" + # were item and totals lines even produced? + if { [info exists item_line] && [info exists totals_line] } { + # do the item and totals lines match? + if { $item_line eq $totals_line } { + pass "verify total for $name" + } else { + fail "verify total for $name" + } } else { - fail "verify total for $name" + # either an item line or the totals line was not seen + unresolved "verify total for $name" } if { $separator_count == 2 } { pass "expected separator lines for $name" diff --git a/testsuite/runtest.libs/utils.test b/testsuite/runtest.libs/utils.test index f4b13dd..8be6a2e 100644 --- a/testsuite/runtest.libs/utils.test +++ b/testsuite/runtest.libs/utils.test @@ -139,12 +139,12 @@ if {[which [file join $objdir .. config.status]] != 0} { fail "which, absolute path to config.status" } -# Test 'which make'. +# Test 'which sh'. # -if {[which make] != 0} { - pass "which, make" +if {[which sh] != 0} { + pass "which, sh" } else { - fail "which, make" + fail "which, sh" } ### Do not adjust the comment on the next line. The grep test case diff --git a/testsuite/runtest.main/nested/testsuite/bug.test/pr42399-sub.exp b/testsuite/runtest.main/nested/testsuite/bug.test/pr42399-sub.exp index 331e043..d3f2b32 100644 --- a/testsuite/runtest.main/nested/testsuite/bug.test/pr42399-sub.exp +++ b/testsuite/runtest.main/nested/testsuite/bug.test/pr42399-sub.exp @@ -21,5 +21,6 @@ load_lib dejagnu.exp if {[info exists N]} { - host_execute [which awk] -f [testsuite file -source -test pr42399.awk] N=$N + host_execute [which awk] -f [testsuite file -source -test pr42399.awk] \ + N=$N /dev/null } diff --git a/testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.exp b/testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.exp index 96f8ac3..f3aece8 100644 --- a/testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.exp +++ b/testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.exp @@ -22,5 +22,7 @@ load_lib dejagnu.exp if { [info exists STATS_TEST] } { host_execute [which awk] -f [testsuite file -source -test unit-sub.awk] \ - UNIT_RESULT=$STATS_TEST + UNIT_RESULT=$STATS_TEST /dev/null } +# Solaris 10 /usr/bin/awk needs /dev/null actually passed on the command +# line, but will run unit-sub.awk without problems if that is done. diff --git a/testsuite/runtest.main/pr42399.exp b/testsuite/runtest.main/pr42399.exp index 1782231..f1d3abe 100644 --- a/testsuite/runtest.main/pr42399.exp +++ b/testsuite/runtest.main/pr42399.exp @@ -33,7 +33,7 @@ proc test_pr42399 {} { foreach test_count {5 5000} { set result pass - set failures [list] + set eof_reached 0 set want_num 1 set cmd_args [list --local_init nested-init.exp --tool bug \ -a pr42399-sub.exp N=$test_count] @@ -49,9 +49,15 @@ proc test_pr42399 {} { exp_continue } eof { - $result "PR42399 test with $test_count inner tests" + set eof_reached 1 } } + # Were any results at all produced? + if { $want_num == 1 } { set result unresolved } + # Did Expect report eof? + if { ! $eof_reached } { set result unresolved } + # emit test result + $result "PR42399 test with $test_count inner tests" } } diff --git a/testsuite/runtest.main/pr48155-csh.sh b/testsuite/runtest.main/pr48155-csh.sh new file mode 100755 index 0000000..08bc039 --- /dev/null +++ b/testsuite/runtest.main/pr48155-csh.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +cat <<EOF 1>&2 +timestamp=2021-01-25: Command not found. +Illegal variable name. +EOF + +exit 1 diff --git a/testsuite/runtest.main/pr48155.exp b/testsuite/runtest.main/pr48155.exp new file mode 100644 index 0000000..8b152cf --- /dev/null +++ b/testsuite/runtest.main/pr48155.exp @@ -0,0 +1,102 @@ +# Copyright (C) 2021 Free Software Foundation, Inc. +# +# This file is part of DejaGnu. +# +# DejaGnu is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# DejaGnu is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with DejaGnu; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +# This file is a regression test for PR48155, where running with the +# environment variable SHELL set to a C shell could cause an error running +# config.guess that would not be properly detected. + +load_lib util-defs.exp + +runtest_setup_nested_testsuite + +# We need a modified local init file for this test; the regular +# nested-init.exp will set host_triplet, which will cause runtest to assume +# that that is the build_triplet and avoid attempting to run config.guess. +exec sed -e /_triplet/d < nested-init.exp > pr48155-init.exp + +proc test_pr48155_setup {} { + upvar 1 envlist envlist + upvar 1 save_env save_env + upvar 1 unset_env unset_env + + set unset_env [list] + foreach {name value} $envlist { + if { [info exists ::env($name)] } { + set save_env($name) $::env($name) + } else { + lappend unset_env $name + } + } + foreach name {CONFIG_SHELL SHELL} { + if { [info exists ::env($name)] } { + set save_env($name) $::env($name) + unset ::env($name) + } + } + array set ::env $envlist +} +proc test_pr48155_cleanup {} { + upvar 1 save_env save_env + upvar 1 unset_env unset_env + + foreach name $unset_env { unset ::env($name) } + unset -nocomplain ::env(CONFIG_SHELL) ::env(SHELL) + array set ::env [array get save_env] +} + +proc test_pr48155_error { name envlist output } { + global RUNTEST + + test_pr48155_setup + + if { [util_test $RUNTEST \ + "--local_init pr48155-init.exp --tool null" \ + "" \ + $output] } { + fail $name + } else { + pass $name + } + + test_pr48155_cleanup +} + +test_pr48155_error "bogus CONFIG_SHELL as false" \ + [list CONFIG_SHELL [which false]] \ + "exited on code .*produced bogus build triplet:" +test_pr48155_error "bogus CONFIG_SHELL as true" \ + [list CONFIG_SHELL [which true]] \ + "produced bogus build triplet:" +test_pr48155_error "bogus CONFIG_SHELL as simulated C shell" \ + [list CONFIG_SHELL [testsuite file -source -test pr48155-csh.sh]] \ + "exited on code 1.*produced bogus build triplet:" + +# The following tests may change if planned future enhancements to reject +# unusable values of SHELL are implemented. + +test_pr48155_error "bogus SHELL as false" \ + [list SHELL [which false]] \ + "exited on code .*produced bogus build triplet:" +test_pr48155_error "bogus SHELL as true" \ + [list SHELL [which true]] \ + "produced bogus build triplet:" +test_pr48155_error "bogus SHELL as simulated C shell" \ + [list SHELL [testsuite file -source -test pr48155-csh.sh]] \ + "exited on code 1.*produced bogus build triplet:" + +runtest_cleanup_nested_testsuite diff --git a/testsuite/runtest.main/stats.exp b/testsuite/runtest.main/stats.exp index 7f4f5be..a380751 100644 --- a/testsuite/runtest.main/stats.exp +++ b/testsuite/runtest.main/stats.exp @@ -50,6 +50,7 @@ foreach t $tests { "" \ [lindex $t 2]] } { fail "[lindex $t 0]/[lindex $t 1]" + runtest_copy_nested_testsuite_log stat } else { pass "[lindex $t 0]/[lindex $t 1]" } |