[Ocfs2-test-devel] [PATCH 10/59] ocfs2-test: fix in multi-inline-run
Junxiao Bi
junxiao.bi at oracle.com
Sun Sep 13 19:43:56 PDT 2015
From: Tiger Yang <tiger.yang at oracle.com>
Signed-off-by: Tiger Yang <tiger.yang at oracle.com>
Signed-off-by: Junxiao Bi <junxiao.bi at oracle.com>
---
programs/inline-data/inline-data.c | 44 ++++++++++++++++--------------
programs/inline-data/multi-inline-data.c | 4 ++-
programs/inline-data/multi-inline-dirs.c | 5 ++++
programs/inline-data/multi-inline-run.sh | 14 ++++++----
programs/python_common/multiple_run.sh | 2 +-
5 files changed, 41 insertions(+), 28 deletions(-)
diff --git a/programs/inline-data/inline-data.c b/programs/inline-data/inline-data.c
index d5682e1..6bf40f7 100644
--- a/programs/inline-data/inline-data.c
+++ b/programs/inline-data/inline-data.c
@@ -101,7 +101,8 @@ static int do_multi_file_test;
static unsigned long child_nums = 2;
static unsigned long file_nums = 2;
-pid_t *child_pid_list;
+pid_t *child_pid_list_mp = NULL;
+pid_t *child_pid_list_mf = NULL;
extern unsigned long get_rand(unsigned long min, unsigned long max);
extern char rand_char(void);
@@ -208,9 +209,9 @@ static int setup(int argc, char *argv[])
}
if (do_multi_process_test)
- child_pid_list = (pid_t *)malloc(sizeof(pid_t) * child_nums);
+ child_pid_list_mp = (pid_t *)malloc(sizeof(pid_t) * child_nums);
if (do_multi_file_test)
- child_pid_list = (pid_t *)malloc(sizeof(pid_t) * file_nums);
+ child_pid_list_mf = (pid_t *)malloc(sizeof(pid_t) * file_nums);
ret = posix_memalign((void *)&pattern, blocksize, PATTERN_SZ);
if (ret) {
@@ -242,8 +243,10 @@ static int setup(int argc, char *argv[])
static int teardown(void)
{
- if (child_pid_list)
- free(child_pid_list);
+ if (child_pid_list_mp)
+ free(child_pid_list_mp);
+ if (child_pid_list_mf)
+ free(child_pid_list_mf);
rmdir(work_place);
@@ -265,17 +268,18 @@ static void sigchld_handler()
static void kill_all_children()
{
int i;
- int process_nums;
- if (do_multi_process_test)
- process_nums = child_nums;
- else
- process_nums = file_nums;
-
- for (i = 0; i < process_nums; i++)
- kill(child_pid_list[i], SIGTERM);
+ if (do_multi_process_test) {
+ for (i = 0; i < child_nums; i++)
+ kill(child_pid_list_mp[i], SIGTERM);
+ free(child_pid_list_mp);
+ }
- free(child_pid_list);
+ if (do_multi_process_test) {
+ for (i = 0; i < file_nums; i++)
+ kill(child_pid_list_mf[i], SIGTERM);
+ free(child_pid_list_mf);
+ }
}
static void sigint_handler()
{
@@ -347,7 +351,7 @@ static int concurrent_rw_test(void)
}
/*Father attempt to control the children*/
if (pid > 0)
- child_pid_list[i] = pid;
+ child_pid_list_mp[i] = pid;
}
signal(SIGINT, sigint_handler);
@@ -364,11 +368,11 @@ static int concurrent_rw_test(void)
/*father wait all children to leave*/
for (i = 0; i < child_nums; i++) {
- ret = waitpid(child_pid_list[i], &status, 0);
+ ret = waitpid(child_pid_list_mp[i], &status, 0);
rc = WEXITSTATUS(status);
if (rc) {
fprintf(stderr, "Child %d exits abnormally with "
- "RC=%d\n", child_pid_list[i], rc);
+ "RC=%d\n", child_pid_list_mp[i], rc);
return rc;
}
}
@@ -445,7 +449,7 @@ static int multi_file_rw_test(int test_num)
exit(0);
}
if (pid > 0)
- child_pid_list[j] = pid;
+ child_pid_list_mf[j] = pid;
}
signal(SIGINT, sigint_handler);
@@ -453,11 +457,11 @@ static int multi_file_rw_test(int test_num)
/*father wait all children to leave*/
for (i = 0; i < file_nums; i++) {
- ret = waitpid(child_pid_list[i], &status, 0);
+ ret = waitpid(child_pid_list_mf[i], &status, 0);
rc = WEXITSTATUS(status);
if (rc) {
fprintf(stderr, "Child %d exists abnormally with "
- "RC=%d\n", child_pid_list[i], rc);
+ "RC=%d\n", child_pid_list_mf[i], rc);
return rc;
}
}
diff --git a/programs/inline-data/multi-inline-data.c b/programs/inline-data/multi-inline-data.c
index 2529780..41eddf1 100755
--- a/programs/inline-data/multi-inline-data.c
+++ b/programs/inline-data/multi-inline-data.c
@@ -742,7 +742,7 @@ static int test_regular_file(int test_no)
test_num);
if (rank == 0) {
fill_pattern(PATTERN_SZ);
- fd = prep_file_no_fill(max_inline_size, 0);
+ fd = prep_file_no_fill(max_inline_size, 1);
if (fd < 0)
abort_printf("prep file no fill failed!\n");
send_pattern_to_ranks();
@@ -849,6 +849,7 @@ static int test_regular_file(int test_no)
ret = extend_pattern(fd, old_size, new_size);
if (ret)
abort_printf("extend pattern failed!\n");
+ sync();
send_pattern_to_ranks();
} else {
recv_pattern_from_ranks();
@@ -901,6 +902,7 @@ static int test_regular_file(int test_no)
abort_printf("extend pattern failed!\n");
send_pattern_to_ranks();
}
+ sync();
} else {
recv_pattern_from_ranks();
}
diff --git a/programs/inline-data/multi-inline-dirs.c b/programs/inline-data/multi-inline-dirs.c
index 443f734..8c58c25 100644
--- a/programs/inline-data/multi-inline-dirs.c
+++ b/programs/inline-data/multi-inline-dirs.c
@@ -702,6 +702,10 @@ static void run_basic_tests(void)
abort_printf("MPI_Barrier failed: %d\n", ret);
root_printf("Test %d: fill directory\n", testno);
+
+ /*initialize the value of operated_entries for all ranks*/
+ get_max_inlined_entries(max_inline_size);
+
if (rank == 0) {
create_and_prep_dir();
get_directory_almost_full(0);
@@ -736,6 +740,7 @@ static void run_basic_tests(void)
MS_SYNC);
msync(mmap_shared_num_region, mmap_num_size,
MS_SYNC);
+ sync();
}
ret = MPI_Barrier(MPI_COMM_WORLD);
diff --git a/programs/inline-data/multi-inline-run.sh b/programs/inline-data/multi-inline-run.sh
index eb5a16c..ba62aa6 100755
--- a/programs/inline-data/multi-inline-run.sh
+++ b/programs/inline-data/multi-inline-run.sh
@@ -41,6 +41,7 @@ REMOTE_MOUNT_BIN="${BINDIR}/remote_mount.py"
UMOUNT_BIN="`which sudo` -u root `which umount`"
REMOTE_UMOUNT_BIN="${BINDIR}/remote_umount.py"
MKFS_BIN="`which sudo` -u root `which mkfs.ocfs2`"
+BLKID_BIN="`which sudo` -u root `which blkid`"
INLINE_DATA_BIN="${BINDIR}/multi-inline-data"
INLINE_DIRS_BIN="${BINDIR}/multi-inline-dirs"
DEFAULT_LOG="multiple-inline-data-test-logs"
@@ -219,9 +220,10 @@ f_do_mkfs_and_mount()
echo_status ${RET} |tee -a ${RUN_LOG_FILE}
exit_or_not ${RET}
${SUDO} chown -R ${USERNAME}:${GROUPNAME} ${MOUNT_POINT}
+ ${SUDO} chown ${USERNAME}:${GROUPNAME} ${OCFS2_DEVICE}
${SUDO} chmod -R 777 ${MOUNT_POINT}
- OCFS2_UUID=`blkid |grep ${OCFS2_DEVICE}|cut -d' ' -f3|cut -d'"' -f2`
+ OCFS2_UUID="`${BLKID_BIN} ${OCFS2_DEVICE}| grep -o '[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{12\}'`"
}
f_do_umount()
@@ -243,7 +245,7 @@ f_run_data_test()
echo "==========================================================">>${DATA_LOG_FILE}
echo -e "Testing Binary:\t\t${INLINE_DATA_BIN} -i 1 -u ${OCFS2_UUID} ${MOUNT_POINT}">>${DATA_LOG_FILE}
- ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -np ${MPI_RANKS} --host ${MPI_HOSTS} ${INLINE_DATA_BIN} -i 1 -u ${OCFS2_UUID} ${MOUNT_POINT}>>${DATA_LOG_FILE} 2>&1
+ ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -np ${MPI_RANKS} --host ${MPI_HOSTS} ${INLINE_DATA_BIN} -i 1 -u ${OCFS2_UUID} ${MOUNT_POINT}>>${DATA_LOG_FILE} 2>&1
RET=$?
echo_status ${RET} |tee -a ${RUN_LOG_FILE}
exit_or_not ${RET}
@@ -257,7 +259,7 @@ f_run_data_test()
echo "==========================================================">>${DATA_LOG_FILE}
echo -e "Testing Binary:\t\t${INLINE_DATA_BIN} -i 200 -u ${OCFS2_UUID} ${MOUNT_POINT}">>${DATA_LOG_FILE}
- ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -np ${MPI_RANKS} --host ${MPI_HOSTS} ${INLINE_DATA_BIN} -i 200 -u ${OCFS2_UUID} ${MOUNT_POINT}>>${DATA_LOG_FILE} 2>&1
+ ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -np ${MPI_RANKS} --host ${MPI_HOSTS} ${INLINE_DATA_BIN} -i 200 -u ${OCFS2_UUID} ${MOUNT_POINT}>>${DATA_LOG_FILE} 2>&1
RET=$?
echo_status ${RET} |tee -a ${RUN_LOG_FILE}
exit_or_not ${RET}
@@ -274,7 +276,7 @@ f_run_dirs_test()
echo "==========================================================">>${DIRS_LOG_FILE}
echo -e "Testing Binary:\t\t${INLINE_DIRS_BIN} -i 1 -s 20 -u ${OCFS2_UUID} ${MOUNT_POINT}">>${DIRS_LOG_FILE}
- ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -np ${MPI_RANKS} --host ${MPI_HOSTS} ${INLINE_DIRS_BIN} -i 1 -s 20 -u ${OCFS2_UUID} ${MOUNT_POINT}>>${DIRS_LOG_FILE} 2>&1
+ ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -np ${MPI_RANKS} --host ${MPI_HOSTS} ${INLINE_DIRS_BIN} -i 1 -s 20 -u ${OCFS2_UUID} ${MOUNT_POINT}>>${DIRS_LOG_FILE} 2>&1
RET=$?
echo_status ${RET} |tee -a ${RUN_LOG_FILE}
exit_or_not ${RET}
@@ -288,7 +290,7 @@ f_run_dirs_test()
echo "==========================================================">>${DIRS_LOG_FILE}
echo -e "Testing Binary:\t\t${INLINE_DIRS_BIN} -i 1 -s 100 -u ${OCFS2_UUID} ${MOUNT_POINT}">>${DIRS_LOG_FILE}
- ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -np ${MPI_RANKS} --host ${MPI_HOSTS} ${INLINE_DIRS_BIN} -i 1 -s 100 -u ${OCFS2_UUID} ${MOUNT_POINT}>>${DIRS_LOG_FILE} 2>&1
+ ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -np ${MPI_RANKS} --host ${MPI_HOSTS} ${INLINE_DIRS_BIN} -i 1 -s 100 -u ${OCFS2_UUID} ${MOUNT_POINT}>>${DIRS_LOG_FILE} 2>&1
RET=$?
echo_status ${RET} |tee -a ${RUN_LOG_FILE}
exit_or_not ${RET}
@@ -302,7 +304,7 @@ f_run_dirs_test()
echo "==========================================================">>${DIRS_LOG_FILE}
echo -e "Testing Binary:\t\t${INLINE_DIRS_BIN} -i 5 -s 20 -u ${OCFS2_UUID} ${MOUNT_POINT}">>${DIRS_LOG_FILE}
- ${SUDO} ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -np ${MPI_RANKS} --host ${MPI_HOSTS} ${INLINE_DIRS_BIN} -i 5 -s 20 -u ${OCFS2_UUID} ${MOUNT_POINT}>>${DIRS_LOG_FILE} 2>&1
+ ${MPIRUN} ${MPI_PLS_AGENT_ARG} -mca btl tcp,self -np ${MPI_RANKS} --host ${MPI_HOSTS} ${INLINE_DIRS_BIN} -i 5 -s 20 -u ${OCFS2_UUID} ${MOUNT_POINT}>>${DIRS_LOG_FILE} 2>&1
RET=$?
echo_status ${RET} |tee -a ${RUN_LOG_FILE}
exit_or_not ${RET}
diff --git a/programs/python_common/multiple_run.sh b/programs/python_common/multiple_run.sh
index 656367d..437d336 100755
--- a/programs/python_common/multiple_run.sh
+++ b/programs/python_common/multiple_run.sh
@@ -349,7 +349,7 @@ run_inline_test()
local logdir=${LOG_DIR}/multi-inline-test
LogRunMsg "inline-test"
- ${BINDIR}/multi-inline-run.sh -r 4 -f ${NODE_LIST} -a rsh -o ${logdir} \
+ ${BINDIR}/multi-inline-run.sh -r 2 -f ${NODE_LIST} -a ssh -o ${logdir} \
-d ${DEVICE} ${MOUNT_POINT} >> ${LOGFILE} 2>&1
LogRC $?
}
--
1.7.9.5
More information about the Ocfs2-test-devel
mailing list