From c3252e33cf41f0d6e4ac6ef8099f925579b1a1ff Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 19 Jun 2020 14:36:58 +0200 Subject: Add tests for handling arithmetic errors in non-auto-loaded procedures --- testsuite/runtest.main/abort.exp | 11 ++++++++ .../abort/testsuite/abort.test/abort-dbz.exp | 29 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 testsuite/runtest.main/abort/testsuite/abort.test/abort-dbz.exp diff --git a/testsuite/runtest.main/abort.exp b/testsuite/runtest.main/abort.exp index b352b56..59a934c 100644 --- a/testsuite/runtest.main/abort.exp +++ b/testsuite/runtest.main/abort.exp @@ -50,6 +50,17 @@ set tests { "PASS: running abort-undef.exp.*\ *UNRESOLVED: .* aborted.*\ *expected passes\[ \t\]+1\n.*unresolved testcases\[ \t\]+1\n" } + { "stop at divide-by-zero without --keep_going" + "abort-dbz.exp simple.exp" + "PASS: running abort-dbz.exp.*\ + *UNRESOLVED: .* aborted.*\ + *expected passes\[ \t\]+1\n.*unresolved testcases\[ \t\]+1\n" } + { "continue after divide-by-zero with --keep_going" + "--keep_going abort-dbz.exp simple.exp" + "PASS: running abort-dbz.exp.*\ + *UNRESOLVED: .* aborted.*\ + *PASS: simple test.*\ + *expected passes\[ \t\]+2\n" } { "stop at auto-loaded divide-by-zero without --keep_going" "abort-al-dbz.exp simple.exp" "PASS: running abort-al-dbz.exp.*\ diff --git a/testsuite/runtest.main/abort/testsuite/abort.test/abort-dbz.exp b/testsuite/runtest.main/abort/testsuite/abort.test/abort-dbz.exp new file mode 100644 index 0000000..711347d --- /dev/null +++ b/testsuite/runtest.main/abort/testsuite/abort.test/abort-dbz.exp @@ -0,0 +1,29 @@ +# 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. + +pass "running abort-dbz.exp" + +proc throw_arith_error_div_by_zero { } { + expr { 1 / 0 } +} + +throw_arith_error_div_by_zero + +fail "script did not abort" -- cgit v1.1