STATS_BIN="$TESTDIR/utils/babelstats.pl"
NUM_TESTS=74
-NUM_CPUS=$(nproc)
PAGE_SIZE=$(getconf PAGE_SIZE)
TRACEFILE_SIZE=$PAGE_SIZE
source "$TESTDIR"/utils/utils.sh
+NUM_CPUS=$(conf_proc_count)
+
if [ ! -x "$TESTAPP_BIN" ]; then
BAIL_OUT "No UST events binary detected."
fi
+function pick_random_cpuid ()
+{
+ local cpuid=0
+
+ # On Linux pick a random available cpuid from sysfs
+ if [ -d "/sys/devices/system/cpu" ]; then
+ local cpuids=()
+
+ for i in /sys/devices/system/cpu/cpu[0-9]*; do
+ cpuids+=("${i#/sys/devices/system/cpu/cpu}")
+ done
+
+ cpuid=${cpuids[ $RANDOM % ${#cpuids[@]} ]}
+ else
+ cpuid=$((RANDOM % NUM_CPUS))
+ fi
+
+ echo $cpuid
+}
+
function enable_lttng_channel_count_limit ()
{
sess_name="$1"
local count_limit="$1"
local channel_name="channel"
- local cpuno=$((RANDOM % NUM_CPUS))
+ local cpuno=$(pick_random_cpuid)
local event_name="tp:tptest"
local expected_size=$((count_limit * TRACEFILE_SIZE))
local num_iter=100000
[ "$(get_stream_file_count "$trace_path" "$stream_pattern")" -eq "$count_limit" ]
ok $? "Stream meets the trace file limit of $count_limit"
- stats=`babeltrace $trace_path | $STATS_BIN --tracepoint $event_name`
+ stats=`"$BABELTRACE_BIN" $trace_path | $STATS_BIN --tracepoint $event_name`
validate_min_max "$stats" "intfield" "[0-9]+" "$expected_max"
ok $? "Trace validation - intfield"
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
start_lttng_sessiond
for limit in "${LIMITS[@]}";