summaryrefslogtreecommitdiffstats
path: root/testsuite/buildok/twentyone.stp
diff options
context:
space:
mode:
authorfche <fche>2005-10-07 19:09:02 +0000
committerfche <fche>2005-10-07 19:09:02 +0000
commit934845563af3c85df78c17ee4752caa100ea6157 (patch)
tree1bba25b9e1e6c035720a8115c4fb212306453a8f /testsuite/buildok/twentyone.stp
parent9f0f2d3f93a63c91f817fda7e4e4cd02884a9084 (diff)
downloadsystemtap-steved-934845563af3c85df78c17ee4752caa100ea6157.tar.gz
systemtap-steved-934845563af3c85df78c17ee4752caa100ea6157.tar.xz
systemtap-steved-934845563af3c85df78c17ee4752caa100ea6157.zip
2005-10-07 Frank Ch. Eigler <fche@elastic.org>
PR 1366. * staptree.h (foreach_loop): Add sort_column, sort_direction fields. * parse.cxx (parse_foreach_loop): Parse "+"/"-" suffix operators. * stap.1.in, stapex.5.in: Document them. * staptree.cxx (foreach_loop print, copy): Propagate them. * translate.cxx (visit_foreach_loop): Support them. * testsuite/parseok/fifteen.stp, parseko/thirteen.stp, buildok/twentyone.stp: Test them. 2005-10-07 Frank Ch. Eigler <fche@elastic.org> PR 1366. * systemtap.samples/primes.*: Sort foreach gratuitiously.
Diffstat (limited to 'testsuite/buildok/twentyone.stp')
-rwxr-xr-xtestsuite/buildok/twentyone.stp27
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/buildok/twentyone.stp b/testsuite/buildok/twentyone.stp
new file mode 100755
index 00000000..052c3a17
--- /dev/null
+++ b/testsuite/buildok/twentyone.stp
@@ -0,0 +1,27 @@
+#! stap -p4
+
+global a
+
+probe begin {
+ a[5] = 0
+ a[4] = 2
+ a[3] = 5
+ a[2] = 8
+ a[1] = 1
+ a[0] = -4
+ exit ()
+}
+
+probe end {
+ log ("x+ in a")
+ foreach (x+ in a) log ("a[" . string(x) . "]=" . string(a[x]))
+
+ log ("x- in a")
+ foreach (x- in a) log ("a[" . string(x) . "]=" . string(a[x]))
+
+ log ("x in a+")
+ foreach (x in a+) log ("a[" . string(x) . "]=" . string(a[x]))
+
+ log ("x in a-")
+ foreach (x in a-) log ("a[" . string(x) . "]=" . string(a[x]))
+}