Test "signal: When the process receives a termination signal, it first terminates mcexec." on arm64
Change-Id: I5c8ab90ffd5c5da30162d606f4d86dca9d387b5a Refs: #863
This commit is contained in:
committed by
Masamichi Takagi
parent
3f11c1aee5
commit
556a64ac5e
27
test/mng_mod/issues/863/x86_64/CT1001.txt
Normal file
27
test/mng_mod/issues/863/x86_64/CT1001.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
スクリプトは Wed Jan 24 20:43:43 2018
|
||||
に開始しました[?1034hbash-4.2$ ~/wallaby11-smp-x86/development/mic/mcexec ./signalonread-multi
|
||||
[4261] I am the examiner for 4270.
|
||||
[4270] I am a subjectThread 1, ad000700 ad000700
|
||||
[4270] I am a subjectThread 3, ae400700 ae400700
|
||||
[4270] I am a subjectThread 2, ada00700 ada00700
|
||||
[4270] I am a subjectThread 0, ac72aec0 ac72aec0
|
||||
[3] setup: 1367 ms
|
||||
[2] setup: 1367 ms
|
||||
[1] setup: 1367 ms
|
||||
[0] setup: 1367 ms
|
||||
[3] START TEST
|
||||
[2] START TEST
|
||||
[3] ./signalonread-multi try to read 2147483648 bytes. buffp=0x2aac40000010
|
||||
[1] START TEST
|
||||
[2] ./signalonread-multi try to read 2147483648 bytes. buffp=0x2aad00000010
|
||||
[0] START TEST
|
||||
[1] ./signalonread-multi try to read 2147483648 bytes. buffp=0x2aab80000010
|
||||
[0] ./signalonread-multi try to read 2147483648 bytes. buffp=0x2aaac0000010
|
||||
The TEST process is terminated by the signal 15
|
||||
TEST SUCCESSED IF YOU DID NOT SEE 'OVERRUN'
|
||||
TEST FINISHED
|
||||
bash-4.2$ シェルから脱出するには "exit" を使用してください。
|
||||
bash-4.2$ exit
|
||||
|
||||
スクリプトは Wed Jan 24 20:45:10 2018
|
||||
に終了しました
|
||||
73
test/mng_mod/issues/863/x86_64/CT2001.c
Normal file
73
test/mng_mod/issues/863/x86_64/CT2001.c
Normal file
@@ -0,0 +1,73 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
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;
|
||||
|
||||
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];
|
||||
|
||||
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));
|
||||
alarm(3);
|
||||
pipe(fds);
|
||||
rc = read(fds[0], &c, 1);
|
||||
if (rc != -1) {
|
||||
fprintf(stderr, "CT2001 NG BAD read rc=%d\n", rc);
|
||||
exit(1);
|
||||
}
|
||||
if (errno != EINTR) {
|
||||
fprintf(stderr, "CT2001 NG BAD error errno=%d\n", errno);
|
||||
exit(1);
|
||||
}
|
||||
tv_sub(&tv2, &tv1);
|
||||
if (tv2.tv_sec != 3)
|
||||
fprintf(stderr, "CT2001 NG signal delayed (%d.%06d)\n", tv2.tv_sec, tv2.tv_usec);
|
||||
else
|
||||
fprintf(stderr, "CT2001 OK\n");
|
||||
exit(0);
|
||||
}
|
||||
3
test/mng_mod/issues/863/x86_64/CT2001.sh
Normal file
3
test/mng_mod/issues/863/x86_64/CT2001.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
MCEXEC=mcexec
|
||||
$MCEXEC ./CT2001
|
||||
54
test/mng_mod/issues/863/x86_64/CT2002.c
Normal file
54
test/mng_mod/issues/863/x86_64/CT2002.c
Normal file
@@ -0,0 +1,54 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#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;
|
||||
|
||||
buf = malloc(FILESIZE);
|
||||
fd = open("testfile", O_RDONLY);
|
||||
if (fd == -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);
|
||||
alarm(1);
|
||||
rc = read(fd, buf, FILESIZE);
|
||||
if (rc == -1) {
|
||||
fprintf(stderr, "CT2002 NG BAD read rc=%ld errno=%d\n", rc, errno);
|
||||
exit(1);
|
||||
}
|
||||
if (sigcalled == 0) {
|
||||
fprintf(stderr, "CT2002 NG signal handler was not called\n");
|
||||
exit(1);
|
||||
}
|
||||
fprintf(stderr, "CT2002 OK\n");
|
||||
exit(0);
|
||||
}
|
||||
7
test/mng_mod/issues/863/x86_64/CT2002.sh
Normal file
7
test/mng_mod/issues/863/x86_64/CT2002.sh
Normal file
@@ -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
|
||||
$MCEXEC ./CT2002
|
||||
rm -f testfile
|
||||
83
test/mng_mod/issues/863/x86_64/CT2003.c
Normal file
83
test/mng_mod/issues/863/x86_64/CT2003.c
Normal file
@@ -0,0 +1,83 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
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;
|
||||
|
||||
void
|
||||
child()
|
||||
{
|
||||
struct sigaction act;
|
||||
int fds[2];
|
||||
char c;
|
||||
int rc;
|
||||
|
||||
alarm(3);
|
||||
pipe(fds);
|
||||
rc = read(fds[0], &c, 1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
pid_t pid;
|
||||
int st;
|
||||
int rc;
|
||||
char buf[16];
|
||||
|
||||
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, "CT2003 NG BAD wait rc=%d errno=%d\n", rc, errno);
|
||||
exit(1);
|
||||
}
|
||||
if (!WIFSIGNALED(st)) {
|
||||
fprintf(stderr, "CT2003 NG no signaled st=%08x\n", st);
|
||||
exit(1);
|
||||
}
|
||||
if (WTERMSIG(st) != SIGALRM) {
|
||||
fprintf(stderr, "CT2003 NG BAD signal sig=%d\n", WTERMSIG(st));
|
||||
exit(1);
|
||||
}
|
||||
tv_sub(&tv2, &tv1);
|
||||
if (tv2.tv_sec != 3)
|
||||
fprintf(stderr, "CT2003 NG signal delayed (%d.%06d)\n", tv2.tv_sec, tv2.tv_usec);
|
||||
else
|
||||
fprintf(stderr, "CT2003 OK\n");
|
||||
exit(0);
|
||||
}
|
||||
3
test/mng_mod/issues/863/x86_64/CT2003.sh
Normal file
3
test/mng_mod/issues/863/x86_64/CT2003.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
MCEXEC=mcexec
|
||||
$MCEXEC ./CT2003
|
||||
94
test/mng_mod/issues/863/x86_64/CT2004.c
Normal file
94
test/mng_mod/issues/863/x86_64/CT2004.c
Normal file
@@ -0,0 +1,94 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
alarm(1);
|
||||
rc = read(fd, buf, FILESIZE);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
pid_t pid;
|
||||
int st;
|
||||
int rc;
|
||||
char buf[16];
|
||||
|
||||
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, "CT2004 NG BAD wait rc=%d errno=%d\n", rc, errno);
|
||||
exit(1);
|
||||
}
|
||||
if (!WIFSIGNALED(st)) {
|
||||
fprintf(stderr, "CT2004 NG no signaled st=%08x\n", st);
|
||||
exit(1);
|
||||
}
|
||||
if (WTERMSIG(st) != SIGALRM) {
|
||||
fprintf(stderr, "CT2004 NG BAD signal sig=%d\n", WTERMSIG(st));
|
||||
exit(1);
|
||||
}
|
||||
tv_sub(&tv2, &tv1);
|
||||
if (tv2.tv_sec != 1)
|
||||
fprintf(stderr, "CT2004 OK (%d.%06d)\n", tv2.tv_sec, tv2.tv_usec);
|
||||
else
|
||||
fprintf(stderr, "CT2004 OK\n");
|
||||
exit(0);
|
||||
}
|
||||
7
test/mng_mod/issues/863/x86_64/CT2004.sh
Normal file
7
test/mng_mod/issues/863/x86_64/CT2004.sh
Normal file
@@ -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
|
||||
$MCEXEC ./CT2004
|
||||
rm -f testfile
|
||||
70
test/mng_mod/issues/863/x86_64/CT2005.c
Normal file
70
test/mng_mod/issues/863/x86_64/CT2005.c
Normal file
@@ -0,0 +1,70 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
pid_t pid;
|
||||
|
||||
void
|
||||
sig(int s)
|
||||
{
|
||||
static int cnt = 0;
|
||||
|
||||
cnt++;
|
||||
if (cnt == 1) {
|
||||
fprintf(stderr, "kill SIGURG\n");
|
||||
kill(pid, SIGURG);
|
||||
}
|
||||
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;
|
||||
|
||||
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, "CT2005 NG BAD wait rc=%d errno=%d\n", rc, errno);
|
||||
exit(1);
|
||||
}
|
||||
if (!WIFSIGNALED(st)) {
|
||||
fprintf(stderr, "CT2005 NG no signaled st=%08x\n", st);
|
||||
exit(1);
|
||||
}
|
||||
if (WTERMSIG(st) != SIGINT) {
|
||||
fprintf(stderr, "CT2005 NG BAD signal sig=%d\n", WTERMSIG(st));
|
||||
exit(1);
|
||||
}
|
||||
fprintf(stderr, "CT2005 OK\n");
|
||||
exit(0);
|
||||
}
|
||||
3
test/mng_mod/issues/863/x86_64/CT2005.sh
Normal file
3
test/mng_mod/issues/863/x86_64/CT2005.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
MCEXEC=mcexec
|
||||
$MCEXEC ./CT2005
|
||||
75
test/mng_mod/issues/863/x86_64/CT2006.c
Normal file
75
test/mng_mod/issues/863/x86_64/CT2006.c
Normal file
@@ -0,0 +1,75 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#define FILESIZE (2L * 1024 * 1024 * 1024)
|
||||
|
||||
pid_t pid;
|
||||
|
||||
void
|
||||
sig(int s)
|
||||
{
|
||||
fprintf(stderr, "kill SIGURG\n");
|
||||
kill(pid, SIGURG);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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, "CT2006 NG BAD wait rc=%d errno=%d\n", rc, errno);
|
||||
exit(1);
|
||||
}
|
||||
if (WIFSIGNALED(st)) {
|
||||
fprintf(stderr, "CT2006 NG BAD signal st=%08x\n", st);
|
||||
exit(1);
|
||||
}
|
||||
if (!WIFEXITED(st)) {
|
||||
fprintf(stderr, "CT2006 NG BAD terminated st=%08x\n", st);
|
||||
exit(1);
|
||||
}
|
||||
if (WEXITSTATUS(st) != 99) {
|
||||
fprintf(stderr, "CT2006 NG BAD exit status st=%08x\n", st);
|
||||
exit(1);
|
||||
}
|
||||
fprintf(stderr, "CT2006 OK\n");
|
||||
exit(0);
|
||||
}
|
||||
7
test/mng_mod/issues/863/x86_64/CT2006.sh
Normal file
7
test/mng_mod/issues/863/x86_64/CT2006.sh
Normal file
@@ -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
|
||||
$MCEXEC ./CT2006
|
||||
rm -f testfile
|
||||
71
test/mng_mod/issues/863/x86_64/CT2007.c
Normal file
71
test/mng_mod/issues/863/x86_64/CT2007.c
Normal file
@@ -0,0 +1,71 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
pid_t pid;
|
||||
|
||||
void
|
||||
sig(int s)
|
||||
{
|
||||
static int cnt = 0;
|
||||
|
||||
cnt++;
|
||||
if (cnt == 1) {
|
||||
fprintf(stderr, "kill SIGTERM (ignored)\n");
|
||||
kill(pid, SIGTERM);
|
||||
}
|
||||
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;
|
||||
|
||||
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, "CT2007 NG BAD wait rc=%d errno=%d\n", rc, errno);
|
||||
exit(1);
|
||||
}
|
||||
if (!WIFSIGNALED(st)) {
|
||||
fprintf(stderr, "CT2007 NG no signaled st=%08x\n", st);
|
||||
exit(1);
|
||||
}
|
||||
if (WTERMSIG(st) != SIGINT) {
|
||||
fprintf(stderr, "CT2007 NG BAD signal sig=%d\n", WTERMSIG(st));
|
||||
exit(1);
|
||||
}
|
||||
fprintf(stderr, "CT2007 OK\n");
|
||||
exit(0);
|
||||
}
|
||||
3
test/mng_mod/issues/863/x86_64/CT2007.sh
Normal file
3
test/mng_mod/issues/863/x86_64/CT2007.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
MCEXEC=mcexec
|
||||
$MCEXEC ./CT2007
|
||||
76
test/mng_mod/issues/863/x86_64/CT2008.c
Normal file
76
test/mng_mod/issues/863/x86_64/CT2008.c
Normal file
@@ -0,0 +1,76 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#define FILESIZE (2L * 1024 * 1024 * 1024)
|
||||
|
||||
pid_t pid;
|
||||
|
||||
void
|
||||
sig(int s)
|
||||
{
|
||||
fprintf(stderr, "kill SIGTERM (ignored)\n");
|
||||
kill(pid, SIGTERM);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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, "CT2008 NG BAD wait rc=%d errno=%d\n", rc, errno);
|
||||
exit(1);
|
||||
}
|
||||
if (WIFSIGNALED(st)) {
|
||||
fprintf(stderr, "CT2008 NG BAD signal st=%08x\n", st);
|
||||
exit(1);
|
||||
}
|
||||
if (!WIFEXITED(st)) {
|
||||
fprintf(stderr, "CT2008 NG BAD terminated st=%08x\n", st);
|
||||
exit(1);
|
||||
}
|
||||
if (WEXITSTATUS(st) != 99) {
|
||||
fprintf(stderr, "CT2008 NG BAD exit status st=%08x\n", st);
|
||||
exit(1);
|
||||
}
|
||||
fprintf(stderr, "CT2008 OK\n");
|
||||
exit(0);
|
||||
}
|
||||
7
test/mng_mod/issues/863/x86_64/CT2008.sh
Normal file
7
test/mng_mod/issues/863/x86_64/CT2008.sh
Normal file
@@ -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
|
||||
$MCEXEC ./CT2008
|
||||
rm -f testfile
|
||||
12
test/mng_mod/issues/863/x86_64/CT200x.sh
Normal file
12
test/mng_mod/issues/863/x86_64/CT200x.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
MCKERNEL_DIR=/home/shirasawa/wallaby11-smp-x86/development/mic
|
||||
export PATH=$MCKERNEL_DIR/bin:$PATH
|
||||
|
||||
./CT2001.sh
|
||||
./CT2002.sh
|
||||
./CT2003.sh
|
||||
./CT2004.sh
|
||||
./CT2005.sh
|
||||
./CT2006.sh
|
||||
./CT2007.sh
|
||||
./CT2008.sh
|
||||
45
test/mng_mod/issues/863/x86_64/CT200x.txt
Normal file
45
test/mng_mod/issues/863/x86_64/CT200x.txt
Normal file
@@ -0,0 +1,45 @@
|
||||
スクリプトは Fri Mar 23 14:44:56 2018
|
||||
に開始しました[?1034hbash-4.2$ make test
|
||||
./CT200x.sh
|
||||
14:44:59.479215 test start, kill after 3 seconds
|
||||
14:45:02.479661 signal hanlder is called
|
||||
CT2001 OK
|
||||
2048+0 レコード入力
|
||||
2048+0 レコード出力
|
||||
2147483648 バイト (2.1 GB) コピーされました、 19.5222 秒、 110 MB/秒
|
||||
vm.drop_caches = 3
|
||||
signal hanlder is called
|
||||
CT2002 OK
|
||||
14:45:46.852481 test start, kill after 3 seconds
|
||||
14:45:49.866473 child process terminated
|
||||
CT2003 OK
|
||||
2048+0 レコード入力
|
||||
2048+0 レコード出力
|
||||
2147483648 バイト (2.1 GB) コピーされました、 19.513 秒、 110 MB/秒
|
||||
vm.drop_caches = 3
|
||||
14:46:09.750053 test start, kill after 1 seconds
|
||||
14:46:11.100485 child process terminated
|
||||
CT2004 OK
|
||||
kill SIGURG
|
||||
kill SIGINT
|
||||
CT2005 OK
|
||||
2048+0 レコード入力
|
||||
2048+0 レコード出力
|
||||
2147483648 バイト (2.1 GB) コピーされました、 19.5075 秒、 110 MB/秒
|
||||
vm.drop_caches = 3
|
||||
kill SIGURG
|
||||
CT2006 OK
|
||||
kill SIGTERM (ignored)
|
||||
kill SIGINT
|
||||
CT2007 OK
|
||||
2048+0 レコード入力
|
||||
2048+0 レコード出力
|
||||
2147483648 バイト (2.1 GB) コピーされました、 19.5217 秒、 110 MB/秒
|
||||
vm.drop_caches = 3
|
||||
kill SIGTERM (ignored)
|
||||
CT2008 OK
|
||||
bash-4.2$ exit
|
||||
exit
|
||||
|
||||
スクリプトは Fri Mar 23 14:48:02 2018
|
||||
に終了しました
|
||||
34
test/mng_mod/issues/863/x86_64/Makefile
Normal file
34
test/mng_mod/issues/863/x86_64/Makefile
Normal file
@@ -0,0 +1,34 @@
|
||||
CC=gcc
|
||||
TARGET=CT2001 CT2002 CT2003 CT2004 CT2005 CT2006 CT2007 CT2008
|
||||
all:: $(TARGET)
|
||||
chmod u+x CT200?.sh
|
||||
|
||||
CT2001: CT2001.c
|
||||
$(CC) -o CT2001 $<
|
||||
|
||||
CT2002: CT2002.c
|
||||
$(CC) -o CT2002 $<
|
||||
|
||||
CT2003: CT2003.c
|
||||
$(CC) -o CT2003 $<
|
||||
|
||||
CT2004: CT2004.c
|
||||
$(CC) -o CT2004 $<
|
||||
|
||||
CT2005: CT2005.c
|
||||
$(CC) -o CT2005 $<
|
||||
|
||||
CT2006: CT2006.c
|
||||
$(CC) -o CT2006 $<
|
||||
|
||||
CT2007: CT2007.c
|
||||
$(CC) -o CT2007 $<
|
||||
|
||||
CT2008: CT2008.c
|
||||
$(CC) -o CT2008 $<
|
||||
|
||||
test:: $(TARGET)
|
||||
./CT200x.sh
|
||||
|
||||
clean::
|
||||
rm -f $(TARGET)
|
||||
49
test/mng_mod/issues/863/x86_64/README
Normal file
49
test/mng_mod/issues/863/x86_64/README
Normal file
@@ -0,0 +1,49 @@
|
||||
【Issue#863 動作確認】
|
||||
1. Issue#863 (https://postpeta.pccluster.org/redmine/issues/863)
|
||||
で指摘されたテストプログラムを用いて現象が解消されていることを
|
||||
確認した。(2件)
|
||||
|
||||
確認項目は、以下の通り。
|
||||
(1) プログラムがSIGTERMで終了すること。
|
||||
→ The TEST process is terminated by the signal 15 の表示があれば OK
|
||||
(2) プログラムがLinuxから送付されたシグナルに即座に応答すること。
|
||||
→ TEST FAILED: Signal response time is more than or equal to 1 second
|
||||
の表示が無ければOK
|
||||
|
||||
実行結果(エビデンス)は以下の通り。
|
||||
|
||||
CT1001.txt Issue#863の指摘で使用されたテストプログラムの実行結果(OK 1件、NG 0件)
|
||||
|
||||
2. Issue#863の変更が、McKernelプロセス間のシグナルに対する既存処理に
|
||||
影響しないことを確認した。
|
||||
|
||||
テストの実行方法は以下の通り。
|
||||
(1) CT200x.shのMCKERNEL_DIR=の行を以下のように書き換える
|
||||
MCKERNEL_DIR=<mckernel-install>
|
||||
(2) 以下のコマンドを実行
|
||||
make
|
||||
sudo <mckernel-install>/sbin/mcreboot.sh -c 2-7
|
||||
./CT200x.sh
|
||||
|
||||
確認内容は以下の通り。
|
||||
|
||||
CT2001 遅いI/Oシステムコール実行中にシグナルを受け、即座にシグナル
|
||||
ハンドラが呼び出され、システムコールがEINTRを返却することを
|
||||
確認する。
|
||||
CT2002 遅くないI/Oシステムコール実行中にシグナルを受け、システム
|
||||
コール完了後にシグナルハンドラが呼び出され、システムコール
|
||||
が正常に終了することを確認する。
|
||||
CT2003 遅いI/Oシステムコール実行中にプログラムを終了するシグナルを
|
||||
受けとると、即座にプログラムが終了することを確認する。
|
||||
CT2004 遅くないI/Oシステムコール実行中にプログラムを終了するシグナル
|
||||
を受けとると、即座にプログラムを終了することを確認する。
|
||||
CT2005 遅いI/Oシステムコール実行中にプログラムを終了しないシグナル(SIGURG)
|
||||
を受けとっても、プログラムの実行に影響しないことを確認する。
|
||||
CT2006 遅くないI/Oシステムコール実行中にプログラムを終了しないシグナル
|
||||
(SIGURG)を受けとっても、プログラムの実行に影響しないことを確認する。
|
||||
CT2007 遅いI/Oシステムコール実行中に無視(SIG_IGN)するシグナルを
|
||||
受けとっても、プログラムの実行に影響しないことを確認する。
|
||||
CT2008 遅くないI/Oシステムコール実行中に無視(SIG_IGN)するシグナルを
|
||||
受けとっても、プログラムの実行に影響しないことを確認する。
|
||||
|
||||
エビデンスは CT200x.txt に示す。(OK 8件、NG 0件)
|
||||
Reference in New Issue
Block a user