qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-2.3 2/2] i440fx-test: Fix test paths to incl


From: Paolo Bonzini
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


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



reply via email to

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