mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-21 01:06:58 +00:00
zdtm: replace sockets03 on socket_dgram_data
They should do mostly the same, but the first one checks nothing after c/r. v2: remove sockets03 from Makefile Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
c674906f69
commit
098e3a2f8f
3 changed files with 1 additions and 124 deletions
|
|
@ -67,11 +67,11 @@ generate_test_list()
|
|||
static/sockets00
|
||||
static/sockets01
|
||||
static/sockets02
|
||||
static/sockets03
|
||||
static/sock_opts00
|
||||
static/sock_opts01
|
||||
static/sockets_spair
|
||||
static/sockets_dgram
|
||||
static/socket_dgram_data
|
||||
static/socket_queues
|
||||
static/deleted_unix_sock
|
||||
static/sk-unix-unconn
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ TST_NOFILE = \
|
|||
pstree \
|
||||
sockets01 \
|
||||
sockets02 \
|
||||
sockets03 \
|
||||
sockets_spair \
|
||||
socket_queues \
|
||||
socket_queues02 \
|
||||
|
|
|
|||
|
|
@ -1,122 +0,0 @@
|
|||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/stat.h>
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "zdtmtst.h"
|
||||
|
||||
const char *test_doc = "Test that we only send one copy of the queue to a dgram socket";
|
||||
const char *test_author = "Tycho Andersen <tycho.andersen@canonical.com>\n";
|
||||
|
||||
/*
|
||||
* /tmp here because as in sockets_dgram, some environments can't handle more
|
||||
* than 108 characters for this path.
|
||||
*/
|
||||
#define CLIENT1_PATH "/tmp/client1"
|
||||
#define CLIENT2_PATH "/tmp/client2"
|
||||
#define SERVER_PATH "/tmp/server"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int server, client, ret = 1, i;
|
||||
struct sockaddr_un name;
|
||||
pid_t pid = 0;
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
name.sun_family = AF_UNIX;
|
||||
server = socket(AF_UNIX, SOCK_DGRAM, 0);
|
||||
if (server < 0) {
|
||||
err("socket");
|
||||
goto out;
|
||||
}
|
||||
|
||||
strcpy(name.sun_path, SERVER_PATH);
|
||||
if (bind(server, &name, sizeof(name)) < 0) {
|
||||
err("bind");
|
||||
goto out;
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
err("fork");
|
||||
goto out;
|
||||
}
|
||||
|
||||
client = socket(AF_UNIX, SOCK_DGRAM, 0);
|
||||
if (client < 0) {
|
||||
err("client socket");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (pid == 0) {
|
||||
strcpy(name.sun_path, CLIENT1_PATH);
|
||||
if (bind(client, &name, sizeof(name)) < 0) {
|
||||
err("client bind");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
strcpy(name.sun_path, SERVER_PATH);
|
||||
if (connect(client, &name, sizeof(name)) < 0) {
|
||||
err("connect");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (write(client, "child-send", 10) != 10) {
|
||||
err("write");
|
||||
exit(1);
|
||||
}
|
||||
while (1)
|
||||
sleep(1000);
|
||||
}
|
||||
|
||||
strcpy(name.sun_path, CLIENT2_PATH);
|
||||
if (bind(client, &name, sizeof(name)) < 0) {
|
||||
err("client bind");
|
||||
goto out;
|
||||
}
|
||||
|
||||
strcpy(name.sun_path, SERVER_PATH);
|
||||
if (connect(client, &name, sizeof(name)) < 0) {
|
||||
err("connect");
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
/*
|
||||
* fill the send queue with the other process; 9 messages
|
||||
* because the default for sysctl.max_dgram_qlen is 10 on most
|
||||
* systems, and we already sent one above.
|
||||
*/
|
||||
if (write(client, "parent-send", 11) != 11) {
|
||||
err("write");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
test_daemon();
|
||||
test_waitsig();
|
||||
|
||||
pass();
|
||||
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
if (pid > 0)
|
||||
kill(pid, SIGKILL);
|
||||
unlink(CLIENT1_PATH);
|
||||
unlink(CLIENT2_PATH);
|
||||
unlink(SERVER_PATH);
|
||||
|
||||
return ret;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue