[PATCH] UBUNTU: SAUCE: ubuntu_sysdig_smoke_test: fix test missing file names

Krzysztof Kozlowski krzysztof.kozlowski at canonical.com
Thu Jun 3 10:36:20 UTC 2021

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 at 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 \

More information about the kernel-team mailing list