Skip to contentSkip to conversation

syscalls/inotify: Extend tests to verify cookie value

PATCH [email protected] 1 participant 1 message Feb 20, 2014 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi!

Quoted 30 lines
(quoted diff) +20 -1
+				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 "

Review int main(int ac, char **av) · line 264

Quoted 4 lines
(quoted diff) +1 -0
@@ -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.

Signature · 12 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list