starttest "dlopen"
plan_tests 4
+USTTRACE="$TESTDIR/../usttrace"
-LD_LIBRARY_PATH=$TESTDIR/dlopen/.libs okx usttrace $TESTDIR/dlopen/dlopen
-trace_loc=$(usttrace -W)
+LD_LIBRARY_PATH=$TESTDIR/dlopen/.libs okx $USTTRACE -L $TESTDIR/dlopen/dlopen
+trace_loc=$($USTTRACE -W)
trace_matches -N "from_library" -n 1 "^ust.from_library:" $trace_loc
trace_matches -N "from_main_before_lib" -n 1 "^ust.from_main_before_lib:" $trace_loc
trace_matches -N "from_main_after_lib" -n 1 "^ust.from_main_after_lib:" $trace_loc
starttest "fork()/exec() test"
plan_tests 8
+USTTRACE="$TESTDIR/../usttrace"
-okx usttrace -f $TESTDIR/fork/.libs/fork $TESTDIR/fork/.libs/fork2
-trace_loc=$(usttrace -W)
+okx $USTTRACE -L -f $TESTDIR/fork/.libs/fork $TESTDIR/fork/.libs/fork2
+trace_loc=$($USTTRACE -W)
trace_matches -N "before_fork" "^ust.before_fork:" $trace_loc
trace_matches -N "after_fork_parent" "^ust.after_fork_parent:" $trace_loc
trace_matches -N "after_fork_child" "^ust.after_fork_child:" $trace_loc
pidfilepath="/tmp/ust-testsuite-$USER-$(date +%Y%m%d%H%M%S%N)-ust-consumerd-pid"
mkfifo -m 0600 "$pidfilepath"
-ust-consumerd --pidfile "$pidfilepath" -o "$TRACE_DIR" >/dev/null 2>&1 &
+UST_CONSUMERD="$TESTDIR/../ust-consumerd/ust-consumerd"
+$UST_CONSUMERD --pidfile "$pidfilepath" -o "$TRACE_DIR" >/dev/null 2>&1 &
UST_CONSUMERD_PID="$(<$pidfilepath)"
LD_PRELOAD=/usr/local/lib/libust.so.0.0.0:/usr/local/lib/libustinstr-malloc.so find -L / >/dev/null 2>&1 &
PID=$!
TRACE=auto
+USTCTL="$TESTDIR/../ustctl/ustctl"
sleep 0.1
-okx ustctl list-markers $PID
-okx ustctl enable-marker $PID $TRACE ust/malloc
-okx ustctl enable-marker $PID $TRACE ust/free
-okx ustctl create-trace $PID $TRACE
-okx ustctl alloc-trace $PID $TRACE
-okx ustctl start-trace $PID $TRACE
+okx $USTCTL list-markers $PID
+okx $USTCTL enable-marker $PID $TRACE ust/malloc
+okx $USTCTL enable-marker $PID $TRACE ust/free
+okx $USTCTL create-trace $PID $TRACE
+okx $USTCTL alloc-trace $PID $TRACE
+okx $USTCTL start-trace $PID $TRACE
sleep 0.5
-okx ustctl stop-trace $PID $TRACE
-okx ustctl destroy-trace $PID $TRACE
+okx $USTCTL stop-trace $PID $TRACE
+okx $USTCTL destroy-trace $PID $TRACE
kill $PID
kill -SIGTERM ${UST_CONSUMERD_PID}
wait ${UST_CONSUMERD_PID}
starttest "same_line_marker"
plan_tests 2
+USTTRACE="$TESTDIR/../usttrace"
-okx usttrace $TESTDIR/same_line_marker/same_line_marker
-trace_loc=$(usttrace -W)
+okx $USTTRACE -L $TESTDIR/same_line_marker/same_line_marker
+trace_loc=$($USTTRACE -W)
trace_matches -N "same_line_event" -n 2 "^ust.same_line_event:" $trace_loc
starttest "libustinstr-malloc"
plan_tests 3
+USTTRACE="$TESTDIR/../usttrace"
-okx usttrace -lm $TESTDIR/test-libustinstr-malloc/.libs/prog
-trace_loc=$(usttrace -W)
+okx $USTTRACE -L -lm $TESTDIR/test-libustinstr-malloc/.libs/prog
+trace_loc=$($USTTRACE -W)
trace_matches -N "libustinstr-malloc - malloc" -n 1000 "^ust.malloc:.*{ size = 1[0-9][0-9][0-9]," $trace_loc
check_trace_logs "$trace_loc"
starttest "Test-nevents"
plan_tests 4
+USTTRACE="$TESTDIR/../usttrace"
-okx usttrace $TESTDIR/test-nevents/prog
-trace_loc=$(usttrace -W)
+okx $USTTRACE -L $TESTDIR/test-nevents/prog
+trace_loc=$($USTTRACE -W)
trace_matches -N "an_event" -n 100000 "^ust.an_event:" $trace_loc
trace_matches -N "another_event" -n 100000 "^ust.another_event:" $trace_loc
check_trace_logs "$trace_loc"
starttest "Testing Tracepoints"
plan_tests 6
+USTTRACE="$TESTDIR/../usttrace"
-okx usttrace $TESTDIR/tracepoint/tracepoint_test
-trace_loc=$(usttrace -W)
+okx $USTTRACE -L $TESTDIR/tracepoint/tracepoint_test
+trace_loc=$($USTTRACE -W)
trace_matches -N "probe1" -n "5" "probe = 13" $trace_loc
trace_matches -N "probe2" -n "5" "probe = 42" $trace_loc
trace_matches -N "probe3" -n "1" "probe = \"probe3\"" $trace_loc