# @TEST-EXEC: bro -b -r $TRACES/wikipedia.trace %INPUT >out 2>&1 # @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out # interpreter exceptions in "when" blocks shouldn't cause termination global p: pkt_hdr; function f(do_exception: bool): bool { return when ( local addrs = lookup_hostname("localhost") ) { print "localhost resolved from f()", do_exception; if ( do_exception ) print p$ip; return T; } return F; } function g(do_exception: bool): bool { return when ( local addrs = lookup_hostname("localhost") ) { print "shouldn't get here, g()", do_exception; } timeout 0 sec { print "timeout g()", do_exception; if ( do_exception ) print p$ip; return T; } return F; } event bro_init() { when ( local addrs = lookup_hostname("localhost") ) { print "localhost resolved"; print p$ip; } when ( local addrs2 = lookup_hostname("localhost") ) { print "shouldn't get here"; } timeout 0 sec { print "timeout"; print p$ip; } when ( local b = f(T) ) print "f() exception done (shouldn't be printed)", b; when ( local b2 = g(T) ) print "g() exception done (shouldn't be printed)", b2; when ( local b3 = f(F) ) print "f() done, no exception", b3; when ( local b4 = g(F) ) print "g() done, no exception", b4; }