All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>,
	"John Snow" <jsnow@redhat.com>,
	qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH for-2.3 2/2] i440fx-test: Fix test paths to include architecture
Date: Wed, 25 Mar 2015 14:04:11 +0100	[thread overview]
Message-ID: <5512B24B.1080608@redhat.com> (raw)
In-Reply-To: <5511F159.2030506@suse.de>



On 25/03/2015 00:20, Andreas Färber wrote:
>>> >> -    g_test_add(testpath, FirmwareTestFixture, NULL, setup_fixture,
>>> >> +    char *path = g_strdup_printf("/%s%s", qtest_get_arch(), testpath);
>>> >> +    g_test_add(path, FirmwareTestFixture, NULL, setup_fixture,
>>> >>                  test_i440fx_firmware, NULL);
>>> >> +    g_free(path);
>>> >>   }
>>> >>
>> > 
>> > Is it not worth adding an even more generic wrapper to prevent future
>> > desynch from our preferred path format?
> As mentioned in the commit message, g_test_add() is a macro, not a
> function, so seemed more complicated to wrap. Can you post a patch if
> you have an idea? :)
> 

You would have to wrap g_test_add_vtable with qtest_add_vtable, and then
add a macro that mimicks g_test_add:

/* hook up a test with fixture under test path */
#define qtest_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
                                        G_STMT_START {                  \
                                         void (*add_vtable) (const char*,       \
                                                    gsize,             \
                                                    gconstpointer,     \
                                                    void (*) (Fixture*, gconstpointer),   \
                                                    void (*) (Fixture*, gconstpointer),   \
                                                    void (*) (Fixture*, gconstpointer)) =  (void (*) (const gchar *, gsize, gconstpointer, void (
*) (Fixture*, gconstpointer), void (*) (Fixture*, gconstpointer), void (*) (Fixture*, gconstpointer))) qtest_add_vtable; \
                                         add_vtable \
                                          (testpath, sizeof (Fixture), tdata, fsetup, ftest, fteardown); \
                                        } G_STMT_END


Paolo

  parent reply	other threads:[~2015-03-25 13:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 22:45 [Qemu-devel] [PATCH for-2.3 0/2] qtest: Fix remaining test paths to include architecture Andreas Färber
2015-03-24 22:45 ` [Qemu-devel] [PATCH for-2.3 1/2] qtest: Add qtest_add_data_func() wrapper function Andreas Färber
2015-03-24 23:04   ` John Snow
2015-03-24 22:45 ` [Qemu-devel] [PATCH for-2.3 2/2] i440fx-test: Fix test paths to include architecture Andreas Färber
2015-03-24 23:09   ` John Snow
2015-03-24 23:20     ` Andreas Färber
2015-03-24 23:28       ` John Snow
2015-03-25 13:04       ` Paolo Bonzini [this message]
2015-03-25 15:29 ` [Qemu-devel] [PATCH for-2.3 0/2] qtest: Fix remaining " Stefan Hajnoczi

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=5512B24B.1080608@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=jsnow@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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.