From 39495c1c73a25c2244ac8667a4a66a15c775a446 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Mon, 19 Jan 2015 10:09:20 -0500 Subject: [PATCH] PR17860: add testcase to foreach_limit.exp This testcase would have failed to compile prior to the previous commit. --- testsuite/systemtap.maps/foreach_limit.exp | 5 +++++ testsuite/systemtap.maps/foreach_limit.stp | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/testsuite/systemtap.maps/foreach_limit.exp b/testsuite/systemtap.maps/foreach_limit.exp index d460cecdd..33ee293e3 100644 --- a/testsuite/systemtap.maps/foreach_limit.exp +++ b/testsuite/systemtap.maps/foreach_limit.exp @@ -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 diff --git a/testsuite/systemtap.maps/foreach_limit.stp b/testsuite/systemtap.maps/foreach_limit.stp index d4646dbc7..64d5b0567 100644 --- a/testsuite/systemtap.maps/foreach_limit.stp +++ b/testsuite/systemtap.maps/foreach_limit.stp @@ -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 # -- 2.43.5