lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20221017104312.16af5467@gandalf.local.home>
Date:   Mon, 17 Oct 2022 10:43:12 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
Cc:     Shuah Khan <shuah@...nel.org>, <linux-kernel@...r.kernel.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Akanksha J N <akanksha@...ux.vnet.ibm.com>
Subject: Re: [PATCH] selftests/ftrace: Add check for ping command for
 trigger tests

On Mon, 17 Oct 2022 15:49:27 +0530
"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com> wrote:

> All these tests depend on the ping command and will fail if it is not
> installed. Add an explicit check and mark the tests as unresolved if it
> isn't found.
> 
> Reported-by: Akanksha J N <akanksha@...ux.vnet.ibm.com>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@...ux.vnet.ibm.com>
> ---
>  .../trigger/inter-event/trigger-field-variable-support.tc    | 5 +++++
>  .../trigger/inter-event/trigger-inter-event-combined-hist.tc | 5 +++++
>  .../trigger/inter-event/trigger-onchange-action-hist.tc      | 5 +++++
>  .../trigger/inter-event/trigger-onmatch-action-hist.tc       | 5 +++++
>  .../trigger/inter-event/trigger-onmatch-onmax-action-hist.tc | 5 +++++
>  .../test.d/trigger/inter-event/trigger-onmax-action-hist.tc  | 5 +++++
>  .../trigger/inter-event/trigger-snapshot-action-hist.tc      | 5 +++++
>  .../trigger/inter-event/trigger-synthetic-event-dynstring.tc | 5 +++++
>  .../test.d/trigger/inter-event/trigger-trace-action-hist.tc  | 5 +++++
>  9 files changed, 45 insertions(+)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-field-variable-support.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-field-variable-support.tc
> index 41119e0440e960..b0969e6eed8375 100644
> --- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-field-variable-support.tc
> +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-field-variable-support.tc
> @@ -10,6 +10,11 @@ fail() { #msg
>  
>  echo "Test field variable support"
>  
> +if ! which ping; then
> +    echo "ping is not found. This test requires ping command."
> +    exit_unresolved
> +fi
> +

This looks like something we should add to the "requires:" field and not
add this type of logic in the test itself.

Something like this:

diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions
index 5f6cbec847fc..e13fe1d5bd6c 100644
--- a/tools/testing/selftests/ftrace/test.d/functions
+++ b/tools/testing/selftests/ftrace/test.d/functions
@@ -144,7 +144,13 @@ check_requires() { # Check required files and tracers
     for i in "$@" ; do
         r=${i%:README}
         t=${i%:tracer}
-        if [ $t != $i ]; then
+        p=${i%:program}
+        if [ $p != $i ]; then
+            if ! which $p; then
+                echo "Required program $p not installed."
+                exit_unresolved
+            fi
+        elif [ $t != $i ]; then
             if ! grep -wq $t available_tracers ; then
                 echo "Required tracer $t is not configured."
                 exit_unsupported
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-inter-event-combined-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-inter-event-combined-hist.tc
index 9098f1e7433f..f7447d800899 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-inter-event-combined-hist.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-inter-event-combined-hist.tc
@@ -1,7 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 # description: event trigger - test inter-event combined histogram trigger
-# requires: set_event synthetic_events events/sched/sched_process_fork/hist
+# requires: set_event synthetic_events events/sched/sched_process_fork/hist ping:program
 
 fail() { #msg
     echo $1


Then add the "ping:program" to the other tests required fields.

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ