[CRIU] [PATCH 1/5] zdtm: don't hardcode file names
Andrey Vagin
avagin at openvz.org
Fri Jan 18 06:05:16 EST 2013
A test should get file names from arguments
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
test/zdtm/live/static/Makefile | 4 ++--
test/zdtm/live/static/sockets00.c | 5 ++++-
test/zdtm/live/static/sockets_dgram.c | 11 +++++++----
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index c8aad1c..a063c95 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -42,10 +42,8 @@ TST_NOFILE = \
vdso00 \
utsname \
pstree \
- sockets00 \
sockets01 \
sockets_spair \
- sockets_dgram \
socket_queues \
socket_queues02 \
socket-tcp \
@@ -114,6 +112,8 @@ TST_FILE = \
file_shared \
cow01 \
fdt_shared \
+ sockets00 \
+ sockets_dgram \
TST_DIR = \
cwd00 \
diff --git a/test/zdtm/live/static/sockets00.c b/test/zdtm/live/static/sockets00.c
index 09a2a38..1ec5593 100644
--- a/test/zdtm/live/static/sockets00.c
+++ b/test/zdtm/live/static/sockets00.c
@@ -21,6 +21,9 @@ const char *test_author = "Cyrill Gorcunov <gorcunov at openvz.org";
#define SK_DATA "packet"
+char *filename;
+TEST_OPTION(filename, string, "socket file name", 1);
+
int main(int argc, char *argv[])
{
int ssk_icon[4];
@@ -41,7 +44,7 @@ int main(int argc, char *argv[])
exit(1);
}
- snprintf(path, sizeof(path), "%s/test-socket", cwd);
+ snprintf(path, sizeof(path), "%s/%s", cwd, filename);
unlink(path);
addr.sun_family = AF_UNIX;
diff --git a/test/zdtm/live/static/sockets_dgram.c b/test/zdtm/live/static/sockets_dgram.c
index d265aba..b914111 100644
--- a/test/zdtm/live/static/sockets_dgram.c
+++ b/test/zdtm/live/static/sockets_dgram.c
@@ -22,6 +22,9 @@ const char *test_author = "Cyrill Gorcunov <gorcunov at openvz.org";
#define SK_DATA_CONN "data-packet-conn"
#define SK_DATA_BOUND_CONN "data-packet-bound-conn"
+char *filename;
+TEST_OPTION(filename, string, "socket file name", 1);
+
int main(int argc, char *argv[])
{
struct sockaddr_un name_bound;
@@ -48,7 +51,7 @@ int main(int argc, char *argv[])
exit(1);
}
- snprintf(path, sizeof(path), "%s/test-socket", cwd);
+ snprintf(path, sizeof(path), "%s/%s", cwd, filename);
unlink(path);
sk_dgram_bound_client = socket(AF_UNIX, SOCK_DGRAM, 0);
@@ -68,19 +71,19 @@ int main(int argc, char *argv[])
exit(1);
}
- snprintf(path, sizeof(path), "%s/test-socket-bound", cwd);
+ snprintf(path, sizeof(path), "%s/%s.bound", cwd, filename);
unlink(path);
name_bound.sun_family = AF_UNIX;
strncpy(name_bound.sun_path, path, sizeof(name_bound.sun_path));
- snprintf(path, sizeof(path), "%s/test-socket-conn", cwd);
+ snprintf(path, sizeof(path), "%s/%s.conn", cwd, filename);
unlink(path);
name_conn.sun_family = AF_UNIX;
strncpy(name_conn.sun_path, path, sizeof(name_conn.sun_path));
- snprintf(path, sizeof(path), "%s/test-socket-bound-conn", cwd);
+ snprintf(path, sizeof(path), "%s/%s.bound-conn", cwd, filename);
unlink(path);
name_bound_conn.sun_family = AF_UNIX;
--
1.7.11.7
More information about the CRIU
mailing list