add testcases for #732 #1065 #1102

This commit is contained in:
Ken Sato
2018-06-07 10:11:23 +09:00
parent 139123dc12
commit 9bb48186e6
35 changed files with 1653 additions and 0 deletions

38
test/issues/1065/CT_001.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh
TESTNAME=CT_001
arg_path=`realpath ./dummy_file`
. ./config
fail=0
echo "*** ${TESTNAME} start *******************"
real_path=`realpath ${arg_path}`
echo "file map: ${arg_path}"
${MCEXEC} ./file_map ${arg_path} | tee ./${TESTNAME}.log
if [ X$? != X0 ]; then
fail=1
fi
echo ""
echo "** grep ${real_path} from maps"
grep -a -e "${real_path}$" ./${TESTNAME}.log
if [ X$? = X0 ]; then
echo "[OK] ${real_path} is found"
else
echo "[NG] ${real_path} is not found"
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""
rm ./${TESTNAME}.log

38
test/issues/1065/CT_002.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh
TESTNAME=CT_002
arg_path=./dummy_file
. ./config
fail=0
echo "*** ${TESTNAME} start *******************"
real_path=`realpath ${arg_path}`
echo "file map: ${arg_path}"
${MCEXEC} ./file_map ${arg_path} | tee ./${TESTNAME}.log
if [ X$? != X0 ]; then
fail=1
fi
echo ""
echo "** grep ${real_path} from maps"
grep -a -e "${real_path}$" ./${TESTNAME}.log
if [ X$? = X0 ]; then
echo "[OK] ${real_path} is found"
else
echo "[NG] ${real_path} is not found"
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""
rm ./${TESTNAME}.log

38
test/issues/1065/CT_003.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh
TESTNAME=CT_003
arg_path=./lnk_to_dummy
. ./config
fail=0
echo "*** ${TESTNAME} start *******************"
real_path=`realpath ${arg_path}`
echo "file map: ${arg_path}"
${MCEXEC} ./file_map ${arg_path} | tee ./${TESTNAME}.log
if [ X$? != X0 ]; then
fail=1
fi
echo ""
echo "** grep ${real_path} from maps"
grep -a -e "${real_path}$" ./${TESTNAME}.log
if [ X$? = X0 ]; then
echo "[OK] ${real_path} is found"
else
echo "[NG] ${real_path} is not found"
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""
rm ./${TESTNAME}.log

52
test/issues/1065/CT_004.sh Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/sh
TESTNAME=CT_004
test_program=./print_maps
. ./config
fail=0
echo "*** ${TESTNAME} start *******************"
real_path=`realpath ${test_program}`
interp_path=`readelf -l ${test_program} | grep "interpreter:" | sed -r 's/.*\[.*interpreter:\s(.*)\].*/\1/'`
interp_real_path=`realpath ${interp_path}`
echo "exec : ${test_program}"
${MCEXEC} ${test_program} | tee ./${TESTNAME}.log
if [ X$? != X0 ]; then
fail=1
fi
echo ""
echo "** grep ${real_path} from maps"
grep -a -e "${real_path}$" ./${TESTNAME}.log
if [ X$? = X0 ]; then
echo "[OK] ${real_path} is found"
else
echo "[NG] ${real_path} is not found"
fail=1
fi
echo ""
echo "** grep ${interp_real_path} from maps"
grep -a -e "${interp_real_path}$" ./${TESTNAME}.log
if [ X$? = X0 ]; then
echo "[OK] ${interp_real_path} is found"
else
echo "[NG] ${interp_real_path} is not found"
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""
rm ./${TESTNAME}.log

53
test/issues/1065/CT_005.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/bin/sh
TESTNAME=CT_005
test_program=./static_print_maps
ref_program=./print_maps
. ./config
fail=0
echo "*** ${TESTNAME} start *******************"
real_path=`realpath ${test_program}`
interp_path=`readelf -l ${ref_program} | grep "interpreter:" | sed -r 's/.*\[.*interpreter:\s(.*)\].*/\1/'`
interp_real_path=`realpath ${interp_path}`
echo "exec : ${test_program}"
${MCEXEC} ${test_program} | tee ./${TESTNAME}.log
if [ X$? != X0 ]; then
fail=1
fi
echo ""
echo "** grep ${real_path} from maps"
grep -a -e "${real_path}$" ./${TESTNAME}.log
if [ X$? = X0 ]; then
echo "[OK] ${real_path} is found"
else
echo "[NG] ${real_path} is not found"
fail=1
fi
echo ""
echo "** grep ${interp_real_path} from maps"
grep -a -e "${interp_real_path}$" ./${TESTNAME}.log
if [ X$? != X0 ]; then
echo "[OK] ${interp_real_path} is not found"
else
echo "[NG] ${interp_real_path} is found"
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""
rm ./${TESTNAME}.log

23
test/issues/1065/CT_006.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
TESTNAME=CT_006
. ./config
fail=0
echo "*** ${TESTNAME} start *******************"
${MCEXEC} cat /proc/self/maps
if [ $? = 0 ]; then
echo "[OK] shell script is running normaly"
else
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""

67
test/issues/1065/CT_007.sh Executable file
View File

@@ -0,0 +1,67 @@
#!/bin/sh
TESTNAME=CT_007
exec_program="./print_maps_and_cmdline"
test_program="./call_execve ${exec_program}"
. ./config
fail=0
echo "*** ${TESTNAME} start *******************"
real_path=`realpath ${exec_program}`
interp_path=`readelf -l ${exec_program} | grep "interpreter:" | sed -r 's/.*\[.*interpreter:\s(.*)\].*/\1/'`
interp_real_path=`realpath ${interp_path}`
echo "exec : ${test_program}"
#${test_program} | tee ./${TESTNAME}.log
${MCEXEC} ${test_program} 1> ./${TESTNAME}_maps.log 2> ./${TESTNAME}_cmdline.log
if [ X$? != X0 ]; then
fail=1
fi
cat ./${TESTNAME}_maps.log
echo ""
echo "** grep ${real_path} from maps"
grep -a -e "${real_path}$" ./${TESTNAME}_maps.log
if [ X$? = X0 ]; then
echo "[OK] ${real_path} is found"
else
echo "[NG] ${real_path} is not found"
fail=1
fi
echo ""
echo "** grep ${interp_real_path} from maps"
grep -a -e "${interp_real_path}$" ./${TESTNAME}_maps.log
if [ X$? = X0 ]; then
echo "[OK] ${interp_real_path} is found"
else
echo "[NG] ${interp_real_path} is not found"
fail=1
fi
cat ./${TESTNAME}_cmdline.log
echo ""
echo "** grep ${exec_program} from cmdline"
grep -a -e "${exec_program}" ./${TESTNAME}_cmdline.log
if [ X$? = X0 ]; then
echo "[OK] ${exec_program} is found"
else
echo "[NG] ${exec_program} is not found"
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""
rm ./${TESTNAME}_maps.log
rm ./${TESTNAME}_cmdline.log

66
test/issues/1065/CT_008.sh Executable file
View File

@@ -0,0 +1,66 @@
#!/bin/sh
TESTNAME=CT_008
exec_program="./print_maps_and_cmdline"
test_program="./call_execve.sh ${exec_program}"
. ./config
fail=0
echo "*** ${TESTNAME} start *******************"
real_path=`realpath ${exec_program}`
interp_path=`readelf -l ${exec_program} | grep "interpreter:" | sed -r 's/.*\[.*interpreter:\s(.*)\].*/\1/'`
interp_real_path=`realpath ${interp_path}`
echo "exec : ${test_program}"
${MCEXEC} ${test_program} 1> ./${TESTNAME}_maps.log 2> ./${TESTNAME}_cmdline.log
if [ X$? != X0 ]; then
fail=1
fi
cat ./${TESTNAME}_maps.log
echo ""
echo "** grep ${real_path} from maps"
grep -a -e "${real_path}$" ./${TESTNAME}_maps.log
if [ X$? = X0 ]; then
echo "[OK] ${real_path} is found"
else
echo "[NG] ${real_path} is not found"
fail=1
fi
echo ""
echo "** grep ${interp_real_path} from maps"
grep -a -e "${interp_real_path}$" ./${TESTNAME}_maps.log
if [ X$? = X0 ]; then
echo "[OK] ${interp_real_path} is found"
else
echo "[NG] ${interp_real_path} is not found"
fail=1
fi
cat ./${TESTNAME}_cmdline.log
echo ""
echo "** grep ${exec_program} from cmdline"
grep -a -e "${exec_program}" ./${TESTNAME}_cmdline.log
if [ X$? = X0 ]; then
echo "[OK] ${exec_program} is found"
else
echo "[NG] ${exec_program} is not found"
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""
#rm ./${TESTNAME}_maps.log
#rm ./${TESTNAME}_cmdline.log

View File

View File

@@ -0,0 +1,3 @@
STKN:[main] This is shell script
STKN:[main_loop] filename:./call_execve shell:0x(nil)
STKN:[main_loop] filename:./print_maps_and_cmdline shell:0x(nil)

45
test/issues/1065/Makefile Normal file
View File

@@ -0,0 +1,45 @@
CC = gcc
MCK_DIR=/home/satoken/ppos
MCEXEC=$(MCK_DIR)/bin/mcexec
TARGET= file_map print_maps static_print_maps call_execve print_maps_and_cmdline config
CPPFLAGS =
LDFLAGS =
all: $(TARGET)
file_map: file_map.c
$(CC) -o $@ $^ $(LDFLAGS)
print_maps: print_maps.c
$(CC) -o $@ $^ $(LDFLAGS)
print_maps_and_cmdline: print_maps_and_cmdline.c
$(CC) -o $@ $^ $(LDFLAGS)
static_print_maps: print_maps.c
$(CC) -o $@ $^ $(LDFLAGS) -static
call_execve: call_execve.c
$(CC) -o $@ $^ $(LDFLAGS)
config:
@echo "MCEXEC=$(MCEXEC)" > ./config
init:
ln -nfs ./dummy_file ./lnk_to_dummy
test: init all
./CT_001.sh
./CT_002.sh
./CT_003.sh
./CT_004.sh
./CT_005.sh
./CT_006.sh
./CT_007.sh
./CT_008.sh
clean:
rm -f $(TARGET) *.o ./lnk_to_dummy

32
test/issues/1065/README Normal file
View File

@@ -0,0 +1,32 @@
CT_001:
ファイル実体を指す絶対パスを指定したファイルマップを実行する
-> /proc/<PID>/maps にファイル実体の絶対パスで表示される
CT_002:
ファイル実体を指す相対パスを指定したファイルマップを実行する
-> /proc/<PID>/maps にファイル実体の絶対パスで表示される
CT_003:
ファイル実体を指すシンボリックリンクを指定したファイルマップを実行する
-> /proc/<PID>/maps にファイル実体の絶対パスで表示される
CT_004:
ELF形式のプログラムを実行する
-> /proc/<PID>/maps に実行したプログラムと、そのinterpの絶対パスが表示される
CT_005:
static linkでビルドされたELF形式のプログラムを実行する
-> /proc/<PID>/maps に実行したプログラムと、そのinterpの絶対パスが表示される
CT_006:
シェルスクリプトを実行する
-> シェルスクリプトが正しく実行される
CT_007:
execveを行うプログラムを実行する
-> execveされたプログラムが正常に実行され、/proc下のmaps, cmdline から新しい情報が取得できる
CT_008:
execveを行うプログラムをシェルスクリプトから実行する
-> execveされたプログラムが正常に実行され、/proc下のmaps, cmdline から新しい情報が取得できる

View File

@@ -0,0 +1,28 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv[])
{
char* command;
char* exargv[] = {NULL, NULL};
char* exenvp[] = {NULL};
int rc;
if (argc < 2) {
printf("Error: too few arguments\n");
return -1;
}
exargv[0] = argv[1];
rc = execve(argv[1], exargv, exenvp);
/* Don't reach here */
if (rc == -1) {
perror("Error: failed to execve");
}
return -1;
}

View File

@@ -0,0 +1,4 @@
#!/bin/sh
./call_execve $*

View File

@@ -0,0 +1 @@
This is Test file for mmap.

View File

@@ -0,0 +1,46 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <sys/mman.h>
#define FILE_SIZE 1024
#define CMD_SIZE 128
int main(int argc, char* argv[])
{
int fd;
void *file_map;
long page_size, file_map_size;
char command[CMD_SIZE];
if (argc < 2) {
printf("Error: too few arguments\n");
return -1;
}
fd = open(argv[1], O_RDWR);
if (fd < 0) {
printf("Error: open %s\n", argv[1]);
return -1;
}
page_size = sysconf(_SC_PAGESIZE);
file_map_size = (FILE_SIZE / page_size + 1) * page_size;
file_map = mmap(0, file_map_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (file_map == MAP_FAILED) {
printf("Error: mmap file\n");
return -1;
}
sprintf(command, "cat /proc/%d/maps", getpid());
system(command);
close(fd);
munmap(file_map, file_map_size);
return 0;
}

View File

@@ -0,0 +1,13 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main(void)
{
char command[128];
sprintf(command, "cat /proc/%d/maps", getpid());
system(command);
return 0;
}

View File

@@ -0,0 +1,21 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#define CMD_SIZE 128
int main(void)
{
char command[CMD_SIZE];
memset(command, '0', CMD_SIZE);
sprintf(command, "cat /proc/%d/maps", getpid());
system(command);
memset(command, '0', CMD_SIZE);
sprintf(command, "cat /proc/%d/cmdline 1>&2", getpid());
system(command);
return 0;
}

225
test/issues/1065/result.log Normal file
View File

@@ -0,0 +1,225 @@
./CT_001.sh
*** CT_001 start *******************
file map: /home/satoken/2018_work/04/test/dummy_file
000000400000-000000401000 r-xs 0 0:0 0 /home/satoken/2018_work/04/test/file_map
000000600000-000000601000 r--s 0 0:0 0 /home/satoken/2018_work/04/test/file_map
000000601000-000000602000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/file_map
2aaaaa9f8000-2aaaaaa00000 rw-s 0 0:0 0
2aaaaaa00000-2aaaaaa21000 r-xs 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac21000-2aaaaac22000 r--s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac22000-2aaaaac23000 rw-s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac23000-2aaaaac24000 rw-p 0 0:0 0
2aaaaac24000-2aaaaac26000 r-xs 0 0:0 0 [vdso]
2aaaaac26000-2aaaaac27000 rw-p 0 0:0 0
2aaaaac4d000-2aaaaac4e000 rw-p 0 0:0 0
2aaaaac4e000-2aaaaae06000 r-xp 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaaae06000-2aaaab006000 ---p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab006000-2aaaab00a000 r--p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab00a000-2aaaab00c000 rw-p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab00c000-2aaaab011000 rw-p 0 0:0 0
2aaaab011000-2aaaab013000 rw-p 0 0:0 0
2aaaab013000-2aaaab014000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/dummy_file
547fff800000-548000000000 rw-s 0 0:0 0 [stack]
** grep /home/satoken/2018_work/04/test/dummy_file from maps
2aaaab013000-2aaaab014000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/dummy_file
[OK] /home/satoken/2018_work/04/test/dummy_file is found
*** CT_001 PASSED
./CT_002.sh
*** CT_002 start *******************
file map: ./dummy_file
000000400000-000000401000 r-xs 0 0:0 0 /home/satoken/2018_work/04/test/file_map
000000600000-000000601000 r--s 0 0:0 0 /home/satoken/2018_work/04/test/file_map
000000601000-000000602000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/file_map
2aaaaa9f8000-2aaaaaa00000 rw-s 0 0:0 0
2aaaaaa00000-2aaaaaa21000 r-xs 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac21000-2aaaaac22000 r--s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac22000-2aaaaac23000 rw-s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac23000-2aaaaac24000 rw-p 0 0:0 0
2aaaaac24000-2aaaaac26000 r-xs 0 0:0 0 [vdso]
2aaaaac26000-2aaaaac27000 rw-p 0 0:0 0
2aaaaac4d000-2aaaaac4e000 rw-p 0 0:0 0
2aaaaac4e000-2aaaaae06000 r-xp 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaaae06000-2aaaab006000 ---p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab006000-2aaaab00a000 r--p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab00a000-2aaaab00c000 rw-p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab00c000-2aaaab011000 rw-p 0 0:0 0
2aaaab011000-2aaaab013000 rw-p 0 0:0 0
2aaaab013000-2aaaab014000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/dummy_file
547fff800000-548000000000 rw-s 0 0:0 0 [stack]
** grep /home/satoken/2018_work/04/test/dummy_file from maps
2aaaab013000-2aaaab014000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/dummy_file
[OK] /home/satoken/2018_work/04/test/dummy_file is found
*** CT_002 PASSED
./CT_003.sh
*** CT_003 start *******************
file map: ./lnk_to_dummy
000000400000-000000401000 r-xs 0 0:0 0 /home/satoken/2018_work/04/test/file_map
000000600000-000000601000 r--s 0 0:0 0 /home/satoken/2018_work/04/test/file_map
000000601000-000000602000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/file_map
2aaaaa9f8000-2aaaaaa00000 rw-s 0 0:0 0
2aaaaaa00000-2aaaaaa21000 r-xs 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac21000-2aaaaac22000 r--s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac22000-2aaaaac23000 rw-s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac23000-2aaaaac24000 rw-p 0 0:0 0
2aaaaac24000-2aaaaac26000 r-xs 0 0:0 0 [vdso]
2aaaaac26000-2aaaaac27000 rw-p 0 0:0 0
2aaaaac4d000-2aaaaac4e000 rw-p 0 0:0 0
2aaaaac4e000-2aaaaae06000 r-xp 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaaae06000-2aaaab006000 ---p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab006000-2aaaab00a000 r--p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab00a000-2aaaab00c000 rw-p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab00c000-2aaaab011000 rw-p 0 0:0 0
2aaaab011000-2aaaab013000 rw-p 0 0:0 0
2aaaab013000-2aaaab014000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/dummy_file
547fff800000-548000000000 rw-s 0 0:0 0 [stack]
** grep /home/satoken/2018_work/04/test/dummy_file from maps
2aaaab013000-2aaaab014000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/dummy_file
[OK] /home/satoken/2018_work/04/test/dummy_file is found
*** CT_003 PASSED
./CT_004.sh
*** CT_004 start *******************
exec : ./print_maps
000000400000-000000401000 r-xs 0 0:0 0 /home/satoken/2018_work/04/test/print_maps
000000600000-000000601000 r--s 0 0:0 0 /home/satoken/2018_work/04/test/print_maps
000000601000-000000602000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/print_maps
2aaaaa9f8000-2aaaaaa00000 rw-s 0 0:0 0
2aaaaaa00000-2aaaaaa21000 r-xs 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac21000-2aaaaac22000 r--s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac22000-2aaaaac23000 rw-s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac23000-2aaaaac24000 rw-p 0 0:0 0
2aaaaac24000-2aaaaac26000 r-xs 0 0:0 0 [vdso]
2aaaaac26000-2aaaaac27000 rw-p 0 0:0 0
2aaaaac4d000-2aaaaac4e000 rw-p 0 0:0 0
2aaaaac4e000-2aaaaae06000 r-xp 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaaae06000-2aaaab006000 ---p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab006000-2aaaab00a000 r--p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab00a000-2aaaab00c000 rw-p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab00c000-2aaaab011000 rw-p 0 0:0 0
2aaaab011000-2aaaab013000 rw-p 0 0:0 0
547fff800000-548000000000 rw-s 0 0:0 0 [stack]
** grep /home/satoken/2018_work/04/test/print_maps from maps
000000400000-000000401000 r-xs 0 0:0 0 /home/satoken/2018_work/04/test/print_maps
000000600000-000000601000 r--s 0 0:0 0 /home/satoken/2018_work/04/test/print_maps
000000601000-000000602000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/print_maps
[OK] /home/satoken/2018_work/04/test/print_maps is found
** grep /usr/lib64/ld-2.17.so from maps
2aaaaaa00000-2aaaaaa21000 r-xs 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac21000-2aaaaac22000 r--s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac22000-2aaaaac23000 rw-s 0 0:0 0 /usr/lib64/ld-2.17.so
[OK] /usr/lib64/ld-2.17.so is found
*** CT_004 PASSED
./CT_005.sh
*** CT_005 start *******************
exec : ./static_print_maps
000000400000-0000004b8000 r-xs 0 0:0 0 /home/satoken/2018_work/04/test/static_print_maps
0000006b7000-0000006ba000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/static_print_maps
0000006ba000-0000006bc000 rw-p 0 0:0 0
000000800000-000000802000 rw-s 0 0:0 0 [heap]
000000802000-000000823000 rw-s 0 0:0 0 [heap]
000000823000-000000824000 rw-s 0 0:0 0 [heap]
2aaaaa9f8000-2aaaaaa00000 rw-s 0 0:0 0
2aaaaaa00000-2aaaaaa02000 r-xs 0 0:0 0 [vdso]
547fff800000-548000000000 rw-s 0 0:0 0 [stack]
** grep /home/satoken/2018_work/04/test/static_print_maps from maps
000000400000-0000004b8000 r-xs 0 0:0 0 /home/satoken/2018_work/04/test/static_print_maps
0000006b7000-0000006ba000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/static_print_maps
[OK] /home/satoken/2018_work/04/test/static_print_maps is found
** grep /usr/lib64/ld-2.17.so from maps
[OK] /usr/lib64/ld-2.17.so is not found
*** CT_005 PASSED
./CT_006.sh
*** CT_006 start *******************
000000400000-00000040b000 r-xs 0 0:0 0 /usr/bin/cat
00000060b000-00000060c000 r--s 0 0:0 0 /usr/bin/cat
00000060c000-00000060d000 rw-s 0 0:0 0 /usr/bin/cat
000000800000-000000821000 rw-s 0 0:0 0 [heap]
2aaaaa9f8000-2aaaaaa00000 rw-s 0 0:0 0
2aaaaaa00000-2aaaaaa21000 r-xs 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac21000-2aaaaac22000 r--s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac22000-2aaaaac23000 rw-s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac23000-2aaaaac24000 rw-p 0 0:0 0
2aaaaac24000-2aaaaac26000 r-xs 0 0:0 0 [vdso]
2aaaaac26000-2aaaaac27000 rw-p 0 0:0 0
2aaaaac4d000-2aaaaac4e000 rw-p 0 0:0 0
2aaaaac4e000-2aaaaae06000 r-xp 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaaae06000-2aaaab006000 ---p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab006000-2aaaab00a000 r--p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab00a000-2aaaab00c000 rw-p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab00c000-2aaaab011000 rw-p 0 0:0 0
2aaaab011000-2aaaab013000 rw-p 0 0:0 0
2aaaab013000-2aaab153c000 r--p 0 0:0 0 /usr/lib/locale/locale-archive
547fff800000-548000000000 rw-s 0 0:0 0 [stack]
[OK] shell script is running normaly
*** CT_006 PASSED
./CT_007.sh
*** CT_007 start *******************
exec : ./call_execve ./print_maps_and_cmdline
000000400000-000000401000 r-xs 0 0:0 0 /home/satoken/2018_work/04/test/print_maps_and_cmdline
000000600000-000000601000 r--s 0 0:0 0 /home/satoken/2018_work/04/test/print_maps_and_cmdline
000000601000-000000602000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/print_maps_and_cmdline
2aaaaa9f8000-2aaaaaa00000 rw-s 0 0:0 0
2aaaaaa00000-2aaaaaa21000 r-xs 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac21000-2aaaaac22000 r--s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac22000-2aaaaac23000 rw-s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac23000-2aaaaac24000 rw-p 0 0:0 0
2aaaaac24000-2aaaaac26000 r-xs 0 0:0 0 [vdso]
2aaaaac26000-2aaaaac27000 rw-p 0 0:0 0
2aaaaac4d000-2aaaaae05000 r-xp 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaaae05000-2aaaab005000 ---p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab005000-2aaaab009000 r--p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab009000-2aaaab00b000 rw-p 0 0:0 0 /usr/lib64/libc-2.17.so
2aaaab00b000-2aaaab010000 rw-p 0 0:0 0
2aaaab010000-2aaaab011000 rw-p 0 0:0 0
2aaaab011000-2aaaab013000 rw-p 0 0:0 0
547fff800000-548000000000 rw-s 0 0:0 0 [stack]
STKN:[main_loop] filename:./print_maps_and_cmdline shell:0x(nil)
STKN:[main_loop] filename:/bin/sh shell:0x(nil)
STKN:[main_loop] filename:./print_maps_and_cmdline shell:0x(nil)
** grep /home/satoken/2018_work/04/test/print_maps_and_cmdline from maps
000000400000-000000401000 r-xs 0 0:0 0 /home/satoken/2018_work/04/test/print_maps_and_cmdline
000000600000-000000601000 r--s 0 0:0 0 /home/satoken/2018_work/04/test/print_maps_and_cmdline
000000601000-000000602000 rw-s 0 0:0 0 /home/satoken/2018_work/04/test/print_maps_and_cmdline
[OK] /home/satoken/2018_work/04/test/print_maps_and_cmdline is found
** grep /usr/lib64/ld-2.17.so from maps
2aaaaaa00000-2aaaaaa21000 r-xs 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac21000-2aaaaac22000 r--s 0 0:0 0 /usr/lib64/ld-2.17.so
2aaaaac22000-2aaaaac23000 rw-s 0 0:0 0 /usr/lib64/ld-2.17.so
[OK] /usr/lib64/ld-2.17.so is found
./print_maps_and_cmdlineso.6o.
** grep ./print_maps_and_cmdline from cmdline
./print_maps_and_cmdlineso.6o.
[OK] ./print_maps_and_cmdline is found
*** CT_007 PASSED
./CT_008.sh
*** CT_008 start *******************
exec : ./call_execve.sh ./print_maps_and_cmdline
./CT_008.sh: line 18: 25571 Segmentation fault (core dumped) ${MCEXEC} ${test_program} > ./${TESTNAME}_maps.log 2> ./${TESTNAME}_cmdline.log
STKN:[main] This is shell script
STKN:[main_loop] filename:./call_execve shell:0x(nil)
STKN:[main_loop] filename:./print_maps_and_cmdline shell:0x(nil)
** grep /home/satoken/2018_work/04/test/print_maps_and_cmdline from maps
[NG] /home/satoken/2018_work/04/test/print_maps_and_cmdline is not found
** grep /usr/lib64/ld-2.17.so from maps
[NG] /usr/lib64/ld-2.17.so is not found
** grep ./print_maps_and_cmdline from cmdline
[NG] ./print_maps_and_cmdline is not found
*** CT_008 FAILED

34
test/issues/1102/CT_001.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/sh
TESTNAME=CT_001
REP=30
. ./config
fail=0
echo "*** ${TESTNAME} start *******************"
echo "** exec ltp-syscall_mkdir09 ${REP} times"
echo -n "" > ./${TESTNAME}.log
for i in `seq 1 ${REP}`
do
${MCEXEC} ${LTP_DIR}/testcases/bin/mkdir09 | tee -a ./${TESTNAME}.log
done
grep -a -e "FAIL" ./${TESTNAME}.log
if [ $? != 0 ]; then
echo "[OK] ltp-syscall_mkdir09 ${REP} times all passed"
else
echo "[NG] ltp-syscall_mkdir09 failed"
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""
rm ./${TESTNAME}.log

29
test/issues/1102/CT_002.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
TESTNAME=CT_002
. ./config
fail=0
echo "*** ${TESTNAME} start *******************"
echo "** exec ostest siginfo_00"
${MCEXEC} ${OSTEST_DIR}/bin/test_mck -s siginfo -n 0| tee -a ./${TESTNAME}.log
tail -n 1 ./${TESTNAME}.log | grep -a -e "RESULT: ok" &> /dev/null
if [ $? = 0 ]; then
echo "[OK] ostest siginfo_00 passed"
else
echo "[NG] ostest siginfo_00 failed"
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""
rm ./${TESTNAME}.log

51
test/issues/1102/CT_003.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/sh
TESTNAME=CT_003
. ./config
SIG_NAME=SIGHUP
SIG_NUM=1
fail=0
echo "*** ${TESTNAME} start *******************"
echo "** exec ostest siginfo_01 and then send ${SIG_NAME} to mcexec"
${MCEXEC} ${OSTEST_DIR}/bin/test_mck -s siginfo -n 1 &
sleep 1
echo "** back ground process(mcexec): $!"
echo "** send ${SIG_NAME} to mcexec once"
kill -${SIG_NUM} $!
sleep 1
echo "** check existing of $!"
ps -p $!
if [ $? = 0 ]; then
echo "[OK] $! exists yet"
else
echo "[NG] $! doesn't exist"
fail=1
fi
echo "** send ${SIG_NAME} to mcexec again"
kill -${SIG_NUM} $!
sleep 1
echo "** check existing of $!"
ps -p $!
if [ $? != 0 ]; then
echo "[OK] $! doesn't exist (be killed by signal)"
else
echo "[NG] exist yet"
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""

51
test/issues/1102/CT_004.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/sh
TESTNAME=CT_004
. ./config
SIG_NAME=SIGINT
SIG_NUM=2
fail=0
echo "*** ${TESTNAME} start *******************"
echo "** exec ostest siginfo_01 and then send ${SIG_NAME} to mcexec"
${MCEXEC} ${OSTEST_DIR}/bin/test_mck -s siginfo -n 1 &
sleep 1
echo "** back ground process(mcexec): $!"
echo "** send ${SIG_NAME} to mcexec once"
kill -${SIG_NUM} $!
sleep 1
echo "** check existing of $!"
ps -p $!
if [ $? = 0 ]; then
echo "[OK] $! exists yet"
else
echo "[NG] $! doesn't exist"
fail=1
fi
echo "** send ${SIG_NAME} to mcexec again"
kill -${SIG_NUM} $!
sleep 1
echo "** check existing of $!"
ps -p $!
if [ $? != 0 ]; then
echo "[OK] $! doesn't exist (be killed by signal)"
else
echo "[NG] exist yet"
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""

51
test/issues/1102/CT_005.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/sh
TESTNAME=CT_005
. ./config
SIG_NAME=SIGTERM
SIG_NUM=15
fail=0
echo "*** ${TESTNAME} start *******************"
echo "** exec ostest siginfo_01 and then send ${SIG_NAME} to mcexec"
${MCEXEC} ${OSTEST_DIR}/bin/test_mck -s siginfo -n 1 &
sleep 1
echo "** back ground process(mcexec): $!"
echo "** send ${SIG_NAME} to mcexec once"
kill -${SIG_NUM} $!
sleep 1
echo "** check existing of $!"
ps -p $!
if [ $? = 0 ]; then
echo "[OK] $! exists yet"
else
echo "[NG] $! doesn't exist"
fail=1
fi
echo "** send ${SIG_NAME} to mcexec again"
kill -${SIG_NUM} $!
sleep 1
echo "** check existing of $!"
ps -p $!
if [ $? != 0 ]; then
echo "[OK] $! doesn't exist (be killed by signal)"
else
echo "[NG] exist yet"
fail=1
fi
if [ X$fail = X0 ]; then
echo "*** ${TESTNAME} PASSED"
else
echo "*** ${TESTNAME} FAILED"
fi
echo ""

29
test/issues/1102/Makefile Normal file
View File

@@ -0,0 +1,29 @@
CC = gcc
MCK_DIR=/home/satoken/ppos
MCEXEC=$(MCK_DIR)/bin/mcexec
LTP_DIR=/home/satoken/ltp
OSTEST_DIR=/home/satoken/ostest
TARGET=config
CPPFLAGS =
LDFLAGS =
all: $(TARGET)
config:
@echo "MCEXEC=$(MCEXEC)" > ./config
@echo "LTP_DIR=$(LTP_DIR)" >> ./config
@echo "OSTEST_DIR=$(OSTEST_DIR)" >> ./config
test: all
./CT_001.sh
./CT_002.sh
./CT_003.sh
./CT_004.sh
./CT_005.sh
clean:
rm -f $(TARGET) *.o

26
test/issues/1102/README Normal file
View File

@@ -0,0 +1,26 @@
CT_001:
ltp-syscall_mkdir09 を繰り返し実行する
-> いずれの実行結果もFAILとならない
CT_002:
ostest のsiginfo_00 を実行する
-> 実行結果がRESULT: ok となる
CT_003:
ostest のsiginfo_01 を実行する
動作の確認には、SIGHUP を用いる
-> 1度目のSIGHUPはハンドルされ、プロセスが残存する
2度目のSIGHUPにより、プロセスが終了する
CT_004:
ostest のsiginfo_01 を実行する
動作の確認には、SIGINT を用いる
-> 1度目のSIGINTはハンドルされ、プロセスが残存する
2度目のSIGINTにより、プロセスが終了する
CT_005:
ostest のsiginfo_01 を実行する
動作の確認には、SIGTERM を用いる
-> 1度目のSIGTERMはハンドルされ、プロセスが残存する
2度目のSIGTERMにより、プロセスが終了する

273
test/issues/1102/result.log Normal file
View File

@@ -0,0 +1,273 @@
./CT_001.sh
*** CT_001 start *******************
** exec ltp-syscall_mkdir09 30 times
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
mkdir09 1 TPASS : PASS
[OK] ltp-syscall_mkdir09 30 times all passed
*** CT_001 PASSED
./CT_002.sh
*** CT_002 start *******************
** exec ostest siginfo_00
TEST_SUITE: siginfo
TEST_NUMBER: 0
ARGS:
=== raise signal #1 ===
Catch signal #1
siginfo->si_signo = 1
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #2 ===
Catch signal #2
siginfo->si_signo = 2
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #3 ===
Catch signal #3
siginfo->si_signo = 3
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #4 ===
Catch signal #4
siginfo->si_signo = 4
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #5 ===
Catch signal #5
siginfo->si_signo = 5
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #6 ===
Catch signal #6
siginfo->si_signo = 6
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #7 ===
Catch signal #7
siginfo->si_signo = 7
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #8 ===
Catch signal #8
siginfo->si_signo = 8
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #10 ===
Catch signal #10
siginfo->si_signo = 10
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #11 ===
Catch signal #11
siginfo->si_signo = 11
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #12 ===
Catch signal #12
siginfo->si_signo = 12
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #13 ===
Catch signal #13
siginfo->si_signo = 13
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #14 ===
Catch signal #14
siginfo->si_signo = 14
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #15 ===
Catch signal #15
siginfo->si_signo = 15
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #16 ===
Catch signal #16
siginfo->si_signo = 16
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #17 ===
Catch signal #17
siginfo->si_signo = 17
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #18 ===
Catch signal #18
siginfo->si_signo = 18
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #20 ===
Catch signal #20
siginfo->si_signo = 20
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #21 ===
Catch signal #21
siginfo->si_signo = 21
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #22 ===
Catch signal #22
siginfo->si_signo = 22
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #23 ===
Catch signal #23
siginfo->si_signo = 23
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #24 ===
Catch signal #24
siginfo->si_signo = 24
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #25 ===
Catch signal #25
siginfo->si_signo = 25
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #26 ===
Catch signal #26
siginfo->si_signo = 26
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #27 ===
Catch signal #27
siginfo->si_signo = 27
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #28 ===
Catch signal #28
siginfo->si_signo = 28
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #29 ===
Catch signal #29
siginfo->si_signo = 29
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #30 ===
Catch signal #30
siginfo->si_signo = 30
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
=== raise signal #31 ===
Catch signal #31
siginfo->si_signo = 31
siginfo->si_errno = 0
siginfo->si_code = 0xfffffffa
RESULT: ok
[OK] ostest siginfo_00 passed
*** CT_002 PASSED
./CT_003.sh
*** CT_003 start *******************
** exec ostest siginfo_01 and then send SIGHUP to mcexec
TEST_SUITE: siginfo
TEST_NUMBER: 1
ARGS:
==================================================
Please send signal to mcexec(pid=12295) from console.
Exit Once you throw twice the same signal.
==================================================
** back ground process(mcexec): 12295
** send SIGHUP to mcexec once
Catch signal #1
siginfo->si_signo = 1
siginfo->si_errno = 0
siginfo->si_code = 0x0
** check existing of 12295
PID TTY TIME CMD
12295 pts/0 00:00:00 exe
[OK] 12295 exists yet
** send SIGHUP to mcexec again
Terminate by signal 1
./CT_003.sh: line 34: 12295 Hangup ${MCEXEC} ${OSTEST_DIR}/bin/test_mck -s siginfo -n 1
** check existing of 12295
PID TTY TIME CMD
[OK] 12295 doesn't exist (be killed by signal)
*** CT_003 PASSED
./CT_004.sh
*** CT_004 start *******************
** exec ostest siginfo_01 and then send SIGINT to mcexec
TEST_SUITE: siginfo
TEST_NUMBER: 1
ARGS:
==================================================
Please send signal to mcexec(pid=12311) from console.
Exit Once you throw twice the same signal.
==================================================
** back ground process(mcexec): 12311
** send SIGINT to mcexec once
Catch signal #2
siginfo->si_signo = 2
siginfo->si_errno = 0
siginfo->si_code = 0x0
** check existing of 12311
PID TTY TIME CMD
12311 pts/0 00:00:00 exe
[OK] 12311 exists yet
** send SIGINT to mcexec again
Terminate by signal 2
** check existing of 12311
PID TTY TIME CMD
[OK] 12311 doesn't exist (be killed by signal)
*** CT_004 PASSED
./CT_005.sh
*** CT_005 start *******************
** exec ostest siginfo_01 and then send SIGTERM to mcexec
TEST_SUITE: siginfo
TEST_NUMBER: 1
ARGS:
==================================================
Please send signal to mcexec(pid=12327) from console.
Exit Once you throw twice the same signal.
==================================================
** back ground process(mcexec): 12327
** send SIGTERM to mcexec once
Catch signal #15
siginfo->si_signo = 15
siginfo->si_errno = 0
siginfo->si_code = 0x0
** check existing of 12327
PID TTY TIME CMD
12327 pts/0 00:00:00 exe
[OK] 12327 exists yet
** send SIGTERM to mcexec again
Terminate by signal 15
./CT_005.sh: line 34: 12327 Terminated ${MCEXEC} ${OSTEST_DIR}/bin/test_mck -s siginfo -n 1
** check existing of 12327
PID TTY TIME CMD
[OK] 12327 doesn't exist (be killed by signal)
*** CT_005 PASSED

29
test/issues/732/CT_001.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
TESTNAME=CT_001
tgt_file=maps
fail=0
. ./config
echo "*** ${TESTNAME} start ***************************"
${MCEXEC} cat -v /proc/self/${tgt_file} | tee ./${TESTNAME}.log
tail -1 ${TESTNAME}.log | grep -e "\^@$"
if [ $? != 0 ]; then
echo "[OK] end of /proc/<PID>/${tgt_file} is not NULL character"
else
echo "[NG] end of /proc/<PID>/${tgt_file} is unnecessary NULL character"
fail=1
fi
rm ./${TESTNAME}.log
if [ X${fail} != X0 ]; then
echo "*** ${TESTNAME} FAILED"
else
echo "*** ${TESTNAME} PASSED"
fi
echo ""

29
test/issues/732/CT_002.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
TESTNAME=CT_002
tgt_file=stat
fail=0
. ./config
echo "*** ${TESTNAME} start ***************************"
${MCEXEC} cat -v /proc/self/${tgt_file} | tee ./${TESTNAME}.log
tail -1 ${TESTNAME}.log | grep -e "\^@$"
if [ $? != 0 ]; then
echo "[OK] end of /proc/<PID>/${tgt_file} is not NULL character"
else
echo "[NG] end of /proc/<PID>/${tgt_file} is unnecessary NULL character"
fail=1
fi
rm ./${TESTNAME}.log
if [ X${fail} != X0 ]; then
echo "*** ${TESTNAME} FAILED"
else
echo "*** ${TESTNAME} PASSED"
fi
echo ""

29
test/issues/732/CT_003.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
TESTNAME=CT_003
tgt_file=status
fail=0
. ./config
echo "*** ${TESTNAME} start ***************************"
${MCEXEC} cat -v /proc/self/${tgt_file} | tee ./${TESTNAME}.log
tail -1 ${TESTNAME}.log | grep -e "\^@$"
if [ $? != 0 ]; then
echo "[OK] end of /proc/<PID>/${tgt_file} is not NULL character"
else
echo "[NG] end of /proc/<PID>/${tgt_file} is unnecessary NULL character"
fail=1
fi
rm ./${TESTNAME}.log
if [ X${fail} != X0 ]; then
echo "*** ${TESTNAME} FAILED"
else
echo "*** ${TESTNAME} PASSED"
fi
echo ""

29
test/issues/732/CT_004.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
TESTNAME=CT_004
tgt_file=stack
fail=0
. ./config
echo "*** ${TESTNAME} start ***************************"
${MCEXEC} cat -v /proc/self/${tgt_file} | tee ./${TESTNAME}.log
tail -1 ${TESTNAME}.log | grep -e "\^@$"
if [ $? != 0 ]; then
echo "[OK] end of /proc/<PID>/${tgt_file} is not NULL character"
else
echo "[NG] end of /proc/<PID>/${tgt_file} is unnecessary NULL character"
fail=1
fi
rm ./${TESTNAME}.log
if [ X${fail} != X0 ]; then
echo "*** ${TESTNAME} FAILED"
else
echo "*** ${TESTNAME} PASSED"
fi
echo ""

29
test/issues/732/CT_005.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
TESTNAME=CT_005
tgt_file=numa_maps
fail=0
. ./config
echo "*** ${TESTNAME} start ***************************"
${MCEXEC} cat -v /proc/self/${tgt_file} | tee ./${TESTNAME}.log
tail -1 ${TESTNAME}.log | grep -e "\^@$"
if [ $? != 0 ]; then
echo "[OK] end of /proc/<PID>/${tgt_file} is not NULL character"
else
echo "[NG] end of /proc/<PID>/${tgt_file} is unnecessary NULL character"
fail=1
fi
rm ./${TESTNAME}.log
if [ X${fail} != X0 ]; then
echo "*** ${TESTNAME} FAILED"
else
echo "*** ${TESTNAME} PASSED"
fi
echo ""

24
test/issues/732/Makefile Normal file
View File

@@ -0,0 +1,24 @@
CC = gcc
MCK_DIR=/home/satoken/ppos
MCEXEC=$(MCK_DIR)/bin/mcexec
TARGET=config
CPPFLAGS =
LDFLAGS =
all: $(TARGET)
config:
@echo "MCEXEC=$(MCEXEC)" > ./config
test: all
./CT_001.sh
./CT_002.sh
./CT_003.sh
./CT_004.sh
./CT_005.sh
clean:
rm -f $(TARGET) *.o

20
test/issues/732/README Normal file
View File

@@ -0,0 +1,20 @@
CT_001:
/proc/<PID>/maps の内容を出力する
-> 出力結果の末尾に不要なNULL文字が存在しない
CT_002:
/proc/<PID>/stat の内容を出力する
-> 出力結果の末尾に不要なNULL文字が存在しない
CT_003:
/proc/<PID>/status の内容を出力する
-> 出力結果の末尾に不要なNULL文字が存在しない
CT_004:
/proc/<PID>/stack の内容を出力する
-> 出力結果の末尾に不要なNULL文字が存在しない
CT_005:
/proc/<PID>/numa_maps の内容を出力する
-> 出力結果の末尾に不要なNULL文字が存在しない

127
test/issues/732/resul.log Normal file
View File

@@ -0,0 +1,127 @@
./CT_001.sh
*** CT_001 start ***************************
000000400000-00000040b000 r-xs 0 0:0 0
00000060b000-00000060c000 r--s 0 0:0 0
00000060c000-00000060d000 rw-s 0 0:0 0
000000800000-000000821000 rw-s 0 0:0 0 [heap]
2aaaaa9f8000-2aaaaaa00000 rw-s 0 0:0 0
2aaaaaa00000-2aaaaaa21000 r-xs 0 0:0 0
2aaaaac21000-2aaaaac22000 r--s 0 0:0 0
2aaaaac22000-2aaaaac24000 rw-s 0 0:0 0
2aaaaac24000-2aaaaac26000 r-xs 0 0:0 0 [vdso]
2aaaaac26000-2aaaaac27000 rw-p 0 0:0 0
2aaaaac4d000-2aaaaac4e000 rw-p 0 0:0 0
2aaaaac4e000-2aaaaae06000 r-xp 0 0:0 0
2aaaaae06000-2aaaab006000 ---p 0 0:0 0
2aaaab006000-2aaaab00a000 r--p 0 0:0 0
2aaaab00a000-2aaaab00c000 rw-p 0 0:0 0
2aaaab00c000-2aaaab011000 rw-p 0 0:0 0
2aaaab011000-2aaaab013000 rw-p 0 0:0 0
2aaaab013000-2aaab153c000 r--p 0 0:0 0
2aaab153c000-2aaab158e000 rw-p 0 0:0 0
547fff800000-548000000000 rw-s 0 0:0 0 [stack]
[OK] end of /proc/<PID>/maps is not NULL character
*** CT_001 PASSED
./CT_002.sh
*** CT_002 start ***************************
9360 (exe) S 9359 9342 21102 34816 9342 1073750272 661 0 0 0 0 0 0 0 20 0 10 0 51949304 92908821254144 772 18446744073709551615 93824992231424 93824992276796 140737488343392 140737488328480 140737345437527 0 0 0 2147155711 18446744073709551615 0 0 17 0 0 0 0 0 0 93824994377104 93824994379104 93824994390016 140737488344339 140737488344392 140737488344392 140737488351209 0
[OK] end of /proc/<PID>/stat is not NULL character
*** CT_002 PASSED
./CT_003.sh
*** CT_003 start ***************************
Uid: 3505 3505 3505 3505
Gid: 3002 3002 3002 3002
State: R (running)
VmLck: 0 kB
Cpus_allowed: ff
Cpus_allowed_list: 0-7
Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
Mems_allowed_list: 0
[OK] end of /proc/<PID>/status is not NULL character
*** CT_003 PASSED
./CT_004.sh
*** CT_004 start ***************************
[<ffffffff810e26e4>] futex_wait_queue_me+0xc4/0x120
[<ffffffff810e3259>] futex_wait+0x179/0x280
[<ffffffff810e52ee>] do_futex+0xfe/0x5b0
[<ffffffff810e5820>] SyS_futex+0x80/0x180
[<ffffffff81646c49>] system_call_fastpath+0x16/0x1b
[<ffffffffffffffff>] 0xffffffffffffffff
[OK] end of /proc/<PID>/stack is not NULL character
*** CT_004 PASSED
./CT_005.sh
*** CT_005 start ***************************
00000000 prefer:0 file=anon_inode:[mckernel]
0060b000 prefer:0 file=anon_inode:[mckernel]
0060c000 prefer:0 file=anon_inode:[mckernel] mapped=3 mapmax=3 active=0 N0=3 kernelpagesize_kB=4
2aaaaac21000 prefer:0 file=anon_inode:[mckernel]
2aaaaac22000 prefer:0 file=anon_inode:[mckernel] mapped=1 mapmax=3 active=0 N0=1 kernelpagesize_kB=4
2aaaaac27000 prefer:0 file=anon_inode:[mckernel]
2aaaaac4d000 prefer:0 file=anon_inode:[mckernel]
2aaaaac4e000 prefer:0 file=anon_inode:[mckernel] mapped=1 mapmax=3 active=0 N0=1 kernelpagesize_kB=4
2aaaab006000 prefer:0 file=anon_inode:[mckernel]
2aaaab00a000 prefer:0 file=anon_inode:[mckernel] dirty=1 mapmax=3 active=0 N0=1 kernelpagesize_kB=4
2aaaab00c000 prefer:0 file=anon_inode:[mckernel]
2aaaab011000 prefer:0 file=anon_inode:[mckernel]
2aaaab013000 prefer:0 file=anon_inode:[mckernel]
2aaab153c000 prefer:0 file=anon_inode:[mckernel] dirty=3 mapped=512 mapmax=3 active=0 N0=512 kernelpagesize_kB=4
555555554000 prefer:0 file=/home/satoken/mck_srcs/pposs/ppos_development/bin/mcexec mapped=10 N0=10 kernelpagesize_kB=4
55555575f000 prefer:0 file=/home/satoken/mck_srcs/pposs/ppos_development/bin/mcexec anon=1 dirty=1 N1=1 kernelpagesize_kB=4
555555760000 prefer:0 file=/home/satoken/mck_srcs/pposs/ppos_development/bin/mcexec anon=1 dirty=1 N1=1 kernelpagesize_kB=4
555555761000 prefer:0 heap anon=11 dirty=11 N1=11 kernelpagesize_kB=4
7ffff29c9000 prefer:0
7ffff29ca000 prefer:0 stack:9416 anon=3 dirty=3 N0=2 N1=1 kernelpagesize_kB=4
7ffff31ca000 prefer:0
7ffff31cb000 prefer:0 stack:9415 anon=7 dirty=7 N0=6 N1=1 kernelpagesize_kB=4
7ffff39cb000 prefer:0
7ffff39cc000 prefer:0 stack:9414 anon=3 dirty=3 N0=2 N1=1 kernelpagesize_kB=4
7ffff41cc000 prefer:0
7ffff41cd000 prefer:0 stack:9413 anon=3 dirty=3 N0=3 kernelpagesize_kB=4
7ffff49cd000 prefer:0
7ffff49ce000 prefer:0 stack:9412 anon=3 dirty=3 N0=3 kernelpagesize_kB=4
7ffff51ce000 prefer:0
7ffff51cf000 prefer:0 stack:9411 anon=3 dirty=3 N0=3 kernelpagesize_kB=4
7ffff59cf000 prefer:0
7ffff59d0000 prefer:0 stack:9410 anon=3 dirty=3 N0=2 N1=1 kernelpagesize_kB=4
7ffff61d0000 prefer:0
7ffff61d1000 prefer:0 stack:9409 anon=3 dirty=3 N0=3 kernelpagesize_kB=4
7ffff69d1000 prefer:0
7ffff69d2000 prefer:0 stack:9408 anon=3 dirty=3 N0=2 N1=1 kernelpagesize_kB=4
7ffff71d2000 prefer:0 file=/usr/lib64/libgcc_s-4.8.5-20150702.so.1 mapped=3 mapmax=25 N0=3 kernelpagesize_kB=4
7ffff71e7000 prefer:0 file=/usr/lib64/libgcc_s-4.8.5-20150702.so.1
7ffff73e6000 prefer:0 file=/usr/lib64/libgcc_s-4.8.5-20150702.so.1 anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff73e7000 prefer:0 file=/usr/lib64/libgcc_s-4.8.5-20150702.so.1 anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff73e8000 prefer:0 file=/usr/lib64/libc-2.17.so mapped=111 mapmax=52 N0=105 N1=6 kernelpagesize_kB=4
7ffff75a0000 prefer:0 file=/usr/lib64/libc-2.17.so
7ffff77a0000 prefer:0 file=/usr/lib64/libc-2.17.so anon=4 dirty=4 N1=4 kernelpagesize_kB=4
7ffff77a4000 prefer:0 file=/usr/lib64/libc-2.17.so anon=2 dirty=2 N1=2 kernelpagesize_kB=4
7ffff77a6000 prefer:0 anon=3 dirty=3 N1=3 kernelpagesize_kB=4
7ffff77ab000 prefer:0 file=/usr/lib64/libpthread-2.17.so mapped=17 mapmax=42 N0=17 kernelpagesize_kB=4
7ffff77c2000 prefer:0 file=/usr/lib64/libpthread-2.17.so
7ffff79c1000 prefer:0 file=/usr/lib64/libpthread-2.17.so anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff79c2000 prefer:0 file=/usr/lib64/libpthread-2.17.so anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff79c3000 prefer:0 anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff79c7000 prefer:0 file=/usr/lib64/libnuma.so.1 mapped=8 mapmax=3 N1=8 kernelpagesize_kB=4
7ffff79d1000 prefer:0 file=/usr/lib64/libnuma.so.1
7ffff7bd1000 prefer:0 file=/usr/lib64/libnuma.so.1 anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff7bd2000 prefer:0 file=/usr/lib64/libnuma.so.1 anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff7bd3000 prefer:0 file=/usr/lib64/librt-2.17.so mapped=3 mapmax=33 N0=3 kernelpagesize_kB=4
7ffff7bda000 prefer:0 file=/usr/lib64/librt-2.17.so
7ffff7dd9000 prefer:0 file=/usr/lib64/librt-2.17.so anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff7dda000 prefer:0 file=/usr/lib64/librt-2.17.so anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff7ddb000 prefer:0 file=/usr/lib64/ld-2.17.so mapped=28 mapmax=50 N0=28 kernelpagesize_kB=4
7ffff7fce000 prefer:0 anon=5 dirty=5 N1=5 kernelpagesize_kB=4
7ffff7ff2000 prefer:0 anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff7ff3000 prefer:0 anon=6 dirty=6 N1=6 kernelpagesize_kB=4
7ffff7ff9000 prefer:0 anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff7ffa000 prefer:0
7ffff7ffc000 prefer:0 file=/usr/lib64/ld-2.17.so anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff7ffd000 prefer:0 file=/usr/lib64/ld-2.17.so anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffff7ffe000 prefer:0 anon=1 dirty=1 N1=1 kernelpagesize_kB=4
7ffffffdc000 prefer:0 stack anon=9 dirty=9 N1=9 kernelpagesize_kB=4
[OK] end of /proc/<PID>/numa_maps is not NULL character
*** CT_005 PASSED