diff options
author | Jacob Bachmeyer <jcb62281+dev@gmail.com> | 2020-06-18 17:32:48 -0500 |
---|---|---|
committer | Jacob Bachmeyer <jcb62281+dev@gmail.com> | 2020-06-18 17:32:48 -0500 |
commit | cbba4dbb8d52c5b0f32e803cf8587f276ee1ec86 (patch) | |
tree | 935895d0f06d7faceec5f430021ff1b6ef60598a | |
parent | 38e913f57bc7be0b83888fb5c5662c29d5060c26 (diff) | |
download | dejagnu-cbba4dbb8d52c5b0f32e803cf8587f276ee1ec86.zip dejagnu-cbba4dbb8d52c5b0f32e803cf8587f276ee1ec86.tar.gz dejagnu-cbba4dbb8d52c5b0f32e803cf8587f276ee1ec86.tar.bz2 |
Add tests for handling arithmetic errors in auto-loaded procedures
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | testsuite/runtest.main/abort.exp | 11 | ||||
-rw-r--r-- | testsuite/runtest.main/abort/testsuite/abort.test/abort-al-dbz.exp | 38 |
3 files changed, 63 insertions, 0 deletions
@@ -1,3 +1,17 @@ +2020-06-18 Jacob Bachmeyer <jcb62281+dev@gmail.com> + + PR 41824 / PR 41918 + + Thanks to Tom de Vries for raising these concerns and offering the + initial patch that was rewritten to produce this. + + * testsuite/runtest.main/abort.exp: Add tests to verify handling + of arithmetic errors (divide-by-zero) in an auto-loaded procedure + called from a test script. + + * testsuite/runtest.main/abort/testsuite/abort.test/abort-al-dbz.exp: + New file. + 2020-06-17 Jacob Bachmeyer <jcb62281+dev@gmail.com> PR 41824 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" |