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:35:29 +0000 (16:35 -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 9df5f2cbfc439bfd542633e6b11126537e146dcc..ebf4c3bb1df7c1e1c96cc9bc2a0afe5b89f394de 100755 (executable)
@@ -93,6 +93,7 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+OLDIFS="$IFS"
 IFS=$'\n'
 INVALID_FILTERS=(
                # Unsupported ops
@@ -144,13 +145,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
@@ -164,15 +169,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.032516 seconds and 4 git commands to generate.