User Space:swapout (this is a rebase commit to merge into development)
This commit is contained in:
19
test/user_space/swapout/Makefile
Normal file
19
test/user_space/swapout/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
PPOSDIR=/home/iizuka/mckernel
|
||||
MPIDIR=/usr/lib64/mpich-3.2
|
||||
MPIBINDIR=$(MPIDIR)/bin
|
||||
MPILIBDIR=$(MPIDIR)/lib
|
||||
CC=gcc
|
||||
|
||||
LIBDIR=$(PPOSDIR)/lib
|
||||
LDFLAGS=-L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -Wl,-rpath,$(MPILIBDIR)
|
||||
CFLAGS= -I$(PPOSDIR)/include
|
||||
|
||||
TARGETS= swaptest
|
||||
|
||||
all:: $(TARGETS)
|
||||
|
||||
swaptest: swaptest.c
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c
|
||||
|
||||
clean::
|
||||
rm -f $(TARGETS)
|
||||
9
test/user_space/swapout/config
Normal file
9
test/user_space/swapout/config
Normal file
@@ -0,0 +1,9 @@
|
||||
MCMOD_DIR=/home/iizuka/mckernel
|
||||
|
||||
START=${MCMOD_DIR}/bin/ql_mpiexec_start
|
||||
FINALIZE=${MCMOD_DIR}/bin/ql_mpiexec_finalize
|
||||
|
||||
USR_PRG_A=../../qlmpi/qlmpi_testsuite/usr_prg_A
|
||||
USR_PRG_B=../../qlmpi/qlmpi_testsuite/usr_prg_B
|
||||
USR_PRG_C=../../qlmpi/qlmpi_testsuite/usr_prg_C
|
||||
USR_PRG_IRREG=../../qlmpi/qlmpi_testsuite/usr_prg_irreg
|
||||
368
test/user_space/swapout/ql_normal.sh
Executable file
368
test/user_space/swapout/ql_normal.sh
Executable file
@@ -0,0 +1,368 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Functions
|
||||
function ok_out() {
|
||||
echo "[OK] ${TEST_PREFIX}`printf %03d ${TEST_NUM}` $1"
|
||||
(( TEST_NUM++ ))
|
||||
TEST_CODE=`printf %03d ${TEST_NUM}`
|
||||
}
|
||||
|
||||
function ng_out() {
|
||||
echo "[NG] ${TEST_PREFIX}`printf %03d ${TEST_NUM}` $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "too few arguments."
|
||||
echo "usage: `basename $0` <param_file>"
|
||||
fi
|
||||
|
||||
# Functions
|
||||
function reboot() {
|
||||
count=`pgrep -c -f 'mcexec '`
|
||||
if [ ${count} -gt 0 ]
|
||||
then
|
||||
echo "kill process :" ${count}
|
||||
pgrep -l -f 'mcexec '
|
||||
pgrep -f 'mcexec ' | xargs sudo kill -9
|
||||
fi
|
||||
# echo -n "mckernel stopping... "
|
||||
sudo ${MCMOD_DIR}/sbin/mcstop+release.sh
|
||||
# echo "done."
|
||||
#sleep 1
|
||||
echo -n "mckernel booting... " 1>&2
|
||||
sudo ${MCMOD_DIR}/sbin/mcreboot.sh $*
|
||||
echo "done." 1>&2
|
||||
}
|
||||
TEST_PARAM_FILE=$1
|
||||
TEST_NUM=1
|
||||
TEST_CODE=001
|
||||
|
||||
ME=`whoami`
|
||||
|
||||
# read config
|
||||
source ./config
|
||||
|
||||
# read test param
|
||||
source ${TEST_PARAM_FILE}
|
||||
|
||||
# make machinefile
|
||||
mkdir ./machinefiles &> /dev/null
|
||||
MFILE=./machinefiles/mfile_${TEST_PREFIX}
|
||||
echo ${MASTER}:${PROC_PER_NODE} > ${MFILE}
|
||||
for slave in ${SLAVE}
|
||||
do
|
||||
echo ${slave}:${PROC_PER_NODE} >> ${MFILE}
|
||||
done
|
||||
|
||||
reboot
|
||||
|
||||
PROC_NUM=`expr ${PROC_PER_NODE} \* ${MPI_NODE_NUM}`
|
||||
|
||||
# read machinefile
|
||||
declare -a node_arry
|
||||
while read line
|
||||
do
|
||||
node_arry+=(${line%:*})
|
||||
done < ${MFILE}
|
||||
MASTER=${node_arry[0]}
|
||||
|
||||
# make result directory
|
||||
RESULT_DIR=./result/${TEST_PREFIX}
|
||||
mkdir -p ${RESULT_DIR}
|
||||
|
||||
RANK_MAX=`expr ${PROC_NUM} - 1`
|
||||
|
||||
# Log files
|
||||
start_1st_A_log=${RESULT_DIR}/exec_1st_A.log
|
||||
start_1st_B_log=${RESULT_DIR}/exec_1st_B.log
|
||||
start_1st_C_log=${RESULT_DIR}/exec_1st_C.log
|
||||
|
||||
start_2nd_A_log=${RESULT_DIR}/exec_2nd_A.log
|
||||
start_2nd_B_log=${RESULT_DIR}/exec_2nd_B.log
|
||||
start_2nd_C_log=${RESULT_DIR}/exec_2nd_C.log
|
||||
|
||||
finalize_A_log=${RESULT_DIR}/finalize_A.log
|
||||
finalize_B_log=${RESULT_DIR}/finalize_B.log
|
||||
finalize_C_log=${RESULT_DIR}/finalize_C.log
|
||||
|
||||
# Arguments
|
||||
args_1st_A="1234 hoge 02hoge"
|
||||
args_2nd_A="foo 99bar test"
|
||||
|
||||
# Env
|
||||
envs_1st_A="1st_exec_A"
|
||||
envs_2nd_A="This_is_2nd_exec_A"
|
||||
|
||||
### テスト開始時点でql_serverとテスト用MPIプログラムが各ノードで実行されていない
|
||||
for node in ${node_arry[@]}
|
||||
do
|
||||
cnt=`ssh $node "pgrep -u ${ME} -c 'ql_(server|talker)'"`
|
||||
if [ ${cnt} -gt 0 ]; then
|
||||
ng_out "ql_server is running on ${node}"
|
||||
fi
|
||||
|
||||
cnt=`ssh $node "pgrep -u ${ME} -c 'mpiexec'"`
|
||||
if [ ${cnt} -gt 0 ]; then
|
||||
ng_out "other MPI program is running on ${node}"
|
||||
fi
|
||||
done
|
||||
ok_out "ql_server and usr_prgs are not running on each node"
|
||||
|
||||
### usr_prg_A を実行するql_mpiexec_start の返り値が0 (成功)
|
||||
env QL_TEST=${envs_1st_A} ${START} -machinefile ${MFILE} -n ${PROC_NUM} ${USR_PRG_A} ${args_1st_A} > ${start_1st_A_log}
|
||||
rc=$?
|
||||
if [ ${rc} -eq 0 ]; then
|
||||
ok_out "ql_mpiexec_start usr_prg_A (first exec) returns 0"
|
||||
else
|
||||
ng_out "ql_mpiexec_start usr_prg_A (first exec) returns ${rc}"
|
||||
fi
|
||||
|
||||
### 初回実行後、マスターノード上でql_serverが動作している
|
||||
cnt=`ssh ${MASTER} "pgrep -u ${ME} -c 'ql_server'"`
|
||||
if [ ${cnt} -ne 1 ]; then
|
||||
ng_out "ql_server is not running on master node"
|
||||
else
|
||||
ok_out "ql_server is running on master node"
|
||||
fi
|
||||
|
||||
### 各ノードのusr_prg_A の引数が実行時に指定したものと一致している
|
||||
for rank in `seq 0 ${RANK_MAX}`
|
||||
do
|
||||
line=`grep -e "^${rank}:" ${start_1st_A_log} | grep -e "argv="`
|
||||
tgt=${line#*argv=}
|
||||
if [ "X${tgt}" != "X${USR_PRG_A} ${args_1st_A}" ]; then
|
||||
ng_out "usr_prg_A's args is incorrect on rank:${rank}\n ${line}"
|
||||
fi
|
||||
done
|
||||
ok_out "usr_prg_A's args are correct on each node"
|
||||
|
||||
### 各ノードのusr_prg_A テスト用に指定した環境変数が実行時に指定したものと一致している
|
||||
for rank in `seq 0 ${RANK_MAX}`
|
||||
do
|
||||
line=`grep -e "^${rank}:" ${start_1st_A_log} | grep -e "QL_TEST="`
|
||||
tgt=${line#*QL_TEST=}
|
||||
if [ "X${tgt}" != "X${envs_1st_A}" ]; then
|
||||
ng_out "usr_prg_A's env (QL_TEST) is incorrect on each node:${rank}\n ${line}"
|
||||
fi
|
||||
done
|
||||
ok_out "usr_prg_A's env (QL_TEST) is correct on each node"
|
||||
|
||||
### 各ノードのusr_prg_A の計算処理が完了
|
||||
for rank in `seq 0 ${RANK_MAX}`
|
||||
do
|
||||
line=`grep -e "^${rank}:" ${start_1st_A_log} | grep -e "done="`
|
||||
tgt=${line#*done=}
|
||||
if [ "X${tgt}" != "Xyes" ]; then
|
||||
ng_out "usr_prg_A's calculation is not done on rank:${rank}"
|
||||
fi
|
||||
done
|
||||
ok_out "usr_prg_A's calculation is done on each node"
|
||||
|
||||
### ql_mpiexec_start の完了後、usr_prg_A が再開指示待ちになっている
|
||||
for node in ${node_arry[@]}
|
||||
do
|
||||
cnt=`ssh $node "pgrep -u ${ME} -fl 'usr_prg_A'" | grep " exe" | wc -l`
|
||||
if [ ${cnt} -eq 0 ]; then
|
||||
ng_out "usr_prg_A is not running on ${node}"
|
||||
else
|
||||
echo " ${cnt} programs is waiting on ${node}"
|
||||
fi
|
||||
done
|
||||
ok_out "usr_prg_A is waiting for resume-req on each node"
|
||||
|
||||
### usr_prg_B を実行するql_mpiexec_start の返り値が0 (成功)
|
||||
${START} -machinefile ${MFILE} -n ${PROC_NUM} ${USR_PRG_B} 1 2 3 > ${start_1st_B_log}
|
||||
rc=$?
|
||||
if [ ${rc} -eq 0 ]; then
|
||||
ok_out "ql_mpiexec_start usr_prg_B (first exec) returns 0"
|
||||
else
|
||||
ng_out "ql_mpiexec_start usr_prg_B (first exec) returns ${rc}"
|
||||
fi
|
||||
|
||||
### 各ノードのusr_prg_B の計算処理が完了
|
||||
for rank in `seq 0 ${RANK_MAX}`
|
||||
do
|
||||
line=`grep -e "^${rank}:" ${start_1st_B_log} | grep -e "done="`
|
||||
tgt=${line#*done=}
|
||||
if [ "X${tgt}" != "Xyes" ]; then
|
||||
ng_out "usr_prg_B's calculation is not done on rank:${rank}"
|
||||
fi
|
||||
done
|
||||
ok_out "usr_prg_B's calculation is done on each node"
|
||||
|
||||
### ql_mpiexec_start の完了後、usr_prg_B が再開指示待ちになっている
|
||||
for node in ${node_arry[@]}
|
||||
do
|
||||
cnt=`ssh $node "pgrep -u ${ME} -fl 'usr_prg_B'" | grep " exe" | wc -l`
|
||||
if [ ${cnt} -eq 0 ]; then
|
||||
ng_out "usr_prg_B is not running on ${node}"
|
||||
else
|
||||
echo " ${cnt} programs is waiting on ${node}"
|
||||
fi
|
||||
done
|
||||
ok_out "usr_prg_B is waiting for resume-req on each node"
|
||||
|
||||
### usr_prg_C を実行するql_mpiexec_start の返り値が0 (成功)
|
||||
${START} -machinefile ${MFILE} -n ${PROC_NUM} ${USR_PRG_C} a b c > ${start_1st_C_log}
|
||||
rc=$?
|
||||
if [ ${rc} -eq 0 ]; then
|
||||
ok_out "ql_mpiexec_start usr_prg_C (first exec) returns 0"
|
||||
else
|
||||
ng_out "ql_mpiexec_start usr_prg_C (first exec) returns ${rc}"
|
||||
fi
|
||||
|
||||
### 各ノードのusr_prg_C の計算処理が完了
|
||||
for rank in `seq 0 ${RANK_MAX}`
|
||||
do
|
||||
line=`grep -e "^${rank}:" ${start_1st_C_log} | grep -e "done="`
|
||||
tgt=${line#*done=}
|
||||
if [ "X${tgt}" != "Xyes" ]; then
|
||||
ng_out "usr_prg_C's calculation is not done on rank:${rank}"
|
||||
fi
|
||||
done
|
||||
ok_out "usr_prg_C's calculation is done on each node"
|
||||
|
||||
### ql_mpiexec_start の完了後、usr_prg_C が再開指示待ちになっている
|
||||
for node in ${node_arry[@]}
|
||||
do
|
||||
cnt=`ssh $node "pgrep -u ${ME} -fl 'usr_prg_C'" | grep " exe" | wc -l`
|
||||
if [ ${cnt} -eq 0 ]; then
|
||||
ng_out "usr_prg_C is not running on ${node}"
|
||||
else
|
||||
echo " ${cnt} programs is waiting on ${node}"
|
||||
fi
|
||||
done
|
||||
ok_out "usr_prg_C is waiting for resume-req on each node"
|
||||
|
||||
### usr_prg_A を再実行するql_mpiexec_start の返り値が0 (成功)
|
||||
env QL_TEST=${envs_2nd_A} ${START} -machinefile ${MFILE} -n ${PROC_NUM} ${USR_PRG_A} ${args_2nd_A} > ${start_2nd_A_log}
|
||||
rc=$?
|
||||
if [ ${rc} -eq 0 ]; then
|
||||
ok_out "(again) ql_mpiexec_start usr_prg_A returns 0"
|
||||
else
|
||||
ng_out "(again) ql_mpiexec_start usr_prg_A returns ${rc}"
|
||||
fi
|
||||
|
||||
### 各ノードのusr_prg_A の引数が再実行時に指定したものと一致している
|
||||
for rank in `seq 0 ${RANK_MAX}`
|
||||
do
|
||||
line=`grep -e "^${rank}:" ${start_2nd_A_log} | grep -e "argv="`
|
||||
tgt=${line#*argv=}
|
||||
if [ "X${tgt}" != "X${USR_PRG_A} ${args_2nd_A}" ]; then
|
||||
ng_out "usr_prg_A's args is incorrect on rank:${rank}\n ${line}"
|
||||
fi
|
||||
done
|
||||
ok_out "(again) usr_prg_A's args are correct on each node"
|
||||
|
||||
### 各ノードのusr_prg_A テスト用に指定した環境変数が再実行時に指定したものと一致している
|
||||
for rank in `seq 0 ${RANK_MAX}`
|
||||
do
|
||||
line=`grep -e "^${rank}:" ${start_2nd_A_log} | grep -e "QL_TEST="`
|
||||
tgt=${line#*QL_TEST=}
|
||||
if [ "X${tgt}" != "X${envs_2nd_A}" ]; then
|
||||
ng_out "usr_prg_A's env (QL_TEST) is incorrect on each node:${rank}\n ${line}"
|
||||
fi
|
||||
done
|
||||
ok_out "(again) usr_prg_A's env (QL_TEST) is correct on each node"
|
||||
|
||||
### 各ノードのusr_prg_A の計算処理が完了
|
||||
for rank in `seq 0 ${RANK_MAX}`
|
||||
do
|
||||
line=`grep -e "^${rank}:" ${start_2nd_A_log} | grep -e "done="`
|
||||
tgt=${line#*done=}
|
||||
if [ "X${tgt}" != "Xyes" ]; then
|
||||
ng_out "usr_prg_A's calculation is not done on rank:${rank}"
|
||||
fi
|
||||
done
|
||||
ok_out "(again) usr_prg_A's calculation is done on each node"
|
||||
|
||||
### ql_mpiexec_start の完了後、usr_prg_A が再開指示待ちになっている
|
||||
for node in ${node_arry[@]}
|
||||
do
|
||||
cnt=`ssh $node "pgrep -u ${ME} -fl 'usr_prg_A'" | grep " exe" | wc -l`
|
||||
if [ ${cnt} -eq 0 ]; then
|
||||
ng_out "usr_prg_A is not running on ${node}"
|
||||
else
|
||||
echo " ${cnt} programs is waiting on ${node}"
|
||||
fi
|
||||
done
|
||||
ok_out "(again) usr_prg_A is waiting for resume-req on each node"
|
||||
|
||||
### usr_prg_B を再実行するql_mpiexec_start の返り値が0 (成功)
|
||||
${START} -machinefile ${MFILE} -n ${PROC_NUM} ${USR_PRG_B} 10 20 30 40 > ${start_2nd_B_log}
|
||||
rc=$?
|
||||
if [ ${rc} -eq 0 ]; then
|
||||
ok_out "(again) ql_mpiexec_start usr_prg_B returns 0"
|
||||
else
|
||||
ng_out "(again) ql_mpiexec_start usr_prg_B returns ${rc}"
|
||||
fi
|
||||
|
||||
### 各ノードのusr_prg_B の計算処理が完了
|
||||
for rank in `seq 0 ${RANK_MAX}`
|
||||
do
|
||||
line=`grep -e "^${rank}:" ${start_2nd_B_log} | grep -e "done="`
|
||||
tgt=${line#*done=}
|
||||
if [ "X${tgt}" != "Xyes" ]; then
|
||||
ng_out "usr_prg_B's calculation is not done on rank:${rank}"
|
||||
fi
|
||||
done
|
||||
ok_out "(again) usr_prg_B's calculation is done on each node"
|
||||
|
||||
### ql_mpiexec_start の完了後、usr_prg_B が再開指示待ちになっている
|
||||
for node in ${node_arry[@]}
|
||||
do
|
||||
cnt=`ssh $node "pgrep -u ${ME} -fl 'usr_prg_B'" | grep " exe" | wc -l`
|
||||
if [ ${cnt} -eq 0 ]; then
|
||||
ng_out "usr_prg_B is not running on ${node}"
|
||||
else
|
||||
echo " ${cnt} programs is waiting on ${node}"
|
||||
fi
|
||||
done
|
||||
ok_out "(again) usr_prg_B is waiting for resume-req on each node"
|
||||
|
||||
### usr_prg_A を終了するql_mpiexec_finalize の返り値が0 (成功)
|
||||
${FINALIZE} -machinefile ${MFILE} -n ${PROC_NUM} ${USR_PRG_A} > ${finalize_A_log}
|
||||
rc=$?
|
||||
if [ ${rc} -eq 0 ]; then
|
||||
ok_out "ql_mpiexec_finalize usr_prg_A return 0"
|
||||
else
|
||||
ng_out "ql_mpiexec_finalize usr_prg_A return ${rc}"
|
||||
fi
|
||||
|
||||
### usr_prg_B を終了するql_mpiexec_finalize の返り値が0 (成功)
|
||||
${FINALIZE} -machinefile ${MFILE} -n ${PROC_NUM} ${USR_PRG_B} > ${finalize_B_log}
|
||||
rc=$?
|
||||
if [ ${rc} -eq 0 ]; then
|
||||
ok_out "ql_mpiexec_finalize usr_prg_B return 0"
|
||||
else
|
||||
ng_out "ql_mpiexec_finalize usr_prg_B return ${rc}"
|
||||
fi
|
||||
|
||||
### usr_prg_Bの終了後、ql_serverがマスターノード上で動作している
|
||||
cnt=`ssh ${MASTER} "pgrep -u ${ME} -c 'ql_server'"`
|
||||
if [ ${cnt} -ne 1 ]; then
|
||||
ng_out "ql_server is not running on master node"
|
||||
else
|
||||
ok_out "ql_server is still running on master node"
|
||||
fi
|
||||
|
||||
### usr_prg_C を終了するql_mpiexec_finalize の返り値が0 (成功)
|
||||
${FINALIZE} -machinefile ${MFILE} -n ${PROC_NUM} ${USR_PRG_C} > ${finalize_C_log}
|
||||
rc=$?
|
||||
if [ ${rc} -eq 0 ]; then
|
||||
ok_out "ql_mpiexec_finalize usr_prg_C return 0"
|
||||
else
|
||||
ng_out "ql_mpiexec_finalize usr_prg_C return ${rc}"
|
||||
fi
|
||||
|
||||
### すべてのMPIプログラムが終了したので、ql_serverが終了した
|
||||
cnt=`ssh ${MASTER} "pgrep -u ${ME} -c 'ql_server'"`
|
||||
sleep 1
|
||||
if [ ${cnt} -eq 0 ]; then
|
||||
ok_out "ql_server is not running on master node"
|
||||
else
|
||||
ng_out "ql_server is still running on master node"
|
||||
fi
|
||||
|
||||
echo "[OK] so_026 qlmpi test "
|
||||
132
test/user_space/swapout/swapout_copy_from.sh
Executable file
132
test/user_space/swapout/swapout_copy_from.sh
Executable file
@@ -0,0 +1,132 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Functions
|
||||
function reboot() {
|
||||
count=`pgrep -c -f 'mcexec '`
|
||||
if [ ${count} -gt 0 ]
|
||||
then
|
||||
echo "kill process :" ${count}
|
||||
pgrep -l -f 'mcexec '
|
||||
pgrep -f 'mcexec ' | xargs sudo kill -9
|
||||
fi
|
||||
# echo -n "mckernel stopping... "
|
||||
sudo ${MCMOD_DIR}/sbin/mcstop+release.sh
|
||||
# echo "done."
|
||||
#sleep 1
|
||||
echo -n "mckernel booting... " 1>&2
|
||||
sudo ${MCMOD_DIR}/sbin/mcreboot.sh $*
|
||||
echo "done." 1>&2
|
||||
}
|
||||
|
||||
function ok_out() {
|
||||
echo "[OK] ${TEST_PREFIX}`printf %03d ${TEST_NUM}` $1"
|
||||
(( TEST_NUM++ ))
|
||||
TEST_CODE=`printf %03d ${TEST_NUM}`
|
||||
}
|
||||
|
||||
function ng_out() {
|
||||
echo "[NG] ${TEST_PREFIX}`printf %03d ${TEST_NUM}` $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
TEST_PARAM_FILE=$1
|
||||
TEST_NUM=1
|
||||
TEST_CODE=001
|
||||
TEST_PREFIX=so_
|
||||
|
||||
ME=`whoami`
|
||||
|
||||
# read config
|
||||
source ./config
|
||||
|
||||
MCPATH=${MCMOD_DIR}
|
||||
|
||||
mkdir -p ./result
|
||||
|
||||
reboot
|
||||
#programを実行 logを保存
|
||||
${MCPATH}/bin/mcexec ./swaptest 2 >./result/swapout_copy_from.log
|
||||
|
||||
#kmsgを保存
|
||||
sudo ${MCPATH}/sbin/ihkosctl 0 kmsg >./result/swapout_copy_from.kmsg
|
||||
|
||||
#swapout001 arealist_update i and count check.
|
||||
#arealist_update i
|
||||
arealist_i=`grep "arealist_update" ./result/swapout_copy_from.kmsg | head -n 1 | sed s/"^.*copy_from_user i:\([0-9a-f]*\),.*$"/"\1"/ `
|
||||
#echo ${arearlist_i}
|
||||
#arealist_update count
|
||||
arealist_count=`grep "arealist_update" ./result/swapout_copy_from.kmsg | head -n 1 | sed s/"^.*count:\([0-9a-f]*\).*$"/"\1"/ `
|
||||
#echo ${arearlist_count}
|
||||
if [ ${#arealist_i} -ne 0 -a ${arealist_i} = ${arealist_count} ]; then
|
||||
text=`echo "arealist_update:variable i matched rea->tail->count"`
|
||||
ok_out "${text} :(${arealist_i})"
|
||||
else
|
||||
ng_out "arealist_update: The value of count does not match the value of i."
|
||||
fi
|
||||
|
||||
#swapout002 mlocklist_morereq went.count and ent->count check.
|
||||
#ent.count
|
||||
went=`grep "mlocklist_morereq" ./result/swapout_copy_from.kmsg | head -n 1 | sed s/"^.*copy_from_user went.count:\([0-9a-f]*\),.*$"/"\1"/ `
|
||||
#echo ${went}
|
||||
#ent->count
|
||||
ent=`grep "mlocklist_morereq" ./result/swapout_copy_from.kmsg | head -n 1 | sed s/"^.*->count:\([0-9a-f]*\).*$"/"\1"/ `
|
||||
#echo ${ent}
|
||||
if [ ${#went} -ne 0 -a ${went} = ${ent} ]; then
|
||||
text=`echo "mlocklist_morereq:variable ent.count matched ent->count"`
|
||||
ok_out "${text} :(${went})"
|
||||
else
|
||||
ng_out "mlocklist_morereq: The value of count does not match the value of i."
|
||||
fi
|
||||
|
||||
#swapout003 arealist_preparewrite went.count and ent->count check.
|
||||
#ent.count
|
||||
went=`grep "arealist_preparewrite" ./result/swapout_copy_from.kmsg | head -n 1 | sed s/"^.*copy_from_user went.count:\([0-9a-f]*\),.*$"/"\1"/ `
|
||||
#echo ${went}
|
||||
ent=`grep "arealist_preparewrite" ./result/swapout_copy_from.kmsg | head -n 1 | sed s/"^.*->count:\([0-9a-f]*\).*$"/"\1"/ `
|
||||
#echo ${ent}
|
||||
if [ ${#went} -ne 0 -a ${went} = ${ent} ]; then
|
||||
text=`echo "arealist_preprarewrite:variable ent.count matched ent->count"`
|
||||
ok_out "${text} :(${went})"
|
||||
else
|
||||
ng_out "arealist_preprarewrite: The value of count does not match the value of i."
|
||||
fi
|
||||
|
||||
#swapout004 do_pageout loop1 si->swap_info[].start and sw_info.start check.
|
||||
#swap_inf
|
||||
swap_info=`grep "do_pageout:1" ./result/swapout_copy_from.kmsg | head -n 1 | sed s/"^.*copy_from_user \([0-9|a-f]*\):.*$"/"\1"/ `
|
||||
#echo ${swap_info}
|
||||
#sw_info
|
||||
sw_info=`grep "do_pageout:1" ./result/swapout_copy_from.kmsg | head -n 1 | sed s/"^.*copy_from_user [0-9|a-f]*:\([0-9|a-f]*\).*$"/"\1"/ `
|
||||
#echo ${sw_info}
|
||||
if [ ${#swap_info} -ne 0 -a ${swap_info} = ${sw_info} ]; then
|
||||
text=`echo "do_pageout loop1:variable swap_info[].start matched sw_info.start"`
|
||||
ok_out "${text} :(${swap_info})"
|
||||
else
|
||||
ng_out "do_pageout loop1: The value of swapinfo[].start does not match the value of sw_info.start."
|
||||
fi
|
||||
|
||||
#swapout005 do_pageout loop2 si->swap_info[].start and sw_info.start check.
|
||||
swap_info=`grep "do_pageout:2" ./result/swapout_copy_from.kmsg | head -n 1 | sed s/"^.*copy_from_user \([0-9|a-f]*\):.*$"/"\1"/ `
|
||||
#echo ${swap_info}
|
||||
sw_info=`grep "do_pageout:2" ./result/swapout_copy_from.kmsg | head -n 1 | sed s/"^.*copy_from_user [0-9|a-f]*:\([0-9|a-f]*\).*$"/"\1"/ `
|
||||
#echo ${sw_info}
|
||||
if [ ${#swap_info} -ne 0 -a ${swap_info} = ${sw_info} ]; then
|
||||
text=`echo "do_pageout loop2:variable swap_info[].start matched sw_info.start"`
|
||||
ok_out "${text} :(${swap_info})"
|
||||
else
|
||||
ng_out "do_pageout loop2: The value of swapinfo[].start does not match the value of sw_info.start."
|
||||
fi
|
||||
|
||||
#swapout006 do_pageout loop3 si->swap_info[].start and sw_info.start check.
|
||||
#swap_inf
|
||||
swap_info=`grep "do_pageout:3" ./result/swapout_copy_from.kmsg | head -n 1 | sed s/"^.*copy_from_user \([0-9|a-f]*\):.*$"/"\1"/ `
|
||||
#echo ${swap_info}
|
||||
sw_info=`grep "do_pageout:3" ./result/swapout_copy_from.kmsg | head -n 1 | sed s/"^.*copy_from_user [0-9|a-f]*:\([0-9|a-f]*\).*$"/"\1"/ `
|
||||
#echo ${sw_info}
|
||||
if [ ${#swap_info} -ne 0 -a ${swap_info} = ${sw_info} ]; then
|
||||
text=`echo "do_pageout loop3:variable swap_info[].start matched sw_info.start"`
|
||||
ok_out "${text} :(${swap_info})"
|
||||
else
|
||||
ng_out "do_pageout loop3: The value of swapinfo[].start does not match the value of sw_info.start."
|
||||
fi
|
||||
|
||||
131
test/user_space/swapout/swapout_copy_to_01.sh
Executable file
131
test/user_space/swapout/swapout_copy_to_01.sh
Executable file
@@ -0,0 +1,131 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Functions
|
||||
function reboot() {
|
||||
count=`pgrep -c -f 'mcexec '`
|
||||
if [ ${count} -gt 0 ]
|
||||
then
|
||||
echo "kill process :" ${count}
|
||||
pgrep -l -f 'mcexec '
|
||||
pgrep -f 'mcexec ' | xargs sudo kill -9
|
||||
fi
|
||||
# echo -n "mckernel stopping... "
|
||||
sudo ${MCMOD_DIR}/sbin/mcstop+release.sh
|
||||
# echo "done."
|
||||
#sleep 1
|
||||
echo -n "mckernel booting... " 1>&2
|
||||
sudo ${MCMOD_DIR}/sbin/mcreboot.sh $*
|
||||
echo "done." 1>&2
|
||||
}
|
||||
|
||||
function ok_out() {
|
||||
echo "[OK] ${TEST_PREFIX}`printf %03d ${TEST_NUM}` $1"
|
||||
(( TEST_NUM++ ))
|
||||
TEST_CODE=`printf %03d ${TEST_NUM}`
|
||||
}
|
||||
|
||||
function ng_out() {
|
||||
echo "[NG] ${TEST_PREFIX}`printf %03d ${TEST_NUM}` $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
TEST_PARAM_FILE=$1
|
||||
TEST_NUM=7
|
||||
TEST_CODE=001
|
||||
TEST_PREFIX=so_
|
||||
|
||||
ME=`whoami`
|
||||
|
||||
# read config
|
||||
source ./config
|
||||
|
||||
MCPATH=${MCMOD_DIR}
|
||||
|
||||
mkdir -p result
|
||||
|
||||
reboot
|
||||
#programを実行 logを保存
|
||||
${MCPATH}/bin/mcexec ./swaptest 2 >./result/swapout_copy_to_01.log
|
||||
|
||||
#kmsgを保存
|
||||
sudo ${MCPATH}/sbin/ihkosctl 0 kmsg >./result/swapout_copy_to_01.kmsg
|
||||
|
||||
#swapout007 arealist_update i and count check.
|
||||
arealist_i=`grep "arealist_update" ./result/swapout_copy_to_01.kmsg | head -n 1 | sed s/"^.*copy_to_user i:\([0-9a-f]*\),.*$"/"\1"/ `
|
||||
#echo ${arearlist_i}
|
||||
arealist_count=`grep "arealist_update" ./result/swapout_copy_to_01.kmsg | head -n 1 | sed s/"^.*count:\([0-9a-f]*\).*$"/"\1"/ `
|
||||
#echo ${arearlist_count}
|
||||
if [ ${#arealist_i} -ne 0 -a ${arealist_i} = ${arealist_count} ]; then
|
||||
text=`echo "arealist_update:variable i matched rea->tail->count"`
|
||||
ok_out "${text} :(${arealist_i})"
|
||||
else
|
||||
ng_out "arealist_update: The value of count does not match the value of i."
|
||||
fi
|
||||
|
||||
#swapout008 arealist_add addr->start and waddr.start check.
|
||||
addr=`grep "arealist_add" ./result/swapout_copy_to_01.kmsg | head -n 1 | sed s/"^.*copy_to_user addr->start:\([0-9a-f]*\),.*$"/"\1"/ `
|
||||
#echo ${addr}
|
||||
waddr=`grep "arealist_add" ./result/swapout_copy_to_01.kmsg | head -n 1 | sed s/"^.*waddr.start:\([0-9a-f]*\)$"/"\1"/ `
|
||||
#echo ${waddr}
|
||||
if [ ${#addr} -ne 0 -a ${addr} = ${waddr} ]; then
|
||||
text=`echo "arealist_add:addr->start matched waddr.start"`
|
||||
ok_out "${text} :(${waddr})"
|
||||
else
|
||||
ng_out "arealist_add: The value of addr->start does not match the value of wsddr.start."
|
||||
fi
|
||||
|
||||
#swapout009 do_pageout si->swapfname and si->udata_buf check.
|
||||
udata_buf=`grep "do_pageout" ./result/swapout_copy_to_01.kmsg | head -n 1 | sed s/"^.*copy_to_user si->udata_buf:\(.*\),.*$"/"\1"/ `
|
||||
#echo ${udata_buf}
|
||||
swapfname=`grep "do_pageout" ./result/swapout_copy_to_01.kmsg | head -n 1 | sed s/"^.*si->swapfname:\(.*\)$"/"\1"/ `
|
||||
#echo ${swapfname}
|
||||
if [ ${#udata_buf} -ne 0 -a "${udata_buf}" = "${swapfname}" ]; then
|
||||
text=`echo "do_pageout:variable si->udata_buf matched si->swapfname"`
|
||||
ok_out "${text} :(${udata_buf})"
|
||||
else
|
||||
ng_out "do_pageout: The value of si->udata_buf does not match the value of si->swapfname."
|
||||
fi
|
||||
|
||||
#swapout010 do_pageout si->swphdr->magic
|
||||
magic=`grep "do_pageout:.* si->swphdr->magic" ./result/swapout_copy_to_01.kmsg | head -n 1 | sed s/"^.*copy_to_user si->swphdr->magic:\(.*\),si->swphdr->version:.*$"/"\1"/ `
|
||||
#echo ${magic}
|
||||
if [ "${magic}" = "McKernel swap" ]; then
|
||||
text=`echo "do_pageout:si->swphdr->magic is McKernel swap"`
|
||||
ok_out "${text} :(${magic})"
|
||||
else
|
||||
ng_out "do_pageout: does not match the value of si->swphdr->magic."
|
||||
fi
|
||||
|
||||
#swapout011 do_pageout si->swphdr->version
|
||||
version=`grep "do_pageout:.*,si->swphdr->version" ./result/swapout_copy_to_01.kmsg | head -n 1 | sed s/"^.*copy_to_user .*,si->swphdr->version:\(.*\),si->swphdr->count_sarea:.*$"/"\1"/ `
|
||||
#echo ${version}
|
||||
if [ "${version}" = "0.9.0" ]; then
|
||||
text=`echo "do_pageout:si->swphdr->version is 0.9.0"`
|
||||
ok_out "${text} :(${version})"
|
||||
else
|
||||
ng_out "do_pageout: does not match the value of si->swphdr->version."
|
||||
fi
|
||||
|
||||
#swapout012 d_pageout si->swphdr->count_sarea
|
||||
sarea=`grep "do_pageout:.*,si->swphdr->count_sarea" ./result/swapout_copy_to_01.kmsg | head -n 1 | sed s/"^.*copy_to_user .*,si->swphdr->count_sarea:\([0-9|a-f]*\),.*$"/"\1"/ `
|
||||
echo ${sarea}
|
||||
count=`grep "do_pageout:.*,si->swphdr->count_sarea" ./result/swapout_copy_to_01.kmsg | head -n 1 | sed s/"^.*si->swap_area.count:\([0-9|a-f]*\),.*$"/"\1"/ `
|
||||
#echo ${count}
|
||||
if [ ${#sarea} -ne 0 -a ${sarea} = ${count} ]; then
|
||||
text=`echo "do_pageout:variable count_sarea matched swap_area.count"`
|
||||
ok_out "${text} :(${sarea})"
|
||||
else
|
||||
ng_out "do_pageout: The value of count_sarea does not match the value of swap_area.count."
|
||||
fi
|
||||
|
||||
#swapout013 d_pageout si->swphdr->count_marea
|
||||
marea=`grep "do_pageout:.*si->swphdr->count_marea" ./result/swapout_copy_to_01.kmsg | head -n 1 | sed s/"^.*copy_to_user .*,si->swphdr->count_marea:\([0-9|a-f]*\),.*$"/"\1"/ `
|
||||
#echo ${marea}
|
||||
count=`grep "do_pageout:.*si->mlock_area.count" ./result/swapout_copy_to_01.kmsg | head -n 1 | sed s/"^.*si->mlock_area.count:\([0-9|a-f]*\)$"/"\1"/ `
|
||||
#echo ${count}
|
||||
if [ ${#marea} -ne 0 -a ${marea} = ${count} ]; then
|
||||
text=`echo "do_pageout:variable count_marea matched mlock_area.count"`
|
||||
ok_out "${text} :(${marea})"
|
||||
else
|
||||
ng_out "do_pageout: The value of count_marea does not match the value of mlock_area.count."
|
||||
fi
|
||||
156
test/user_space/swapout/swapout_copy_to_02.sh
Executable file
156
test/user_space/swapout/swapout_copy_to_02.sh
Executable file
@@ -0,0 +1,156 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Functions
|
||||
function reboot() {
|
||||
count=`pgrep -c -f 'mcexec '`
|
||||
if [ ${count} -gt 0 ]
|
||||
then
|
||||
echo "kill process :" ${count}
|
||||
pgrep -l -f 'mcexec '
|
||||
pgrep -f 'mcexec ' | xargs sudo kill -9
|
||||
fi
|
||||
# echo -n "mckernel stopping... "
|
||||
sudo ${MCMOD_DIR}/sbin/mcstop+release.sh
|
||||
# echo "done."
|
||||
#sleep 1
|
||||
echo -n "mckernel booting... " 1>&2
|
||||
sudo ${MCMOD_DIR}/sbin/mcreboot.sh $*
|
||||
echo "done." 1>&2
|
||||
}
|
||||
|
||||
function ok_out() {
|
||||
echo "[OK] ${TEST_PREFIX}`printf %03d ${TEST_NUM}` $1"
|
||||
(( TEST_NUM++ ))
|
||||
TEST_CODE=`printf %03d ${TEST_NUM}`
|
||||
}
|
||||
|
||||
function ng_out() {
|
||||
echo "[NG] ${TEST_PREFIX}`printf %03d ${TEST_NUM}` $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
TEST_PARAM_FILE=$1
|
||||
TEST_NUM=14
|
||||
TEST_CODE=001
|
||||
TEST_PREFIX=so_
|
||||
|
||||
ME=`whoami`
|
||||
|
||||
# read config
|
||||
source ./config
|
||||
|
||||
MCPATH=${MCMOD_DIR}
|
||||
|
||||
mkdir -p ./result
|
||||
|
||||
reboot
|
||||
#programを実行 logを保存
|
||||
${MCPATH}/bin/mcexec ./swaptest 2 >./result/swapout_copy_to_02.log
|
||||
|
||||
#kmsgを保存
|
||||
sudo ${MCPATH}/sbin/ihkosctl 0 kmsg >./result/swapout_copy_to_02.kmsg
|
||||
|
||||
#swapout014 arealist_preparewrite info[].start
|
||||
start=`grep "arealist_preparewrite:.* info\[[0-9]\].start:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.*copy_to_user info\[[0-9]\].start:\([0-9|a-f]*\),end:.*$"/"\1"/ `
|
||||
#echo ${start}
|
||||
wstart=`grep "arealist_preparewrite:.* ,went.pair\[[0-9]\]\.start:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.* ,went.pair\[[0-9]\]\.start:\([0-9|a-f]*\),end:.*$"/"\1"/ `
|
||||
#echo ${wstart}
|
||||
if [ ${#start} -ne 0 -a "${start}" = "${wstart}" ]; then
|
||||
text=`echo "arealist_preparewrite:info[].start matched went.pair[].start"`
|
||||
ok_out "${text} :(${start})"
|
||||
else
|
||||
ng_out "arealist_preparewrite: does not match the value of info[].start"
|
||||
fi
|
||||
|
||||
#swapout015 arealist_preparewrite info[].end
|
||||
end=`grep "arealist_preparewrite:.* info\[[0-9]\].start:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.*copy_to_user info\[[0-9]\].start:[0-9|a-f]*,end:\([0-9|a-f]*\),flag:.*$"/"\1"/ `
|
||||
#echo ${end}
|
||||
wend=`grep "arealist_preparewrite:.* ,went.pair\[[0-9]\]\.start:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.* ,went.pair\[[0-9]\].start:[0-9|a-f]*,end:\([0-9|a-f]*\),flag:.*$"/"\1"/ `
|
||||
#echo ${wend}
|
||||
if [ ${#end} -ne 0 -a "${end}" = "${wend}" ]; then
|
||||
text=`echo "arealist_preparewrite:info[].end matched went.pair[].end"`
|
||||
ok_out "${text} :(${end})"
|
||||
else
|
||||
ng_out "arealist_preparewrite: does not match the value of info[].end"
|
||||
fi
|
||||
|
||||
#swapout016 arealist_preparewrite info[].flag
|
||||
flag=`grep "arealist_preparewrite:.* info\[[0-9]\].start:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.*copy_to_user info\[[0-9]\].start:[0-9a-f]*,.*flag:\([0-9a-f]*\) ,.*$"/"\1"/ `
|
||||
#echo ${flag}
|
||||
wflag=`grep "arealist_preparewrite:.* ,went.pair\[[0-9]\]\.start:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.* ,went.pair\[[0-9]\].start:[0-9a-f]*,.*flag:\([0-9a-f]*\)$"/"\1"/ `
|
||||
#echo ${wflag}
|
||||
if [ ${#flag} -ne 0 -a "${flag}" = "${wflag}" ]; then
|
||||
text=`echo "arealist_preparewrite:info[].flag matched went.pair[].flag"`
|
||||
ok_out "${text} :(${flag})"
|
||||
else
|
||||
ng_out "arealist_preparewrite: does not match the value of info[].flag"
|
||||
fi
|
||||
|
||||
#swapout017 arealist_preparewrite info[].pos
|
||||
pos=`grep "arealist_preparewrite:.* info\[[0-9]\].pos:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.*copy_to_user info\[[0-9]\].pos:\([0-9a-f]*\),pos:[0-9a-f]*$"/"\1"/ `
|
||||
#echo ${pos}
|
||||
wpos=`grep "arealist_preparewrite:.* info\[[0-9]\].pos:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.*copy_to_user info\[[0-9]\].pos:[0-9a-f]*,pos:\([0-9a-f]*\)$"/"\1"/ `
|
||||
#echo ${wpos}
|
||||
if [ ${#pos} -ne 0 -a "${pos}" = "${wpos}" ]; then
|
||||
text=`echo "arealist_preparewrite:info[].pos matched went.pair[].pos"`
|
||||
ok_out "${text} :(${pos})"
|
||||
else
|
||||
ng_out "arealist_preparewrite: does not match the value of info[].pos"
|
||||
fi
|
||||
|
||||
#swapout018 pager_open swapfname
|
||||
fname=`grep "pager_open: copy_to_user si->udata_buf:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.* si->udata_buf:\(.*\),fname:.*$"/"\1"/ `
|
||||
#echo ${fname}
|
||||
wfname=`grep "pager_open: copy_to_user si->udata_buf:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.* si->udata_buf:.*,fname:\(.*\)$"/"\1"/ `
|
||||
#echo ${wfname}
|
||||
if [ ${#fname} -ne 0 -a "${fname}" = "${wfname}" ]; then
|
||||
text=`echo "pager_open:swapfname matched si-udate_buf"`
|
||||
ok_out "${text} :(${fname})"
|
||||
else
|
||||
ng_out "pager_open: does not match the value of swapfname"
|
||||
fi
|
||||
|
||||
#swapout019 pager_unlink swapfname
|
||||
fname=`grep "pager_unlink: copy_to_user si->udata_buf:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.* si->udata_buf:\(.*\),fname:.*$"/"\1"/ `
|
||||
#echo ${fname}
|
||||
wfname=`grep "pager_unlink: copy_to_user si->udata_buf:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.* si->udata_buf:.*,fname:\(.*\)$"/"\1"/ `
|
||||
#echo ${wfname}
|
||||
if [ ${#fname} -ne 0 -a "${fname}" = "${wfname}" ]; then
|
||||
text=`echo "pager_unlink:swapfname matched si-udate_buf"`
|
||||
ok_out "${text} :(${fname})"
|
||||
else
|
||||
ng_out "pager_unlink: does not match the value of swapfname"
|
||||
fi
|
||||
|
||||
#swapout020 arealist_get user_space initialize
|
||||
count=`grep "arealist_get:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.*tmp->count:\([0-9]\) area.*$"/"\1"/ `
|
||||
#echo ${count}
|
||||
if [ "${count}" = "0" ]; then
|
||||
text=`echo "arealist_get:arealist is inistialized."`
|
||||
ok_out "${text} :(${count})"
|
||||
else
|
||||
ng_out "arealist_get: arealist was not initialized"
|
||||
fi
|
||||
|
||||
#swapout021 prealist_get arealist->next
|
||||
next=`grep "arealist_get: copy_to_user" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.* area->tail->next \([0-9a-f]*\):\([0-9a-f]*\)$"/"\1"/ `
|
||||
#echo ${next}
|
||||
wnext=`grep "arealist_get: copy_to_user" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.* area->tail->next \([0-9a-f]*\):\([0-9a-f]*\)$"/"\2"/ `
|
||||
#echo ${wnext}
|
||||
if [ ${#next} -ne 0 -a "${next}" = "${wnext}" ]; then
|
||||
text=`echo "arealist_get: area->tail->next is matched"`
|
||||
ok_out "${text} :(${next})"
|
||||
else
|
||||
ng_out "arealist_get: does not match the value of area->tail->next"
|
||||
fi
|
||||
|
||||
#swapout022 arealist_alloc user_space initialize
|
||||
count=`grep "arealist_alloc:" ./result/swapout_copy_to_02.kmsg | head -n 1 | sed s/"^.*areap->head->count:\([0-9]\)$"/"\1"/ `
|
||||
#echo ${count}
|
||||
if [ "${count}" = "0" ]; then
|
||||
text=`echo "arealist_alloc:arealist is inistialized."`
|
||||
ok_out "${text} :(${count})"
|
||||
else
|
||||
ng_out "arealist_get: arealist was not initialized"
|
||||
fi
|
||||
|
||||
90
test/user_space/swapout/swapout_normal.sh
Executable file
90
test/user_space/swapout/swapout_normal.sh
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Functions
|
||||
function reboot() {
|
||||
count=`pgrep -c -f 'mcexec '`
|
||||
if [ ${count} -gt 0 ]
|
||||
then
|
||||
echo "kill process :" ${count}
|
||||
pgrep -l -f 'mcexec '
|
||||
pgrep -f 'mcexec ' | xargs sudo kill -9
|
||||
fi
|
||||
# echo -n "mckernel stopping... "
|
||||
sudo ${MCMOD_DIR}/sbin/mcstop+release.sh
|
||||
# echo "done."
|
||||
#sleep 1
|
||||
echo -n "mckernel booting... " 1>&2
|
||||
sudo ${MCMOD_DIR}/sbin/mcreboot.sh $*
|
||||
echo "done." 1>&2
|
||||
}
|
||||
|
||||
function ok_out() {
|
||||
echo "[OK] ${TEST_PREFIX}`printf %03d ${TEST_NUM}` $1"
|
||||
(( TEST_NUM++ ))
|
||||
TEST_CODE=`printf %03d ${TEST_NUM}`
|
||||
}
|
||||
|
||||
function ng_out() {
|
||||
echo "[NG] ${TEST_PREFIX}`printf %03d ${TEST_NUM}` $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
TEST_PARAM_FILE=$1
|
||||
TEST_NUM=23
|
||||
TEST_CODE=001
|
||||
TEST_PREFIX=so_
|
||||
|
||||
ME=`whoami`
|
||||
|
||||
# read config
|
||||
source ./config
|
||||
|
||||
MCPATH=${MCMOD_DIR}
|
||||
|
||||
mkdir -p result
|
||||
|
||||
reboot
|
||||
#programを実行 logを保存
|
||||
${MCPATH}/bin/mcexec ./swaptest 2 >./result/swapout_normal.log
|
||||
|
||||
#kmsgを保存
|
||||
sudo ${MCPATH}/sbin/ihkosctl 0 kmsg >./result/swapout_normal.kmsg
|
||||
|
||||
#swapout023 execute swaptest(return code)
|
||||
grep "^swapout returns: 0$" ./result/swapout_normal.log
|
||||
ret=$?
|
||||
if [ ${ret} -eq 0 ]; then
|
||||
ok_out "swaptest program is nomrmal exit."
|
||||
else
|
||||
ng_out "swaptest pogram is abnormal exit."
|
||||
fi
|
||||
|
||||
#swapout024 execute swaptest (restore data)
|
||||
grep "^data = hello$" ./result/swapout_normal.log
|
||||
ret=$?
|
||||
if [ ${ret} -eq 0 ]; then
|
||||
ok_out "confirmed restoration of data."
|
||||
else
|
||||
ng_out "did not restore the data."
|
||||
fi
|
||||
|
||||
#wapout025 execute swapout (restore user space)
|
||||
rc=1
|
||||
for str in `sed -n -e /"^.*: SWAP:.*$"/,/"^.*: MLOCK:.*$"/p ./result/swapout_normal.kmsg |sed -n s/"^\[ 0\]: \t\([0-9a-f]*\) -- \([0-9a-f]*\)$"/"\1:\2"/p`
|
||||
do
|
||||
grep ${str} ./result/swapout_normal.kmsg >/dev/null
|
||||
rtn=$?
|
||||
if [ ${rtn} -eq 0 ]; then
|
||||
echo ${str} is matched.
|
||||
rc=0
|
||||
else
|
||||
echo ${str} is not matched.
|
||||
rc=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ${rc} -eq 0 ]; then
|
||||
ok_out "pageout areas and pagein areas are matched."
|
||||
else
|
||||
ng_out "pagein areas is not matched."
|
||||
fi
|
||||
81
test/user_space/swapout/swaptest.c
Normal file
81
test/user_space/swapout/swaptest.c
Normal file
@@ -0,0 +1,81 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define BUF_SIZE (32*1024)
|
||||
|
||||
int data[1024*1024];
|
||||
char sym2[1024*1024] = { 10, 20, 30, 0 };
|
||||
char sym3[1024*1024] = { 10, 20, 30, 0 };
|
||||
char *sym1 = "aaaaaa";
|
||||
char buffer[BUF_SIZE];
|
||||
char *ptr1, *ptr2;
|
||||
char fnamebuf[1024];
|
||||
|
||||
int
|
||||
swapout(char *fname, void *buf, size_t sz, int flag)
|
||||
{
|
||||
int cc;
|
||||
cc = syscall(801, fname, buf, sz, flag);
|
||||
return cc;
|
||||
}
|
||||
int
|
||||
linux_mlock(const void *addr, size_t len)
|
||||
{
|
||||
int cc;
|
||||
cc = syscall(802, addr, len);
|
||||
return cc;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int cc;
|
||||
int flag = 0;
|
||||
|
||||
if (argc == 2) {
|
||||
flag = atoi(argv[1]);
|
||||
}
|
||||
switch (flag) {
|
||||
case 1:
|
||||
printf("skipping real paging for debugging and just calling swapout in Linux\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("skipping calling swapout in Linux\n");
|
||||
break;
|
||||
}
|
||||
printf("&data = %p\n", data);
|
||||
printf("&sym1 = %p\n", &sym1);
|
||||
printf("&sym2 = %p\n", sym2);
|
||||
printf("&sym3 = %p\n", sym3);
|
||||
printf("&cc = %p\n", &cc);
|
||||
ptr1 = malloc(1024);
|
||||
ptr2 = malloc(1024*1024);
|
||||
printf("ptr1 = %p\n", ptr1);
|
||||
printf("ptr2 = %p\n", ptr2);
|
||||
sprintf((char*) data, "hello\n");
|
||||
/*
|
||||
* testing mlock in mckernel side
|
||||
*/
|
||||
cc = mlock(data, 16*1024);
|
||||
printf("McKernel mlock returns: %d\n", cc);
|
||||
/*
|
||||
* testing mlock in linux side
|
||||
*/
|
||||
cc = linux_mlock(data, 16*1024);
|
||||
printf("linux_mlock returns: %d\n", cc);
|
||||
strcpy(sym2, "returns: %d\n");
|
||||
strcpy(sym3, "data = %s\n");
|
||||
|
||||
/* buf area will be used in swapout systemcall for debugging */
|
||||
strcpy(fnamebuf, "/tmp/pages");
|
||||
cc = swapout(fnamebuf, buffer, BUF_SIZE, flag);
|
||||
printf("swapout returns: %d\n", cc);
|
||||
printf("data = %s", data);
|
||||
printf(sym2, cc);
|
||||
printf(sym3, data);
|
||||
return 0;
|
||||
}
|
||||
5
test/user_space/swapout/test_cases/CT01.txt
Normal file
5
test/user_space/swapout/test_cases/CT01.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
TEST_PREFIX=CT01
|
||||
MPI_NODE_NUM=1
|
||||
PROC_PER_NODE=1
|
||||
MASTER=10.0.1.46
|
||||
SLAVE=
|
||||
Reference in New Issue
Block a user