aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJacob Bachmeyer <jcb62281+dev@gmail.com>2020-06-18 17:32:48 -0500
committerJacob Bachmeyer <jcb62281+dev@gmail.com>2020-06-18 17:32:48 -0500
commitcbba4dbb8d52c5b0f32e803cf8587f276ee1ec86 (patch)
tree935895d0f06d7faceec5f430021ff1b6ef60598a /testsuite
parent38e913f57bc7be0b83888fb5c5662c29d5060c26 (diff)
downloaddejagnu-cbba4dbb8d52c5b0f32e803cf8587f276ee1ec86.zip
dejagnu-cbba4dbb8d52c5b0f32e803cf8587f276ee1ec86.tar.gz
dejagnu-cbba4dbb8d52c5b0f32e803cf8587f276ee1ec86.tar.bz2
Add tests for handling arithmetic errors in auto-loaded procedures
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/runtest.main/abort.exp11
-rw-r--r--testsuite/runtest.main/abort/testsuite/abort.test/abort-al-dbz.exp38
2 files changed, 49 insertions, 0 deletions
diff --git a/testsuite/runtest.main/abort.exp b/testsuite/runtest.main/abort.exp
index c5f7014..864f1e0 100644
--- a/testsuite/runtest.main/abort.exp
+++ b/testsuite/runtest.main/abort.exp
@@ -50,6 +50,16 @@ set tests {
"PASS: running abort-undef.exp.*\
*UNRESOLVED: .* aborted at call to unknown command.*\
*expected passes\[ \t\]+1\n.*unresolved testcases\[ \t\]+1\n" }
+ { "stop at auto-loaded divide-by-zero without --keep_going"
+ "abort-al-dbz.exp simple.exp"
+ "PASS: running abort-al-dbz.exp.*\
+ *UNRESOLVED: .* aborted at .*\
+ *expected passes\[ \t\]+1\n.*unresolved testcases\[ \t\]+1\n" }
+ { "continue after auto-loaded divide-by-zero with --keep_going"
+ "--keep_going abort-al-dbz.exp simple.exp"
+ "PASS: running abort-al-dbz.exp.*\
+ *PASS: simple test.*\
+ *expected passes\[ \t\]+2\n" }
{ "stop at abort without --keep_going"
"abort-undef.exp simple.exp"
"PASS: running abort-undef.exp.*\
@@ -76,3 +86,4 @@ foreach t $tests {
}
file delete -force $tmpdir
+file delete -force [testsuite file -object -test abort testsuite abort.test lib]
diff --git a/testsuite/runtest.main/abort/testsuite/abort.test/abort-al-dbz.exp b/testsuite/runtest.main/abort/testsuite/abort.test/abort-al-dbz.exp
new file mode 100644
index 0000000..df55a9a
--- /dev/null
+++ b/testsuite/runtest.main/abort/testsuite/abort.test/abort-al-dbz.exp
@@ -0,0 +1,38 @@
+# 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.
+
+# Cause a divide-by-zero error in an auto-loaded procedure.
+
+pass "running abort-al-dbz.exp"
+
+set fd [open [testsuite file -object -test lib foo.tcl] w]
+puts $fd {proc throw_arith_error_div_by_zero { } {
+ expr { 1 / 0 }
+}
+}
+close $fd
+
+auto_mkindex \
+ [testsuite file -object -test lib] \
+ [testsuite file -object -test lib/*.tcl]
+
+lappend auto_path [testsuite file -object -test lib]
+
+throw_arith_error_div_by_zero
+
+fail "script did not abort"