Commit 5975c94e authored by Pavel Emelyanov's avatar Pavel Emelyanov

zdtm: Add testing of irmap cache generation

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent a20011ac
...@@ -68,6 +68,7 @@ static/unlink_mmap02 ...@@ -68,6 +68,7 @@ static/unlink_mmap02
static/eventfs00 static/eventfs00
static/signalfd00 static/signalfd00
static/inotify00 static/inotify00
static/inotify_irmap
static/fanotify00 static/fanotify00
static/unbound_sock static/unbound_sock
static/fifo-rowo-pair static/fifo-rowo-pair
...@@ -162,6 +163,7 @@ maps007 ...@@ -162,6 +163,7 @@ maps007
tempfs tempfs
bind-mount bind-mount
mountpoints mountpoints
inotify_irmap
" "
source $(readlink -f `dirname $0`/env.sh) || exit 1 source $(readlink -f `dirname $0`/env.sh) || exit 1
...@@ -469,6 +471,10 @@ EOF ...@@ -469,6 +471,10 @@ EOF
ps_args="--auto-dedup" ps_args="--auto-dedup"
fi fi
if echo $tname | fgrep -q 'irmap'; then
args="$args --force-irmap"
fi
for i in `seq $ITERATIONS`; do for i in `seq $ITERATIONS`; do
local dump_only= local dump_only=
local postdump= local postdump=
......
...@@ -73,6 +73,7 @@ TST_NOFILE = \ ...@@ -73,6 +73,7 @@ TST_NOFILE = \
eventfs00 \ eventfs00 \
signalfd00 \ signalfd00 \
inotify00 \ inotify00 \
inotify_irmap \
fanotify00 \ fanotify00 \
uptime_grow \ uptime_grow \
session00 \ session00 \
......
#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 irmap";
const char *test_author = "Pavel Emelyanov <xemul@parallels.com>";
#define TDIR "/etc"
#define TFIL TDIR"/zdtm-test"
#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);
mkdir(TDIR, 0600);
unlink(TFIL);
if (creat(TFIL, 0600) < 0) {
err("Can't make test file");
exit(1);
}
fd = inotify_init1(IN_NONBLOCK);
if (fd < 0) {
fail("inotify_init failed");
unlink(TFIL);
exit(1);
}
wd = inotify_add_watch(fd, TFIL, IN_OPEN);
if (wd < 0) {
fail("inotify_add_watch failed");
unlink(TFIL);
exit(1);
}
test_daemon();
test_waitsig();
memset(buf, 0, sizeof(buf));
wd = open(TFIL, O_RDONLY);
if (read(fd, buf, sizeof(buf)) <= 0) {
unlink(TFIL);
fail("No events in queue");
exit(1);
}
close(wd);
close(fd);
unlink(TFIL);
pass();
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