aboutsummaryrefslogtreecommitdiff
path: root/testsuite/runtest.main
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/runtest.main')
-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/pr42399.exp60
3 files changed, 120 insertions, 0 deletions
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/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