Commit 6cebc484 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

zdtm: Add inotify00 test case

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent bff52ba9
......@@ -42,6 +42,7 @@ static/file_fown
static/unlink_fstat00
static/unlink_fstat02
static/eventfs00
static/inotify00
"
UTS_TEST_LIST="
......
......@@ -43,6 +43,7 @@ TST_NOFILE = \
xids00 \
file_fown \
eventfs00 \
inotify00 \
# jobctl00 \
TST_FILE = \
......
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <unistd.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <sys/inotify.h>
#include <unistd.h>
#include <stdlib.h>
#include "zdtmtst.h"
const char *test_doc = "Check for inotify delivery";
const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org>";
#define BUFF_SIZE ((sizeof(struct inotify_event) + PATH_MAX))
int main (int argc, char *argv[])
{
char buf[BUFF_SIZE];
int fd, wd;
test_init(argc, argv);
fd = inotify_init1(IN_NONBLOCK);
if (fd < 0) {
fail("inotify_init failed");
exit(1);
}
wd = 0;
wd |= inotify_add_watch(fd, "/", IN_ALL_EVENTS);
wd |= inotify_add_watch(fd, "/root", IN_ALL_EVENTS);
wd |= inotify_add_watch(fd, "/boot", IN_ALL_EVENTS);
if (wd < 0) {
fail("inotify_add_watch failed");
exit(1);
}
test_daemon();
test_waitsig();
wd = open("/", O_RDONLY);
if (read(fd, buf, sizeof(buf)) > 0) {
pass();
} else {
fail("No events in queue");
exit(1);
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment