[CRIU] [crtools-bot for Cyrill Gorcunov ] zdtm: Add selfexe00
test-case
Cyrill Gorcunov
gorcunov at openvz.org
Tue Feb 7 11:08:15 EST 2012
The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 872ba20f880e247b4a2ed0c448d522be1468b818
Author: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Tue Feb 7 13:59:44 2012 +0400
zdtm: Add selfexe00 test-case
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
Acked-by: Pavel Emelyanov <xemul at parallels.com>
---
test/zdtm.sh | 1 +
test/zdtm/live/static/Makefile | 1 +
test/zdtm/live/static/selfexe00.c | 54 +++++++++++++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/test/zdtm.sh b/test/zdtm.sh
index 04f7589..e64a832 100644
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -30,6 +30,7 @@ static/pstree
static/caps00
static/cmdlinenv00
static/socket_listen
+static/selfexe00
"
UTS_TEST_LIST="
diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index 4c4b934..9b4684e 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -32,6 +32,7 @@ TST_NOFILE = \
pstree \
sockets00 \
ipc_namespace \
+ selfexe00 \
# jobctl00 \
TST_FILE = \
diff --git a/test/zdtm/live/static/selfexe00.c b/test/zdtm/live/static/selfexe00.c
new file mode 100644
index 0000000..f8fcece
--- /dev/null
+++ b/test/zdtm/live/static/selfexe00.c
@@ -0,0 +1,54 @@
+/*
+ * A simple testee program with threads
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <string.h>
+#include <limits.h>
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+
+#include "zdtmtst.h"
+
+#define gettid() pthread_self()
+
+const char *test_doc = "Check if /proc/self/exe points to same location after restore\n";
+const char *test_author = "Cyrill Gorcunov <gorcunov at openvz.org";
+
+int main(int argc, char *argv[])
+{
+ char path_before[PATH_MAX];
+ char path_after[PATH_MAX];
+
+ test_init(argc, argv);
+
+ test_msg("%s pid %d\n", argv[0], getpid());
+ if (readlink("/proc/self/exe", path_before, sizeof(path_before)) < 0) {
+ err("Can't read selflink\n");
+ fail();
+ exit(1);
+ }
+
+
+ test_daemon();
+ test_waitsig();
+
+ if (readlink("/proc/self/exe", path_after, sizeof(path_after)) < 0) {
+ err("Can't read selflink\n");
+ fail();
+ exit(1);
+ }
+
+ if (!strcmp(path_before, path_after))
+ pass();
+ else
+ fail();
+
+ return 0;
+}
More information about the CRIU
mailing list