All of lore.kernel.org
 help / color / mirror / Atom feed
From: chrubis@suse.cz
To: Jan Kara <jack@suse.cz>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] syscalls/inotify: Extend tests to verify cookie value
Date: Thu, 20 Feb 2014 15:01:28 +0100	[thread overview]
Message-ID: <20140220140128.GA25930@rei> (raw)
In-Reply-To: <1392642413-11071-1-git-send-email-jack@suse.cz>

Hi!
> +				if (event->mask == IN_MOVED_FROM) {
> +					if (event->cookie == 0)
> +						goto cookie_fail;
> +					stored_cookie = event->cookie;
> +				} else if (event->mask == IN_MOVED_TO) {
> +					if (event->cookie != stored_cookie)
> +						goto cookie_fail;
> +					stored_cookie = UINT_MAX;
> +				} else {
> +					if (event->cookie != 0)
> +						goto cookie_fail;
> +				}
>  				tst_resm(TPASS,
>  					 "get event: wd=%d mask=%x"
>  					 " cookie=%u len=%u name=\"%s\"",
>  					 event->wd, event->mask, event->cookie,
>  					 event->len, event->name);
> -
> +				goto next;
> +cookie_fail:
> +				tst_resm(TFAIL,
> +					 "get event: wd=%d mask=%x cookie=%u "
> +					 "(wrong) len=%u name=\"%s\"",
> +					 event->wd, event->mask,
> +					 event->cookie, event->len,
> +					 event->name);
>  			} else {
>  				tst_resm(TFAIL, "get event: wd=%d mask=%x "
>  					 "(expected %x) cookie=%u len=%u "
> @@ -241,6 +261,7 @@ int main(int ac, char **av)
>  					 strcmp(event_set[test_num].name,
>  						event->name));
>  			}
> +next:

Hmm, shouldn't we rather add a variable named failed, initialize it to
zero, set it to non-zero values ono failure and branch tst_resm() on it?

The goto statements are getting a bit out of hand in this part...

Otherwise it's fine.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

           reply	other threads:[~2014-02-20 14:01 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1392642413-11071-1-git-send-email-jack@suse.cz>]

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=20140220140128.GA25930@rei \
    --to=chrubis@suse.cz \
    --cc=jack@suse.cz \
    --cc=ltp-list@lists.sourceforge.net \
    /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.