* [ltt-dev] [UST PATCH 1/3] Try harder to find a usable lttv in the tests scripts v2
@ 2011-02-18 17:59 Yannick Brosseau
2011-02-18 17:59 ` [ltt-dev] [UST PATCH 2/3] Use usttrace and libraries from the build directory in the test scripts Yannick Brosseau
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Yannick Brosseau @ 2011-02-18 17:59 UTC (permalink / raw)
Add many more attempts to auto-detect the path to the lttv executable or
the runlttv script in trace comparison tests.
Also support setting the LTTV env variable to directly set a path the
the lttv executable in addition to the RUNLTTV variable
Changelog:
Correctly manage multiple traces
Signed-off-by: Yannick Brosseau <yannick.brosseau at gmail.com>
---
tests/test_functions.sh | 46 ++++++++++++++++++++++++++++++++++++++----
tests/trace_matches | 50 +++++++++++++++++++++++++++++++++++++++-------
2 files changed, 83 insertions(+), 13 deletions(-)
diff --git a/tests/test_functions.sh b/tests/test_functions.sh
index 40d4d89..79ade73 100644
--- a/tests/test_functions.sh
+++ b/tests/test_functions.sh
@@ -42,11 +42,44 @@ function check_trace_logs() {
function trace_matches() {
local OPTIND=
- RUNLTTV=~/devel/lttv/runlttv
+ #Get a textdump command
+ # if RUNLTTV is defined try to use it
+ # if LTTV variable is defined try to use it
+ # try to find lttv in the path
+ # try to find runlttv in std paths (devel/lttv/runlttv and ust/../lttv/runlttv
- if [ ! -x "$RUNLTTV" ]; then
- echo "$0: $RUNLTTV not executable. Edit \$RUNLTTV to point to your lttv source directory." >/dev/stderr
+ if [ ! -d "$RUNLTTV" -a -x "$RUNLTTV" ]; then
+ LTTV_TEXTDUMP_CMD="$RUNLTTV -m text "
+ LTTV_TRACE_PREFIX=""
+
+ elif [ -d "$RUNLTTV" -a -x "$RUNLTTV/runlttv" ]; then
+ LTTV_TEXTDUMP_CMD="$RUNLTTV/runlttv -m text "
+ LTTV_TRACE_PREFIX=""
+
+ elif [ ! -d "$LTTV" -a -x "$LTTV" ]; then
+ LTTV_TEXTDUMP_CMD="$LTTV -m textDump "
+ LTTV_TRACE_PREFIX="-t"
+
+ elif [ -d "$LTTV" -a -x "$LTTV/lttv" ]; then
+ LTTV_TEXTDUMP_CMD="$LTTV/lttv -m textDump "
+ LTTV_TRACE_PREFIX="-t"
+
+ elif [ -x "$(which lttv.real)" ]; then
+ LTTV_TEXTDUMP_CMD="$(which lttv.real) -m textDump ";
+ LTTV_TRACE_PREFIX="-t"
+
+ elif [ -x "~/devel/lttv/runlttv" ]; then
+ LTTV_TEXTDUMP_CMD="~/devel/lttv/runlttv -m text ";
+ LTTV_TRACE_PREFIX=""
+
+ elif [ -x "$(dirname `readlink -f $0`)/../../lttv/runlttv" ]; then
+ LTTV_TEXTDUMP_CMD="$(dirname `readlink -f $0`)/../../lttv/runlttv -m text "
+ LTTV_TRACE_PREFIX=""
+
+ else
+ echo "$0: No lttv found. Edit \$RUNLTTV to point to your lttv source directory or \$LTTV to you lttv executable." >/dev/stderr
exit 1;
+
fi
while getopts ":n:N:" options; do
@@ -71,8 +104,11 @@ function trace_matches() {
return 1
fi
traces=$(find "$2" -mindepth 1 -maxdepth 1 -type d)
-
- cnt=$($RUNLTTV -m text "$traces" | grep "$pattern" | wc -l)
+ lttv_trace_cmd=$LTTV_TEXTDUMP_CMD
+ for trace in $traces; do
+ lttv_trace_cmd="$lttv_trace_cmd $LTTV_TRACE_PREFIX $trace"
+ done
+ cnt=$($lttv_trace_cmd | grep "$pattern" | wc -l)
if [ -z "$expected_count" ]; then
if [ "$cnt" -eq "0" ]; then
fail "Did not find at least one instance of $name in trace"
diff --git a/tests/trace_matches b/tests/trace_matches
index ae838fb..17a65f8 100755
--- a/tests/trace_matches
+++ b/tests/trace_matches
@@ -1,9 +1,5 @@
#!/bin/bash
-if [ -z "$RUNLTTV" ]; then
- RUNLTTV=~/devel/lttv/runlttv
-fi
-
function error() {
echo "$0: $@" >/dev/stderr
}
@@ -12,9 +8,44 @@ function usage() {
echo "Usage: $0 [ -N pattern_name ] [ -n pattern_count ] PATTERN TRACE_PARENT_DIR"
}
-if [ ! -x "$RUNLTTV" ]; then
- echo "$0: $RUNLTTV not executable. Edit \$RUNLTTV to point to your lttv source directory." >/dev/stderr
+#Get a textdump command
+# if RUNLTTV is defined try to use it
+# if LTTV variable is defined try to use it
+# try to find lttv in the path
+# try to find runlttv in std paths (devel/lttv/runlttv and ust/../lttv/runlttv
+
+if [ ! -d "$RUNLTTV" -a -x "$RUNLTTV" ]; then
+ LTTV_TEXTDUMP_CMD="$RUNLTTV -m text "
+ LTTV_TRACE_PREFIX=""
+
+elif [ -d "$RUNLTTV" -a -x "$RUNLTTV/runlttv" ]; then
+ LTTV_TEXTDUMP_CMD="$RUNLTTV/runlttv -m text "
+ LTTV_TRACE_PREFIX=""
+
+elif [ ! -d "$LTTV" -a -x "$LTTV" ]; then
+ LTTV_TEXTDUMP_CMD="$LTTV -m textDump "
+ LTTV_TRACE_PREFIX="-t"
+
+elif [ -d "$LTTV" -a -x "$LTTV/lttv" ]; then
+ LTTV_TEXTDUMP_CMD="$LTTV/lttv -m textDump "
+ LTTV_TRACE_PREFIX="-t"
+
+elif [ -x "$(which lttv.real)" ]; then
+ LTTV_TEXTDUMP_CMD="$(which lttv.real) -m textDump ";
+ LTTV_TRACE_PREFIX="-t"
+
+elif [ -x "~/devel/lttv/runlttv" ]; then
+ LTTV_TEXTDUMP_CMD="~/devel/lttv/runlttv -m text ";
+ LTTV_TRACE_PREFIX=""
+
+elif [ -x "$(dirname `readlink -f $0`)/../../lttv/runlttv" ]; then
+ LTTV_TEXTDUMP_CMD="$(dirname `readlink -f $0`)/../../lttv/runlttv -m text "
+ LTTV_TRACE_PREFIX=""
+
+else
+ echo "$0: No lttv found. Edit \$RUNLTTV to point to your lttv source directory or \$LTTV to you lttv executable." >/dev/stderr
exit 1;
+
fi
while getopts ":n:N:" options; do
@@ -44,10 +75,13 @@ if [ -z "$2" ]; then
exit 1
fi
traces=$(find "$2" -mindepth 1 -maxdepth 1 -type d)
-
+lttv_trace_cmd=$LTTV_TEXTDUMP_CMD
+for trace in $traces; do
+ lttv_trace_cmd="$lttv_trace_cmd $LTTV_TRACE_PREFIX $trace"
+done
echo -n "Analyzing trace ($name): "
-cnt=$($RUNLTTV -m text "$traces" | grep "$pattern" | wc -l)
+cnt=$($lttv_trace_cmd | grep "$pattern" | wc -l)
if [ -z "$expected_count" ]; then
if [ "$cnt" -eq "0" ]; then
echo "ERROR"
--
1.7.2.3
^ permalink raw reply [flat|nested] 6+ messages in thread* [ltt-dev] [UST PATCH 2/3] Use usttrace and libraries from the build directory in the test scripts
2011-02-18 17:59 [ltt-dev] [UST PATCH 1/3] Try harder to find a usable lttv in the tests scripts v2 Yannick Brosseau
@ 2011-02-18 17:59 ` Yannick Brosseau
2011-02-18 20:33 ` Mathieu Desnoyers
2011-02-18 17:59 ` [ltt-dev] [UST PATCH 3/3] Test for the presence of valgrind in the valgrind test Yannick Brosseau
2011-02-18 20:32 ` [ltt-dev] [UST PATCH 1/3] Try harder to find a usable lttv in the tests scripts v2 Mathieu Desnoyers
2 siblings, 1 reply; 6+ messages in thread
From: Yannick Brosseau @ 2011-02-18 17:59 UTC (permalink / raw)
Signed-off-by: Yannick Brosseau <yannick.brosseau at gmail.com>
---
tests/dlopen/dlopen.sh | 5 +++--
tests/fork/fork.sh | 5 +++--
tests/manual_mode_tracing.sh | 20 +++++++++++---------
tests/same_line_marker/same_line_marker.sh | 5 +++--
.../test-libustinstr-malloc.sh | 5 +++--
tests/test-nevents/test-nevents.sh | 5 +++--
tests/tracepoint/run | 5 +++--
7 files changed, 29 insertions(+), 21 deletions(-)
diff --git a/tests/dlopen/dlopen.sh b/tests/dlopen/dlopen.sh
index 723f038..673fdbc 100755
--- a/tests/dlopen/dlopen.sh
+++ b/tests/dlopen/dlopen.sh
@@ -25,9 +25,10 @@ source $TESTDIR/tap.sh
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
diff --git a/tests/fork/fork.sh b/tests/fork/fork.sh
index 2c02e94..631c9d5 100755
--- a/tests/fork/fork.sh
+++ b/tests/fork/fork.sh
@@ -25,9 +25,10 @@ source $TESTDIR/tap.sh
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
diff --git a/tests/manual_mode_tracing.sh b/tests/manual_mode_tracing.sh
index b60a957..bd85083 100755
--- a/tests/manual_mode_tracing.sh
+++ b/tests/manual_mode_tracing.sh
@@ -37,23 +37,25 @@ mkdir "$TRACE_DIR"
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}
diff --git a/tests/same_line_marker/same_line_marker.sh b/tests/same_line_marker/same_line_marker.sh
index e391ec3..c3688ed 100755
--- a/tests/same_line_marker/same_line_marker.sh
+++ b/tests/same_line_marker/same_line_marker.sh
@@ -25,7 +25,8 @@ source $TESTDIR/tap.sh
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
diff --git a/tests/test-libustinstr-malloc/test-libustinstr-malloc.sh b/tests/test-libustinstr-malloc/test-libustinstr-malloc.sh
index 2daa4b5..04ed64d 100755
--- a/tests/test-libustinstr-malloc/test-libustinstr-malloc.sh
+++ b/tests/test-libustinstr-malloc/test-libustinstr-malloc.sh
@@ -25,8 +25,9 @@ source $TESTDIR/tap.sh
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"
diff --git a/tests/test-nevents/test-nevents.sh b/tests/test-nevents/test-nevents.sh
index 03ff87f..2a7a98a 100755
--- a/tests/test-nevents/test-nevents.sh
+++ b/tests/test-nevents/test-nevents.sh
@@ -25,9 +25,10 @@ source $TESTDIR/tap.sh
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"
diff --git a/tests/tracepoint/run b/tests/tracepoint/run
index 0da9864..f0d9ed1 100755
--- a/tests/tracepoint/run
+++ b/tests/tracepoint/run
@@ -7,9 +7,10 @@ source $TESTDIR/tap.sh
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
--
1.7.2.3
^ permalink raw reply [flat|nested] 6+ messages in thread* [ltt-dev] [UST PATCH 2/3] Use usttrace and libraries from the build directory in the test scripts
2011-02-18 17:59 ` [ltt-dev] [UST PATCH 2/3] Use usttrace and libraries from the build directory in the test scripts Yannick Brosseau
@ 2011-02-18 20:33 ` Mathieu Desnoyers
0 siblings, 0 replies; 6+ messages in thread
From: Mathieu Desnoyers @ 2011-02-18 20:33 UTC (permalink / raw)
* Yannick Brosseau (yannick.brosseau at gmail.com) wrote:
> Signed-off-by: Yannick Brosseau <yannick.brosseau at gmail.com>
Merged.
> ---
> tests/dlopen/dlopen.sh | 5 +++--
> tests/fork/fork.sh | 5 +++--
> tests/manual_mode_tracing.sh | 20 +++++++++++---------
> tests/same_line_marker/same_line_marker.sh | 5 +++--
> .../test-libustinstr-malloc.sh | 5 +++--
> tests/test-nevents/test-nevents.sh | 5 +++--
> tests/tracepoint/run | 5 +++--
> 7 files changed, 29 insertions(+), 21 deletions(-)
>
> diff --git a/tests/dlopen/dlopen.sh b/tests/dlopen/dlopen.sh
> index 723f038..673fdbc 100755
> --- a/tests/dlopen/dlopen.sh
> +++ b/tests/dlopen/dlopen.sh
> @@ -25,9 +25,10 @@ source $TESTDIR/tap.sh
> 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
> diff --git a/tests/fork/fork.sh b/tests/fork/fork.sh
> index 2c02e94..631c9d5 100755
> --- a/tests/fork/fork.sh
> +++ b/tests/fork/fork.sh
> @@ -25,9 +25,10 @@ source $TESTDIR/tap.sh
> 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
> diff --git a/tests/manual_mode_tracing.sh b/tests/manual_mode_tracing.sh
> index b60a957..bd85083 100755
> --- a/tests/manual_mode_tracing.sh
> +++ b/tests/manual_mode_tracing.sh
> @@ -37,23 +37,25 @@ mkdir "$TRACE_DIR"
> 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}
> diff --git a/tests/same_line_marker/same_line_marker.sh b/tests/same_line_marker/same_line_marker.sh
> index e391ec3..c3688ed 100755
> --- a/tests/same_line_marker/same_line_marker.sh
> +++ b/tests/same_line_marker/same_line_marker.sh
> @@ -25,7 +25,8 @@ source $TESTDIR/tap.sh
> 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
> diff --git a/tests/test-libustinstr-malloc/test-libustinstr-malloc.sh b/tests/test-libustinstr-malloc/test-libustinstr-malloc.sh
> index 2daa4b5..04ed64d 100755
> --- a/tests/test-libustinstr-malloc/test-libustinstr-malloc.sh
> +++ b/tests/test-libustinstr-malloc/test-libustinstr-malloc.sh
> @@ -25,8 +25,9 @@ source $TESTDIR/tap.sh
> 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"
> diff --git a/tests/test-nevents/test-nevents.sh b/tests/test-nevents/test-nevents.sh
> index 03ff87f..2a7a98a 100755
> --- a/tests/test-nevents/test-nevents.sh
> +++ b/tests/test-nevents/test-nevents.sh
> @@ -25,9 +25,10 @@ source $TESTDIR/tap.sh
> 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"
> diff --git a/tests/tracepoint/run b/tests/tracepoint/run
> index 0da9864..f0d9ed1 100755
> --- a/tests/tracepoint/run
> +++ b/tests/tracepoint/run
> @@ -7,9 +7,10 @@ source $TESTDIR/tap.sh
>
> 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
> --
> 1.7.2.3
>
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ltt-dev] [UST PATCH 3/3] Test for the presence of valgrind in the valgrind test
2011-02-18 17:59 [ltt-dev] [UST PATCH 1/3] Try harder to find a usable lttv in the tests scripts v2 Yannick Brosseau
2011-02-18 17:59 ` [ltt-dev] [UST PATCH 2/3] Use usttrace and libraries from the build directory in the test scripts Yannick Brosseau
@ 2011-02-18 17:59 ` Yannick Brosseau
2011-02-18 20:34 ` Mathieu Desnoyers
2011-02-18 20:32 ` [ltt-dev] [UST PATCH 1/3] Try harder to find a usable lttv in the tests scripts v2 Mathieu Desnoyers
2 siblings, 1 reply; 6+ messages in thread
From: Yannick Brosseau @ 2011-02-18 17:59 UTC (permalink / raw)
Signed-off-by: Yannick Brosseau <yannick.brosseau at gmail.com>
---
tests/valgrind_ust-consumerd.sh | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/tests/valgrind_ust-consumerd.sh b/tests/valgrind_ust-consumerd.sh
index a0d9e44..d89a1f2 100755
--- a/tests/valgrind_ust-consumerd.sh
+++ b/tests/valgrind_ust-consumerd.sh
@@ -17,6 +17,11 @@
# You should have received a copy of the GNU General Public License
# along with LTTng-UST. If not, see <http://www.gnu.org/licenses/>.
+if [ -n "$(which valgrind)" ]; then
+ echo "$0: Valgrind not found on the system." >/dev/stderr
+ exit 1;
+fi
+
TESTDIR=$(dirname $0)
source $TESTDIR/test_functions.sh
--
1.7.2.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ltt-dev] [UST PATCH 1/3] Try harder to find a usable lttv in the tests scripts v2
2011-02-18 17:59 [ltt-dev] [UST PATCH 1/3] Try harder to find a usable lttv in the tests scripts v2 Yannick Brosseau
2011-02-18 17:59 ` [ltt-dev] [UST PATCH 2/3] Use usttrace and libraries from the build directory in the test scripts Yannick Brosseau
2011-02-18 17:59 ` [ltt-dev] [UST PATCH 3/3] Test for the presence of valgrind in the valgrind test Yannick Brosseau
@ 2011-02-18 20:32 ` Mathieu Desnoyers
2 siblings, 0 replies; 6+ messages in thread
From: Mathieu Desnoyers @ 2011-02-18 20:32 UTC (permalink / raw)
* Yannick Brosseau (yannick.brosseau at gmail.com) wrote:
> Add many more attempts to auto-detect the path to the lttv executable or
> the runlttv script in trace comparison tests.
> Also support setting the LTTV env variable to directly set a path the
> the lttv executable in addition to the RUNLTTV variable
>
> Changelog:
> Correctly manage multiple traces
Merged, thanks!
Mathieu
>
> Signed-off-by: Yannick Brosseau <yannick.brosseau at gmail.com>
> ---
> tests/test_functions.sh | 46 ++++++++++++++++++++++++++++++++++++++----
> tests/trace_matches | 50 +++++++++++++++++++++++++++++++++++++++-------
> 2 files changed, 83 insertions(+), 13 deletions(-)
>
> diff --git a/tests/test_functions.sh b/tests/test_functions.sh
> index 40d4d89..79ade73 100644
> --- a/tests/test_functions.sh
> +++ b/tests/test_functions.sh
> @@ -42,11 +42,44 @@ function check_trace_logs() {
> function trace_matches() {
> local OPTIND=
>
> - RUNLTTV=~/devel/lttv/runlttv
> + #Get a textdump command
> + # if RUNLTTV is defined try to use it
> + # if LTTV variable is defined try to use it
> + # try to find lttv in the path
> + # try to find runlttv in std paths (devel/lttv/runlttv and ust/../lttv/runlttv
>
> - if [ ! -x "$RUNLTTV" ]; then
> - echo "$0: $RUNLTTV not executable. Edit \$RUNLTTV to point to your lttv source directory." >/dev/stderr
> + if [ ! -d "$RUNLTTV" -a -x "$RUNLTTV" ]; then
> + LTTV_TEXTDUMP_CMD="$RUNLTTV -m text "
> + LTTV_TRACE_PREFIX=""
> +
> + elif [ -d "$RUNLTTV" -a -x "$RUNLTTV/runlttv" ]; then
> + LTTV_TEXTDUMP_CMD="$RUNLTTV/runlttv -m text "
> + LTTV_TRACE_PREFIX=""
> +
> + elif [ ! -d "$LTTV" -a -x "$LTTV" ]; then
> + LTTV_TEXTDUMP_CMD="$LTTV -m textDump "
> + LTTV_TRACE_PREFIX="-t"
> +
> + elif [ -d "$LTTV" -a -x "$LTTV/lttv" ]; then
> + LTTV_TEXTDUMP_CMD="$LTTV/lttv -m textDump "
> + LTTV_TRACE_PREFIX="-t"
> +
> + elif [ -x "$(which lttv.real)" ]; then
> + LTTV_TEXTDUMP_CMD="$(which lttv.real) -m textDump ";
> + LTTV_TRACE_PREFIX="-t"
> +
> + elif [ -x "~/devel/lttv/runlttv" ]; then
> + LTTV_TEXTDUMP_CMD="~/devel/lttv/runlttv -m text ";
> + LTTV_TRACE_PREFIX=""
> +
> + elif [ -x "$(dirname `readlink -f $0`)/../../lttv/runlttv" ]; then
> + LTTV_TEXTDUMP_CMD="$(dirname `readlink -f $0`)/../../lttv/runlttv -m text "
> + LTTV_TRACE_PREFIX=""
> +
> + else
> + echo "$0: No lttv found. Edit \$RUNLTTV to point to your lttv source directory or \$LTTV to you lttv executable." >/dev/stderr
> exit 1;
> +
> fi
>
> while getopts ":n:N:" options; do
> @@ -71,8 +104,11 @@ function trace_matches() {
> return 1
> fi
> traces=$(find "$2" -mindepth 1 -maxdepth 1 -type d)
> -
> - cnt=$($RUNLTTV -m text "$traces" | grep "$pattern" | wc -l)
> + lttv_trace_cmd=$LTTV_TEXTDUMP_CMD
> + for trace in $traces; do
> + lttv_trace_cmd="$lttv_trace_cmd $LTTV_TRACE_PREFIX $trace"
> + done
> + cnt=$($lttv_trace_cmd | grep "$pattern" | wc -l)
> if [ -z "$expected_count" ]; then
> if [ "$cnt" -eq "0" ]; then
> fail "Did not find at least one instance of $name in trace"
> diff --git a/tests/trace_matches b/tests/trace_matches
> index ae838fb..17a65f8 100755
> --- a/tests/trace_matches
> +++ b/tests/trace_matches
> @@ -1,9 +1,5 @@
> #!/bin/bash
>
> -if [ -z "$RUNLTTV" ]; then
> - RUNLTTV=~/devel/lttv/runlttv
> -fi
> -
> function error() {
> echo "$0: $@" >/dev/stderr
> }
> @@ -12,9 +8,44 @@ function usage() {
> echo "Usage: $0 [ -N pattern_name ] [ -n pattern_count ] PATTERN TRACE_PARENT_DIR"
> }
>
> -if [ ! -x "$RUNLTTV" ]; then
> - echo "$0: $RUNLTTV not executable. Edit \$RUNLTTV to point to your lttv source directory." >/dev/stderr
> +#Get a textdump command
> +# if RUNLTTV is defined try to use it
> +# if LTTV variable is defined try to use it
> +# try to find lttv in the path
> +# try to find runlttv in std paths (devel/lttv/runlttv and ust/../lttv/runlttv
> +
> +if [ ! -d "$RUNLTTV" -a -x "$RUNLTTV" ]; then
> + LTTV_TEXTDUMP_CMD="$RUNLTTV -m text "
> + LTTV_TRACE_PREFIX=""
> +
> +elif [ -d "$RUNLTTV" -a -x "$RUNLTTV/runlttv" ]; then
> + LTTV_TEXTDUMP_CMD="$RUNLTTV/runlttv -m text "
> + LTTV_TRACE_PREFIX=""
> +
> +elif [ ! -d "$LTTV" -a -x "$LTTV" ]; then
> + LTTV_TEXTDUMP_CMD="$LTTV -m textDump "
> + LTTV_TRACE_PREFIX="-t"
> +
> +elif [ -d "$LTTV" -a -x "$LTTV/lttv" ]; then
> + LTTV_TEXTDUMP_CMD="$LTTV/lttv -m textDump "
> + LTTV_TRACE_PREFIX="-t"
> +
> +elif [ -x "$(which lttv.real)" ]; then
> + LTTV_TEXTDUMP_CMD="$(which lttv.real) -m textDump ";
> + LTTV_TRACE_PREFIX="-t"
> +
> +elif [ -x "~/devel/lttv/runlttv" ]; then
> + LTTV_TEXTDUMP_CMD="~/devel/lttv/runlttv -m text ";
> + LTTV_TRACE_PREFIX=""
> +
> +elif [ -x "$(dirname `readlink -f $0`)/../../lttv/runlttv" ]; then
> + LTTV_TEXTDUMP_CMD="$(dirname `readlink -f $0`)/../../lttv/runlttv -m text "
> + LTTV_TRACE_PREFIX=""
> +
> +else
> + echo "$0: No lttv found. Edit \$RUNLTTV to point to your lttv source directory or \$LTTV to you lttv executable." >/dev/stderr
> exit 1;
> +
> fi
>
> while getopts ":n:N:" options; do
> @@ -44,10 +75,13 @@ if [ -z "$2" ]; then
> exit 1
> fi
> traces=$(find "$2" -mindepth 1 -maxdepth 1 -type d)
> -
> +lttv_trace_cmd=$LTTV_TEXTDUMP_CMD
> +for trace in $traces; do
> + lttv_trace_cmd="$lttv_trace_cmd $LTTV_TRACE_PREFIX $trace"
> +done
> echo -n "Analyzing trace ($name): "
>
> -cnt=$($RUNLTTV -m text "$traces" | grep "$pattern" | wc -l)
> +cnt=$($lttv_trace_cmd | grep "$pattern" | wc -l)
> if [ -z "$expected_count" ]; then
> if [ "$cnt" -eq "0" ]; then
> echo "ERROR"
> --
> 1.7.2.3
>
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-02-18 20:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-18 17:59 [ltt-dev] [UST PATCH 1/3] Try harder to find a usable lttv in the tests scripts v2 Yannick Brosseau
2011-02-18 17:59 ` [ltt-dev] [UST PATCH 2/3] Use usttrace and libraries from the build directory in the test scripts Yannick Brosseau
2011-02-18 20:33 ` Mathieu Desnoyers
2011-02-18 17:59 ` [ltt-dev] [UST PATCH 3/3] Test for the presence of valgrind in the valgrind test Yannick Brosseau
2011-02-18 20:34 ` Mathieu Desnoyers
2011-02-18 20:32 ` [ltt-dev] [UST PATCH 1/3] Try harder to find a usable lttv in the tests scripts v2 Mathieu Desnoyers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox