Add util_event_generator.sh to shellcheck test while at it.
Change-Id: I261452496827a5b9fc08b39a1132b13a39d0a7f5
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
NUM_TESTS=837
-source $TESTDIR/utils/utils.sh
+# shellcheck source=../utils/utils.sh
+source "$TESTDIR/utils/utils.sh"
function signal_cleanup ()
{
--tracefile-size=$PAGE_SIZE --tracefile-count=2
enable_kernel_lttng_event_ok $SESSION_NAME $EVENT_NAME $channel_name
start_lttng_tracing_ok $SESSION_NAME
- taskset -c 0 echo -n "200000" > /proc/lttng-test-filter-event
+ taskset -c "$(get_any_available_cpu)" echo -n "200000" > /proc/lttng-test-filter-event
do_clear_session $SESSION_NAME $tracing_active $clear_twice $rotate_before $rotate_after
stop_lttng_tracing_ok $SESSION_NAME
fi
start_lttng_tracing_ok $SESSION_NAME
- taskset -c 0 echo -n "400000" > /proc/lttng-test-filter-event
+ taskset -c "$(get_any_available_cpu)" echo -n "400000" > /proc/lttng-test-filter-event
stop_lttng_tracing_ok
if [[ $rotate_before -eq 1 ]]; then
PAGE_SIZE=$(getconf PAGE_SIZE)
TRACE_PATH=$(mktemp -d)
-source $TESTDIR/utils/utils.sh
+# shellcheck source=../utils/utils.sh
+source "$TESTDIR/utils/utils.sh"
if [ ! -x "$TESTAPP_BIN" ]; then
BAIL_OUT "No UST events binary detected."
--tracefile-size=$PAGE_SIZE --tracefile-count=2 --buffers-$buffer_type
enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $channel_name
start_lttng_tracing_ok $SESSION_NAME
- taskset -c 0 $TESTAPP_BIN -i 200000
+ taskset -c "$(get_any_available_cpu)" $TESTAPP_BIN -i 200000
do_clear_session $SESSION_NAME $tracing_active $clear_twice $rotate_before $rotate_after
stop_lttng_tracing_ok $SESSION_NAME
fi
start_lttng_tracing_ok $SESSION_NAME
- taskset -c 0 $TESTAPP_BIN -i 400000
+ taskset -c "$(get_any_available_cpu)" $TESTAPP_BIN -i 400000
stop_lttng_tracing_ok
if [[ $rotate_before -eq 1 ]]; then
if [[ -f $state_file ]]; then
rm $state_file 2> /dev/null
fi
- taskset -c 0 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT > /dev/null 2>&1
+ taskset -c "$(get_any_available_cpu)" $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT > /dev/null 2>&1
fi
done
}
if [[ -f $state_file ]]; then
rm -rf $state_file 2> /dev/null
fi
- taskset -c 0 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT > /dev/null 2>&1
+ taskset -c "$(get_any_available_cpu)" $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT > /dev/null 2>&1
fi
done
}
{
# Generate many system call events (fill buffers) on CPU 0
for a in $(seq 1 $1); do
- taskset 0x00000001 /bin/true;
+ taskset --cpu-list "$(get_any_available_cpu)" /bin/true;
done
}
NUM_TESTS=49
-source $TESTDIR/utils/utils.sh
+# shellcheck source=../utils/utils.sh
+source "$TESTDIR/utils/utils.sh"
# MUST set TESTDIR before calling those functions
-# Run app on CPU 0 to ensure we only write in a single ring buffer.
+# Run app on a single CPU to ensure we only write in a single ring buffer.
function run_app()
{
- taskset 0x00000001 $TESTAPP_BIN -i $NUM_EVENT
+ taskset --cpu-list "$(get_any_available_cpu)" $TESTAPP_BIN -i $NUM_EVENT
ok $? "Application done"
}
echo "${list[@]}"
}
+# Return any available CPU found. Do not make assumption about the returned
+# value, e.g. that it could be 0.
+function get_any_available_cpu()
+{
+ for cpu in /sys/devices/system/cpu/cpu[0-9]*; do
+ echo "${cpu#/sys/devices/system/cpu/cpu}"
+ break;
+ done
+}
+
# Return the number of _configured_ CPUs.
function conf_proc_count()
{