Gen-ust-events: use options instead of arguments
[lttng-tools.git] / tests / regression / ust / getcpu-override / test_getcpu_override
index 081099e798d5a99fd816b094ba5e044c1bd94ef1..75a3d6d4daf0335418a6d0e64373ec9abbc30a99 100755 (executable)
@@ -45,28 +45,24 @@ 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
 
 run_app()
 {
        diag "Launching app without getcpu-plugin wrapper"
-       $TESTAPP_BIN $NUM_EVENT $EVENT_WAIT_USEC
+       $TESTAPP_BIN -i $NUM_EVENT -w $EVENT_WAIT_USEC
        ok $? "Application without wrapper done"
 }
 
 run_getcpu_plugin_app()
 {
        diag "Launching app with getcpu-plugin wrapper"
-       $CURDIR/$TESTAPP_WRAPPER $TESTAPP_BIN $NUM_EVENT $EVENT_WAIT_USEC
+       $CURDIR/$TESTAPP_WRAPPER $TESTAPP_BIN -i $NUM_EVENT -w $EVENT_WAIT_USEC
        ok $? "Application with wrapper done"
 }
 
@@ -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,14 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+if [ -x "$CURDIR/.libs/lttng-ust-getcpu-override-test.so" ]; then
+       foundobj=1
+else
+       foundobj=0
+fi
+
+skip $foundobj "No shared object generated. Skipping all tests." $NUM_TESTS && exit 0
+
 TESTS=(
        test_getcpu_override_fail
        test_getcpu_override
This page took 0.034723 seconds and 5 git commands to generate.