[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/7] libqtest: add QTEST_LOG for debugging qtest
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 3/7] libqtest: add QTEST_LOG for debugging qtest testcases |
Date: |
Fri, 25 Jul 2014 16:22:19 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, Jul 24, 2014 at 08:31:01PM +0200, Marc Marí wrote:
> @@ -397,10 +398,18 @@ QDict *qtest_qmpv(QTestState *s, const char *fmt,
> va_list ap)
>
> /* No need to send anything for an empty QObject. */
> if (qobj) {
> + size_t len;
> + int log = getenv("QTEST_LOG") != NULL;
> QString *qstr = qobject_to_json(qobj);
> const char *str = qstring_get_str(qstr);
> size_t size = qstring_get_length(qstr);
>
> + if (log) {
> + len = write(2, str, size);
> + if (len != size) {
> + fprintf(stderr, "Could not log\n");
It's a bit funny that we print an error message to stderr after failing
to write to stderr.
Why not just fprintf(stderr, "%s", str) instead of using write()?
pgpXjo48kPbFk.pgp
Description: PGP signature
- [Qemu-devel] [PATCH 0/7] Virtio PCI libqos driver, Marc Marí, 2014/07/24
- [Qemu-devel] [PATCH 3/7] libqtest: add QTEST_LOG for debugging qtest testcases, Marc Marí, 2014/07/24
- Re: [Qemu-devel] [PATCH 3/7] libqtest: add QTEST_LOG for debugging qtest testcases,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 5/7] libqos: Change free function called in malloc, Marc Marí, 2014/07/24
- [Qemu-devel] [PATCH 1/7] tests: Functions bus_foreach and device_find from libqos virtio API, Marc Marí, 2014/07/24
- [Qemu-devel] [PATCH 4/7] libqos: Correct mask to align size to PAGE_SIZE in malloc-pc, Marc Marí, 2014/07/24
- [Qemu-devel] [PATCH 6/7] virtio-blk: Correct bug in support for flexible descriptor layout, Marc Marí, 2014/07/24