Commit 580d3b02 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

zdtm: Add eventfs00 test-case

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 889795da
......@@ -41,6 +41,7 @@ static/selfexe00
static/file_fown
static/unlink_fstat00
static/unlink_fstat02
static/eventfs00
"
UTS_TEST_LIST="
......
......@@ -42,6 +42,7 @@ TST_NOFILE = \
maps01 \
xids00 \
file_fown \
eventfs00 \
# jobctl00 \
TST_FILE = \
......
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/eventfd.h>
#include <sys/ioctl.h>
#include <sys/epoll.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "zdtmtst.h"
#ifndef F_SETSIG
#define F_SETSIG 10 /* for sockets. */
#define F_GETSIG 11 /* for sockets. */
#endif
const char *test_doc = "Check for eventfs";
const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org>";
#define EVENTFD_INITIAL 30
#define EVENTFD_FINAL 90
int main(int argc, char *argv[])
{
int efd, ret;
uint64_t v = EVENTFD_INITIAL;
test_init(argc, argv);
efd = eventfd((unsigned int)v, EFD_NONBLOCK);
if (efd < 0) {
fail("eventfd");
exit(1);
}
test_msg("created eventfd with %lx\n", v);
ret = write(efd, &v, sizeof(v));
if (ret != sizeof(v)) {
fail("write");
exit(1);
}
ret = write(efd, &v, sizeof(v));
if (ret != sizeof(v)) {
fail("write");
exit(1);
}
test_daemon();
test_waitsig();
ret = read(efd, &v, sizeof(v));
if (ret != sizeof(v)) {
fail("write");
exit(1);
}
if (v != EVENTFD_FINAL) {
fail("EVENTFD_FINAL mismatch\n");
exit(1);
}
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