Tests: use CPU ids from online ranges
[lttng-tools.git] / tests / regression / tools / tracefile-limits / test_tracefile_count
index 5ca10ac231bc6e407a94983f4a56e7162d473200..df32b4039cc56e8ecff209da1ea50f87738d5297 100755 (executable)
@@ -17,7 +17,6 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 STATS_BIN="$TESTDIR/utils/babelstats.pl"
 NUM_TESTS=74
 
-NUM_CPUS=$(nproc)
 PAGE_SIZE=$(getconf PAGE_SIZE)
 TRACEFILE_SIZE=$PAGE_SIZE
 
@@ -27,6 +26,13 @@ if [ ! -x "$TESTAPP_BIN" ]; then
        BAIL_OUT "No UST events binary detected."
 fi
 
+function pick_random_cpuid ()
+{
+       local cpuids
+       read -r -a cpuids <<< "$(get_online_cpus)"
+       echo "${cpuids[ $RANDOM % ${#cpuids[@]} ]}"
+}
+
 function enable_lttng_channel_count_limit ()
 {
        sess_name="$1"
@@ -82,7 +88,7 @@ function test_tracefile_count_limit ()
        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
@@ -90,7 +96,7 @@ function test_tracefile_count_limit ()
        local session_name
        local stream_pattern=".*${channel_name}_${cpuno}_[0-9]*"
        local stream_size=0
-       local trace_path=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
+       local trace_path=$(mktemp -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
 
        session_name=$(randstring 16 0)
 
This page took 0.024293 seconds and 4 git commands to generate.