From f4fe2e932cc8f445e9e1bc52863e11b669e3afc9 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 3 Mar 2010 00:28:22 -0500 Subject: PR11004: try / catch error-handling script syntax * parse.h (try_block): New class. Update basic visitors. * staptree.cxx: Implement basic visitors. * parse.cxx (expect_kw): Fix to actually look for keywords. (parse_try_block): New function. (lexer ctor): Designate 'try' and 'catch' as keywords. * elaborate.cxx (dead_assignment_remover, dead_statmtexpr_remover): Optimize. (other visitors): Implement. * translate.cxx (c_unparser): Implement via super-handy __local__ labels. (emit_probe, emit_function): Make outer out: label also __local__. * testsuite/buildok/fortyone.stp, semko/fortynine.stp, systemtap.base/trycatch.exp: Test it. * NEWS, doc/langref.txt, stap.1.in: Document it. --- testsuite/systemtap.base/trycatch.exp | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 testsuite/systemtap.base/trycatch.exp (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/trycatch.exp b/testsuite/systemtap.base/trycatch.exp new file mode 100644 index 00000000..f0a133e2 --- /dev/null +++ b/testsuite/systemtap.base/trycatch.exp @@ -0,0 +1,41 @@ +set test "trycatch" + +if {! [installtest_p]} { untested $test; return } + +set ok 0 +set ko 0 +spawn stap $srcdir/buildok/fortyone.stp +expect { + -timeout 30 + -re {^ERROR: MAXACTION[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^WARNING: Number of errors[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^Pass 5: run failed[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^OK[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^KO[^\r\n]*\r\n} { incr ko; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +wait; catch { close } +if {$ok == 12 && $ko == 0} then {pass $test} else {fail "$test ($ok $ko)"} + + +set test "trycatch -u" + +set ok 0 +set ko 0 +spawn stap -u $srcdir/buildok/fortyone.stp +expect { + -timeout 30 + -re {^ERROR: MAXACTION[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^WARNING: Number of errors[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^Pass 5: run failed[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^OK[^\r\n]*\r\n} { incr ok; exp_continue } + -re {^KO[^\r\n]*\r\n} { incr ko; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +wait; catch { close } +if {$ok == 12 && $ko == 0} then {pass $test} else {fail "$test ($ok $ko)"} + + + -- cgit