poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/2] nbd: Add testsuite coverage


From: Jose E. Marchesi
Subject: Re: [PATCH v2 2/2] nbd: Add testsuite coverage
Date: Fri, 28 Feb 2020 11:55:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hi Eric.

    +Using NBD connections in tests
    +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    +
    +If your test requires an NBD server (only useful when poke is compiled
    +with libnbd), the dg-nbd directive is what you need.  It has one form::
    +
    +  /* { dg-nbd foo.data /tmp/pokenbd.[pid]/sock } */
    +
    +This serves a previously-created temporary file (use dg-data with the
    +named file form) over the named Unix socket.  The server at this
    +socket is provided by nbdkit, and will be shut down gracefully when
    +the testsuite completes.
    +
    +To use the server as an IO space, your test will then follow up with::
    +
    +  /* { dg-command "open (\"nbd+unix:///?socket=/tmp/pokenbd.[pid]/sock\")" 
} */

Does NBDKIT == "yes" imply an unix environment?  If not, we may need to
add extra logic to skip these tests in non-unix systems (such as mingw
or cygwin.)
    
    +# Create a temporary NBD server for a file previously create with the

s/create/created/

         # Uncomment the following couple of lines to run the testsuite with
    -    # valgring.
    +    # valgrind.

Spurious change?

    diff --git a/testsuite/poke.cmd/nbd.pk b/testsuite/poke.cmd/nbd.pk
    new file mode 100644
    index 00000000..f7296da9
    --- /dev/null
    +++ b/testsuite/poke.cmd/nbd.pk
    @@ -0,0 +1,8 @@
    +/* { dg-do run } */
    +/* { dg-data {c*} {0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80} nbddata } */
    +/* { dg-nbd nbddata /tmp/pokenbd.[pid]/sock } */
    +
    +/* { dg-command ".nbd nbd+unix:///?socket=/tmp/pokenbd.[pid]/sock" } */
    +/* { dg-command {.set obase 16} }  */
    +/* { dg-command { byte[8] @ 0#B } } */
    +/* { dg-output {[0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80]} } */

Please call the test nbd-1.pk.  This will avoid renames when we add more
tests for the .nbd command.

    diff --git a/testsuite/poke.pkl/open-3.pk b/testsuite/poke.pkl/open-3.pk
    new file mode 100644
    index 00000000..57b45f2e
    --- /dev/null
    +++ b/testsuite/poke.pkl/open-3.pk
    @@ -0,0 +1,8 @@
    +/* { dg-do run } */
    +/* { dg-data {c*} {0x10} nbddata } */
    +/* { dg-nbd nbddata /tmp/pokenbd.[pid]/open-3 } */
    +
    +/* { dg-command { .set obase 10 } } */
    +/* { dg-command "defvar foo = open 
(\"nbd+unix:///?socket=/tmp/pokenbd.[pid]/open-3\")" } */
    +/* { dg-command { get_ios == foo } } */
    +/* { dg-output "1" } */

Very nice :)
We are gonna also need a few tests mapping stuff (both read and write)
in a NBD ios.

Thanks!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]