1 # Copyright (C) 2020 Free Software Foundation, Inc.
3 # This file is part of DejaGnu.
5 # DejaGnu is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # DejaGnu is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with DejaGnu; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
19 # This file is a regression test for PR42399, where timing variations can
20 # cause test names to be truncated under certain conditions.
22 # The bug was originally reported using a C test case, but GNU Awk is
23 # sufficiently fast for a simple Awk script to also trigger the bug.
25 # The bug was originally reported as only affecting long test names, but
26 # the underlying issue applies equally to shorter names, as long as the
27 # unit test program produces output faster than DejaGnu can read it.
29 runtest_setup_nested_testsuite
31 proc test_pr42399 {} {
34 foreach test_count {5 5000} {
38 set cmd_args [list --local_init nested-init.exp --tool bug \
39 -a pr42399-sub.exp N=$test_count]
40 verbose "Spawning $RUNTEST $cmd_args ..."
41 eval [list spawn $RUNTEST] $cmd_args
43 -re {PASS:[[:space:]]+([^\r\n]*)[\r\n]+} {
44 if { [regexp {sample test ([0-9]+)} \
45 $expect_out(1,string) -> read_num] } {
46 if { $read_num != $want_num } { set result fail }
47 } else { set result fail }
55 # Were any results at all produced?
56 if { $want_num == 1 } { set result unresolved }
57 # Did Expect report eof?
58 if { ! $eof_reached } { set result unresolved }
60 $result "PR42399 test with $test_count inner tests"
66 runtest_cleanup_nested_testsuite