mirror of https://gitee.com/Nocallback/dejagnu.git
20 changed files with 407 additions and 140 deletions
@ -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 |
|||
} |
|||
@ -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 |
|||
@ -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 |
|||
@ -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 |
|||
} |
|||
@ -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 |
|||
Loading…
Reference in new issue