Limit the scope of IFS overwriting
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 8 Oct 2015 18:01:40 +0000 (14:01 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 10 Mar 2016 21:36:55 +0000 (16:36 -0500)
The overwrite caused a folder ' ' to be created locally when running root tests.
Use while loop to preserve space in invalid filter string.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/regression/tools/filtering/test_invalid_filter

index bfc817d3f1133655a53af10f33413cbfba6d19d8..e15f2e6fcb2a2431f23aed08cc9f5aa5f3a24243 100755 (executable)
@@ -93,6 +93,7 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+OLDIFS="$IFS"
 IFS=$'\n'
 INVALID_FILTERS=(
                # Unsupported ops
@@ -153,13 +154,17 @@ INVALID_FILTERS=(
                "0 == \$global.value"
                # A wildcard should only appear as the last character in a string literal
                "msg == \"my_event*_blah\""
-               )
+)
+IFS="$OLDIFS"
 
 start_lttng_sessiond
 diag "Test UST filters"
-for FILTER in ${INVALID_FILTERS[@]};
-do
-       test_invalid_filter -u "$FILTER"
+
+i=0
+while [ "$i" -lt "${#INVALID_FILTERS[@]}" ]; do
+       echo "${INVALID_FILTERS[$i]}"
+       test_invalid_filter -u "${INVALID_FILTERS[$i]}"
+       let "i++"
 done
 
 test_bytecode_limit -u
@@ -173,15 +178,15 @@ fi
 skip $isroot "Root access is needed. Skipping all kernel invalid filter tests." $NUM_KERNEL_TESTS ||
 {
        diag "Test kernel filters"
-       for FILTER in ${INVALID_FILTERS[@]};
-       do
-               test_invalid_filter -k "$FILTER"
+       i=0
+       while [ "$i" -lt "${#INVALID_FILTERS[@]}" ]; do
+               echo "${INVALID_FILTERS[$i]}"
+               test_invalid_filter -k "${INVALID_FILTERS[$i]}"
+               let "i++"
        done
 
        test_bytecode_limit -k
 }
-
-unset IFS
 stop_lttng_sessiond
 
 rm -f $ENABLE_EVENT_STDERR
This page took 0.026397 seconds and 4 git commands to generate.