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