[SSSD] [PATCH] 1332-Abort unit test when open() fails

Jakub Hrozek jhrozek at redhat.com
Mon May 14 08:22:18 UTC 2012


On Sun, May 13, 2012 at 04:18:39PM -0500, Ariel Barria wrote:
>    https://fedorahosted.org/sssd/ticket/1332

> +    if ( fd < 0 ){

Thanks for the patch Ariel, but would you also mind amending the
whitespace? We don't put whitespace between brackets and the expression
inside, but we do put a space after a normal bracket and a curly one. So
the "if" should read:

+ if (fd < 0) {

> +       fail("Cannot open /dev/zero");
> +    }else{

Similar here, space between curly bracket and else on both sides.

The same applies to the second change.

I was also thinking we may want to introduce a new macro that would mark
the test as failed and quit the test at the same time, something like
quit_if and equivalent quit_unless. These would be just simple wrappers
around existing fail_if/unless. Along the lines of (untested):

#define quit_if(expr, ...) do {    \
    fail_if(expr, ## __VA_ARGS__); \
    if (expr) {                    \
        return;                    \
    }                              \
} while(0)

But perhaps that's outside the scope of this ticket..



More information about the sssd-devel mailing list