aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJacob Bachmeyer <jcb62281+dev@gmail.com>2020-07-22 17:46:12 -0500
committerJacob Bachmeyer <jcb62281+dev@gmail.com>2020-07-22 17:46:12 -0500
commitcc275d7ed80965def55d7b64c7175d2e985e38f3 (patch)
treef8602b9719a09590b110458b3da93667cda4ab67 /testsuite
parent89f58b27832f8fc7b443988d02e56cfaba12eb5a (diff)
downloaddejagnu-cc275d7ed80965def55d7b64c7175d2e985e38f3.zip
dejagnu-cc275d7ed80965def55d7b64c7175d2e985e38f3.tar.gz
dejagnu-cc275d7ed80965def55d7b64c7175d2e985e38f3.tar.bz2
Add tests for DejaGNU unit testing support
Diffstat (limited to 'testsuite')
-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/stats.exp35
3 files changed, 86 insertions, 14 deletions
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]"
}
}