Commit a5228b3b authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

Merge branch 'zdtm' of https://github.com/avagin/crtools

* 'zdtm' of https://github.com/avagin/crtools:
  zdtm: remove warnings
  zdtm: move tast_daemon after preparation actions
  zdtm: fix warnings in mmx00.c
  zdtm: say no to EINTR
  zdtm: fix warning in Makefile
  zdtm: fix warning in transition/ptrace.c
  zdtm: initilize a variable in cmdlinenv00.c
parents 255cd497 61f50a9c
CFLAGS = -g -O2 -Wall CFLAGS = -g -O2 -Wall -Werror
LIB = libzdtmtst.a LIB = libzdtmtst.a
......
...@@ -27,7 +27,7 @@ void test_msg(const char *format, ...) ...@@ -27,7 +27,7 @@ void test_msg(const char *format, ...)
va_end(arg); va_end(arg);
if (len >= msg_buf.left) { /* indicate message buffer overflow */ if (len >= msg_buf.left) { /* indicate message buffer overflow */
const static char overflow_mark[] = "\n.@.\n"; const char overflow_mark[] = "\n.@.\n";
msg_buf.left = 0; msg_buf.left = 0;
msg_buf.ptr = msg_buf.buffer + sizeof(msg_buf.buffer); msg_buf.ptr = msg_buf.buffer + sizeof(msg_buf.buffer);
strcpy(msg_buf.ptr - sizeof(overflow_mark), overflow_mark); strcpy(msg_buf.ptr - sizeof(overflow_mark), overflow_mark);
...@@ -56,7 +56,6 @@ void dump_msg(const char *fname) ...@@ -56,7 +56,6 @@ void dump_msg(const char *fname)
return; return;
/* ignore errors as there's no way to report them */ /* ignore errors as there's no way to report them */
write(fd, msg_buf.buffer, msg_buf.ptr - msg_buf.buffer); write(fd, msg_buf.buffer, msg_buf.ptr - msg_buf.buffer);
out:
close(fd); close(fd);
} }
} }
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
...@@ -8,6 +9,7 @@ ...@@ -8,6 +9,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sched.h>
#include "zdtmtst.h" #include "zdtmtst.h"
...@@ -83,6 +85,7 @@ void test_init(int argc, char **argv) ...@@ -83,6 +85,7 @@ void test_init(int argc, char **argv)
static FILE *pidf; static FILE *pidf;
struct sigaction sa = { struct sigaction sa = {
.sa_handler = sig_hand, .sa_handler = sig_hand,
.sa_flags = SA_RESTART,
}; };
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
...@@ -157,7 +160,7 @@ void test_init(int argc, char **argv) ...@@ -157,7 +160,7 @@ void test_init(int argc, char **argv)
#define STACK_SIZE (8 * 4096) #define STACK_SIZE (8 * 4096)
struct zdtm_clone_arg { struct zdtm_clone_arg {
int pidf; FILE *pidf;
void (*fn)(void); void (*fn)(void);
}; };
......
LIBDIR = ../../lib LIBDIR = ../../lib
LIB = $(LIBDIR)/libzdtmtst.a LIB = $(LIBDIR)/libzdtmtst.a
override CPPFLAGS += -I$(LIBDIR) override CPPFLAGS += -I$(LIBDIR)
CFLAGS = -g -O2 -Wall CFLAGS = -g -O2 -Wall -Werror
TST_NOFILE = \ TST_NOFILE = \
busyloop00 \ busyloop00 \
...@@ -27,7 +27,6 @@ TST_NOFILE = \ ...@@ -27,7 +27,6 @@ TST_NOFILE = \
pipe00 \ pipe00 \
pthread00 \ pthread00 \
vdso00 \ vdso00 \
cmdlinenv00 \
utsname \ utsname \
# jobctl00 \ # jobctl00 \
...@@ -64,6 +63,7 @@ TST = \ ...@@ -64,6 +63,7 @@ TST = \
$(TST_DIR) \ $(TST_DIR) \
env00 \ env00 \
umask00 \ umask00 \
cmdlinenv00 \
TST_STATE = \ TST_STATE = \
conntracks \ conntracks \
......
...@@ -21,7 +21,7 @@ TEST_OPTION(arg3, string, "arg3", 1); ...@@ -21,7 +21,7 @@ TEST_OPTION(arg3, string, "arg3", 1);
static void read_from_proc(const char *path, char *buf, size_t size) static void read_from_proc(const char *path, char *buf, size_t size)
{ {
size_t r, ret; size_t r = 0, ret;
int fd; int fd;
fd = open(path, O_RDONLY); fd = open(path, O_RDONLY);
......
...@@ -19,7 +19,7 @@ void start(uint8_t *bytes, uint16_t *words) ...@@ -19,7 +19,7 @@ void start(uint8_t *bytes, uint16_t *words)
"psubw %%mm2, %%mm3\n" "psubw %%mm2, %%mm3\n"
: :
: "m" (bytes[0]), "m" (bytes[8]), : "m" (bytes[0]), "m" (bytes[8]),
"m" (words[0]), "m" (words[8]) "m" (words[0]), "m" (words[4])
); );
} }
......
...@@ -33,7 +33,7 @@ int main(int argc, char **argv) ...@@ -33,7 +33,7 @@ int main(int argc, char **argv)
int fd, fd_s; int fd, fd_s;
int status; int status;
pid_t pid; pid_t pid;
int ret, res; int res;
uint32_t crc; uint32_t crc;
test_init(argc, argv); test_init(argc, argv);
......
LIBDIR = ../../lib LIBDIR = ../../lib
LIB = $(LIBDIR)/libzdtmtst.a LIB = $(LIBDIR)/libzdtmtst.a
override CPPFLAGS += -I$(LIBDIR) override CPPFLAGS += -I$(LIBDIR)
CFLAGS = -g -O2 -Wall CFLAGS = -g -O2 -Wall -Werror
TST_NOFILE = \ TST_NOFILE = \
pipe_loop00 \ pipe_loop00 \
......
...@@ -68,11 +68,9 @@ cmd_t cmd[CMD_NUM]={form_request_add, form_request_del}; ...@@ -68,11 +68,9 @@ cmd_t cmd[CMD_NUM]={form_request_add, form_request_del};
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int ret=0;
int i; int i;
test_init(argc, argv); test_init(argc, argv);
test_daemon();
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (fd<0){ if (fd<0){
...@@ -86,7 +84,6 @@ int main(int argc, char *argv[]) ...@@ -86,7 +84,6 @@ int main(int argc, char *argv[])
la.nl_pid = getpid(); la.nl_pid = getpid();
if (bind(fd, (struct sockaddr*) &la, sizeof(la))){ if (bind(fd, (struct sockaddr*) &la, sizeof(la))){
err("bind failed: %m "); err("bind failed: %m ");
ret=-1;
goto out; goto out;
} }
//Preperation: //Preperation:
...@@ -94,6 +91,8 @@ int main(int argc, char *argv[]) ...@@ -94,6 +91,8 @@ int main(int argc, char *argv[])
send_request(); send_request();
recv_reply(); recv_reply();
test_daemon();
while (test_go()){ while (test_go()){
for (i=0;i<CMD_NUM;i++){ for (i=0;i<CMD_NUM;i++){
cmd[i](); cmd[i]();
......
LIBDIR = ../../lib LIBDIR = ../../lib
LIB = $(LIBDIR)/libzdtmtst.a LIB = $(LIBDIR)/libzdtmtst.a
override CPPFLAGS += -I$(LIBDIR) override CPPFLAGS += -I$(LIBDIR)
CFLAGS = -g -O2 -Wall CFLAGS = -g -O2 -Wall -Werror
TST_NOFILE = \ TST_NOFILE = \
file_read \ file_read \
......
...@@ -59,7 +59,7 @@ static void run_child(int num) ...@@ -59,7 +59,7 @@ static void run_child(int num)
int fd = fds[num][1]; int fd = fds[num][1];
uint32_t crc = ~0; uint32_t crc = ~0;
size_t buf_size=512; size_t buf_size=512;
char buf[buf_size]; uint8_t buf[buf_size];
struct timeval tv; struct timeval tv;
struct timespec ts; struct timespec ts;
int rv; int rv;
......
...@@ -25,6 +25,7 @@ static void *thread(void *arg) ...@@ -25,6 +25,7 @@ static void *thread(void *arg)
*(int *)arg = syscall(SYS_gettid); *(int *)arg = syscall(SYS_gettid);
while (1) while (1)
sleep(1); sleep(1);
return NULL;
} }
int main(int argc, char **argv) int main(int argc, char **argv)
......
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