diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.awk | 39 | ||||
-rw-r--r-- | testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.exp | 26 | ||||
-rw-r--r-- | testsuite/runtest.main/stats.exp | 35 |
5 files changed, 99 insertions, 14 deletions
@@ -1,3 +1,14 @@ +2020-07-22 Jacob Bachmeyer <jcb62281+dev@gmail.com> + + * Makefile.am (TESTSUITE_FILES): Update. + + * testsuite/runtest.main/stats.exp: Generalize infrastructure and + add tests for DejaGnu unit testing support. + * testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.exp: + New file. + * testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.awk: + New file. + 2020-07-20 Jacob Bachmeyer <jcb62281+dev@gmail.com> PR42399 diff --git a/Makefile.am b/Makefile.am index bbf6fc5..92158e1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -190,6 +190,8 @@ TESTSUITE_FILES = \ testsuite/runtest.main/nested/testsuite/null.test/null.exp \ testsuite/runtest.main/stats.exp \ testsuite/runtest.main/nested/testsuite/stat.test/stats-sub.exp \ + testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.awk \ + testsuite/runtest.main/nested/testsuite/stat.test/unit-sub.exp \ testsuite/runtest.main/pr42399.exp \ testsuite/runtest.main/nested/testsuite/bug.test/pr42399.awk \ testsuite/runtest.main/nested/testsuite/bug.test/pr42399-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/stats.exp b/testsuite/runtest.main/stats.exp index 39093ec..7f4f5be 100644 --- a/testsuite/runtest.main/stats.exp +++ b/testsuite/runtest.main/stats.exp @@ -25,26 +25,33 @@ load_lib util-defs.exp 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 \ + if { [util_test $RUNTEST \ "--local_init nested-init.exp --tool stat\ - STATS_TEST=[lindex $t 0] stats-sub.exp" \ + 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]" } } |