diff mbox series

UBUNTU: SAUCE: ubuntu_sysdig_smoke_test: fix test missing file names

Message ID 20210603103620.26065-1-krzysztof.kozlowski@canonical.com
State New
Headers show
Series UBUNTU: SAUCE: ubuntu_sysdig_smoke_test: fix test missing file names | expand

Commit Message

Krzysztof Kozlowski June 3, 2021, 10:36 a.m. UTC
The sysdig is unable to report the name of file used in reads and
writes.  This maybe worked some time ago, but definitely does not work
with sysdig 0.27.1.

For dd, cat or cp, the sysdig reports only arguments:
  cp (3558) < execve res=0 exe=cp args=/tmp/somefile./tmp/otherfile. tid=3558(cp) pid=3558(cp) ptid=1151(bash)

and all further reads/writes are to file descriptors, e.g.:
  write fd=4 size=131072

Also sysdig reporting tools fail to find the name of file used in IO:

  $ sysdig -r ${TMPFILE}.raw -c fdbytes_by fd.name
  Bytes               fd.name
  ------------------------------------------------
  1024.00KB           /dev/pts/1

  $ sysdig -r ${TMPFILE}.raw -c echo_fds
  ------ Write 1024B to   /dev/pts/1 (dd)

Fix the test by looking only for reads or writes tgo any descriptor.  It
is clearly a limitation of sysdig so the test should not expect and test
more than the tool can provide.

This fixes the test failures like:

  FAILED (trace at least 25 reads of /dev/zero by dd)
  FAILED (trace at least 25 writes to /dev/null by dd)

BugLink: https://bugs.launchpad.net/bugs/1844493
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Colin Ian King June 3, 2021, 10:40 a.m. UTC | #1
On 03/06/2021 11:36, Krzysztof Kozlowski wrote:
> The sysdig is unable to report the name of file used in reads and
> writes.  This maybe worked some time ago, but definitely does not work
> with sysdig 0.27.1.
> 
> For dd, cat or cp, the sysdig reports only arguments:
>   cp (3558) < execve res=0 exe=cp args=/tmp/somefile./tmp/otherfile. tid=3558(cp) pid=3558(cp) ptid=1151(bash)
> 
> and all further reads/writes are to file descriptors, e.g.:
>   write fd=4 size=131072
> 
> Also sysdig reporting tools fail to find the name of file used in IO:
> 
>   $ sysdig -r ${TMPFILE}.raw -c fdbytes_by fd.name
>   Bytes               fd.name
>   ------------------------------------------------
>   1024.00KB           /dev/pts/1
> 
>   $ sysdig -r ${TMPFILE}.raw -c echo_fds
>   ------ Write 1024B to   /dev/pts/1 (dd)
> 
> Fix the test by looking only for reads or writes tgo any descriptor.  It
> is clearly a limitation of sysdig so the test should not expect and test
> more than the tool can provide.
> 
> This fixes the test failures like:
> 
>   FAILED (trace at least 25 reads of /dev/zero by dd)
>   FAILED (trace at least 25 writes to /dev/null by dd)
> 
> BugLink: https://bugs.launchpad.net/bugs/1844493
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh b/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh
> index b6df4564ef73..bfd6bdca2d29 100755
> --- a/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh
> +++ b/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh
> @@ -140,8 +140,8 @@ test_sysdig_context_switch()
>  
>  		events=$(wc -l ${TMPFILE} | cut -d' ' -f1)
>  		switches=$(grep switch ${TMPFILE} | wc -l | cut -d' ' -f1)
> -		ddrdzero=$(grep read ${TMPFILE} | grep "/dev/zero" | wc -l | cut -d' ' -f1)
> -		ddwrnull=$(grep write ${TMPFILE} | grep "/dev/null" | wc -l | cut -d' ' -f1)
> +		ddrdzero=$(grep read ${TMPFILE} | wc -l | cut -d' ' -f1)
> +		ddwrnull=$(grep write ${TMPFILE} | wc -l | cut -d' ' -f1)
>  
>  		if [ $switches -ge ${THRESHOLD} -a \
>  		     $ddrdzero -ge ${THRESHOLD} -a \
> 

Thanks, this always have been a bit of a bodged test, so that's a very
reasonable improvement fix.

Acked-by: Colin Ian King <colin.king@canonical.com>
Guilherme G. Piccoli June 3, 2021, 11:17 a.m. UTC | #2
On Thu, Jun 3, 2021 at 7:36 AM Krzysztof Kozlowski
<krzysztof.kozlowski@canonical.com> wrote:
>
> The sysdig is unable to report the name of file used in reads and
> writes.  This maybe worked some time ago, but definitely does not work
> with sysdig 0.27.1.
>
> For dd, cat or cp, the sysdig reports only arguments:
>   cp (3558) < execve res=0 exe=cp args=/tmp/somefile./tmp/otherfile. tid=3558(cp) pid=3558(cp) ptid=1151(bash)
>
> and all further reads/writes are to file descriptors, e.g.:
>   write fd=4 size=131072
>
> Also sysdig reporting tools fail to find the name of file used in IO:
>
>   $ sysdig -r ${TMPFILE}.raw -c fdbytes_by fd.name
>   Bytes               fd.name
>   ------------------------------------------------
>   1024.00KB           /dev/pts/1
>
>   $ sysdig -r ${TMPFILE}.raw -c echo_fds
>   ------ Write 1024B to   /dev/pts/1 (dd)
>
> Fix the test by looking only for reads or writes tgo any descriptor.  It
> is clearly a limitation of sysdig so the test should not expect and test
> more than the tool can provide.
>
> This fixes the test failures like:
>
>   FAILED (trace at least 25 reads of /dev/zero by dd)
>   FAILED (trace at least 25 writes to /dev/null by dd)
>
> BugLink: https://bugs.launchpad.net/bugs/1844493
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh b/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh
> index b6df4564ef73..bfd6bdca2d29 100755
> --- a/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh
> +++ b/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh
> @@ -140,8 +140,8 @@ test_sysdig_context_switch()
>
>                 events=$(wc -l ${TMPFILE} | cut -d' ' -f1)
>                 switches=$(grep switch ${TMPFILE} | wc -l | cut -d' ' -f1)
> -               ddrdzero=$(grep read ${TMPFILE} | grep "/dev/zero" | wc -l | cut -d' ' -f1)
> -               ddwrnull=$(grep write ${TMPFILE} | grep "/dev/null" | wc -l | cut -d' ' -f1)
> +               ddrdzero=$(grep read ${TMPFILE} | wc -l | cut -d' ' -f1)
> +               ddwrnull=$(grep write ${TMPFILE} | wc -l | cut -d' ' -f1)
>
>                 if [ $switches -ge ${THRESHOLD} -a \
>                      $ddrdzero -ge ${THRESHOLD} -a \

Thanks for fixing the tests Krzysztof!
Acked-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
Po-Hsu Lin June 3, 2021, 12:24 p.m. UTC | #3
You can add [autotest-client-tests] or [ACT] to the title to make this
stand out from other kernel-releated patches.

Thanks for the fix!

Applied and pushed.
Sam
diff mbox series

Patch

diff --git a/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh b/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh
index b6df4564ef73..bfd6bdca2d29 100755
--- a/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh
+++ b/ubuntu_sysdig_smoke_test/ubuntu_sysdig_smoke_test.sh
@@ -140,8 +140,8 @@  test_sysdig_context_switch()
 
 		events=$(wc -l ${TMPFILE} | cut -d' ' -f1)
 		switches=$(grep switch ${TMPFILE} | wc -l | cut -d' ' -f1)
-		ddrdzero=$(grep read ${TMPFILE} | grep "/dev/zero" | wc -l | cut -d' ' -f1)
-		ddwrnull=$(grep write ${TMPFILE} | grep "/dev/null" | wc -l | cut -d' ' -f1)
+		ddrdzero=$(grep read ${TMPFILE} | wc -l | cut -d' ' -f1)
+		ddwrnull=$(grep write ${TMPFILE} | wc -l | cut -d' ' -f1)
 
 		if [ $switches -ge ${THRESHOLD} -a \
 		     $ddrdzero -ge ${THRESHOLD} -a \