Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [ltt-dev] [UST PATCH] Try harder to find a usable lttv in the tests scripts
@ 2011-02-15 23:43 Yannick Brosseau
  2011-02-16  2:37 ` Mathieu Desnoyers
       [not found] ` <BLU0-SMTP965F3876D7E258F1C2368196D20@phx.gbl>
  0 siblings, 2 replies; 3+ messages in thread
From: Yannick Brosseau @ 2011-02-15 23:43 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

Signed-off-by: Yannick Brosseau <yannick.brosseau at gmail.com>
---
 tests/test_functions.sh |   33 +++++++++++++++++++++++++++++----
 tests/trace_matches     |   37 ++++++++++++++++++++++++++++++-------
 2 files changed, 59 insertions(+), 11 deletions(-)

diff --git a/tests/test_functions.sh b/tests/test_functions.sh
index 40d4d89..c0cdeb2 100644
--- a/tests/test_functions.sh
+++ b/tests/test_functions.sh
@@ -42,11 +42,36 @@ 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 "
+	
+    elif [ -d "$RUNLTTV" -a -x "$RUNLTTV/runlttv" ]; then 
+	LTTV_TEXTDUMP_CMD="$RUNLTTV/runlttv -m text "
+	
+    elif [ ! -d "$LTTV" -a -x "$LTTV" ]; then
+	LTTV_TEXTDUMP_CMD="$LTTV -m textDump -t "
+	
+    elif [ -d "$LTTV" -a -x "$LTTV/lttv" ]; then
+	LTTV_TEXTDUMP_CMD="$LTTV/lttv -m textDump -t "
+	
+    elif [ -x "$(which lttv.real)" ]; then
+	LTTV_TEXTDUMP_CMD="$(which lttv.real) -m textDump -t ";
+	
+    elif [ -x "~/devel/lttv/runlttv" ]; then
+	LTTV_TEXTDUMP_CMD="~/devel/lttv/runlttv -m text ";
+	
+    elif [ -x "$(dirname `readlink -f $0`)/../../lttv/runlttv" ]; then
+	LTTV_TEXTDUMP_CMD="$(dirname `readlink -f $0`)/../../lttv/runlttv -m text "
+    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
@@ -72,7 +97,7 @@ function trace_matches() {
     fi
     traces=$(find "$2" -mindepth 1 -maxdepth 1 -type d)
 
-    cnt=$($RUNLTTV -m text "$traces" | grep "$pattern" | wc -l)
+    cnt=$($LTTV_TEXTDUMP_CMD "$traces" | 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..25df2fd 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,36 @@ 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 "
+
+elif [ -d "$RUNLTTV" -a -x "$RUNLTTV/runlttv" ]; then 
+	LTTV_TEXTDUMP_CMD="$RUNLTTV/runlttv -m text "
+
+elif [ ! -d "$LTTV" -a -x "$LTTV" ]; then
+	LTTV_TEXTDUMP_CMD="$LTTV -m textDump -t "
+		
+elif [ -d "$LTTV" -a -x "$LTTV/lttv" ]; then
+	LTTV_TEXTDUMP_CMD="$LTTV/lttv -m textDump -t "
+
+elif [ -x "$(which lttv.real)" ]; then
+	LTTV_TEXTDUMP_CMD="$(which lttv.real) -m textDump -t ";
+
+elif [ -x "~/devel/lttv/runlttv" ]; then
+	LTTV_TEXTDUMP_CMD="~/devel/lttv/runlttv -m text ";
+
+elif [ -x "$(dirname `readlink -f $0`)/../../lttv/runlttv" ]; then
+	LTTV_TEXTDUMP_CMD="$(dirname `readlink -f $0`)/../../lttv/runlttv -m text "
+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
@@ -47,7 +70,7 @@ traces=$(find "$2" -mindepth 1 -maxdepth 1 -type d)
 
 echo -n "Analyzing trace ($name): "
 
-cnt=$($RUNLTTV -m text "$traces" | grep "$pattern" | wc -l)
+cnt=$($LTTV_TEXTDUMP_CMD "$traces" | 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] 3+ messages in thread

* [ltt-dev] [UST PATCH] Try harder to find a usable lttv in the tests scripts
  2011-02-15 23:43 [ltt-dev] [UST PATCH] Try harder to find a usable lttv in the tests scripts Yannick Brosseau
@ 2011-02-16  2:37 ` Mathieu Desnoyers
       [not found] ` <BLU0-SMTP965F3876D7E258F1C2368196D20@phx.gbl>
  1 sibling, 0 replies; 3+ messages in thread
From: Mathieu Desnoyers @ 2011-02-16  2:37 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

Hrm, what is so special about runlttv that it needs to look into the
depths of ~/devel for lttv ?

If we install runlttv into the same directory as lttv, shouldn't we try
to use the path leading to the runlttv executable as the first attempt
to find lttv instead ?

Thanks,

Mathieu

> 
> Signed-off-by: Yannick Brosseau <yannick.brosseau at gmail.com>
> ---
>  tests/test_functions.sh |   33 +++++++++++++++++++++++++++++----
>  tests/trace_matches     |   37 ++++++++++++++++++++++++++++++-------
>  2 files changed, 59 insertions(+), 11 deletions(-)
> 
> diff --git a/tests/test_functions.sh b/tests/test_functions.sh
> index 40d4d89..c0cdeb2 100644
> --- a/tests/test_functions.sh
> +++ b/tests/test_functions.sh
> @@ -42,11 +42,36 @@ 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 "
> +	
> +    elif [ -d "$RUNLTTV" -a -x "$RUNLTTV/runlttv" ]; then 
> +	LTTV_TEXTDUMP_CMD="$RUNLTTV/runlttv -m text "
> +	
> +    elif [ ! -d "$LTTV" -a -x "$LTTV" ]; then
> +	LTTV_TEXTDUMP_CMD="$LTTV -m textDump -t "
> +	
> +    elif [ -d "$LTTV" -a -x "$LTTV/lttv" ]; then
> +	LTTV_TEXTDUMP_CMD="$LTTV/lttv -m textDump -t "
> +	
> +    elif [ -x "$(which lttv.real)" ]; then
> +	LTTV_TEXTDUMP_CMD="$(which lttv.real) -m textDump -t ";
> +	
> +    elif [ -x "~/devel/lttv/runlttv" ]; then
> +	LTTV_TEXTDUMP_CMD="~/devel/lttv/runlttv -m text ";
> +	
> +    elif [ -x "$(dirname `readlink -f $0`)/../../lttv/runlttv" ]; then
> +	LTTV_TEXTDUMP_CMD="$(dirname `readlink -f $0`)/../../lttv/runlttv -m text "
> +    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
> @@ -72,7 +97,7 @@ function trace_matches() {
>      fi
>      traces=$(find "$2" -mindepth 1 -maxdepth 1 -type d)
>  
> -    cnt=$($RUNLTTV -m text "$traces" | grep "$pattern" | wc -l)
> +    cnt=$($LTTV_TEXTDUMP_CMD "$traces" | 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..25df2fd 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,36 @@ 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 "
> +
> +elif [ -d "$RUNLTTV" -a -x "$RUNLTTV/runlttv" ]; then 
> +	LTTV_TEXTDUMP_CMD="$RUNLTTV/runlttv -m text "
> +
> +elif [ ! -d "$LTTV" -a -x "$LTTV" ]; then
> +	LTTV_TEXTDUMP_CMD="$LTTV -m textDump -t "
> +		
> +elif [ -d "$LTTV" -a -x "$LTTV/lttv" ]; then
> +	LTTV_TEXTDUMP_CMD="$LTTV/lttv -m textDump -t "
> +
> +elif [ -x "$(which lttv.real)" ]; then
> +	LTTV_TEXTDUMP_CMD="$(which lttv.real) -m textDump -t ";
> +
> +elif [ -x "~/devel/lttv/runlttv" ]; then
> +	LTTV_TEXTDUMP_CMD="~/devel/lttv/runlttv -m text ";
> +
> +elif [ -x "$(dirname `readlink -f $0`)/../../lttv/runlttv" ]; then
> +	LTTV_TEXTDUMP_CMD="$(dirname `readlink -f $0`)/../../lttv/runlttv -m text "
> +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
> @@ -47,7 +70,7 @@ traces=$(find "$2" -mindepth 1 -maxdepth 1 -type d)
>  
>  echo -n "Analyzing trace ($name): "
>  
> -cnt=$($RUNLTTV -m text "$traces" | grep "$pattern" | wc -l)
> +cnt=$($LTTV_TEXTDUMP_CMD "$traces" | 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] 3+ messages in thread

* [ltt-dev] [UST PATCH] Try harder to find a usable lttv in the tests scripts
       [not found] ` <BLU0-SMTP965F3876D7E258F1C2368196D20@phx.gbl>
@ 2011-02-16  2:41   ` Yannick Brosseau
  0 siblings, 0 replies; 3+ messages in thread
From: Yannick Brosseau @ 2011-02-16  2:41 UTC (permalink / raw)


On 2011-02-15 21:37, Mathieu Desnoyers wrote:
> * 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
>>     
> Hrm, what is so special about runlttv that it needs to look into the
> depths of ~/devel for lttv ?
>
> If we install runlttv into the same directory as lttv, shouldn't we try
> to use the path leading to the runlttv executable as the first attempt
> to find lttv instead ?
>
>   

runlttv is never installed. It's a script to help you run the compiled
lttv in your development directory.

The ~/devel path lookup is kept there because it is the placed it
currently look.

Yannick




> Thanks,
>
> Mathieu
>
>   
>> Signed-off-by: Yannick Brosseau <yannick.brosseau at gmail.com>
>> ---
>>  tests/test_functions.sh |   33 +++++++++++++++++++++++++++++----
>>  tests/trace_matches     |   37 ++++++++++++++++++++++++++++++-------
>>  2 files changed, 59 insertions(+), 11 deletions(-)
>>
>> diff --git a/tests/test_functions.sh b/tests/test_functions.sh
>> index 40d4d89..c0cdeb2 100644
>> --- a/tests/test_functions.sh
>> +++ b/tests/test_functions.sh
>> @@ -42,11 +42,36 @@ 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 "
>> +	
>> +    elif [ -d "$RUNLTTV" -a -x "$RUNLTTV/runlttv" ]; then 
>> +	LTTV_TEXTDUMP_CMD="$RUNLTTV/runlttv -m text "
>> +	
>> +    elif [ ! -d "$LTTV" -a -x "$LTTV" ]; then
>> +	LTTV_TEXTDUMP_CMD="$LTTV -m textDump -t "
>> +	
>> +    elif [ -d "$LTTV" -a -x "$LTTV/lttv" ]; then
>> +	LTTV_TEXTDUMP_CMD="$LTTV/lttv -m textDump -t "
>> +	
>> +    elif [ -x "$(which lttv.real)" ]; then
>> +	LTTV_TEXTDUMP_CMD="$(which lttv.real) -m textDump -t ";
>> +	
>> +    elif [ -x "~/devel/lttv/runlttv" ]; then
>> +	LTTV_TEXTDUMP_CMD="~/devel/lttv/runlttv -m text ";
>> +	
>> +    elif [ -x "$(dirname `readlink -f $0`)/../../lttv/runlttv" ]; then
>> +	LTTV_TEXTDUMP_CMD="$(dirname `readlink -f $0`)/../../lttv/runlttv -m text "
>> +    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
>> @@ -72,7 +97,7 @@ function trace_matches() {
>>      fi
>>      traces=$(find "$2" -mindepth 1 -maxdepth 1 -type d)
>>  
>> -    cnt=$($RUNLTTV -m text "$traces" | grep "$pattern" | wc -l)
>> +    cnt=$($LTTV_TEXTDUMP_CMD "$traces" | 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..25df2fd 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,36 @@ 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 "
>> +
>> +elif [ -d "$RUNLTTV" -a -x "$RUNLTTV/runlttv" ]; then 
>> +	LTTV_TEXTDUMP_CMD="$RUNLTTV/runlttv -m text "
>> +
>> +elif [ ! -d "$LTTV" -a -x "$LTTV" ]; then
>> +	LTTV_TEXTDUMP_CMD="$LTTV -m textDump -t "
>> +		
>> +elif [ -d "$LTTV" -a -x "$LTTV/lttv" ]; then
>> +	LTTV_TEXTDUMP_CMD="$LTTV/lttv -m textDump -t "
>> +
>> +elif [ -x "$(which lttv.real)" ]; then
>> +	LTTV_TEXTDUMP_CMD="$(which lttv.real) -m textDump -t ";
>> +
>> +elif [ -x "~/devel/lttv/runlttv" ]; then
>> +	LTTV_TEXTDUMP_CMD="~/devel/lttv/runlttv -m text ";
>> +
>> +elif [ -x "$(dirname `readlink -f $0`)/../../lttv/runlttv" ]; then
>> +	LTTV_TEXTDUMP_CMD="$(dirname `readlink -f $0`)/../../lttv/runlttv -m text "
>> +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
>> @@ -47,7 +70,7 @@ traces=$(find "$2" -mindepth 1 -maxdepth 1 -type d)
>>  
>>  echo -n "Analyzing trace ($name): "
>>  
>> -cnt=$($RUNLTTV -m text "$traces" | grep "$pattern" | wc -l)
>> +cnt=$($LTTV_TEXTDUMP_CMD "$traces" | 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
>>
>>     
>   





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-16  2:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-15 23:43 [ltt-dev] [UST PATCH] Try harder to find a usable lttv in the tests scripts Yannick Brosseau
2011-02-16  2:37 ` Mathieu Desnoyers
     [not found] ` <BLU0-SMTP965F3876D7E258F1C2368196D20@phx.gbl>
2011-02-16  2:41   ` Yannick Brosseau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox