diff --git a/test/mng_mod/issues/863/CT3008.c b/test/mng_mod/issues/863/CT3008.c index 7ad51563..8d98d6a5 100644 --- a/test/mng_mod/issues/863/CT3008.c +++ b/test/mng_mod/issues/863/CT3008.c @@ -17,7 +17,7 @@ void sig(int s) { fprintf(stderr, "kill SIGTERM (ignored)\n"); - kill(pid, SIGURG); + kill(pid, SIGTERM); } void diff --git a/test/mng_mod/issues/863/CT300x.txt b/test/mng_mod/issues/863/CT300x.txt index 988ed50a..0cb12c0c 100644 --- a/test/mng_mod/issues/863/CT300x.txt +++ b/test/mng_mod/issues/863/CT300x.txt @@ -1,31 +1,31 @@ -スクリプトは Fri Mar 23 13:25:09 2018 +スクリプトは Fri Mar 23 14:44:56 2018 に開始しました[?1034hbash-4.2$ make test ./CT300x.sh -13:25:13.087171 test start, kill after 3 seconds -13:25:16.087626 signal hanlder is called +14:44:59.479215 test start, kill after 3 seconds +14:45:02.479661 signal hanlder is called CT3001 OK 2048+0 レコード入力 2048+0 レコード出力 -2147483648 バイト (2.1 GB) コピーされました、 19.5143 秒、 110 MB/秒 +2147483648 バイト (2.1 GB) コピーされました、 19.5222 秒、 110 MB/秒 vm.drop_caches = 3 signal hanlder is called CT3002 OK -13:26:00.218056 test start, kill after 3 seconds -13:26:03.230253 child process terminated +14:45:46.852481 test start, kill after 3 seconds +14:45:49.866473 child process terminated CT3003 OK 2048+0 レコード入力 2048+0 レコード出力 -2147483648 バイト (2.1 GB) コピーされました、 19.5203 秒、 110 MB/秒 +2147483648 バイト (2.1 GB) コピーされました、 19.513 秒、 110 MB/秒 vm.drop_caches = 3 -13:26:23.478328 test start, kill after 1 seconds -13:26:24.836362 child process terminated +14:46:09.750053 test start, kill after 1 seconds +14:46:11.100485 child process terminated CT3004 OK kill SIGURG kill SIGINT CT3005 OK 2048+0 レコード入力 2048+0 レコード出力 -2147483648 バイト (2.1 GB) コピーされました、 19.4966 秒、 110 MB/秒 +2147483648 バイト (2.1 GB) コピーされました、 19.5075 秒、 110 MB/秒 vm.drop_caches = 3 kill SIGURG CT3006 OK @@ -34,12 +34,12 @@ kill SIGINT CT3007 OK 2048+0 レコード入力 2048+0 レコード出力 -2147483648 バイト (2.1 GB) コピーされました、 19.4999 秒、 110 MB/秒 +2147483648 バイト (2.1 GB) コピーされました、 19.5217 秒、 110 MB/秒 vm.drop_caches = 3 kill SIGTERM (ignored) CT3008 OK bash-4.2$ exit exit -スクリプトは Fri Mar 23 13:28:04 2018 +スクリプトは Fri Mar 23 14:48:02 2018 に終了しました \ No newline at end of file diff --git a/test/mng_mod/issues/863/CT4000.c b/test/mng_mod/issues/863/CT4000.c new file mode 100644 index 00000000..b63574c1 --- /dev/null +++ b/test/mng_mod/issues/863/CT4000.c @@ -0,0 +1,97 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int +readline(int fd, char *buf) +{ + int r; + int rc = 0; + + while ((r = read(fd, buf, 1)) == 1) { + rc++; + if (*buf == '\n') + break; + buf++; + } + if (r == -1) { + perror("read"); + exit(1); + } + if (!rc) { + fprintf(stderr, "CT400x read: BAD EOF\n"); + exit(1); + } + *buf = '\0'; + return rc; +} + +int +main(int argc, char **argv) +{ + int fds[2]; + pid_t mcexec; + struct stat sb; + char line[80]; + char *m; + int rc; + int t; + int p; + int s; + int st; + + if (syscall(732) != -1) { + fprintf(stderr, "run under Linux!\n"); + exit(1); + } + + if (stat(argv[1], &sb) == -1) { + fprintf(stderr, "no %s found\n", argv[1]); + exit(1); + } + if (pipe(fds) == -1) { + perror("pipe"); + exit(1); + } + + if ((mcexec = fork()) == 0) { + char param[10]; + char *args[4]; + + close(fds[0]); + args[0] = "mcexec"; + args[1] = argv[1]; + sprintf(param, "%d", fds[1]); + args[2] = param; + args[3] = NULL; + if (stat("mcexec", &sb) == -1) { + execvp("mcexec", args); + } + else { + execv("./mcexec", args); + } + perror("execvp"); + exit(1); + } + if (mcexec == -1) { + perror("fork"); + exit(1); + } + close(fds[1]); + + readline(fds[0], line); + sscanf(line, "%d %d %d", &t, &p, &s); + + sleep(t); + kill(p, s); + + while(waitpid(mcexec, &st, 0) == -1 && errno == EINTR); + + exit(0); +} diff --git a/test/mng_mod/issues/863/CT4001.c b/test/mng_mod/issues/863/CT4001.c new file mode 100644 index 00000000..b71fd5fe --- /dev/null +++ b/test/mng_mod/issues/863/CT4001.c @@ -0,0 +1,77 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +char * +gettime(char *buf, struct timeval *tv) +{ + struct tm *tm; + + gettimeofday(tv, NULL); + tm = localtime(&tv->tv_sec); + sprintf(buf, "%02d:%02d:%02d.%06d", tm->tm_hour, tm->tm_min, tm->tm_sec, tv->tv_usec); + return buf; +} + +void +tv_sub(struct timeval *tv1, const struct timeval *tv2) +{ + tv1->tv_sec -= tv2->tv_sec; + tv1->tv_usec -= tv2->tv_usec; + if (tv1->tv_usec < 0) { + tv1->tv_sec--; + tv1->tv_usec += 1000000; + } +} + +struct timeval tv1; +struct timeval tv2; +int fd; + +void +sig(int s) +{ + char buf[16]; + + fprintf(stderr, "%s signal hanlder is called\n", gettime(buf, &tv2)); +} + +int +main(int argc, char **argv) +{ + struct sigaction act; + int fds[2]; + char c; + int rc; + char buf[16]; + char line[80]; + + fd = atoi(argv[1]); + memset(&act, '\0', sizeof act); + act.sa_handler = sig; + sigaction(SIGALRM, &act, NULL); + fprintf(stderr, "%s test start, kill after 3 seconds\n", gettime(buf, &tv1)); + sprintf(line, "%d %d %d\n", 3, getpid(), SIGALRM); + write(fd, line, strlen(line)); + pipe(fds); + rc = read(fds[0], &c, 1); + if (rc != -1) { + fprintf(stderr, "CT4001 NG BAD read rc=%d\n", rc); + exit(1); + } + if (errno != EINTR) { + fprintf(stderr, "CT4001 NG BAD error errno=%d\n", errno); + exit(1); + } + tv_sub(&tv2, &tv1); + if (tv2.tv_sec != 3) + fprintf(stderr, "CT4001 NG signal delayed (%d.%06d)\n", tv2.tv_sec, tv2.tv_usec); + else + fprintf(stderr, "CT4001 OK\n"); + exit(0); +} diff --git a/test/mng_mod/issues/863/CT4001.sh b/test/mng_mod/issues/863/CT4001.sh new file mode 100755 index 00000000..109e3e5e --- /dev/null +++ b/test/mng_mod/issues/863/CT4001.sh @@ -0,0 +1,3 @@ +#!/bin/sh +MCEXEC=mcexec +./CT4000 ./CT4001 diff --git a/test/mng_mod/issues/863/CT4002.c b/test/mng_mod/issues/863/CT4002.c new file mode 100644 index 00000000..16856e39 --- /dev/null +++ b/test/mng_mod/issues/863/CT4002.c @@ -0,0 +1,58 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define FILESIZE (2L * 1024 * 1024 * 1024) +int sigcalled = 0; + +void +sig(int s) +{ + sigcalled = 1; + fprintf(stderr, "signal hanlder is called\n"); +} + +int +main(int argc, char **argv) +{ + struct sigaction act; + char *buf; + long rc; + long l; + long r; + int fd; + int ofd; + char line[80]; + + fd = atoi(argv[1]); + buf = malloc(FILESIZE); + ofd = open("testfile", O_RDONLY); + if (ofd == -1) { + fprintf(stderr, "Could not open file\n"); + unlink("testfile"); + exit(1); + } + + memset(&act, '\0', sizeof act); + act.sa_handler = sig; + sigaction(SIGALRM, &act, NULL); + sprintf(line, "%d %d %d\n", 1, getpid(), SIGALRM); + write(fd, line, strlen(line)); + rc = read(ofd, buf, FILESIZE); + if (rc == -1) { + fprintf(stderr, "CT4002 NG BAD read rc=%ld errno=%d\n", rc, errno); + exit(1); + } + if (sigcalled == 0) { + fprintf(stderr, "CT4002 NG signal handler was not called\n"); + exit(1); + } + fprintf(stderr, "CT4002 OK\n"); + exit(0); +} diff --git a/test/mng_mod/issues/863/CT4002.sh b/test/mng_mod/issues/863/CT4002.sh new file mode 100755 index 00000000..88f52cd9 --- /dev/null +++ b/test/mng_mod/issues/863/CT4002.sh @@ -0,0 +1,7 @@ +#!/bin/sh +MCEXEC=mcexec +dd if=/dev/zero of=testfile bs=$((1024 * 1024)) count=$((2 * 1024)) +sync +sudo /sbin/sysctl vm.drop_caches=3 +./CT4000 ./CT4002 +rm -f testfile diff --git a/test/mng_mod/issues/863/CT4003.c b/test/mng_mod/issues/863/CT4003.c new file mode 100644 index 00000000..a5abfe58 --- /dev/null +++ b/test/mng_mod/issues/863/CT4003.c @@ -0,0 +1,87 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +char * +gettime(char *buf, struct timeval *tv) +{ + struct tm *tm; + + gettimeofday(tv, NULL); + tm = localtime(&tv->tv_sec); + sprintf(buf, "%02d:%02d:%02d.%06d", tm->tm_hour, tm->tm_min, tm->tm_sec, tv->tv_usec); + return buf; +} + +void +tv_sub(struct timeval *tv1, const struct timeval *tv2) +{ + tv1->tv_sec -= tv2->tv_sec; + tv1->tv_usec -= tv2->tv_usec; + if (tv1->tv_usec < 0) { + tv1->tv_sec--; + tv1->tv_usec += 1000000; + } +} + +struct timeval tv1; +struct timeval tv2; +int fd; + +void +child() +{ + struct sigaction act; + int fds[2]; + char c; + int rc; + char line[80]; + + sprintf(line, "%d %d %d\n", 3, getpid(), SIGALRM); + write(fd, line, strlen(line)); + pipe(fds); + rc = read(fds[0], &c, 1); +} + +int +main(int argc, char **argv) +{ + pid_t pid; + int st; + int rc; + char buf[16]; + + fd = atoi(argv[1]); + fprintf(stderr, "%s test start, kill after 3 seconds\n", gettime(buf, &tv1)); + pid = fork(); + if (pid == 0) { + child(); + exit(1); + } + while ((rc = waitpid(pid, &st, 0)) == -1 && errno == EINTR); + fprintf(stderr, "%s child process terminated\n", gettime(buf, &tv2)); + if (rc != pid) { + fprintf(stderr, "CT4003 NG BAD wait rc=%d errno=%d\n", rc, errno); + exit(1); + } + if (!WIFSIGNALED(st)) { + fprintf(stderr, "CT4003 NG no signaled st=%08x\n", st); + exit(1); + } + if (WTERMSIG(st) != SIGALRM) { + fprintf(stderr, "CT4003 NG BAD signal sig=%d\n", WTERMSIG(st)); + exit(1); + } + tv_sub(&tv2, &tv1); + if (tv2.tv_sec != 3) + fprintf(stderr, "CT4003 NG signal delayed (%d.%06d)\n", tv2.tv_sec, tv2.tv_usec); + else + fprintf(stderr, "CT4003 OK\n"); + exit(0); +} diff --git a/test/mng_mod/issues/863/CT4003.sh b/test/mng_mod/issues/863/CT4003.sh new file mode 100755 index 00000000..e6d0083c --- /dev/null +++ b/test/mng_mod/issues/863/CT4003.sh @@ -0,0 +1,3 @@ +#!/bin/sh +MCEXEC=mcexec +./CT4000 ./CT4003 diff --git a/test/mng_mod/issues/863/CT4004.c b/test/mng_mod/issues/863/CT4004.c new file mode 100644 index 00000000..c55a8225 --- /dev/null +++ b/test/mng_mod/issues/863/CT4004.c @@ -0,0 +1,98 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define FILESIZE (2L * 1024 * 1024 * 1024) + +char * +gettime(char *buf, struct timeval *tv) +{ + struct tm *tm; + + gettimeofday(tv, NULL); + tm = localtime(&tv->tv_sec); + sprintf(buf, "%02d:%02d:%02d.%06d", tm->tm_hour, tm->tm_min, tm->tm_sec, tv->tv_usec); + return buf; +} + +void +tv_sub(struct timeval *tv1, const struct timeval *tv2) +{ + tv1->tv_sec -= tv2->tv_sec; + tv1->tv_usec -= tv2->tv_usec; + if (tv1->tv_usec < 0) { + tv1->tv_sec--; + tv1->tv_usec += 1000000; + } +} + +struct timeval tv1; +struct timeval tv2; +int fd; + +void +child() +{ + char *buf; + long rc; + long l; + long r; + int ofd; + char line[80]; + + buf = malloc(FILESIZE); + ofd = open("testfile", O_RDONLY); + if (ofd == -1) { + fprintf(stderr, "Could not open file\n"); + unlink("testfile"); + exit(1); + } + + sprintf(line, "%d %d %d\n", 1, getpid(), SIGALRM); + write(fd, line, strlen(line)); + rc = read(ofd, buf, FILESIZE); +} + +int +main(int argc, char **argv) +{ + pid_t pid; + int st; + int rc; + char buf[16]; + + fd = atoi(argv[1]); + fprintf(stderr, "%s test start, kill after 1 seconds\n", gettime(buf, &tv1)); + pid = fork(); + if (pid == 0) { + child(); + exit(1); + } + while ((rc = waitpid(pid, &st, 0)) == -1 && errno == EINTR); + fprintf(stderr, "%s child process terminated\n", gettime(buf, &tv2)); + if (rc != pid) { + fprintf(stderr, "CT4004 NG BAD wait rc=%d errno=%d\n", rc, errno); + exit(1); + } + if (!WIFSIGNALED(st)) { + fprintf(stderr, "CT4004 NG no signaled st=%08x\n", st); + exit(1); + } + if (WTERMSIG(st) != SIGALRM) { + fprintf(stderr, "CT4004 NG BAD signal sig=%d\n", WTERMSIG(st)); + exit(1); + } + tv_sub(&tv2, &tv1); + if (tv2.tv_sec != 1) + fprintf(stderr, "CT4004 OK (%d.%06d)\n", tv2.tv_sec, tv2.tv_usec); + else + fprintf(stderr, "CT4004 OK\n"); + exit(0); +} diff --git a/test/mng_mod/issues/863/CT4004.sh b/test/mng_mod/issues/863/CT4004.sh new file mode 100755 index 00000000..517e8c24 --- /dev/null +++ b/test/mng_mod/issues/863/CT4004.sh @@ -0,0 +1,7 @@ +#!/bin/sh +MCEXEC=mcexec +dd if=/dev/zero of=testfile bs=$((1024 * 1024)) count=$((2 * 1024)) +sync +sudo /sbin/sysctl vm.drop_caches=3 +./CT4000 ./CT4004 +rm -f testfile diff --git a/test/mng_mod/issues/863/CT4005.c b/test/mng_mod/issues/863/CT4005.c new file mode 100644 index 00000000..0a350c1d --- /dev/null +++ b/test/mng_mod/issues/863/CT4005.c @@ -0,0 +1,74 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +pid_t pid; +int fd; + +void +sig(int s) +{ + static int cnt = 0; + char line[80]; + + cnt++; + if (cnt == 1) { + fprintf(stderr, "kill SIGURG\n"); + sprintf(line, "%d %d %d\n", 0, pid, SIGURG); + write(fd, line, strlen(line)); + } + else if (cnt == 2) { + fprintf(stderr, "kill SIGINT\n"); + kill(pid, SIGINT); + } + alarm(2); +} + +void +child() +{ + struct sigaction act; + int fds[2]; + char c; + int rc; + + pipe(fds); + rc = read(fds[0], &c, 1); +} + +int +main(int argc, char **argv) +{ + int st; + int rc; + + fd = atoi(argv[1]); + pid = fork(); + if (pid == 0) { + child(); + exit(1); + } + signal(SIGALRM, sig); + alarm(2); + while ((rc = waitpid(pid, &st, 0)) == -1 && errno == EINTR); + if (rc != pid) { + fprintf(stderr, "CT4005 NG BAD wait rc=%d errno=%d\n", rc, errno); + exit(1); + } + if (!WIFSIGNALED(st)) { + fprintf(stderr, "CT4005 NG no signaled st=%08x\n", st); + exit(1); + } + if (WTERMSIG(st) != SIGINT) { + fprintf(stderr, "CT4005 NG BAD signal sig=%d\n", WTERMSIG(st)); + exit(1); + } + fprintf(stderr, "CT4005 OK\n"); + exit(0); +} diff --git a/test/mng_mod/issues/863/CT4005.sh b/test/mng_mod/issues/863/CT4005.sh new file mode 100755 index 00000000..f65603c8 --- /dev/null +++ b/test/mng_mod/issues/863/CT4005.sh @@ -0,0 +1,3 @@ +#!/bin/sh +MCEXEC=mcexec +./CT4000 ./CT4005 diff --git a/test/mng_mod/issues/863/CT4006.c b/test/mng_mod/issues/863/CT4006.c new file mode 100644 index 00000000..f021ee32 --- /dev/null +++ b/test/mng_mod/issues/863/CT4006.c @@ -0,0 +1,80 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define FILESIZE (2L * 1024 * 1024 * 1024) + +pid_t pid; +int fd; + +void +sig(int s) +{ + char line[80]; + + fprintf(stderr, "kill SIGURG\n"); + sprintf(line, "%d %d %d\n", 0, pid, SIGURG); + write(fd, line, strlen(line)); +} + +void +child() +{ + char *buf; + long rc; + long l; + long r; + int fd; + + buf = malloc(FILESIZE); + fd = open("testfile", O_RDONLY); + if (fd == -1) { + fprintf(stderr, "Could not open file\n"); + unlink("testfile"); + exit(1); + } + + rc = read(fd, buf, FILESIZE); +} + +int +main(int argc, char **argv) +{ + int st; + int rc; + + fd = atoi(argv[1]); + pid = fork(); + if (pid == 0) { + child(); + exit(99); + } + signal(SIGALRM, sig); + alarm(2); + while ((rc = waitpid(pid, &st, 0)) == -1 && errno == EINTR); + if (rc != pid) { + fprintf(stderr, "CT4006 NG BAD wait rc=%d errno=%d\n", rc, errno); + exit(1); + } + if (WIFSIGNALED(st)) { + fprintf(stderr, "CT4006 NG BAD signal st=%08x\n", st); + exit(1); + } + if (!WIFEXITED(st)) { + fprintf(stderr, "CT4006 NG BAD terminated st=%08x\n", st); + exit(1); + } + if (WEXITSTATUS(st) != 99) { + fprintf(stderr, "CT4006 NG BAD exit status st=%08x\n", st); + exit(1); + } + fprintf(stderr, "CT4006 OK\n"); + exit(0); +} diff --git a/test/mng_mod/issues/863/CT4006.sh b/test/mng_mod/issues/863/CT4006.sh new file mode 100755 index 00000000..6ac6475a --- /dev/null +++ b/test/mng_mod/issues/863/CT4006.sh @@ -0,0 +1,7 @@ +#!/bin/sh +MCEXEC=mcexec +dd if=/dev/zero of=testfile bs=$((1024 * 1024)) count=$((2 * 1024)) +sync +sudo /sbin/sysctl vm.drop_caches=3 +./CT4000 ./CT4006 +rm -f testfile diff --git a/test/mng_mod/issues/863/CT4007.c b/test/mng_mod/issues/863/CT4007.c new file mode 100644 index 00000000..8452bfd2 --- /dev/null +++ b/test/mng_mod/issues/863/CT4007.c @@ -0,0 +1,76 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +pid_t pid; +int fd; + +void +sig(int s) +{ + static int cnt = 0; + + cnt++; + if (cnt == 1) { + char line[80]; + + fprintf(stderr, "kill SIGTERM (ignored)\n"); + sprintf(line, "%d %d %d\n", 0, pid, SIGTERM); + write(fd, line, strlen(line)); + } + else if (cnt == 2) { + fprintf(stderr, "kill SIGINT\n"); + kill(pid, SIGINT); + } + alarm(2); +} + +void +child() +{ + struct sigaction act; + int fds[2]; + char c; + int rc; + + pipe(fds); + rc = read(fds[0], &c, 1); +} + +int +main(int argc, char **argv) +{ + int st; + int rc; + + fd = atoi(argv[1]); + pid = fork(); + if (pid == 0) { + signal(SIGTERM, SIG_IGN); + child(); + exit(1); + } + signal(SIGALRM, sig); + alarm(2); + while ((rc = waitpid(pid, &st, 0)) == -1 && errno == EINTR); + if (rc != pid) { + fprintf(stderr, "CT4007 NG BAD wait rc=%d errno=%d\n", rc, errno); + exit(1); + } + if (!WIFSIGNALED(st)) { + fprintf(stderr, "CT4007 NG no signaled st=%08x\n", st); + exit(1); + } + if (WTERMSIG(st) != SIGINT) { + fprintf(stderr, "CT4007 NG BAD signal sig=%d\n", WTERMSIG(st)); + exit(1); + } + fprintf(stderr, "CT4007 OK\n"); + exit(0); +} diff --git a/test/mng_mod/issues/863/CT4007.sh b/test/mng_mod/issues/863/CT4007.sh new file mode 100755 index 00000000..5cbb9dbc --- /dev/null +++ b/test/mng_mod/issues/863/CT4007.sh @@ -0,0 +1,3 @@ +#!/bin/sh +MCEXEC=mcexec +./CT4000 ./CT4007 diff --git a/test/mng_mod/issues/863/CT4008.c b/test/mng_mod/issues/863/CT4008.c new file mode 100644 index 00000000..03f7eda9 --- /dev/null +++ b/test/mng_mod/issues/863/CT4008.c @@ -0,0 +1,80 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define FILESIZE (2L * 1024 * 1024 * 1024) + +pid_t pid; +int fd; + +void +sig(int s) +{ + char line[80]; + fprintf(stderr, "kill SIGTERM (ignored)\n"); + sprintf(line, "%d %d %d\n", 0, pid, SIGTERM); + write(fd, line, strlen(line)); +} + +void +child() +{ + char *buf; + long rc; + long l; + long r; + int fd; + + buf = malloc(FILESIZE); + fd = open("testfile", O_RDONLY); + if (fd == -1) { + fprintf(stderr, "Could not open file\n"); + unlink("testfile"); + exit(1); + } + + rc = read(fd, buf, FILESIZE); +} + +int +main(int argc, char **argv) +{ + int st; + int rc; + + fd = atoi(argv[1]); + pid = fork(); + if (pid == 0) { + signal(SIGTERM, SIG_IGN); + child(); + exit(99); + } + signal(SIGALRM, sig); + alarm(2); + while ((rc = waitpid(pid, &st, 0)) == -1 && errno == EINTR); + if (rc != pid) { + fprintf(stderr, "CT4008 NG BAD wait rc=%d errno=%d\n", rc, errno); + exit(1); + } + if (WIFSIGNALED(st)) { + fprintf(stderr, "CT4008 NG BAD signal st=%08x\n", st); + exit(1); + } + if (!WIFEXITED(st)) { + fprintf(stderr, "CT4008 NG BAD terminated st=%08x\n", st); + exit(1); + } + if (WEXITSTATUS(st) != 99) { + fprintf(stderr, "CT4008 NG BAD exit status st=%08x\n", st); + exit(1); + } + fprintf(stderr, "CT4008 OK\n"); + exit(0); +} diff --git a/test/mng_mod/issues/863/CT4008.sh b/test/mng_mod/issues/863/CT4008.sh new file mode 100755 index 00000000..7da7777d --- /dev/null +++ b/test/mng_mod/issues/863/CT4008.sh @@ -0,0 +1,7 @@ +#!/bin/sh +MCEXEC=mcexec +dd if=/dev/zero of=testfile bs=$((1024 * 1024)) count=$((2 * 1024)) +sync +sudo /sbin/sysctl vm.drop_caches=3 +./CT4000 ./CT4008 +rm -f testfile diff --git a/test/mng_mod/issues/863/CT400x.sh b/test/mng_mod/issues/863/CT400x.sh new file mode 100755 index 00000000..bdae7ab1 --- /dev/null +++ b/test/mng_mod/issues/863/CT400x.sh @@ -0,0 +1,12 @@ +#!/bin/sh +MCKERNEL_DIR=/home/shirasawa/wallaby11-smp-x86/development/mic +export PATH=$MCKERNEL_DIR/bin:$PATH + +./CT4001.sh +./CT4002.sh +./CT4003.sh +./CT4004.sh +./CT4005.sh +./CT4006.sh +./CT4007.sh +./CT4008.sh diff --git a/test/mng_mod/issues/863/CT400x.txt b/test/mng_mod/issues/863/CT400x.txt new file mode 100644 index 00000000..0dc9b712 --- /dev/null +++ b/test/mng_mod/issues/863/CT400x.txt @@ -0,0 +1,45 @@ +スクリプトは Fri Mar 23 14:34:24 2018 + に開始しました[?1034hbash-4.2$ make test2 +./CT400x.sh +14:34:27.063487 test start, kill after 3 seconds +14:34:30.063982 signal hanlder is called +CT4001 OK +2048+0 レコード入力 +2048+0 レコード出力 +2147483648 バイト (2.1 GB) コピーされました、 19.4964 秒、 110 MB/秒 +vm.drop_caches = 3 +signal hanlder is called +CT4002 OK +14:35:14.331110 test start, kill after 3 seconds +14:35:17.343787 child process terminated +CT4003 OK +2048+0 レコード入力 +2048+0 レコード出力 +2147483648 バイト (2.1 GB) コピーされました、 19.527 秒、 110 MB/秒 +vm.drop_caches = 3 +14:35:37.609699 test start, kill after 1 seconds +14:35:38.967493 child process terminated +CT4004 OK +kill SIGURG +kill SIGINT +CT4005 OK +2048+0 レコード入力 +2048+0 レコード出力 +2147483648 バイト (2.1 GB) コピーされました、 19.5092 秒、 110 MB/秒 +vm.drop_caches = 3 +kill SIGURG +CT4006 OK +kill SIGTERM (ignored) +kill SIGINT +CT4007 OK +2048+0 レコード入力 +2048+0 レコード出力 +2147483648 バイト (2.1 GB) コピーされました、 19.508 秒、 110 MB/秒 +vm.drop_caches = 3 +kill SIGTERM (ignored) +CT4008 OK +bash-4.2$ exit +exit + +スクリプトは Fri Mar 23 14:37:18 2018 + に終了しました \ No newline at end of file diff --git a/test/mng_mod/issues/863/Makefile b/test/mng_mod/issues/863/Makefile index c274e8e9..81982a1e 100644 --- a/test/mng_mod/issues/863/Makefile +++ b/test/mng_mod/issues/863/Makefile @@ -1,5 +1,6 @@ CC=gcc -TARGET=CT3001 CT3002 CT3003 CT3004 CT3005 CT3006 CT3007 CT3008 +TARGET=CT3001 CT3002 CT3003 CT3004 CT3005 CT3006 CT3007 CT3008 \ + CT4001 CT4002 CT4003 CT4004 CT4005 CT4006 CT4007 CT4008 CT4000 all:: $(TARGET) CT3001: CT3001.c @@ -26,8 +27,38 @@ CT3007: CT3007.c CT3008: CT3008.c $(CC) -o CT3008 $< +CT4000: CT4000.c + $(CC) -o CT4000 $< + +CT4001: CT4001.c + $(CC) -o CT4001 $< + +CT4002: CT4002.c + $(CC) -o CT4002 $< + +CT4003: CT4003.c + $(CC) -o CT4003 $< + +CT4004: CT4004.c + $(CC) -o CT4004 $< + +CT4005: CT4005.c + $(CC) -o CT4005 $< + +CT4006: CT4006.c + $(CC) -o CT4006 $< + +CT4007: CT4007.c + $(CC) -o CT4007 $< + +CT4008: CT4008.c + $(CC) -o CT4008 $< + test:: $(TARGET) ./CT300x.sh +test2:: $(TARGET) + ./CT400x.sh + clean:: rm -f $(TARGET) diff --git a/test/mng_mod/issues/863/README b/test/mng_mod/issues/863/README index f0bb42f1..e948186a 100644 --- a/test/mng_mod/issues/863/README +++ b/test/mng_mod/issues/863/README @@ -13,7 +13,8 @@ CT1001.txt Issue#863の指摘で使用されたテストプログラムの実行結果(OK 1件、NG 0件) CT2001.txt Issue#870の指摘で使用されたテストプログラムの実行結果(OK 1件、NG 0件) -2. Issue#863の変更が既存シグナル機能に影響しないことを確認した。 +2. Issue#863の変更が、McKernelプロセス間のシグナルに対する既存処理に + 影響しないことを確認した。 確認内容は以下の通り。 CT3001 遅いI/Oシステムコール実行中にシグナルを受け、即座にシグナル @@ -37,3 +38,29 @@ CT3008 遅くないI/Oシステムコール実行中に無視(SIG_IGN)するシ CT300x の実行は、make test で行う。 エビデンスは CT300x.txt に示す。(OK 8件、NG 0件) + +3. Issue#863の変更が、Linuxからmcexec経由でMcKernelプロセスに届くシグナルの + 既存処理に影響しないことを確認した (Issue#870対応の確認)。 + 確認内容は以下の通り。 + +CT4001 遅いI/Oシステムコール実行中にシグナルを受け、即座にシグナル + ハンドラが呼び出され、システムコールがEINTRを返却することを + 確認する。 +CT4002 遅くないI/Oシステムコール実行中にシグナルを受け、システム + コール完了後にシグナルハンドラが呼び出され、システムコール + が正常に終了することを確認する。 +CT4003 遅いI/Oシステムコール実行中にプログラムを終了するシグナルを + 受けとると、即座にプログラムが終了することを確認する。 +CT4004 遅くないI/Oシステムコール実行中にプログラムを終了するシグナル + を受けとると、即座にプログラムを終了することを確認する。 +CT4005 遅いI/Oシステムコール実行中にプログラムを終了しないシグナル(SIGURG) + を受けとっても、プログラムの実行に影響しないことを確認する。 +CT4006 遅くないI/Oシステムコール実行中にプログラムを終了しないシグナル + (SIGURG)を受けとっても、プログラムの実行に影響しないことを確認する。 +CT4007 遅いI/Oシステムコール実行中に無視(SIG_IGN)するシグナルを + 受けとっても、プログラムの実行に影響しないことを確認する。 +CT4008 遅くないI/Oシステムコール実行中に無視(SIG_IGN)するシグナルを + 受けとっても、プログラムの実行に影響しないことを確認する。 + +CT400x の実行は、make test2 で行う。 +エビデンスは CT400x.txt に示す。(OK 8件、NG 0件)