* Re: [LTP] [PATCH] syscalls/inotify: Extend tests to verify cookie value
[not found] <1392642413-11071-1-git-send-email-jack@suse.cz>
@ 2014-02-20 14:01 ` chrubis
0 siblings, 0 replies; only message in thread
From: chrubis @ 2014-02-20 14:01 UTC (permalink / raw)
To: Jan Kara; +Cc: ltp-list
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-02-20 14:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1392642413-11071-1-git-send-email-jack@suse.cz>
2014-02-20 14:01 ` [LTP] [PATCH] syscalls/inotify: Extend tests to verify cookie value chrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox