Tests: use CPU ids from online ranges
[lttng-tools.git] / tests / regression / tools / snapshots / ust_test
index 26cfbf88e9a8961a696eb128261d7d045be700c8..9cd5a48c9eb50c0c76b1d7b4bf66a1abdca25e80 100755 (executable)
@@ -212,7 +212,7 @@ function test_ust_local_snapshot_small_discard_buffers ()
        OLDCPUSET=$(taskset -p $$)
 
        diag "Test local UST snapshots with small discard buffers"
-       taskset -p 0x1 $$ 1>/dev/null 2>&1      # CPU 0 only
+       taskset -c "$(get_any_available_cpu)" -p $$ 1>/dev/null 2>&1
        create_lttng_session_no_output $SESSION_NAME
        enable_mmap_small_discard_ust_channel $SESSION_NAME $CHANNEL_NAME
        enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
@@ -257,7 +257,7 @@ function test_ust_local_snapshot_small_overwrite_buffers ()
        OLDCPUSET=$(taskset -p $$)
 
        diag "Test local UST snapshots with small overwrite buffers"
-       taskset -p 0x1 $$ 1>/dev/null 2>&1      # CPU 0 only
+       taskset -p "$(get_any_available_cpu)" $$ 1>/dev/null 2>&1
        create_lttng_session_no_output $SESSION_NAME
        enable_mmap_small_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
        enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
@@ -298,14 +298,15 @@ function test_ust_local_snapshot_small_overwrite_buffers ()
 function test_ust_local_snapshot_max_size ()
 {
        local possible_cpus
-       local online_cpus
+       local cpus_list
        local subbuf_size
        local subbuf_count
        local snapshot_max_size
        local channel_max_size_per_cpu
 
+       IFS=" " read -r -a cpus_list <<< "$(get_online_cpus)"
+
        possible_cpus=$(get_possible_cpus_count)
-       online_cpus=$(conf_proc_count)
        subbuf_size=$(getconf PAGE_SIZE)
        subbuf_count=8
        snapshot_max_size=$((subbuf_size*possible_cpus))
@@ -325,9 +326,10 @@ function test_ust_local_snapshot_max_size ()
 
        # Fill all ring-buffers of the channel; assuming event size of at least one
        # byte
-       for cpu in $(seq "$online_cpus");
+       for cpu in "${cpus_list[@]}";
        do
-               taskset --cpu-list $((cpu-1)) "$TESTAPP_BIN" \
+               diag "setting affinity to $cpu"
+               taskset --cpu-list "$cpu" "$TESTAPP_BIN" \
                        --iter "$channel_max_size_per_cpu"
        done
        diag "Filled channel ring-buffers"
This page took 0.025681 seconds and 4 git commands to generate.