[DTrace-devel] [PATCH 4/5] test: Add more diagnostic info to io tests

Kris Van Hees kris.van.hees at oracle.com
Thu Feb 22 03:50:21 UTC 2024


On Wed, Feb 21, 2024 at 01:48:50PM -0500, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

> ---
>  test/unittest/io/check_io_probe_args.sh | 32 ++++++++++++-------------
>  test/unittest/io/tst.local2.sh          |  2 ++
>  test/unittest/io/tst.nfs2.sh            |  2 ++
>  3 files changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/test/unittest/io/check_io_probe_args.sh b/test/unittest/io/check_io_probe_args.sh
> index 9a74b712..7a2b696f 100755
> --- a/test/unittest/io/check_io_probe_args.sh
> +++ b/test/unittest/io/check_io_probe_args.sh
> @@ -26,7 +26,7 @@ BEGIN {
>  
>  NF == 0 { next }      # skip empty lines
>  
> -NF != 23 { err = 1; print "  ERROR: garbled input: " $0; next }
> +NF != 23 { err = 1; print "  ERROR (" NR "): garbled input: " $0; next }
>  
>  {
>      nrecs++;
> @@ -57,16 +57,16 @@ NF != 23 { err = 1; print "  ERROR: garbled input: " $0; next }
>  
>      # Check probe description.
>  
> -    if (myprobeprov != "io:") { err = 1; print "  ERROR: provider is not io, got", myprobeprov }
> -    if (myprobemod != "vmlinux:") { err = 1; print "  ERROR: module is not vmlinux, got", myprobemod }
> -    if (myprobefunc != ":") { err = 1; print "  ERROR: function is not blank, got", myprobefunc }
> +    if (myprobeprov != "io:") { err = 1; print "  ERROR (" NR "): provider is not io, got", myprobeprov }
> +    if (myprobemod != "vmlinux:") { err = 1; print "  ERROR (" NR "): module is not vmlinux, got", myprobemod }
> +    if (myprobefunc != ":") { err = 1; print "  ERROR (" NR "): function is not blank, got", myprobefunc }
>      if (myprobename != "wait-start" &&
>          myprobename != "wait-done" &&
>          myprobename != "start" &&
> -        myprobename != "done") { err = 1; print "  ERROR: name is unrecognized", myprobename }
> +        myprobename != "done") { err = 1; print "  ERROR (" NR "): name is unrecognized", myprobename }
>  
>      # Check that args[2] is 0.
> -    if (myarg2 != 0) { err = 1; print "  ERROR: args[2] should be 0, got", myarg2 }
> +    if (myarg2 != 0) { err = 1; print "  ERROR (" NR "): args[2] should be 0, got", myarg2 }
>  
>      # Check for a legal set of flags.
>      {
> @@ -119,26 +119,26 @@ NF != 23 { err = 1; print "  ERROR: garbled input: " $0; next }
>  
>      # FIXME: can we add a check for myb_bcount?
>  
> -    if (myb_bufsize != myb_bcount) { err = 1; print "  ERROR: bcount and bufsize do not match", myb_bcount, myb_bufsize }
> +    if (myb_bufsize != myb_bcount) { err = 1; print "  ERROR (" NR "): bcount and bufsize do not match", myb_bcount, myb_bufsize }
>  
> -    if (myb_addr != "0") { err = 1; print "  ERROR: b_addr is not 0:", b_addr }
> -    if (myb_resid != "0") { err = 1; print "  ERROR: b_resid is not 0:", b_resid }
> -    if (myb_error != "0") { err = 1; print "  ERROR: b_error is not 0:", b_error }
> +    if (myb_addr != "0") { err = 1; print "  ERROR (" NR "): b_addr is not 0:", b_addr }
> +    if (myb_resid != "0") { err = 1; print "  ERROR (" NR "): b_resid is not 0:", b_resid }
> +    if (myb_error != "0") { err = 1; print "  ERROR (" NR "): b_error is not 0:", b_error }
>  
>      # FIXME: can we add a check for myb_lblkno?
>  
> -    if (myb_blkno != myb_lblkno) { err = 1; print "  ERROR: lblkno and blkno do not match", myb_lblkno, myb_blkno }
> +    if (myb_blkno != myb_lblkno) { err = 1; print "  ERROR (" NR "): lblkno and blkno do not match", myb_lblkno, myb_blkno }
>  
>      # FIXME: can we add a check for myb_iodone?
>      # FIXME: can we add a check for myb_edev?
>  
> -    if ( myb_major != rshift(myb_edev, 20)) { err = 1; print "  ERROR: b_major inconsistent with edev", myb_major, myb_edev }
> -    if ( myb_minor != and(myb_edev, 0xfffff)) { err = 1; print "  ERROR: b_minor inconsistent with edev", myb_minor, myb_edev }
> +    if ( myb_major != rshift(myb_edev, 20)) { err = 1; print "  ERROR (" NR "): b_major inconsistent with edev", myb_major, myb_edev }
> +    if ( myb_minor != and(myb_edev, 0xfffff)) { err = 1; print "  ERROR (" NR "): b_minor inconsistent with edev", myb_minor, myb_edev }
>  
> -    if (mydev_major != myb_major) { err = 1; print "  ERROR: b_major and dev_major do not match", myb_major, mydev_major }
> -    if (mydev_minor != myb_minor) { err = 1; print "  ERROR: b_minor and dev_minor do not match", myb_minor, mydev_minor }
> +    if (mydev_major != myb_major) { err = 1; print "  ERROR (" NR "): b_major and dev_major do not match", myb_major, mydev_major }
> +    if (mydev_minor != myb_minor) { err = 1; print "  ERROR (" NR "): b_minor and dev_minor do not match", myb_minor, mydev_minor }
>  
> -    if (mydev_instance != 0) { err = 1; print "  ERROR: dev_instance is not 0", mydev_instance }
> +    if (mydev_instance != 0) { err = 1; print "  ERROR (" NR "): dev_instance is not 0", mydev_instance }
>  
>      # FIXME: can we add a check for mydev_name?
>      # FIXME: can we add a check for mydev_statname?
> diff --git a/test/unittest/io/tst.local2.sh b/test/unittest/io/tst.local2.sh
> index 5b7084b3..326f6be4 100755
> --- a/test/unittest/io/tst.local2.sh
> +++ b/test/unittest/io/tst.local2.sh
> @@ -54,10 +54,12 @@ rm -f $iodir.img
>  
>  $check_args log.write
>  if [ $? -ne 0 ]; then
> +    cat log.write
>      retval=1
>  fi
>  $check_args log.read
>  if [ $? -ne 0 ]; then
> +    cat log.read
>      retval=1
>  fi
>  
> diff --git a/test/unittest/io/tst.nfs2.sh b/test/unittest/io/tst.nfs2.sh
> index dd3bef73..8f5f260a 100755
> --- a/test/unittest/io/tst.nfs2.sh
> +++ b/test/unittest/io/tst.nfs2.sh
> @@ -49,10 +49,12 @@ rmdir $exdir
>  
>  $check_args log.write
>  if [ $? -ne 0 ]; then
> +    cat log.write
>      retval=1
>  fi
>  $check_args log.read
>  if [ $? -ne 0 ]; then
> +    cat log.read
>      retval=1
>  fi
>  
> -- 
> 2.18.4
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list