Rethinking the FAIL_TESTs

Marek Chalupa mchqwerty at gmail.com
Mon May 26 06:47:30 PDT 2014


Hi,

When we expect a failure in test, we're using FAIL_TEST at the moment.
The FAIL_TEST will pass on any failure in the test -- but we want the test
pass only when it fails on a particular line. Consider this code:

1   FAIL_TEST
2   {
3        struct wl_display *d = wl_display_connect();
4        assert(d);
5
6        expect_fail_in_this_function(d);
7    }

We want the test pass if and only if the failure is raised in
expect_fail_in_this_function() on line 6. But if the wl_display_connect()
on line 3 fails, then the test passes as well, which is wrong.
The conclusion is: the FAIL_TESTs should be used only when the test can
fail only in one location. Basically, only for sanity testing. The rest of
the tests can be rewritten to regular TESTs. The next few patches are doing
this work.

Regards,
Marek Chalupa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140526/ad3b569e/attachment.html>


More information about the wayland-devel mailing list