aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRob Savoye <rob@senecass.com>2020-08-02 12:22:42 -0600
committerRob Savoye <rob@senecass.com>2020-08-02 12:22:42 -0600
commit1e4010a4d2a8b63c3215dd7492eba38f056bb6e3 (patch)
treec61c7b3bfeab336649488914b32a28832d327458 /testsuite
parentbc0e0d6286d418bfc2013edc1e3bd2c0045122ae (diff)
parent264bd34c28a16e18860dbc69a21a96c1be130b08 (diff)
downloaddejagnu-1e4010a4d2a8b63c3215dd7492eba38f056bb6e3.zip
dejagnu-1e4010a4d2a8b63c3215dd7492eba38f056bb6e3.tar.gz
dejagnu-1e4010a4d2a8b63c3215dd7492eba38f056bb6e3.tar.bz2
Merge branch 'PR42399'
Branch surived testing.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/lib/runtest.exp39
-rw-r--r--testsuite/runtest.main/error.exp29
-rw-r--r--testsuite/runtest.main/nested/testsuite/bug.test/pr42399-sub.exp25
-rwxr-xr-xtestsuite/runtest.main/nested/testsuite/bug.test/pr42399.awk35
-rw-r--r--testsuite/runtest.main/nested/testsuite/error.test/error-al-dbz.exp (renamed from testsuite/runtest.main/error/testsuite/error.test/error-al-dbz.exp)0
-rw-r--r--testsuite/runtest.main/nested/testsuite/error.test/error-dbz.exp (renamed from testsuite/runtest.main/error/testsuite/error.test/error-dbz.exp)0
-rw-r--r--testsuite/runtest.main/nested/testsuite/error.test/error-undef.exp (renamed from testsuite/runtest.main/error/testsuite/error.test/error-undef.exp)0
-rw-r--r--testsuite/runtest.main/nested/testsuite/error.test/simple.exp (renamed from testsuite/runtest.main/error/testsuite/error.test/simple.exp)0
-rw-r--r--testsuite/runtest.main/nested/testsuite/null.test/null.exp (renamed from testsuite/runtest.main/options/testsuite/null.test/null.exp)0
-rw-r--r--testsuite/runtest.main/nested/testsuite/stat.test/stats-sub.exp (renamed from testsuite/runtest.main/stats/testsuite/stat.test/stats-sub.exp)0
-rw-r--r--testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.awk39
-rw-r--r--testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.exp26
-rw-r--r--testsuite/runtest.main/options.exp32
-rw-r--r--testsuite/runtest.main/pr42399.exp60
-rw-r--r--testsuite/runtest.main/stats.exp59
15 files changed, 261 insertions, 83 deletions
diff --git a/testsuite/lib/runtest.exp b/testsuite/lib/runtest.exp
index 67643b4..bbb541b 100644
--- a/testsuite/lib/runtest.exp
+++ b/testsuite/lib/runtest.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2016, 2018 Free Software Foundation, Inc.
+# Copyright (C) 1992-2016, 2018, 2020 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
@@ -37,6 +37,43 @@ if { [which $EXPECT] == 0 } {
}
#
+# support procedures for running items in a nested testsuite
+#
+# Note that these procedures establish and use a "tmpdir" variable in the
+# caller's context.
+proc runtest_setup_nested_testsuite {} {
+ global host_triplet
+ upvar 1 tmpdir tmpdir
+
+ if {![info exists tmpdir]} {
+ set tmpdir [testsuite file -object -top tmpdir]
+ }
+
+ set fd [open nested-init.exp w]
+ puts $fd "set host_triplet $host_triplet"
+ puts $fd "set srcdir [testsuite file -source -test nested]"
+ puts $fd "set objdir [testsuite file -object -test nested]"
+ puts $fd "set tmpdir $tmpdir"
+ puts $fd "set outdir $tmpdir"
+ close $fd
+
+ if {![file isdirectory $tmpdir]} {
+ catch {file mkdir $tmpdir}
+ }
+
+ if {![file isdirectory [testsuite file -object -test nested]]} {
+ catch {file mkdir [testsuite file -object -test nested]}
+ }
+}
+
+proc runtest_cleanup_nested_testsuite {} {
+ upvar 1 tmpdir tmpdir
+
+ file delete -force $tmpdir
+}
+
+
+#
# runtest_version -- extract and print the version number
#
proc runtest_version { } {
diff --git a/testsuite/runtest.main/error.exp b/testsuite/runtest.main/error.exp
index 1473ee1..8d5795f 100644
--- a/testsuite/runtest.main/error.exp
+++ b/testsuite/runtest.main/error.exp
@@ -22,23 +22,7 @@
load_lib util-defs.exp
-if {![info exists tmpdir]} {
- set tmpdir [testsuite file -object -top tmpdir]
-}
-
-set fd [open error-init.exp w]
-puts $fd "set srcdir [testsuite file -source -test error]"
-puts $fd "set objdir [testsuite file -object -test error]"
-puts $fd "set tmpdir $tmpdir"
-close $fd
-
-if {![file isdirectory $tmpdir]} {
- catch "file mkdir $tmpdir"
-}
-
-if {![file isdirectory [testsuite file -object -test error]]} {
- catch {file mkdir [testsuite file -object -test error]}
-}
+runtest_setup_nested_testsuite
set tests {
{ "run only simple test"
@@ -67,8 +51,8 @@ set tests {
foreach t $tests {
if [util_test $RUNTEST \
- "--local_init error-init.exp\
- --outdir $tmpdir -a [lindex $t 1]" \
+ "--local_init nested-init.exp --tool error\
+ -a [lindex $t 1]" \
"" \
[lindex $t 2]] {
fail [lindex $t 0]
@@ -77,5 +61,8 @@ foreach t $tests {
}
}
-file delete -force $tmpdir
-file delete -force [testsuite file -object -test error testsuite error.test lib]
+runtest_cleanup_nested_testsuite
+
+# remove the autoload files generated during the test
+file delete -force \
+ [testsuite file -object -test nested testsuite error.test lib]
diff --git a/testsuite/runtest.main/nested/testsuite/bug.test/pr42399-sub.exp b/testsuite/runtest.main/nested/testsuite/bug.test/pr42399-sub.exp
new file mode 100644
index 0000000..331e043
--- /dev/null
+++ b/testsuite/runtest.main/nested/testsuite/bug.test/pr42399-sub.exp
@@ -0,0 +1,25 @@
+# Copyright (C) 2020 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.
+
+# Regression test for PR42399; inner runtest component.
+
+load_lib dejagnu.exp
+
+if {[info exists N]} {
+ host_execute [which awk] -f [testsuite file -source -test pr42399.awk] N=$N
+}
diff --git a/testsuite/runtest.main/nested/testsuite/bug.test/pr42399.awk b/testsuite/runtest.main/nested/testsuite/bug.test/pr42399.awk
new file mode 100755
index 0000000..c460508
--- /dev/null
+++ b/testsuite/runtest.main/nested/testsuite/bug.test/pr42399.awk
@@ -0,0 +1,35 @@
+#!/usr/bin/awk -f
+# Copyright (C) 2020 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.
+
+# Return a large number of unit test results to test buffer handling and
+# synchronization. This is part of a regression test for PR42399.
+
+BEGIN {
+ # Provide a useful default value.
+ N = 1
+ # Avoid reading stdin if no files were given on the command line.
+ ARGV[ARGC++] = "/dev/null"
+}
+
+END {
+ for (i = 1; i <= N; i++)
+ print "\tPASSED: sample test "i
+}
+
+# EOF \ No newline at end of file
diff --git a/testsuite/runtest.main/error/testsuite/error.test/error-al-dbz.exp b/testsuite/runtest.main/nested/testsuite/error.test/error-al-dbz.exp
index 52b5bc3..52b5bc3 100644
--- a/testsuite/runtest.main/error/testsuite/error.test/error-al-dbz.exp
+++ b/testsuite/runtest.main/nested/testsuite/error.test/error-al-dbz.exp
diff --git a/testsuite/runtest.main/error/testsuite/error.test/error-dbz.exp b/testsuite/runtest.main/nested/testsuite/error.test/error-dbz.exp
index 463337a..463337a 100644
--- a/testsuite/runtest.main/error/testsuite/error.test/error-dbz.exp
+++ b/testsuite/runtest.main/nested/testsuite/error.test/error-dbz.exp
diff --git a/testsuite/runtest.main/error/testsuite/error.test/error-undef.exp b/testsuite/runtest.main/nested/testsuite/error.test/error-undef.exp
index fa59f4a..fa59f4a 100644
--- a/testsuite/runtest.main/error/testsuite/error.test/error-undef.exp
+++ b/testsuite/runtest.main/nested/testsuite/error.test/error-undef.exp
diff --git a/testsuite/runtest.main/error/testsuite/error.test/simple.exp b/testsuite/runtest.main/nested/testsuite/error.test/simple.exp
index 93a03e7..93a03e7 100644
--- a/testsuite/runtest.main/error/testsuite/error.test/simple.exp
+++ b/testsuite/runtest.main/nested/testsuite/error.test/simple.exp
diff --git a/testsuite/runtest.main/options/testsuite/null.test/null.exp b/testsuite/runtest.main/nested/testsuite/null.test/null.exp
index f6f11af..f6f11af 100644
--- a/testsuite/runtest.main/options/testsuite/null.test/null.exp
+++ b/testsuite/runtest.main/nested/testsuite/null.test/null.exp
diff --git a/testsuite/runtest.main/stats/testsuite/stat.test/stats-sub.exp b/testsuite/runtest.main/nested/testsuite/stat.test/stats-sub.exp
index c797ad1..c797ad1 100644
--- a/testsuite/runtest.main/stats/testsuite/stat.test/stats-sub.exp
+++ b/testsuite/runtest.main/nested/testsuite/stat.test/stats-sub.exp
diff --git a/testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.awk b/testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.awk
new file mode 100644
index 0000000..c02f7ea
--- /dev/null
+++ b/testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.awk
@@ -0,0 +1,39 @@
+# Copyright (C) 2020 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.
+
+BEGIN {
+ # Avoid reading stdin if no files were given on the command line.
+ ARGV[ARGC++] = "/dev/null"
+}
+
+END {
+ if (UNIT_RESULT == "pass")
+ print "\tPASSED: sample unit test"
+ else if (UNIT_RESULT == "fail")
+ print "\tFAILED: sample unit test"
+ else if (UNIT_RESULT == "xpass")
+ print "\tXPASSED: sample unit test"
+ else if (UNIT_RESULT == "xfail")
+ print "\tXFAILED: sample unit test"
+ else if (UNIT_RESULT == "untested")
+ print "\tUNTESTED: sample unit test"
+ else if (UNIT_RESULT == "unresolved")
+ print "\tUNRESOLVED: sample unit test"
+}
+
+# EOF
diff --git a/testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.exp b/testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.exp
new file mode 100644
index 0000000..96f8ac3
--- /dev/null
+++ b/testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.exp
@@ -0,0 +1,26 @@
+# Copyright (C) 2020 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.
+
+# Functional test for DejaGnu unit testing; inner runtest component.
+
+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
+}
diff --git a/testsuite/runtest.main/options.exp b/testsuite/runtest.main/options.exp
index abbdc6a..2e2d81c 100644
--- a/testsuite/runtest.main/options.exp
+++ b/testsuite/runtest.main/options.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2016, 2018 Free Software Foundation, Inc.
+# Copyright (C) 1992-2016, 2018, 2020 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
@@ -20,25 +20,7 @@
load_lib util-defs.exp
-if {![info exists tmpdir]} {
- set tmpdir [testsuite file -object -top tmpdir]
-}
-
-set fd [open options-init.exp w]
-puts $fd "set host_triplet $host_triplet"
-puts $fd "set srcdir [testsuite file -source -test options]"
-puts $fd "set objdir [testsuite file -object -test options]"
-puts $fd "set tmpdir $tmpdir"
-puts $fd "set outdir [testsuite file -object -test options]"
-close $fd
-
-if {![file isdirectory $tmpdir]} {
- catch "file mkdir $tmpdir"
-}
-
-if {![file isdirectory [testsuite file -object -test options]]} {
- catch {file mkdir [testsuite file -object -test options]}
-}
+runtest_setup_nested_testsuite
#
# Set up the list.
@@ -52,7 +34,7 @@ set tests {
{ "--help" "USAGE:*" "Display help" }
{ "-v -v -v" "Verbose level is 3" "Verbose set correctly" }
{ "-v --tool xXx"
- "Found.*options-init\..*Loading.*utils\.exp"
+ "Found.*nested-init\..*Loading.*utils\.exp"
"Loading library files" }
{ "-v --tool xXx"
"Expect binary is.*Using.*main test driver"
@@ -112,7 +94,7 @@ set tests {
foreach t $tests {
if [util_test $RUNTEST \
- "[lindex $t 0] --local_init options-init.exp" \
+ "[lindex $t 0] --local_init nested-init.exp --tool null" \
"" \
"[lindex $t 1]"] {
fail "[lindex $t 2]"
@@ -121,8 +103,4 @@ foreach t $tests {
}
}
-# clean up log files left by the child runtest
-foreach f [glob [testsuite file -object -test options *]] {
- file delete $f
-}
-file delete -force $tmpdir
+runtest_cleanup_nested_testsuite
diff --git a/testsuite/runtest.main/pr42399.exp b/testsuite/runtest.main/pr42399.exp
new file mode 100644
index 0000000..1782231
--- /dev/null
+++ b/testsuite/runtest.main/pr42399.exp
@@ -0,0 +1,60 @@
+# Copyright (C) 2020 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 PR42399, where timing variations can
+# cause test names to be truncated under certain conditions.
+
+# The bug was originally reported using a C test case, but GNU Awk is
+# sufficiently fast for a simple Awk script to also trigger the bug.
+
+# The bug was originally reported as only affecting long test names, but
+# the underlying issue applies equally to shorter names, as long as the
+# unit test program produces output faster than DejaGnu can read it.
+
+runtest_setup_nested_testsuite
+
+proc test_pr42399 {} {
+ global RUNTEST
+
+ foreach test_count {5 5000} {
+ set result pass
+ set failures [list]
+ set want_num 1
+ set cmd_args [list --local_init nested-init.exp --tool bug \
+ -a pr42399-sub.exp N=$test_count]
+ verbose "Spawning $RUNTEST $cmd_args ..."
+ eval [list spawn $RUNTEST] $cmd_args
+ expect {
+ -re {PASS:[[:space:]]+([^\r\n]*)[\r\n]+} {
+ if { [regexp {sample test ([0-9]+)} \
+ $expect_out(1,string) -> read_num] } {
+ if { $read_num != $want_num } { set result fail }
+ } else { set result fail }
+ incr want_num
+ exp_continue
+ }
+ eof {
+ $result "PR42399 test with $test_count inner tests"
+ }
+ }
+ }
+}
+
+test_pr42399
+
+runtest_cleanup_nested_testsuite
diff --git a/testsuite/runtest.main/stats.exp b/testsuite/runtest.main/stats.exp
index a81c8e6..7f4f5be 100644
--- a/testsuite/runtest.main/stats.exp
+++ b/testsuite/runtest.main/stats.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2016, 2018 Free Software Foundation, Inc.
+# Copyright (C) 1995-2016, 2018, 2020 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
@@ -22,46 +22,37 @@
load_lib util-defs.exp
-if {![info exists tmpdir]} {
- set tmpdir [testsuite file -object -top tmpdir]
-}
-
-set fd [open stats-init.exp w]
-puts $fd "set srcdir [testsuite file -source -test stats]"
-puts $fd "set objdir [testsuite file -object -test stats]"
-puts $fd "set tmpdir $tmpdir"
-close $fd
-
-if {![file isdirectory $tmpdir]} {
- catch "file mkdir $tmpdir"
-}
-
-if {![file isdirectory [testsuite file -object -test stats]]} {
- catch {file mkdir [testsuite file -object -test stats]}
-}
+runtest_setup_nested_testsuite
set tests {
- { pass "expected passes\[ \t\]+1\n" }
- { fail "unexpected failures\[ \t\]+1\n" }
- { xpass "unexpected successes\[ \t\]+1\n" }
- { xfail "expected failures\[ \t\]+1\n" }
- { kpass "unknown successes\[ \t\]+1\n" }
- { kfail "known failures\[ \t\]+1\n" }
- { untested "untested testcases\[ \t\]+1\n" }
- { unresolved "unresolved testcases\[ \t\]+1\n" }
- { unsupported "unsupported tests\[ \t\]+1\n" }
+ { stats pass "expected passes\[ \t\]+1\n" }
+ { stats fail "unexpected failures\[ \t\]+1\n" }
+ { stats xpass "unexpected successes\[ \t\]+1\n" }
+ { stats xfail "expected failures\[ \t\]+1\n" }
+ { stats kpass "unknown successes\[ \t\]+1\n" }
+ { stats kfail "known failures\[ \t\]+1\n" }
+ { stats untested "untested testcases\[ \t\]+1\n" }
+ { stats unresolved "unresolved testcases\[ \t\]+1\n" }
+ { stats unsupported "unsupported tests\[ \t\]+1\n" }
+
+ { unit pass "expected passes\[ \t\]+1\n" }
+ { unit fail "unexpected failures\[ \t\]+1\n" }
+ { unit xpass "unexpected successes\[ \t\]+1\n" }
+ { unit xfail "expected failures\[ \t\]+1\n" }
+ { unit untested "untested testcases\[ \t\]+1\n" }
+ { unit unresolved "unresolved testcases\[ \t\]+1\n" }
}
foreach t $tests {
- if [util_test $RUNTEST \
- "--local_init stats-init.exp\
- --outdir $tmpdir STATS_TEST=[lindex $t 0] stats-sub.exp" \
+ if { [util_test $RUNTEST \
+ "--local_init nested-init.exp --tool stat\
+ STATS_TEST=[lindex $t 1] [lindex $t 0]-sub.exp" \
"" \
- [lindex $t 1]] {
- fail [lindex $t 0]
+ [lindex $t 2]] } {
+ fail "[lindex $t 0]/[lindex $t 1]"
} else {
- pass [lindex $t 0]
+ pass "[lindex $t 0]/[lindex $t 1]"
}
}
-file delete -force $tmpdir
+runtest_cleanup_nested_testsuite