error/3 can raise error uncleanly? (0943)

From: Kish Shen <ks15_at_icparc.ic.ac.uk>
Date: Wed 30 May 2001 02:47:44 PM GMT
Message-Id: <E1557GC-0000aY-00@holborn.icparc.ic.ac.uk>
When error/3 is called for an event with an undefined handler, it seems
that two errors can be raised, and one of the error may not be cleared up
properly.

With the following 2 tests in a Bips test file:


set_event_handler(a,undef/1), error(a,a(X),eclipse) should_raise 68. 
set_interrupt_handler(X,Y) should_raise 4.


These are the errors that are normally raised. However, the first run
through the test generates an unexpected error, but not subsequent runs:

[eclipse 1]: lib(test_util).
test_util.pl compiled traceable 7576 bytes in 0.02 seconds

Yes (0.02s cpu)
[eclipse 2]: test(t).

Running tests from file (using call) t...
accessing an undefined procedure from set_interrupt_handler(X, Y) in module eclipse
====== goal unexpectedly did exit_block(abort):
set_interrupt_handler(_284, _283)


2 tests done.

Yes (0.00s cpu)
[eclipse 3]: test(t).

Running tests from file (using call) t...

2 tests done.

Yes (0.00s cpu)

=================================

It seems that the first test,

set_event_handler(3,undef/1), error(3,a(X),eclipse)

can generate 2 errors: 68, calling an undefined procedure, *and*
                       60, accessing an undefined procedure from..

When this second error is generated, it is not cleaned up after the
execution of the test, and thus causes confusion in the second test.


The tests are done inside a failure driven loop of test_util.pl:

               repeat,
               ....
pos1
	       do_test(Type, Test, M),
pos2
	       incval(test_count),
	       fail


by adding get_bip_error/1 in pos1, this shows that there is an error 60
before do_test is called for the second test (only on the first run), and
by adding it in pos2, error 60 exists after the first do_test. Thus the
error appears to be set during the first test, but is not cleaned up
properly in the failure, and affects the second test.
Received on Wed May 30 15:47:45 2001

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:07 PM GMT GMT