X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Fnotification%2Futil_event_generator.sh;h=bac089086444c7453301f65a8337c131c6f4067c;hb=2a05e025c52eda43f8ebafdbe6f47dc0e80efa77;hp=5eef0deea82f0a775e88f04d7144816d4e6bd3b1;hpb=25cb2044b0c8132fcce62783c9ab487840a001f2;p=lttng-tools.git diff --git a/tests/regression/tools/notification/util_event_generator.sh b/tests/regression/tools/notification/util_event_generator.sh index 5eef0deea..bac089086 100644 --- a/tests/regression/tools/notification/util_event_generator.sh +++ b/tests/regression/tools/notification/util_event_generator.sh @@ -14,6 +14,9 @@ SYSCALL_TESTAPP_BIN=${SYSCALL_TESTAPP_BIN:-"$TESTAPP_PATH/$SYSCALL_TESTAPP_NAME/ USERSPACE_PROBE_ELF_TESTAPP_NAME=${USERSPACE_PROBE_ELF_TESTAPP_NAME:-"userspace-probe-elf-binary"} USERSPACE_PROBE_ELF_TESTAPP_BIN=${USERSPACE_PROBE_ELF_TESTAPP_BIN:-"$TESTAPP_PATH/$USERSPACE_PROBE_ELF_TESTAPP_NAME/.libs/$USERSPACE_PROBE_ELF_TESTAPP_NAME"} +# shellcheck source=../utils/utils.sh +source "$GENERATOR_TESTDIR/utils/utils.sh" + function generate_filter_events { local nr=$1 @@ -25,7 +28,7 @@ function generate_syscalls local nr=$1 shift - for i in $(seq 1 "$nr"); do + for _ in $(seq 1 "$nr"); do # Pass /dev/null so to generate the syscall right away. $SYSCALL_TESTAPP_BIN /dev/null "$@" done @@ -36,8 +39,20 @@ function userspace_probe_testapp local nr=$1 shift - for i in $(seq 1 "$nr"); do - $USERSPACE_PROBE_ELF_TESTAPP_BIN "$@" + for _ in $(seq 1 "$nr"); do + # This userspace probe test has to instrument the actual elf + # binary and not the generated libtool wrapper. However, we + # can't invoke the wrapper either since it will re-link the test + # application binary on its first invocation, resulting in a new + # binary with an 'lt-*' prefix under the .libs folder. The + # relinking stage adds the .libs folder to the 'lt-*' binary's + # rpath. + # + # To ensure the binary (inode) that instrumented is the same as + # what is running, set LD_LIBRARY_PATH to find the .libs folder + # that contains the libfoo.so library and invoke the binary + # directly. + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-elf-binary/.libs" $USERSPACE_PROBE_ELF_TESTAPP_BIN "$@" done } @@ -78,7 +93,7 @@ function ust_event_generator_run_once_per_transition run=true sleep 0.5 elif [ "$run" = true ]; then - taskset -c 0 "$test_app" -i "$nr_iter" -w "$nr_usec_wait" "$@"> /dev/null 2>&1 + taskset -c "$(get_any_available_cpu)" "$test_app" -i "$nr_iter" -w "$nr_usec_wait" "$@"> /dev/null 2>&1 run=false; if [[ -f $state_file ]]; then rm -rf "$state_file" 2> /dev/null @@ -115,7 +130,7 @@ function ust_event_generator # Reset the "run" state sleep 0.5 else - taskset -c 0 "$test_app" -i $nr_iter -w $nr_usec_wait "$@" > /dev/null 2>&1 + taskset -c "$(get_any_available_cpu)" "$test_app" -i $nr_iter -w $nr_usec_wait "$@" > /dev/null 2>&1 if [[ -f $state_file ]]; then rm -rf "$state_file" 2> /dev/null fi