diff options
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/buildok/fortyone.stp | 37 | ||||
-rwxr-xr-x | testsuite/semko/fortynine.stp | 3 | ||||
-rw-r--r-- | testsuite/systemtap.base/trycatch.exp | 41 |
3 files changed, 81 insertions, 0 deletions
diff --git a/testsuite/buildok/fortyone.stp b/testsuite/buildok/fortyone.stp new file mode 100755 index 00000000..7a1fceb8 --- /dev/null +++ b/testsuite/buildok/fortyone.stp @@ -0,0 +1,37 @@ +#! stap -p4 + +# NB: also used for systemtap.base/trycatch.exp + +function foo () { + try { error("foo") println("KO 1") } catch { println("OK 1") error ("bar") } +} + +function koo () { + try { println(1/(0*foo())) println("KO 2") } catch (er) { println("OK 2 ",er) error("baz") } +} + +probe begin { + try { koo () println("KO 3") } catch { println("OK 3") } + try { /* empty */ } catch { log("KO 4") } + try { log("OK 4") } catch { /* empty */ } + try { /* empty */ } catch { /* empty */ } + println("OK 5") + + // check for proper loop / try/catch nesting + for (i=0;i<5;i++) try { error("me") } catch { break } + println ((i==0) ? "OK 7" : "KO 7") + + for (j=0;j<5;j++) { for (i=0;i<5;i++) try { break } catch { continue } } + println ((i==0 && j==5) ? "OK 7a" : "KO 7a") + + for (i=0;i<5;i++) try { error("me") } catch { continue } + println ((i==5) ? "OK 8" : "KO 8") + + for (j=0;j<5;j++) { for (i=0;i<5;i++) try { continue } catch { break } } + println ((i==5 && j==5) ? "OK 8a" : "KO 8a") + + // check that MAXACTIONS cannot be bypassed, e.g. with nested catch {}'s + try { for (i=0; i<100000; i++) ; println("KO 6") } catch { println("KO 5") } + println("KO 6") + // will result in MAXACTION error +} diff --git a/testsuite/semko/fortynine.stp b/testsuite/semko/fortynine.stp new file mode 100755 index 00000000..01e5bf49 --- /dev/null +++ b/testsuite/semko/fortynine.stp @@ -0,0 +1,3 @@ +#! stap -up2 + +probe begin { try {} catch (er) {println(er+2)} } 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)"} + + + |