All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org, eblake@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] test: replace gtester with a TAP driver
Date: Fri, 30 Nov 2018 15:50:03 +0000	[thread overview]
Message-ID: <20181130155003.GG9162@redhat.com> (raw)
In-Reply-To: <1543513531-1151-3-git-send-email-pbonzini@redhat.com>

On Thu, Nov 29, 2018 at 06:45:31PM +0100, Paolo Bonzini wrote:
> gtester is deprecated by upstream glib and it does not support tests
> that call g_test_skip in some glib stable releases.
> 
> glib suggests instead using Automake's TAP support.  We do not support
> Automake, but we can copy the code that beautifies the TAP output and
> use it.  I chose to use the Perl copy rather than the shell/awk one,
> in order to reuse Perl's TAP parsing package, but I'm open to suggestions
> about which language to use.

Do we even need the beutifier ?

IIUC, this output is only seen when you with 'make check' passing V=1,
so most people won't see it.

When V=1 is set, it just changes:

$ ./tests/test-io-channel-socket -k --tap
# random seed: R02Sb9d02d2a9658ae1be211540f5ceebc01
1..9
# Start of io tests
# Start of channel tests
# Start of socket tests
ok 1 /io/channel/socket/ipv4-sync
ok 2 /io/channel/socket/ipv4-async
ok 3 /io/channel/socket/ipv4-fd
ok 4 /io/channel/socket/ipv6-sync
ok 5 /io/channel/socket/ipv6-async
ok 6 /io/channel/socket/unix-sync
ok 7 /io/channel/socket/unix-async
**
ERROR:tests/test-io-channel-socket.c:424:test_io_channel_unix_fd_pass: assertion failed: (0)
Bail out! ERROR:tests/test-io-channel-socket.c:424:test_io_channel_unix_fd_pass: assertion failed: (0)
Aborted (core dumped)


To look like:

$ ./tests/test-io-channel-socket -k --tap | ./scripts/tap-driver.pl 
PASS 1 /io/channel/socket/ipv4-sync
PASS 2 /io/channel/socket/ipv4-async
PASS 3 /io/channel/socket/ipv4-fd
PASS 4 /io/channel/socket/ipv6-sync
PASS 5 /io/channel/socket/ipv6-async
PASS 6 /io/channel/socket/unix-sync
PASS 7 /io/channel/socket/unix-async
ERROR - Bail out! ERROR:tests/test-io-channel-socket.c:424:test_io_channel_unix_fd_pass: assertion failed: (0)

where 'PASS' is coloured in green and 'ERROR' is red. I'm not
convinced this change justifies having the tap-driver.pl script

Since this commit already proposes a dep on the perl-Test-Harness
package, the host will have the 'prove' command, which can be used
for invoking tests.

Prove just needs a wrapper to know how to invoke glib tests:

  $ cat glibharness.sh 
  #!/bin/sh

  exec "$@" -k --tap

Now you can run :

$ prove -v -e ./glibharness.sh  tests/test-io-channel-socket
tests/test-io-channel-socket .. 
# random seed: R02S7b47ca0de1bc27cbbcf22dcc130c2b7f
1..9
# Start of io tests
# Start of channel tests
# Start of socket tests
ok 1 /io/channel/socket/ipv4-sync
ok 2 /io/channel/socket/ipv4-async
ok 3 /io/channel/socket/ipv4-fd
ok 4 /io/channel/socket/ipv6-sync
ok 5 /io/channel/socket/ipv6-async
ok 6 /io/channel/socket/unix-sync
ok 7 /io/channel/socket/unix-async
**
ERROR:tests/test-io-channel-socket.c:424:test_io_channel_unix_fd_pass: assertion failed: (0)
Bailout called.  Further testing stopped:  ERROR:tests/test-io-channel-socket.c:424:test_io_channel_unix_fd_pass: assertion failed: (0)
Bail out! ERROR:tests/test-io-channel-socket.c:424:test_io_channel_unix_fd_pass: assertion failed: (0)
FAILED--Further testing stopped: ERROR:tests/test-io-channel-socket.c:424:test_io_channel_unix_fd_pass: assertion failed: (0)


Where the failure line is now coloured in Red (or sucess is coloured
in green)

prove can also run tests in batches, giving progress of execution of
each test as it runs

$ prove  -e ./glibharness.sh  tests/test-io-channel-{buffer,command,file,socket,tls} 
tests/test-io-channel-buffer ... ok   
tests/test-io-channel-command .. ok   
tests/test-io-channel-file ..... ok   
tests/test-io-channel-socket ... 1/? **
ERROR:tests/test-io-channel-socket.c:424:test_io_channel_unix_fd_pass: assertion failed: (0)
Bailout called.  Further testing stopped:  ERROR:tests/test-io-channel-socket.c:424:test_io_channel_unix_fd_pass: assertion failed: (0)
FAILED--Further testing stopped: ERROR:tests/test-io-channel-socket.c:424:test_io_channel_unix_fd_pass: assertion failed: (0)


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

  parent reply	other threads:[~2018-11-30 15:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29 17:45 [Qemu-devel] [PATCH for-4.0 0/2] test: replace gtester with a TAP driver Paolo Bonzini
2018-11-29 17:45 ` [Qemu-devel] [PATCH 1/2] test: execute g_test_run when tests are skipped Paolo Bonzini
2018-11-29 20:48   ` Eric Blake
2018-11-30  7:10   ` Thomas Huth
2018-11-29 17:45 ` [Qemu-devel] [PATCH 2/2] test: replace gtester with a TAP driver Paolo Bonzini
2018-11-29 21:06   ` Eric Blake
2018-11-29 22:04     ` Paolo Bonzini
2018-11-30 15:50   ` Daniel P. Berrangé [this message]
2018-11-30 16:19     ` Paolo Bonzini
2018-11-29 20:43 ` [Qemu-devel] [PATCH for-4.0 0/2] " Eric Blake
2018-11-30  7:21   ` Thomas Huth
2018-11-30  9:58     ` Paolo Bonzini
2018-11-30 14:47       ` Cleber Rosa
2018-11-30 15:05         ` Thomas Huth
2018-11-30  9:54   ` Daniel P. Berrangé
2018-11-30  9:56     ` Paolo Bonzini
2018-11-30 10:21       ` Daniel P. Berrangé
2018-12-06 21:50 [Qemu-devel] [PATCH for-4.0 v2 " Paolo Bonzini
2018-12-06 21:50 ` [Qemu-devel] [PATCH 2/2] " Paolo Bonzini
2018-12-07  6:15   ` Thomas Huth
2019-02-08 12:48   ` Kevin Wolf
2019-02-08 13:46     ` Paolo Bonzini
2019-02-08 16:00       ` Kevin Wolf
2019-02-08 17:16         ` Paolo Bonzini
2019-02-11 14:32           ` Kevin Wolf
2019-02-11 14:54             ` Paolo Bonzini
2019-07-01 14:42   ` Philippe Mathieu-Daudé
2019-07-03 11:29     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181130155003.GG9162@redhat.com \
    --to=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.