]> sourceware.org Git - systemtap.git/commitdiff
PR17860: add testcase to foreach_limit.exp
authorJonathan Lebon <jlebon@redhat.com>
Mon, 19 Jan 2015 15:09:20 +0000 (10:09 -0500)
committerJonathan Lebon <jlebon@redhat.com>
Fri, 23 Jan 2015 14:24:39 +0000 (09:24 -0500)
This testcase would have failed to compile prior to the previous commit.

testsuite/systemtap.maps/foreach_limit.exp
testsuite/systemtap.maps/foreach_limit.stp

index d460cecddf4f67496a020ba0432de66132947e27..33ee293e37b03c9c9392e3086a20a61ed161de64 100644 (file)
@@ -71,6 +71,11 @@ key 6, value 12
 loop had 4 iterations
 x ended up as 5
 
+sorted (by values) with key specified limit x++:
+key 6, value 12
+loop had 1 iterations
+x ended up as 6
+
 Aggregates:
 count=150 sum=21360
 min=4 max=600
index d4646dbc72380ebe8bef41f5af049d55ddec8c22..64d5b05670268393f72ada1b4314677eb27e75de 100644 (file)
@@ -98,6 +98,17 @@ probe begin
     printf("loop had %d iterations\n", i);
     printf("x ended up as %d\n", x);
 
+    # Use array index (PR17860)
+    printf("\nsorted (by values) with key specified limit x++:\n");
+    i = 0
+    foreach (key in array[++x]+ limit x)
+    {
+       printf("key %d, value %d\n", key, array[key])
+       i++;
+    }
+    printf("loop had %d iterations\n", i);
+    printf("x ended up as %d\n", x);
+
     #
     # Aggregate section
     #
This page took 0.029062 seconds and 5 git commands to generate.