All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf test: Fix exit code for record+probe_libc_inet_pton.sh
@ 2018-03-12 12:44 Sandipan Das
  2018-03-12 13:05 ` Jiri Olsa
  2018-03-20  6:30 ` [tip:perf/core] " tip-bot for Sandipan Das
  0 siblings, 2 replies; 4+ messages in thread
From: Sandipan Das @ 2018-03-12 12:44 UTC (permalink / raw)
  To: acme, jolsa; +Cc: linux-kernel, naveen.n.rao

This fixes record+probe_libc_inet_pton.sh from always exiting
with code 0 and making the test pass even if the perf script
output does not match the expected pattern.

The issue can be observed if this test is run with the verbose
flags as shown below:

60: probe libc's inet_pton & backtrace it with ping       :
...
ping 19602 [006] 16988.413767: probe_libc:inet_pton: (7fff9a2c42e8)
1842e8 __GI___inet_pton (/usr/lib64/libc-2.26.so)
130db4 getaddrinfo (/usr/lib64/libc-2.26.so)

FAIL: expected backtrace entry 3 ".*\(.*/bin/ping.*\)$" got ""
test child finished with 0
...
probe libc's inet_pton & backtrace it with ping: Ok

Fixes: e07d585e2454 ("perf tests: Switch trace+probe_libc_inet_pton to use record")
Signed-off-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
---
 tools/perf/tests/shell/record+probe_libc_inet_pton.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
index 52c3ee701a89..1ecc1f0ff84a 100755
--- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
@@ -47,7 +47,10 @@ trace_libc_inet_pton_backtrace() {
 		[ -z "${expected[$idx]}" ] && break
 	done
 
-	rm -f $file
+	# If any statements are executed from this point onwards,
+	# the exit code of the last among these will be reflected
+	# in err below. If the exit code is 0, the test will pass
+	# even if the perf script output does not match.
 }
 
 # Check for IPv6 interface existence
-- 
2.14.3

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

* Re: [PATCH] perf test: Fix exit code for record+probe_libc_inet_pton.sh
  2018-03-12 12:44 [PATCH] perf test: Fix exit code for record+probe_libc_inet_pton.sh Sandipan Das
@ 2018-03-12 13:05 ` Jiri Olsa
  2018-03-12 16:53   ` Sandipan Das
  2018-03-20  6:30 ` [tip:perf/core] " tip-bot for Sandipan Das
  1 sibling, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2018-03-12 13:05 UTC (permalink / raw)
  To: Sandipan Das; +Cc: acme, jolsa, linux-kernel, naveen.n.rao

On Mon, Mar 12, 2018 at 06:14:50PM +0530, Sandipan Das wrote:
> This fixes record+probe_libc_inet_pton.sh from always exiting
> with code 0 and making the test pass even if the perf script
> output does not match the expected pattern.
> 
> The issue can be observed if this test is run with the verbose
> flags as shown below:
> 
> 60: probe libc's inet_pton & backtrace it with ping       :
> ...
> ping 19602 [006] 16988.413767: probe_libc:inet_pton: (7fff9a2c42e8)
> 1842e8 __GI___inet_pton (/usr/lib64/libc-2.26.so)
> 130db4 getaddrinfo (/usr/lib64/libc-2.26.so)
> 
> FAIL: expected backtrace entry 3 ".*\(.*/bin/ping.*\)$" got ""
> test child finished with 0
> ...
> probe libc's inet_pton & backtrace it with ping: Ok
> 
> Fixes: e07d585e2454 ("perf tests: Switch trace+probe_libc_inet_pton to use record")
> Signed-off-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
> ---
>  tools/perf/tests/shell/record+probe_libc_inet_pton.sh | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
> index 52c3ee701a89..1ecc1f0ff84a 100755
> --- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
> +++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
> @@ -47,7 +47,10 @@ trace_libc_inet_pton_backtrace() {
>  		[ -z "${expected[$idx]}" ] && break
>  	done
>  
> -	rm -f $file
> +	# If any statements are executed from this point onwards,
> +	# the exit code of the last among these will be reflected
> +	# in err below. If the exit code is 0, the test will pass
> +	# even if the perf script output does not match.

right :-\ but we still need to delete that $file.. I assume it will
get delete by the 'rm -f ${file}' in the script main body?

thanks,
jirka

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

* Re: [PATCH] perf test: Fix exit code for record+probe_libc_inet_pton.sh
  2018-03-12 13:05 ` Jiri Olsa
@ 2018-03-12 16:53   ` Sandipan Das
  0 siblings, 0 replies; 4+ messages in thread
From: Sandipan Das @ 2018-03-12 16:53 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: acme, jolsa, linux-kernel, naveen.n.rao



On 03/12/2018 06:35 PM, Jiri Olsa wrote:
> On Mon, Mar 12, 2018 at 06:14:50PM +0530, Sandipan Das wrote:
>> This fixes record+probe_libc_inet_pton.sh from always exiting
>> with code 0 and making the test pass even if the perf script
>> output does not match the expected pattern.
>>
>> The issue can be observed if this test is run with the verbose
>> flags as shown below:
>>
>> 60: probe libc's inet_pton & backtrace it with ping       :
>> ...
>> ping 19602 [006] 16988.413767: probe_libc:inet_pton: (7fff9a2c42e8)
>> 1842e8 __GI___inet_pton (/usr/lib64/libc-2.26.so)
>> 130db4 getaddrinfo (/usr/lib64/libc-2.26.so)
>>
>> FAIL: expected backtrace entry 3 ".*\(.*/bin/ping.*\)$" got ""
>> test child finished with 0
>> ...
>> probe libc's inet_pton & backtrace it with ping: Ok
>>
>> Fixes: e07d585e2454 ("perf tests: Switch trace+probe_libc_inet_pton to use record")
>> Signed-off-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
>> ---
>>  tools/perf/tests/shell/record+probe_libc_inet_pton.sh | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
>> index 52c3ee701a89..1ecc1f0ff84a 100755
>> --- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
>> +++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
>> @@ -47,7 +47,10 @@ trace_libc_inet_pton_backtrace() {
>>  		[ -z "${expected[$idx]}" ] && break
>>  	done
>>  
>> -	rm -f $file
>> +	# If any statements are executed from this point onwards,
>> +	# the exit code of the last among these will be reflected
>> +	# in err below. If the exit code is 0, the test will pass
>> +	# even if the perf script output does not match.
> 
> right :-\ but we still need to delete that $file.. I assume it will
> get delete by the 'rm -f ${file}' in the script main body?
> 
> thanks,
> jirka
> 
> 

Yes, that deletes $file.

--
With Regards,
Sandipan

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

* [tip:perf/core] perf test: Fix exit code for record+probe_libc_inet_pton.sh
  2018-03-12 12:44 [PATCH] perf test: Fix exit code for record+probe_libc_inet_pton.sh Sandipan Das
  2018-03-12 13:05 ` Jiri Olsa
@ 2018-03-20  6:30 ` tip-bot for Sandipan Das
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Sandipan Das @ 2018-03-20  6:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, tglx, linux-kernel, sandipan, jolsa, naveen.n.rao, hpa, mingo

Commit-ID:  10f354a36f9a9aa1b8bffe0abc1cd43822a85bcd
Gitweb:     https://git.kernel.org/tip/10f354a36f9a9aa1b8bffe0abc1cd43822a85bcd
Author:     Sandipan Das <sandipan@linux.vnet.ibm.com>
AuthorDate: Mon, 12 Mar 2018 18:14:50 +0530
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Mar 2018 13:56:31 -0300

perf test: Fix exit code for record+probe_libc_inet_pton.sh

This fixes record+probe_libc_inet_pton.sh from always exiting with code
0 and making the test pass even if the perf script output does not match
the expected pattern.

The issue can be observed if this test is run with the verbose flags as
shown below:

  60: probe libc's inet_pton & backtrace it with ping       :
  ...
  ping 19602 [006] 16988.413767: probe_libc:inet_pton: (7fff9a2c42e8)
  1842e8 __GI___inet_pton (/usr/lib64/libc-2.26.so)
  130db4 getaddrinfo (/usr/lib64/libc-2.26.so)

  FAIL: expected backtrace entry 3 ".*\(.*/bin/ping.*\)$" got ""
  test child finished with 0
  ...
  probe libc's inet_pton & backtrace it with ping: Ok

Signed-off-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Fixes: e07d585e2454 ("perf tests: Switch trace+probe_libc_inet_pton to use record")
Link: http://lkml.kernel.org/r/20180312124450.30371-1-sandipan@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/shell/record+probe_libc_inet_pton.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
index 52c3ee701a89..1ecc1f0ff84a 100755
--- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
@@ -47,7 +47,10 @@ trace_libc_inet_pton_backtrace() {
 		[ -z "${expected[$idx]}" ] && break
 	done
 
-	rm -f $file
+	# If any statements are executed from this point onwards,
+	# the exit code of the last among these will be reflected
+	# in err below. If the exit code is 0, the test will pass
+	# even if the perf script output does not match.
 }
 
 # Check for IPv6 interface existence

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

end of thread, other threads:[~2018-03-20  6:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-12 12:44 [PATCH] perf test: Fix exit code for record+probe_libc_inet_pton.sh Sandipan Das
2018-03-12 13:05 ` Jiri Olsa
2018-03-12 16:53   ` Sandipan Das
2018-03-20  6:30 ` [tip:perf/core] " tip-bot for Sandipan Das

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.