X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Fust%2Fgetcpu-override%2Ftest_getcpu_override;h=72010581e83aa251451ba4ffeee8db32c11d97f9;hp=081099e798d5a99fd816b094ba5e044c1bd94ef1;hb=f87d0ca370c17b597762f5ee218f0e821ed2452d;hpb=ce14b22be913b209d40193fc52b24b471fda047e diff --git a/tests/regression/ust/getcpu-override/test_getcpu_override b/tests/regression/ust/getcpu-override/test_getcpu_override index 081099e79..72010581e 100755 --- a/tests/regression/ust/getcpu-override/test_getcpu_override +++ b/tests/regression/ust/getcpu-override/test_getcpu_override @@ -45,14 +45,10 @@ SEQUENCE_SEED=( 89 13 63 6 136 153 23 16 47 130 75 62 ) -# Equivalent to the syconf(_SC_NPROCESSORS_CONF) call. -NPROC=`nproc --all` - source $TESTDIR/utils/utils.sh -if [ ! -x "$CURDIR/.libs/lttng-ust-getcpu-override-test.so" ]; then - BAIL_OUT "No shared object generated" -fi +# Equivalent to the syconf(_SC_NPROCESSORS_CONF) call. +num_cpus=$(conf_proc_count) # MUST set TESTDIR before calling those functions @@ -90,7 +86,7 @@ compare() ok $? "Sequence seed and cpuid sequence have the same size ${#SEQUENCE_SEED[*]}/${#array_to_compare[*]}" for (( i = 0; i < ${#SEQUENCE_SEED[*]}; i++ )); do - if [ "${array_to_compare[$i]}" -ne "$(( ${SEQUENCE_SEED[$i]} % $NPROC))" ]; then + if [ "${array_to_compare[$i]}" -ne "$(( ${SEQUENCE_SEED[$i]} % $num_cpus))" ]; then valid=1 break fi @@ -107,7 +103,7 @@ compare() echo -n "# array value is " echo -n "${array_to_compare[$i]}" echo -n " expected " - echo "$(( ${SEQUENCE_SEED[$i]} % $NPROC))" + echo "$(( ${SEQUENCE_SEED[$i]} % $num_cpus))" done diag "Dumping trace" $BABELTRACE_BIN $TRACE_PATH | awk '{print "# " $0}' @@ -161,6 +157,20 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" +if [ ! -x "$CURDIR/.libs/lttng-ust-getcpu-override-test.so" ]; then + skip 0 "No shared object generated. Skipping all tests." $NUM_TESTS && exit 0 +fi + +if [ "$num_cpus" -eq "1" ]; then + # Skip the test since we cannot perform it as designed since N mod 1 + # is always equals to zero. There is no point testing this on a system + # with a single configured core. LTTng-UST limits the get_cpu function + # to return value inside the [0, NUM_CPU - 1] range for a valid event + # (present in trace). + skip 0 "Test system only have a single thread. Skipping all tests." $NUM_TESTS && exit 0 +fi + + TESTS=( test_getcpu_override_fail test_getcpu_override