diff options
Diffstat (limited to '0052-add-ci-for-runc.patch')
-rw-r--r-- | 0052-add-ci-for-runc.patch | 1666 |
1 files changed, 1666 insertions, 0 deletions
diff --git a/0052-add-ci-for-runc.patch b/0052-add-ci-for-runc.patch new file mode 100644 index 0000000..24c4194 --- /dev/null +++ b/0052-add-ci-for-runc.patch @@ -0,0 +1,1666 @@ +From b7b26805535a73eb647111d247d0e7c5f2c81856 Mon Sep 17 00:00:00 2001 +From: zhongtao <zhongtao17@huawei.com> +Date: Wed, 22 Mar 2023 09:50:56 +0800 +Subject: [PATCH 52/53] add ci for runc + +Signed-off-by: zhongtao <zhongtao17@huawei.com> +--- + CI/test_cases/container_cases/annotaion.sh | 31 ++-- + .../container_cases/bind_special_dir.sh | 10 +- + .../check_fd_leakage_of_isulad.sh | 31 +++- + .../container_cases/cleanup_leftover.sh | 49 ++++--- + .../container_cases/cni_bridge_test.sh | 14 +- + CI/test_cases/container_cases/cpu_rt.sh | 88 ++++++----- + CI/test_cases/container_cases/create.sh | 41 ++++-- + .../container_cases/cri_default_namespace.sh | 28 ++-- + CI/test_cases/container_cases/cri_pod_ip.sh | 18 ++- + CI/test_cases/container_cases/cri_stream.sh | 58 ++++++-- + CI/test_cases/container_cases/kill.sh | 19 ++- + CI/test_cases/container_cases/log_test.sh | 138 ++++++++++-------- + CI/test_cases/container_cases/pause.sh | 21 ++- + CI/test_cases/container_cases/resume.sh | 25 ++-- + CI/test_cases/container_cases/rm.sh | 29 ++-- + CI/test_cases/container_cases/start.sh | 39 +++-- + CI/test_cases/container_cases/stats.sh | 16 +- + CI/test_cases/container_cases/ulimit.sh | 24 +-- + CI/test_cases/container_cases/update.sh | 46 ++++-- + CI/test_cases/helpers.sh | 5 +- + 20 files changed, 472 insertions(+), 258 deletions(-) + +diff --git a/CI/test_cases/container_cases/annotaion.sh b/CI/test_cases/container_cases/annotaion.sh +index 65c474e8..93b432e5 100755 +--- a/CI/test_cases/container_cases/annotaion.sh ++++ b/CI/test_cases/container_cases/annotaion.sh +@@ -21,13 +21,12 @@ + + declare -r curr_path=$(dirname $(readlink -f "$0")) + source ../helpers.sh +-test="annotation test => test_annotation" + + function test_label() + { + local ret=0 + +- isula run -tid --name annotation --label "test_long_label=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" busybox sh ++ isula run -tid --name annotation --runtime $1 --label "test_long_label=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" busybox sh + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container for long label" && ((ret++)) + + isula inspect annotation +@@ -52,7 +51,7 @@ function test_annotation() + { + local ret=0 + +- isula run -tid --name annotation --annotation "test_long_label=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" busybox sh ++ isula run -tid --name annotation --runtime $1 --annotation "test_long_label=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" busybox sh + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container for long label" && ((ret++)) + + isula inspect annotation +@@ -73,14 +72,28 @@ function test_annotation() + return ${ret} + } + +-declare -i ans=0 ++function do_test_t() ++{ ++ local ret=0 ++ local runtime=$1 ++ local test="annotation test => $runtime" ++ msg_info "${test} starting..." + +-msg_info "${test} starting..." +-[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - start isulad failed" && ((ret++)) ++ test_label $runtime || ((ret++)) ++ test_annotation $runtime || ((ret++)) + +-test_label || ((ans++)) +-test_annotation || ((ans++)) ++ msg_info "${test} finished with return ${ret}..." ++ return $ret ++} ++ ++declare -i ans=0 + +-msg_info "${test} finished with return ${ans}..." ++for element in ${RUNTIME_LIST[@]}; ++do ++ do_test_t $element ++ if [ $? -ne 0 ];then ++ let "ans=$ans + 1" ++ fi ++done + + show_result ${ans} "${curr_path}/${0}" +diff --git a/CI/test_cases/container_cases/bind_special_dir.sh b/CI/test_cases/container_cases/bind_special_dir.sh +index e855404b..e2653685 100755 +--- a/CI/test_cases/container_cases/bind_special_dir.sh ++++ b/CI/test_cases/container_cases/bind_special_dir.sh +@@ -25,8 +25,9 @@ source ../helpers.sh + function test_bind_special_dir() + { + local ret=0 ++ local runtime=$1 + local image="busybox" +- local test="container bind special directory test => (${FUNCNAME[@]})" ++ local test="container bind special directory test with ($runtime) => (${FUNCNAME[@]})" + + msg_info "${test} starting..." + +@@ -36,7 +37,7 @@ function test_bind_special_dir() + isula images | grep busybox + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++)) + +- c_id=`isula run -itd -v -itd -v /sys/fs:/sys/fs:rw,rshared -v /proc:/proc -v /dev:/dev:ro -v /dev/pts:/dev/pts:rw busybox sh` ++ c_id=`isula run --runtime=$runtime -itd -v -itd -v /sys/fs:/sys/fs:rw,rshared -v /proc:/proc -v /dev:/dev:ro -v /dev/pts:/dev/pts:rw busybox sh` + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++)) + + isula exec -it $c_id sh -c "ls -al /sys/fs" | grep "cgroup" +@@ -51,6 +52,9 @@ function test_bind_special_dir() + + declare -i ans=0 + +-test_bind_special_dir || ((ans++)) ++for element in ${RUNTIME_LIST[@]}; ++do ++ test_bind_special_dir $element || ((ans++)) ++done + + show_result ${ans} "${curr_path}/${0}" +diff --git a/CI/test_cases/container_cases/check_fd_leakage_of_isulad.sh b/CI/test_cases/container_cases/check_fd_leakage_of_isulad.sh +index 39c9f49f..1978b587 100755 +--- a/CI/test_cases/container_cases/check_fd_leakage_of_isulad.sh ++++ b/CI/test_cases/container_cases/check_fd_leakage_of_isulad.sh +@@ -26,6 +26,10 @@ connect="grpc" + + function do_test_t_grpc() + { ++ local runtime=$1 ++ local test="do_test_t_grpc test => $runtime" ++ msg_info "${test} starting..." ++ + if [ $connect != "grpc" ];then + echo "this test is designed for grpc version" + return 0 +@@ -34,7 +38,7 @@ function do_test_t_grpc() + containername=test_fds + isulad_pid=`cat /var/run/isulad.pid` + precount=`ls /proc/$isulad_pid/fd | wc -l` +- isula create -t --name $containername busybox ++ isula create -t --name $containername --runtime $runtime busybox + fn_check_eq "$?" "0" "create failed" + testcontainer $containername inited + +@@ -61,11 +65,15 @@ function do_test_t_grpc() + curcount=`ls /proc/$isulad_pid/fd | wc -l` + fn_check_eq "$precount" "$curcount" "test failed" + ++ msg_info "${test} finished with return ${TC_RET_T}..." + return $TC_RET_T + } + + function do_test_t_rest() + { ++ local runtime=$1 ++ local test="do_test_t_rest test => $runtime" ++ msg_info "${test} starting..." + if [ $connect != "rest" ];then + echo "this test is designed for rest version" + return 0 +@@ -76,7 +84,7 @@ function do_test_t_rest() + isulad_pid=`cat /var/run/isulad.pid` + precount=`ls /proc/$isulad_pid/fd | wc -l` + +- isula create -t --name $containername busybox ++ isula create -t --name $containername --runtime $runtime busybox + fn_check_eq "$?" "0" "create failed" + testcontainer $containername inited + +@@ -118,15 +126,24 @@ function do_test_t_rest() + TC_RET_T=$(($TC_RET_T+1)) + fi + ++ msg_info "${test} finished with return ${TC_RET_T}..." + return $TC_RET_T + } + + ret=0 + +-do_test_t_grpc +-do_test_t_rest +-if [ $? -ne 0 ];then +- let "ret=$ret + 1" +-fi ++for element in ${RUNTIME_LIST[@]}; ++do ++ do_test_t_grpc $element ++ if [ $? -ne 0 ];then ++ let "ret=$ret + 1" ++ fi ++ do_test_t_rest $element ++ if [ $? -ne 0 ];then ++ let "ret=$ret + 1" ++ fi ++done ++ ++ + + show_result $ret "basic check fd leak" +diff --git a/CI/test_cases/container_cases/cleanup_leftover.sh b/CI/test_cases/container_cases/cleanup_leftover.sh +index 054f7d48..6f29180c 100755 +--- a/CI/test_cases/container_cases/cleanup_leftover.sh ++++ b/CI/test_cases/container_cases/cleanup_leftover.sh +@@ -5,26 +5,41 @@ + declare -r curr_path=$(dirname $(readlink -f "$0")) + source ../helpers.sh + +-containerid=$(isula run -tid busybox ls) ++function test_cleanup() ++{ ++ local runtime=$1 ++ local test="cleanup_test => (${runtime})" ++ msg_info "${test} starting..." + +-check_valgrind_log +-rm -rf "$LCR_ROOT_PATH/$containerid" ++ containerid=$(isula run -tid --runtime $runtime busybox ls) + +-start_isulad_with_valgrind +-wait_isulad_running ++ check_valgrind_log ++ rm -rf "$RUNTIME_ROOT_PATH/$runtime/$containerid" ++ ++ start_isulad_with_valgrind ++ wait_isulad_running + +-ret=0 +-ls "/var/lib/isulad/storage/overlay-containers/$containerid" +-if [ $? != 0 ]; then +- echo "ls can't access which is expected" + ret=0 +-else +- ret=1; +-fi +-check_valgrind_log +-[[ $? -ne 0 ]] && msg_err "cleanup leftover - memory leak, please check...." && ((ret++)) +- +-start_isulad_with_valgrind +-wait_isulad_running ++ ls "/var/lib/isulad/storage/overlay-containers/$containerid" ++ if [ $? != 0 ]; then ++ echo "ls can't access which is expected" ++ ret=0 ++ else ++ ret=1; ++ fi ++ check_valgrind_log ++ [[ $? -ne 0 ]] && msg_err "cleanup leftover - memory leak, please check...." && ((ret++)) ++ ++ start_isulad_with_valgrind ++ wait_isulad_running ++ msg_info "${test} finished with return ${ret}..." ++} ++ ++declare -i ret=0 ++ ++for element in ${RUNTIME_LIST[@]}; ++do ++ test_cleanup $element || ((ret++)) ++done + + show_result $ret "${curr_path}/${0}" +\ No newline at end of file +diff --git a/CI/test_cases/container_cases/cni_bridge_test.sh b/CI/test_cases/container_cases/cni_bridge_test.sh +index 369b284d..55c6e37c 100755 +--- a/CI/test_cases/container_cases/cni_bridge_test.sh ++++ b/CI/test_cases/container_cases/cni_bridge_test.sh +@@ -72,8 +72,9 @@ function do_post() + function do_test_help() + { + local ret=0 ++ local runtime=$4 + +- msg_info "this is $0 do_test" ++ msg_info "this is $0 do_test with runtime $runtime" + + crictl pull busybox + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Failed to pull busybox image" && ((ret++)) +@@ -81,14 +82,14 @@ function do_test_help() + crictl images | grep "mirrorgooglecontainers/pause-amd64" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Failed to find mirrorgooglecontainers/pause-amd64 image" && ((ret++)) + +- sid1=`crictl runp ${data_path}/$1` ++ sid1=`crictl runp --runtime $runtime ${data_path}/$1` + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Failed to run sandbox1" && ((ret++)) + + spid1=`isula inspect -f '{{json .State.Pid}}' $sid1` + nsenter -t $spid1 -n ifconfig eth0 + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Sandbox1 network config failed" && ((ret++)) + +- sid2=`crictl runp ${data_path}/$2` ++ sid2=`crictl runp --runtime $runtime ${data_path}/$2` + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Failed to run sandbox2" && ((ret++)) + + spid2=`isula inspect -f '{{json .State.Pid}}' $sid2` +@@ -123,7 +124,7 @@ function do_test_help() + crictl rmp $sid1 $sid2 + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - rm sandbox failed" && ((ret++)) + +- msg_info "$0 do_test finished with return ${ret}..." ++ msg_info "$0 do_test with runtime $runtime finished with return ${ret}..." + return ${ret} + } + +@@ -131,7 +132,10 @@ declare -i ans=0 + + do_pre || ((ans++)) + +-do_test_help "sandbox-config.json" "sandbox-config2.json" "10\.2\." || ((ans++)) ++for element in ${RUNTIME_LIST[@]}; ++do ++ do_test_help "sandbox-config.json" "sandbox-config2.json" "10\.2\." $element || ((ans++)) ++done + + do_post + +diff --git a/CI/test_cases/container_cases/cpu_rt.sh b/CI/test_cases/container_cases/cpu_rt.sh +index 39c0b427..bdc43a5e 100755 +--- a/CI/test_cases/container_cases/cpu_rt.sh ++++ b/CI/test_cases/container_cases/cpu_rt.sh +@@ -47,10 +47,9 @@ function test_isula_update_normal() + msg_info "${test} starting..." + + #start isulad with cpu_rt +- isulad --cpu-rt-period 1000000 --cpu-rt-runtime 950000 -l DEBUG > /dev/null 2>&1 & +- wait_isulad_running ++ start_isulad_without_valgrind --cpu-rt-period 1000000 --cpu-rt-runtime 950000 + +- c_id=`isula run -itd --cpu-rt-period 1000000 --cpu-rt-runtime 1000 ${image} sh` ++ c_id=`isula run -itd --cpu-rt-period 1000000 --cpu-rt-runtime 1000 --runtime $1 ${image} sh` + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++)) + + isula update --cpu-rt-period 900000 --cpu-rt-runtime 2000 $c_id +@@ -67,8 +66,7 @@ function test_isula_update_normal() + + stop_isulad_without_valgrind + #set cpu-rt to the initial state +- isulad --cpu-rt-period 1000000 --cpu-rt-runtime 0 -l DEBUG > /dev/null 2>&1 & +- wait_isulad_running ++ start_isulad_without_valgrind --cpu-rt-period 1000000 --cpu-rt-runtime 0 + + msg_info "${test} finished with return ${ret}..." + return ${ret} +@@ -84,23 +82,18 @@ function test_isula_update_abnormal() + isulad --cpu-rt-period 1000000 --cpu-rt-runtime 950000 -l DEBUG > /dev/null 2>&1 & + wait_isulad_running + +- c_id=`isula run -itd --cpu-rt-period 1000000 --cpu-rt-runtime 1000 ${image} sh` ++ c_id=`isula run -itd --cpu-rt-period 1000000 --cpu-rt-runtime 1000 --runtime $1 ${image} sh` + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++)) + + isula update --cpu-rt-period 800000 --cpu-rt-runtime 900000 $c_id 2>&1 | grep "Invalid --cpu-rt-runtime: rt runtime cannot be higher than rt period" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to update container cpu-rt-runtime" && ((ret++)) + +- isula update --cpu-rt-runtime 1000000 $c_id 2>&1 | grep "updating cgroup cpu.rt_runtime_us to 1000000: Invalid argument" ++ isula update --cpu-rt-runtime 1000000 $c_id 2>&1 | grep -i "invalid argument" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to update container cpu-rt-runtime" && ((ret++)) + + isula rm -f $c_id + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm container ${c_id}" && ((ret++)) + +- stop_isulad_without_valgrind +- #set cpu-rt to the initial state +- isulad --cpu-rt-period 1000000 --cpu-rt-runtime 0 -l DEBUG > /dev/null 2>&1 & +- wait_isulad_running +- + msg_info "${test} finished with return ${ret}..." + return ${ret} + } +@@ -113,8 +106,7 @@ function test_kernel_without_cpurt() + + msg_info "${test} starting..." + +- isulad --cpu-rt-period 1000000 --cpu-rt-runtime 950000 -l DEBUG > /dev/null 2>&1 & +- wait_isulad_running ++ start_isulad_without_valgrind --cpu-rt-period 1000000 --cpu-rt-runtime 950000 + + isula pull ${image} + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to pull image: ${image}" && return ${FAILURE} +@@ -122,7 +114,7 @@ function test_kernel_without_cpurt() + isula images | grep busybox + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++)) + +- isula run -itd --cpu-rt-period 1000000 --cpu-rt-runtime 900000 $image /bin/sh 2>&1 | grep "Your kernel does not support cgroup rt" ++ isula run -itd --cpu-rt-period 1000000 --cpu-rt-runtime 900000 --runtime $1 $image /bin/sh 2>&1 | grep "Your kernel does not support cgroup rt" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - kernel does not support cpu-rt" && ((ret++)) + + msg_info "${test} finished with return ${ret}..." +@@ -137,9 +129,8 @@ function test_isula_run_abnormal() + + msg_info "${test} starting..." + +- #start isulad without cpu_rt +- isulad --cpu-rt-period 1000000 --cpu-rt-runtime 950000 -l DEBUG > /dev/null 2>&1 & +- wait_isulad_running ++ #start isulad with cpu_rt ++ start_isulad_without_valgrind --cpu-rt-period 1000000 --cpu-rt-runtime 950000 + + isula pull ${image} + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to pull image: ${image}" && return ${FAILURE} +@@ -147,25 +138,25 @@ function test_isula_run_abnormal() + isula images | grep busybox + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++)) + +- isula run -itd --cpu-rt-period 1000000 --cpu-rt-runtime -1 $image /bin/sh 2>&1 | grep "failed to write -1" | grep "cpu.rt_runtime_us: Invalid argument" ++ isula run -itd --cpu-rt-period 1000000 --cpu-rt-runtime -1 --runtime $1 $image /bin/sh 2>&1 | grep "failed to write" | grep -i "cpu.rt_runtime_us: Invalid argument" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Invalid argument for cpu-rt-runtime" && ((ret++)) + +- isula run -itd --cpu-rt-period xx --cpu-rt-runtime 10000 $image /bin/sh 2>&1 | grep 'Invalid value "xx" for flag --cpu-rt-period: Invalid argument' ++ isula run -itd --cpu-rt-period xx --cpu-rt-runtime 10000 --runtime $1 $image /bin/sh 2>&1 | grep 'Invalid value "xx" for flag --cpu-rt-period: Invalid argument' + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Invalid argument for cpu-rt-period" && ((ret++)) + +- isula run -itd --cpu-rt-period 1000000 --cpu-rt-runtime xx $image /bin/sh 2>&1 | grep 'Invalid value "xx" for flag --cpu-rt-runtime: Invalid argument' ++ isula run -itd --cpu-rt-period 1000000 --cpu-rt-runtime xx --runtime $1 $image /bin/sh 2>&1 | grep 'Invalid value "xx" for flag --cpu-rt-runtime: Invalid argument' + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Invalid argument for cpu-rt-runtime" && ((ret++)) + +- isula run -itd --cpu-rt-period xx --cpu-rt-runtime xx $image /bin/sh 2>&1 | grep 'Invalid value "xx" for flag --cpu-rt-period: Invalid argument' ++ isula run -itd --cpu-rt-period xx --cpu-rt-runtime xx --runtime $1 $image /bin/sh 2>&1 | grep 'Invalid value "xx" for flag --cpu-rt-period: Invalid argument' + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Invalid argument for cpu-rt-period" && ((ret++)) + +- isula run -itd --cpu-rt-period -1 --cpu-rt-runtime 10000 $image /bin/sh 2>&1 | grep "Invalid --cpu-rt-runtime: rt runtime cannot be higher than rt period" ++ isula run -itd --cpu-rt-period -1 --cpu-rt-runtime 10000 --runtime $1 $image /bin/sh 2>&1 | grep "Invalid --cpu-rt-runtime: rt runtime cannot be higher than rt period" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - cpu-rt-runtime cannot be higher than cpu-rt-period" && ((ret++)) + +- isula run -itd --cpu-rt-period 100 --cpu-rt-runtime 10000 $image /bin/sh 2>&1 | grep "Invalid --cpu-rt-runtime: rt runtime cannot be higher than rt period" ++ isula run -itd --cpu-rt-period 100 --cpu-rt-runtime 10000 --runtime $1 $image /bin/sh 2>&1 | grep "Invalid --cpu-rt-runtime: rt runtime cannot be higher than rt period" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - cpu-rt-runtime cannot be higher than cpu-rt-period" && ((ret++)) + +- isula run -itd --cpu-rt-period 1000000 --cpu-rt-runtime 960000 $image /bin/sh 2>&1 | grep "failed to write 960000" | grep "cpu.rt_runtime_us: Invalid argument" ++ isula run -itd --cpu-rt-period 1000000 --cpu-rt-runtime 960000 --runtime $1 $image /bin/sh 2>&1 | grep "failed to write" | grep -i "cpu.rt_runtime_us: Invalid argument" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Invalid argument for cpu-rt-runtime" && ((ret++)) + + msg_info "${test} finished with return ${ret}..." +@@ -177,7 +168,7 @@ function test_isula_run_normal() + local ret=0 + local image="busybox" + +- isula run -itd -n box --cpu-rt-period 1000000 --cpu-rt-runtime 1000 $image /bin/sh 2>&1 ++ isula run -itd -n box --cpu-rt-period 1000000 --cpu-rt-runtime 1000 --runtime $1 $image /bin/sh 2>&1 + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container" && ((ret++)) + + isula rm -f box +@@ -187,18 +178,41 @@ function test_isula_run_normal() + return ${ret} + } + ++function do_test() ++{ ++ local ret=0 ++ local runtime=$1 ++ local test="cpu_rt_test => (${runtime})" ++ msg_info "${test} starting..." ++ ++ if [ -f "/sys/fs/cgroup/cpu/cpu.rt_runtime_us" ];then ++ test_isula_run_abnormal $runtime|| ((ret++)) ++ test_isula_run_normal $runtime || ((ret++)) ++ test_cpurt_isulad_abnormal $runtime || ((ret++)) ++ test_isula_update_normal $runtime || ((ret++)) ++ test_isula_update_abnormal $runtime || ((ret++)) ++ else ++ test_kernel_without_cpurt $runtime || ((ans++)) ++ fi ++ ++ msg_info "${test} finished with return ${ret}..." ++ ++ return ${ret} ++} ++ + declare -i ans=0 + +-if [ -f "/sys/fs/cgroup/cpu/cpu.rt_runtime_us" ];then +- test_isula_run_abnormal || ((ans++)) +- test_isula_run_normal || ((ans++)) +- test_cpurt_isulad_abnormal || ((ans++)) +- test_isula_update_normal || ((ans++)) +- test_isula_update_abnormal || ((ans++)) +-else +- test_kernel_without_cpurt || ((ans++)) +-fi +- +-isula rm -f $(isula ps -aq) ++for element in ${RUNTIME_LIST[@]}; ++do ++ check_valgrind_log ++ ++ do_test $element || ((ans++)) ++ ++ stop_isulad_without_valgrind ++ # set cpu-rt to the initial state ++ start_isulad_with_valgrind --cpu-rt-period 1000000 --cpu-rt-runtime 0 ++ ++ isula rm -f $(isula ps -aq) ++done + + show_result ${ans} "${curr_path}/${0}" +diff --git a/CI/test_cases/container_cases/create.sh b/CI/test_cases/container_cases/create.sh +index 2c28a4fa..868a9b22 100755 +--- a/CI/test_cases/container_cases/create.sh ++++ b/CI/test_cases/container_cases/create.sh +@@ -23,8 +23,12 @@ source ../helpers.sh + + function do_test_t() + { ++ local runtime=$1 ++ local test="create_test => (${runtime})" ++ msg_info "${test} starting..." ++ + containername=test_create +- isula run -itd --name $containername busybox ++ isula run -itd --name $containername --runtime $runtime busybox + fn_check_eq "$?" "0" "create failed" + testcontainer $containername running + +@@ -34,44 +38,44 @@ function do_test_t() + isula inspect $containername + fn_check_ne "$?" "0" "inspect should fail" + +- containerid=`isula run -itd --name $containername --cpu-shares 1024 busybox` ++ containerid=`isula run -itd --name $containername --cpu-shares 1024 --runtime $runtime busybox` + fn_check_eq "$?" "0" "create failed" + +- cat "$LCR_ROOT_PATH/$containerid/config" | grep "cpu.shares = 1024" ++ cat "$RUNTIME_ROOT_PATH/$runtime/$containerid/config.json" | grep "\"shares\": 1024" + fn_check_eq "$?" "0" "create failed" + + isula rm -f $containername + fn_check_eq "$?" "0" "rm failed" + +- containerid=`isula run -itd --name $containername --cpu-quota 50000 busybox` ++ containerid=`isula run -itd --name $containername --cpu-quota 50000 --runtime $runtime busybox` + fn_check_eq "$?" "0" "create failed" + +- cat "$LCR_ROOT_PATH/$containerid/config" | grep "cpu.cfs_quota_us = 50000" ++ cat "$RUNTIME_ROOT_PATH/$runtime/$containerid/config.json" | grep "\"quota\": 50000" + fn_check_eq "$?" "0" "create failed" + + isula rm -f $containername + fn_check_eq "$?" "0" "rm failed" + +- containerid=`isula run -itd --name $containername --cpuset-cpus 0-1 busybox` ++ containerid=`isula run -itd --name $containername --cpuset-cpus 0-1 --runtime $runtime busybox` + fn_check_eq "$?" "0" "create failed" + +- cat "$LCR_ROOT_PATH/$containerid/config" | grep "cpuset.cpus = 0-1" ++ cat "$RUNTIME_ROOT_PATH/$runtime/$containerid/config.json" | grep "\"cpus\": \"0-1\"" + fn_check_eq "$?" "0" "create failed" + + isula rm -f $containername + fn_check_eq "$?" "0" "rm failed" + +- containerid=`isula run -itd --name $containername --memory 1000000000 busybox` ++ containerid=`isula run -itd --name $containername --memory 1000000000 --runtime $runtime busybox` + fn_check_eq "$?" "0" "create failed" + +- cat "$LCR_ROOT_PATH/$containerid/config" | grep "memory.limit_in_bytes = 1000000000" ++ cat "$RUNTIME_ROOT_PATH/$runtime/$containerid/config.json" | grep "\"limit\": 1000000000" + fn_check_eq "$?" "0" "create failed" + + isula rm -f $containername + fn_check_eq "$?" "0" "rm failed" + + # validate --label +- containerid=`isula run -itd --name $containername --label "iSulad=lcrd" busybox` ++ containerid=`isula run -itd --name $containername --label "iSulad=lcrd" --runtime $runtime busybox` + fn_check_eq "$?" "0" "create failed" + + isula inspect -f "{{.Config.Labels}}" ${containerid} | grep iSulad | grep lcrd +@@ -82,7 +86,7 @@ function do_test_t() + + # validate --label-file + echo "iSulad=lcrd\n abc=kkk" > ./label_file +- containerid=`isula run -itd --name $containername --label-file ./label_file busybox` ++ containerid=`isula run -itd --name $containername --label-file ./label_file --runtime $runtime busybox` + fn_check_eq "$?" "0" "create failed" + + isula inspect -f "{{.Config.Labels}}" ${containerid} | grep iSulad | grep lcrd +@@ -97,7 +101,7 @@ function do_test_t() + fn_check_eq "$?" "0" "rm failed" + + # validate --dns --dns-search --dns-opt +- containerid=`isula run -itd --name $containername --dns 8.8.8.8 --dns-opt debug --dns-search example.com busybox` ++ containerid=`isula run -itd --name $containername --dns 8.8.8.8 --dns-opt debug --dns-search example.com --runtime $runtime busybox` + fn_check_eq "$?" "0" "create failed" + + isula exec -it ${containerid} cat /etc/resolv.conf | grep "nameserver 8.8.8.8" +@@ -112,14 +116,19 @@ function do_test_t() + isula rm -f $containername + fn_check_eq "$?" "0" "rm failed" + ++ msg_info "${test} finished with return ${TC_RET_T}..." ++ + return $TC_RET_T + } + + ret=0 + +-do_test_t +-if [ $? -ne 0 ];then +- let "ret=$ret + 1" +-fi ++for element in ${RUNTIME_LIST[@]}; ++do ++ do_test_t $element ++ if [ $? -ne 0 ];then ++ let "ret=$ret + 1" ++ fi ++done + + show_result $ret "basic create" +diff --git a/CI/test_cases/container_cases/cri_default_namespace.sh b/CI/test_cases/container_cases/cri_default_namespace.sh +index 6a17289b..d013c6fa 100755 +--- a/CI/test_cases/container_cases/cri_default_namespace.sh ++++ b/CI/test_cases/container_cases/cri_default_namespace.sh +@@ -43,10 +43,11 @@ function set_up() + function test_cri_default_namespace_in_pod_fun() + { + local ret=0 +- local test="test_cri_default_namespace_in_pod_fun => (${FUNCNAME[@]})" ++ local runtime=$1 ++ local test="test_cri_default_namespace_in_pod_fun => (${runtime})" + msg_info "${test} starting..." + +- sid=$(crictl runp ${data_path}/sandbox-config.json) ++ sid=$(crictl runp --runtime $runtime ${data_path}/sandbox-config.json) + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run sandbox" && ((ret++)) + + cid=$(crictl create $sid ${data_path}/container-config-default-namespace.json ${data_path}/sandbox-config.json) +@@ -73,14 +74,6 @@ function test_cri_default_namespace_in_pod_fun() + [[ x"$sandboxns" == x"$conatainerns" ]] && msg_err "${FUNCNAME[0]}:${LINENO} - $element namespace should be not shared in pod" && ((ret++)) + done + +- msg_info "${test} finished with return ${ret}..." +- return ${ret} +-} +- +-function tear_down() +-{ +- local ret=0 +- + crictl stop $cid + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to stop container" && ((ret++)) + +@@ -93,19 +86,26 @@ function tear_down() + crictl rmp $sid + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm sandbox" && ((ret++)) + ++ msg_info "${test} finished with return ${ret}..." ++ return ${ret} ++} ++ ++function tear_down() ++{ + cp -f /etc/isulad/daemon.bak /etc/isulad/daemon.json + check_valgrind_log + start_isulad_with_valgrind +- +- return ${ret} + } + + declare -i ans=0 + + set_up || ((ans++)) + +-test_cri_default_namespace_in_pod_fun || ((ans++)) ++for element in ${RUNTIME_LIST[@]}; ++do ++ test_cri_default_namespace_in_pod_fun $element || ((ans++)) ++done + +-tear_down || ((ans++)) ++tear_down + + show_result ${ans} "${curr_path}/${0}" +diff --git a/CI/test_cases/container_cases/cri_pod_ip.sh b/CI/test_cases/container_cases/cri_pod_ip.sh +index 4048ed74..7bf7833b 100755 +--- a/CI/test_cases/container_cases/cri_pod_ip.sh ++++ b/CI/test_cases/container_cases/cri_pod_ip.sh +@@ -7,7 +7,6 @@ + curr_path=$(dirname $(readlink -f "$0")) + data_path=$(realpath $curr_path/criconfigs) + pause_img_path=$(realpath $curr_path/test_data) +-work_path="/var/lib/isulad/engines/lcr" + pod_config="sandbox-config.json" + source ../helpers.sh + +@@ -41,7 +40,7 @@ function do_post() + + function do_test() + { +- msg_info "this is $0 do_test" ++ msg_info "this is $0 do_test -> ($1)" + + crictl pull busybox + if [ $? -ne 0 ]; then +@@ -55,7 +54,7 @@ function do_test() + TC_RET_T=$(($TC_RET_T+1)) + fi + +- pod_id=`crictl runp ${data_path}/$pod_config` ++ pod_id=`crictl runp --runtime $1 ${data_path}/$pod_config` + if [ $? -ne 0 ]; then + msg_err "Failed to run sandbox" + TC_RET_T=$(($TC_RET_T+1)) +@@ -83,7 +82,7 @@ function do_test() + TC_RET_T=$(($TC_RET_T+1)) + fi + +- cat ${work_path}/${pod_id}/network_settings.json | grep "$ip" ++ cat ${RUNTIME_ROOT_PATH}/${1}/${pod_id}/network_settings.json | grep "$ip" + if [ $? -ne 0 ];then + msg_err "expect ip: $ip, network_settings.json cannot get it" + TC_RET_T=$(($TC_RET_T+1)) +@@ -112,10 +111,13 @@ if [ $? -ne 0 ];then + let "ret=$ret + 1" + fi + +-do_test +-if [ $? -ne 0 ];then +- let "ret=$ret + 1" +-fi ++for element in ${RUNTIME_LIST[@]}; ++do ++ do_test $element ++ if [ $? -ne 0 ];then ++ let "ret=$ret + 1" ++ fi ++done + + do_post + +diff --git a/CI/test_cases/container_cases/cri_stream.sh b/CI/test_cases/container_cases/cri_stream.sh +index 6c89ab38..6124c783 100755 +--- a/CI/test_cases/container_cases/cri_stream.sh ++++ b/CI/test_cases/container_cases/cri_stream.sh +@@ -8,8 +8,9 @@ curr_path=$(dirname $(readlink -f "$0")) + data_path=$(realpath $curr_path/criconfigs) + pause_img_path=$(realpath $curr_path/test_data) + source ../helpers.sh ++export CONTAINER_RUNTIME_ENDPOINT=unix:///var/run/isulad.sock + +-function set_up() ++function do_pre() + { + local ret=0 + local image="busybox" +@@ -21,7 +22,8 @@ function set_up() + cp /etc/isulad/daemon.json /etc/isulad/daemon.bak + sed -i "s#\"pod-sandbox-image\": \"\"#\"pod-sandbox-image\": \"mirrorgooglecontainers/pause-amd64:3.0\"#g" /etc/isulad/daemon.json + +- check_valgrind_log ++ # check_valgrind_log ++ stop_isulad_without_valgrind + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to stop isulad" && return ${FAILURE} + + start_isulad_without_valgrind +@@ -36,7 +38,13 @@ function set_up() + crictl images | grep ${podimage} + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${podimage}" && ((ret++)) + +- sid=$(crictl runp ${data_path}/sandbox-config.json) ++ return ${ret} ++} ++ ++function set_up() ++{ ++ local ret=0 ++ sid=$(crictl runp --runtime $1 ${data_path}/sandbox-config.json) + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run sandbox" && ((ret++)) + + cid=$(crictl create $sid ${data_path}/container-config.json ${data_path}/sandbox-config.json) +@@ -135,22 +143,50 @@ function tear_down() + crictl rmp $sid + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm sandbox" && ((ret++)) + ++ return ${ret} ++} ++ ++function do_post() ++{ + cp -f /etc/isulad/daemon.bak /etc/isulad/daemon.json ++ # check_valgrind_log ++ + stop_isulad_without_valgrind +- start_isulad_with_valgrind ++ start_isulad_without_valgrind ++} + +- return ${ret} ++function do_test_t() ++{ ++ local ret=0 ++ local runtime=$1 ++ local test="cri_stream_test => (${runtime})" ++ msg_info "${test} starting..." ++ ++ set_up $runtime || ((ret++)) ++ ++ test_cri_exec_fun || ((ret++)) ++ test_cri_exec_abn || ((ret++)) ++ ++ # runc attach not support ++ if [ $runtime == "lcr" ]; then ++ test_cri_attach || ((ret++)) ++ fi ++ tear_down || ((ret++)) ++ ++ msg_info "${test} finished with return ${ret}..." ++ ++ return $ret + } + + declare -i ans=0 + +-set_up || ((ans++)) +- +-test_cri_exec_fun || ((ans++)) +-test_cri_exec_abn || ((ans++)) ++do_pre || ((ans++)) + +-test_cri_attach || ((ans++)) ++for element in ${RUNTIME_LIST[@]}; ++do ++ do_test_t $element || ((ans++)) ++done + +-tear_down || ((ans++)) ++do_post + + show_result ${ans} "${curr_path}/${0}" +diff --git a/CI/test_cases/container_cases/kill.sh b/CI/test_cases/container_cases/kill.sh +index b31714a7..7b50b094 100755 +--- a/CI/test_cases/container_cases/kill.sh ++++ b/CI/test_cases/container_cases/kill.sh +@@ -25,8 +25,12 @@ source ../helpers.sh + + function do_test_t() + { ++ local runtime=$1 ++ local test="kill_test => (${runtime})" ++ msg_info "${test} starting..." ++ + containername=test_kill +- isula create -t --name $containername busybox ++ isula create -t --name $containername --runtime $runtime busybox + fn_check_eq "$?" "0" "create failed" + testcontainer $containername inited + +@@ -42,14 +46,19 @@ function do_test_t() + isula rm $containername + fn_check_eq "$?" "0" "rm failed" + ++ msg_info "${test} finished with return ${TC_RET_T}..." ++ + return $TC_RET_T + } + + ret=0 + +-do_test_t +-if [ $? -ne 0 ];then +- let "ret=$ret + 1" +-fi ++for element in ${RUNTIME_LIST[@]}; ++do ++ do_test_t $element ++ if [ $? -ne 0 ];then ++ let "ret=$ret + 1" ++ fi ++done + + show_result $ret "basic kill" +diff --git a/CI/test_cases/container_cases/log_test.sh b/CI/test_cases/container_cases/log_test.sh +index 119a005a..d13dd702 100755 +--- a/CI/test_cases/container_cases/log_test.sh ++++ b/CI/test_cases/container_cases/log_test.sh +@@ -24,10 +24,10 @@ function do_post() + + function do_check_item() + { +- cat ${ISULAD_ROOT_PATH}/engines/lcr/$1/config | grep console | grep "$2" ++ cat ${RUNTIME_ROOT_PATH}/$1/$2/config.json | grep console | grep "$3" + if [ $? -ne 0 ]; then +- cat ${ISULAD_ROOT_PATH}/engines/lcr/$1/config | grep console +- msg_err "expect $2" ++ cat ${RUNTIME_ROOT_PATH}/$1/$2/config.json | grep console ++ msg_err "expect $3" + TC_RET_T=$(($TC_RET_T+1)) + fi + } +@@ -42,16 +42,16 @@ function do_test_syslog_helper() + TC_RET_T=$(($TC_RET_T+1)) + fi + +- cid=`isula run -tid busybox sh` ++ cid=`isula run -tid --runtime $2 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi + +- do_check_item ${cid} "logdriver = syslog" ++ do_check_item $2 ${cid} "driver\": \"syslog" + + if [ "x$1" != "x" ]; then +- do_check_item ${cid} "syslog_tag = $1" ++ do_check_item $2 ${cid} "tag\": \"$1" + fi + + isula rm -f ${cid} +@@ -74,91 +74,91 @@ function do_test_syslog_tag() + TC_RET_T=$(($TC_RET_T+1)) + fi + +- isula run -ti --log-opt="syslog-tag={{.xxx}}" busybox date ++ isula run -ti --log-opt="syslog-tag={{.xxx}}" --runtime $1 busybox date + if [ $? -eq 0 ]; then + msg_err "run container success with invalid syslog-tag" + TC_RET_T=$(($TC_RET_T+1)) + fi + +- isula run -ti --log-opt="syslog-tag={{" busybox date ++ isula run -ti --log-opt="syslog-tag={{" --runtime $1 busybox date + if [ $? -eq 0 ]; then + msg_err "run container success with invalid syslog-tag" + TC_RET_T=$(($TC_RET_T+1)) + fi + +- isula run -ti --log-opt="syslog-tag=aab{{cd" busybox date ++ isula run -ti --log-opt="syslog-tag=aab{{cd" --runtime $1 busybox date + if [ $? -eq 0 ]; then + msg_err "run container success with invalid syslog-tag" + TC_RET_T=$(($TC_RET_T+1)) + fi + +- cid=$(isula run -tid --log-opt="syslog-tag={{.DaemonName}}" busybox sh) ++ cid=$(isula run -tid --log-opt="syslog-tag={{.DaemonName}}" --runtime $1 busybox sh) + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi +- do_check_item ${cid} "logdriver = syslog" +- do_check_item ${cid} "syslog_tag = iSulad" ++ do_check_item $1 ${cid} "driver\": \"syslog" ++ do_check_item $1 ${cid} "tag\": \"iSulad" + +- cid=`isula run -tid --log-opt="syslog-tag={{.ID}}" busybox sh` ++ cid=`isula run -tid --log-opt="syslog-tag={{.ID}}" --runtime $1 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi +- do_check_item ${cid} "logdriver = syslog" +- do_check_item ${cid} "syslog_tag = ${cid: 0: 12}" ++ do_check_item $1 ${cid} "driver\": \"syslog" ++ do_check_item $1 ${cid} "tag\": \"${cid: 0: 12}" + +- cid=`isula run -tid --name=haozi --log-opt="syslog-tag={{.ID}}xx{{.Name}}" busybox sh` ++ cid=`isula run -tid --name=haozi --log-opt="syslog-tag={{.ID}}xx{{.Name}}" --runtime $1 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi +- do_check_item ${cid} "logdriver = syslog" +- do_check_item ${cid} "syslog_tag = ${cid: 0: 12}xxhaozi" ++ do_check_item $1 ${cid} "driver\": \"syslog" ++ do_check_item $1 ${cid} "tag\": \"${cid: 0: 12}xxhaozi" + isula rm -f haozi + +- cid=`isula run -tid --log-opt="syslog-tag={{.FullID}}" busybox sh` ++ cid=`isula run -tid --log-opt="syslog-tag={{.FullID}}" --runtime $1 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi +- do_check_item ${cid} "logdriver = syslog" +- do_check_item ${cid} "syslog_tag = ${cid}" ++ do_check_item $1 ${cid} "driver\": \"syslog" ++ do_check_item $1 ${cid} "tag\": \"${cid}" + +- cid=`isula run -tid --name haozi --log-opt="syslog-tag={{.Name}}" busybox sh` ++ cid=`isula run -tid --name haozi --log-opt="syslog-tag={{.Name}}" --runtime $1 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi +- do_check_item ${cid} "logdriver = syslog" +- do_check_item ${cid} "syslog_tag = haozi" ++ do_check_item $1 ${cid} "driver\": \"syslog" ++ do_check_item $1 ${cid} "tag\": \"haozi" + isula rm -f haozi + +- cid=`isula run -tid --name haozi --log-opt="syslog-tag=xx{{.Name}}yy" busybox sh` ++ cid=`isula run -tid --name haozi --log-opt="syslog-tag=xx{{.Name}}yy" --runtime $1 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi +- do_check_item ${cid} "logdriver = syslog" +- do_check_item ${cid} "syslog_tag = xxhaoziyy" ++ do_check_item $1 ${cid} "driver\": \"syslog" ++ do_check_item $1 ${cid} "tag\": \"xxhaoziyy" + isula rm -f haozi + +- cid=`isula run -tid --log-opt="syslog-tag={{.ImageName}}" busybox sh` ++ cid=`isula run -tid --log-opt="syslog-tag={{.ImageName}}" --runtime $1 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi +- do_check_item ${cid} "logdriver = syslog" +- do_check_item ${cid} "syslog_tag = busybox" ++ do_check_item $1 ${cid} "driver\": \"syslog" ++ do_check_item $1 ${cid} "tag\": \"busybox" + +- cid=`isula run -tid --log-opt="syslog-tag={{.ImageID}}" busybox sh` ++ cid=`isula run -tid --log-opt="syslog-tag={{.ImageID}}" --runtime $1 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi + img_id=`isula inspect -f '{{.image.id}}' busybox` +- do_check_item ${cid} "logdriver = syslog" +- do_check_item ${cid} "syslog_tag = sha256:${img_id:0:5}" ++ do_check_item $1 ${cid} "driver\": \"syslog" ++ do_check_item $1 ${cid} "tag\": \"sha256:${img_id:0:5}" + + isula rm -f `isula ps -aq` + if [ $? -ne 0 ]; then +@@ -182,15 +182,15 @@ function do_test_json_file_helper() + file_size=$2 + fi + +- cid=`isula run -tid busybox sh` ++ cid=`isula run -tid --runtime $3 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi + +- do_check_item ${cid} "logdriver = json-file" +- do_check_item ${cid} "rotate = $file_cnt" +- do_check_item ${cid} "size = $file_size" ++ do_check_item $3 ${cid} "driver\": \"json-file" ++ do_check_item $3 ${cid} "rotate\": \"$file_cnt" ++ do_check_item $3 ${cid} "size\": \"$file_size" + + isula rm -f ${cid} + if [ $? -ne 0 ]; then +@@ -207,40 +207,40 @@ function do_test_container_log() + cat /etc/isulad/daemon.json + ps aux | grep -i isulad + +- cid=`isula run -tid --log-driver=json-file busybox sh` ++ cid=`isula run -tid --log-driver=json-file --runtime $1 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi +- do_check_item ${cid} "logdriver = json-file" +- do_check_item ${cid} "rotate = 7" +- do_check_item ${cid} "size = 1MB" ++ do_check_item $1 ${cid} "driver\": \"json-file" ++ do_check_item $1 ${cid} "rotate\": \"7" ++ do_check_item $1 ${cid} "size\": \"1MB" + +- cid=`isula run -tid --log-driver=json-file --log-opt="max-file=8" busybox sh` ++ cid=`isula run -tid --log-driver=json-file --log-opt="max-file=8" --runtime $1 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi +- do_check_item ${cid} "logdriver = json-file" +- do_check_item ${cid} "rotate = 8" +- do_check_item ${cid} "size = 1MB" ++ do_check_item $1 ${cid} "driver\": \"json-file" ++ do_check_item $1 ${cid} "rotate\": \"8" ++ do_check_item $1 ${cid} "size\": \"1MB" + +- cid=`isula run -tid --log-driver=json-file --log-opt="max-size=128KB" busybox sh` ++ cid=`isula run -tid --log-driver=json-file --log-opt="max-size=128KB" --runtime $1 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi +- do_check_item ${cid} "logdriver = json-file" +- do_check_item ${cid} "rotate = 7" +- do_check_item ${cid} "size = 128KB" ++ do_check_item $1 ${cid} "driver\": \"json-file" ++ do_check_item $1 ${cid} "rotate\": \"7" ++ do_check_item $1 ${cid} "size\": \"128KB" + +- cid=`isula run -tid --log-driver=json-file --log-opt="disable-log=true" busybox sh` ++ cid=`isula run -tid --log-driver=json-file --log-opt="disable-log=true" --runtime $1 busybox sh` + if [ $? -ne 0 ]; then + msg_err "Failed to run container" + TC_RET_T=$(($TC_RET_T+1)) + fi +- cat ${ISULAD_ROOT_PATH}/engines/lcr/${cid}/config | grep console | grep "logfile =" +- if [ $? -eq 0 ]; then ++ cat ${RUNTIME_ROOT_PATH}/$1/$cid/config.json | grep console | grep "\"log.console.file\": \"none\"" ++ if [ $? -ne 0 ]; then + msg_err "Failed to disable log" + TC_RET_T=$(($TC_RET_T+1)) + fi +@@ -250,32 +250,48 @@ function do_test_container_log() + } + + function do_test_container_syslog() { +- do_test_syslog_helper "xxxx" ++ do_test_syslog_helper "xxxx" $1 + +- do_test_syslog_tag ++ do_test_syslog_tag $1 + } + + function do_test() { ++ local runtime=$1 ++ local test="log_test => (${runtime})" ++ msg_info "${test} starting..." ++ + check_valgrind_log + start_isulad_with_valgrind --container-log-opts="syslog-tag=xxxx" + +- do_test_container_syslog ++ do_test_container_syslog $runtime + + check_valgrind_log + start_isulad_with_valgrind --container-log-driver=json-file --container-log-opts="max-size=10MB" --container-log-opts="max-file=3" +- do_test_json_file_helper "3" "10MB" ++ ++ do_test_json_file_helper "3" "10MB" $runtime + + check_valgrind_log + start_isulad_with_valgrind +- do_test_container_log +-} + +-ret=0 ++ do_test_container_log $runtime ++ ++ msg_info "${test} finished with return ${TC_RET_T}..." ++ ++ return $TC_RET_T ++} + + do_pre + +-do_test ++ret=0 ++ ++for element in ${RUNTIME_LIST[@]}; ++do ++ do_test $element ++ if [ $? -ne 0 ];then ++ let "ret=$ret + 1" ++ fi ++done + + do_post + +-show_result $TC_RET_T "container log test" ++show_result $ret "container log test" +diff --git a/CI/test_cases/container_cases/pause.sh b/CI/test_cases/container_cases/pause.sh +index fe749cd1..5778642b 100755 +--- a/CI/test_cases/container_cases/pause.sh ++++ b/CI/test_cases/container_cases/pause.sh +@@ -25,10 +25,12 @@ source ../helpers.sh + + function do_test_t() + { +- echo "Do not support pause function now" +- return 0 ++ local runtime=$1 ++ local test="rm_test => (${runtime})" ++ msg_info "${test} starting..." ++ + containername=test_pause +- isula create -t --name $containername busybox ++ isula create -t --name $containername --runtime $runtime busybox + fn_check_eq "$?" "0" "create failed" + testcontainer $containername inited + +@@ -48,14 +50,19 @@ function do_test_t() + isula rm -f $containername + fn_check_eq "$?" "0" "rm failed" + ++ msg_info "${test} finished with return ${TC_RET_T}..." ++ + return $TC_RET_T + } + + ret=0 + +-do_test_t +-if [ $? -ne 0 ];then +- let "ret=$ret + 1" +-fi ++for element in ${RUNTIME_LIST[@]}; ++do ++ do_test_t $element ++ if [ $? -ne 0 ];then ++ let "ret=$ret + 1" ++ fi ++done + + show_result $ret "basic pause" +diff --git a/CI/test_cases/container_cases/resume.sh b/CI/test_cases/container_cases/resume.sh +index d0b6ba98..e7de41bb 100755 +--- a/CI/test_cases/container_cases/resume.sh ++++ b/CI/test_cases/container_cases/resume.sh +@@ -25,14 +25,16 @@ source ../helpers.sh + + function do_test_t() + { +- echo "Do not support resume function now" +- return 0 ++ local runtime=$1 ++ local test="kill_test => (${runtime})" ++ msg_info "${test} starting..." ++ + containername=test_resume +- isula create -t --name $containername busybox ++ isula create -t --name $containername --runtime $runtime busybox + fn_check_eq "$?" "0" "create failed" + testcontainer $containername inited + +- isula resume $containername ++ isula unpause $containername + fn_check_ne "$?" "0" "resume should fail" + testcontainer $containername inited + +@@ -45,21 +47,26 @@ function do_test_t() + + testcontainer $containername paused + +- isula resume $containername ++ isula unpause $containername + fn_check_eq "$?" "0" "resume failed" + testcontainer $containername running + + isula rm -f $containername + fn_check_eq "$?" "0" "rm failed" + ++ msg_info "${test} finished with return ${TC_RET_T}..." ++ + return $TC_RET_T + } + + ret=0 + +-do_test_t +-if [ $? -ne 0 ];then +- let "ret=$ret + 1" +-fi ++for element in ${RUNTIME_LIST[@]}; ++do ++ do_test_t $element ++ if [ $? -ne 0 ];then ++ let "ret=$ret + 1" ++ fi ++done + + show_result $ret "basic resume" +diff --git a/CI/test_cases/container_cases/rm.sh b/CI/test_cases/container_cases/rm.sh +index 2903edab..3deae453 100755 +--- a/CI/test_cases/container_cases/rm.sh ++++ b/CI/test_cases/container_cases/rm.sh +@@ -26,7 +26,7 @@ source ../helpers.sh + function rm_stopped_container() + { + containername=test_rm_stopped +- isula create -t --name $containername busybox ++ isula create -t --name $containername --runtime $1 busybox + fn_check_eq "$?" "0" "create failed" + testcontainer $containername inited + +@@ -40,7 +40,7 @@ function rm_stopped_container() + function rm_running_container() + { + containername=test_rm_running +- isula run -td --name $containername busybox ++ isula run -td --name $containername --runtime $1 busybox + fn_check_eq "$?" "0" "run failed" + testcontainer $containername running + +@@ -61,7 +61,7 @@ function rm_running_container() + function rm_running_container_force() + { + containername=test_rm_running_force +- conID=$(isula run -td --name $containername busybox) ++ conID=$(isula run -td --name $containername --runtime $1 busybox) + fn_check_eq "$?" "0" "run failed" + testcontainer $containername running + +@@ -83,18 +83,27 @@ function rm_running_container_force() + + function do_test_t() + { +- rm_stopped_container +- rm_running_container +- rm_running_container_force ++ local runtime=$1 ++ local test="rm_test => (${runtime})" ++ msg_info "${test} starting..." ++ ++ rm_stopped_container $runtime ++ rm_running_container $runtime ++ rm_running_container_force $runtime ++ ++ msg_info "${test} finished with return ${TC_RET_T}..." + + return $TC_RET_T + } + + ret=0 + +-do_test_t +-if [ $? -ne 0 ];then +- let "ret=$ret + 1" +-fi ++for element in ${RUNTIME_LIST[@]}; ++do ++ do_test_t $element ++ if [ $? -ne 0 ];then ++ let "ret=$ret + 1" ++ fi ++done + + show_result $ret "basic rm" +diff --git a/CI/test_cases/container_cases/start.sh b/CI/test_cases/container_cases/start.sh +index c3dc9c27..c2d0d02f 100755 +--- a/CI/test_cases/container_cases/start.sh ++++ b/CI/test_cases/container_cases/start.sh +@@ -26,7 +26,7 @@ source ../helpers.sh + function do_test_t() + { + containername=test_start +- isula create -t --name $containername busybox ++ isula create -t --name $containername --runtime $1 busybox + fn_check_eq "$?" "0" "create failed" + testcontainer $containername inited + +@@ -51,7 +51,7 @@ function do_attach_local_test_t() + local test="container start with --attach local test => (${FUNCNAME[@]})" + + containername=start_attach +- isula create -ti --name $containername busybox /bin/sh -c 'echo "hello"' ++ isula create -ti --name $containername --runtime $1 busybox /bin/sh -c 'echo "hello"' + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to create ${containername}" && ((ret++)) + testcontainer $containername inited + +@@ -62,7 +62,7 @@ function do_attach_local_test_t() + isula rm -f $containername + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm container" && ((ret++)) + +- id=`isula create -ti busybox /bin/sh -c 'ech "hello"'` ++ id=`isula create -ti --runtime $1 busybox /bin/sh -c 'ech "hello"'` + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to create container" && ((ret++)) + + isula start -a $id +@@ -88,19 +88,19 @@ function do_attach_remote_test_t() + start_isulad_with_valgrind -H "$config" + + containername=start_attach +- isula create -ti -H "$config" --name $containername busybox /bin/sh -c 'echo "hello"' ++ isula create -ti -H "$config" --name $containername --runtime $1 busybox /bin/sh -c 'echo "hello"' + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to create ${containername} remote" && ((ret++)) +- testcontainer $containername inited ++ testcontainer $containername inited "-H $config" + + result=`isula start -a -H "$config" $containername` + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to start -a ${containername} remote" && ((ret++)) +- testcontainer $containername exited ++ testcontainer $containername exited "-H $config" + + isula rm -f -H "$config" $containername + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm container remote" && ((ret++)) + + containername=start_exit +- isula run -it -H "$config" --name $containername busybox /bin/sh -c 'exit 5' ++ isula run -it -H "$config" --name $containername --runtime $1 busybox /bin/sh -c 'exit 5' + [[ $? -ne 5 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - invalid exit code with remote start" && ((ret++)) + + isula start -a -H "$config" $containername +@@ -119,12 +119,29 @@ function do_attach_remote_test_t() + return ${ret} + } + +-declare -i ans=0 ++function test_start() ++{ ++ local ret=0 ++ local runtime=$1 ++ local test="start_test => (${runtime})" ++ msg_info "${test} starting..." ++ ++ do_test_t $runtime || ((ret++)) + +-do_test_t || ((ans++)) ++ do_attach_local_test_t $runtime || ((ret++)) + +-do_attach_local_test_t || ((ans++)) ++ do_attach_remote_test_t $runtime || ((ret++)) ++ ++ msg_info "${test} finished with return ${ret}..." ++ ++ return $ret ++} ++ ++declare -i ans=0 + +-do_attach_remote_test_t || ((ans++)) ++for element in ${RUNTIME_LIST[@]}; ++do ++ test_start $element || ((ans++)) ++done + + show_result ${ans} "${curr_path}/${0}" +diff --git a/CI/test_cases/container_cases/stats.sh b/CI/test_cases/container_cases/stats.sh +index 705f7a7c..df241b90 100755 +--- a/CI/test_cases/container_cases/stats.sh ++++ b/CI/test_cases/container_cases/stats.sh +@@ -26,7 +26,8 @@ function test_stats_spec() + { + local ret=0 + local image="busybox" +- local test="container stats test => (${FUNCNAME[@]})" ++ local runtime=$1 ++ local test="container stats test with (${runtime}) => (${FUNCNAME[@]})" + statslog=/tmp/stats.log + + msg_info "${test} starting..." +@@ -44,11 +45,11 @@ function test_stats_spec() + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++)) + + container_name_init=stats_inited +- id_init=`isula create -t -n $container_name_init $image /bin/sh` ++ id_init=`isula create -t -n $container_name_init --runtime $runtime $image /bin/sh` + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++)) + + container_name_running=stats_running +- id_running=`isula run -td -n $container_name_running $image /bin/sh` ++ id_running=`isula run -td -n $container_name_running --runtime $runtime $image /bin/sh` + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++)) + + isula stats --no-stream > $statslog +@@ -73,14 +74,14 @@ function test_stats_spec() + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++)) + + container_name_pause=stats_paused +- id_pause=`isula run -td -n $container_name_pause $image /bin/sh` ++ id_pause=`isula run -td -n $container_name_pause --runtime $runtime $image /bin/sh` + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++)) + + isula pause $id_pause + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to pause running container" && ((ret++)) + + container_name_stop=stats_stopped +- id_stop=`isula run -td -n $container_name_stop $image /bin/sh` ++ id_stop=`isula run -td -n $container_name_stop --runtime $runtime $image /bin/sh` + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++)) + + isula stop -t 0 $id_stop +@@ -129,6 +130,9 @@ function test_stats_spec() + + declare -i ans=0 + +-test_stats_spec || ((ans++)) ++for element in ${RUNTIME_LIST[@]}; ++do ++ test_stats_spec $element || ((ans++)) ++done + + show_result ${ans} "${curr_path}/${0}" +diff --git a/CI/test_cases/container_cases/ulimit.sh b/CI/test_cases/container_cases/ulimit.sh +index c134a71a..29868041 100755 +--- a/CI/test_cases/container_cases/ulimit.sh ++++ b/CI/test_cases/container_cases/ulimit.sh +@@ -26,10 +26,11 @@ source ../helpers.sh + function test_ulimit() + { + local ret=0 ++ local runtime=$1 + local image="busybox" + ulimitlog=/tmp/ulimit.log + +- local test="ulimit test => (${FUNCNAME[@]})" ++ local test="ulimit test with (${runtime})=> (${FUNCNAME[@]})" + msg_info "${test} starting..." + + check_valgrind_log +@@ -38,37 +39,37 @@ function test_ulimit() + start_isulad_with_valgrind --default-ulimit nproc=2048:4096 --default-ulimit nproc=2048:8192 --default-ulimit nofile=1024:4096 + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - start isulad failed" && ((ret++)) + +- isula run --ulimit nproc= $image /bin/sh > $ulimitlog 2>&1 ++ isula run --ulimit nproc= $image --runtime $runtime /bin/sh > $ulimitlog 2>&1 + cat $ulimitlog | grep "delimiter '=' can't be the first or the last character" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - check failed" && ((ret++)) + +- isula run --ulimit nproc=1024: $image /bin/sh > $ulimitlog 2>&1 ++ isula run --ulimit nproc=1024: --runtime $runtime $image /bin/sh > $ulimitlog 2>&1 + cat $ulimitlog | grep "delimiter ':' can't be the first or the last character" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - check failed" && ((ret++)) + +- isula run --ulimit npro=1024:2048 $image /bin/sh > $ulimitlog 2>&1 ++ isula run --ulimit npro=1024:2048 --runtime $runtime $image /bin/sh > $ulimitlog 2>&1 + cat $ulimitlog | grep "Invalid ulimit type" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - check failed" && ((ret++)) + +- isula run --ulimit nproc=4096:2048 $image /bin/sh > $ulimitlog 2>&1 ++ isula run --ulimit nproc=4096:2048 --runtime $runtime $image /bin/sh > $ulimitlog 2>&1 + cat $ulimitlog | grep "Ulimit soft limit must be less than or equal to hard limit" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - check failed" && ((ret++)) + +- isula run --ulimit nproc=2048:4096.5 $image /bin/sh > $ulimitlog 2>&1 ++ isula run --ulimit nproc=2048:4096.5 --runtime $runtime $image /bin/sh > $ulimitlog 2>&1 + cat $ulimitlog | grep "Invalid ulimit hard value" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - check failed" && ((ret++)) + +- isula run --ulimit nproc==2048:4096 $image /bin/sh > $ulimitlog 2>&1 ++ isula run --ulimit nproc==2048:4096 --runtime $runtime $image /bin/sh > $ulimitlog 2>&1 + cat $ulimitlog | grep "Invalid ulimit argument" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - check failed" && ((ret++)) + +- isula run --ulimit nproc=2048::4096 $image /bin/sh > $ulimitlog 2>&1 ++ isula run --ulimit nproc=2048::4096 --runtime $runtime $image /bin/sh > $ulimitlog 2>&1 + cat $ulimitlog | grep "Too many limit value arguments" + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - check failed" && ((ret++)) + + container_name="ulimit_test" + +- isula run -td -n $container_name --ulimit nofile=20480:40960 --ulimit core=1024:2048 $image /bin/sh ++ isula run -td -n $container_name --ulimit nofile=20480:40960 --ulimit core=1024:2048 --runtime $runtime $image /bin/sh + [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - check failed" && ((ret++)) + + isula exec $container_name /bin/sh -c "cat /proc/self/limits" | grep "Max open files" |awk '{ print $(NF-1) }' |grep 40960 +@@ -106,6 +107,9 @@ function test_ulimit() + + declare -i ans=0 + +-test_ulimit || ((ans++)) ++for element in ${RUNTIME_LIST[@]}; ++do ++ test_ulimit $element || ((ans++)) ++done + + show_result ${ans} "${curr_path}/${0}" +diff --git a/CI/test_cases/container_cases/update.sh b/CI/test_cases/container_cases/update.sh +index 1e1e9cdc..d379acc2 100755 +--- a/CI/test_cases/container_cases/update.sh ++++ b/CI/test_cases/container_cases/update.sh +@@ -26,7 +26,7 @@ source ../helpers.sh + function do_test_t() + { + containername=test_update +- containerid=`isula create -t --name $containername busybox` ++ containerid=`isula create -t --runtime $1 --name $containername busybox` + fn_check_eq "$?" "0" "create failed" + testcontainer $containername inited + +@@ -101,7 +101,24 @@ function do_test_t() + + main=$(uname -r | awk -F . '{print $1}') + minor=$(uname -r | awk -F . '{print $2}') +- if [[ ${main} -lt 5 ]] || [[ ${main} -eq 5 ]] && [[ ${minor} -lt 11 ]]; then ++ enable=1 ++ if [ $1 == "runc" ]; then ++ version=$(runc --version | grep runc) ++ # Runc does not support '--kernel-memory' options from v1.0.0-rc94 version ++ limit=(1 0 0 93) ++ array=`echo $version |egrep -o "[0-9]*"` ++ index=0 ++ for i in $(echo $array| awk '{print $1,$2}') ++ do ++ echo $i ++ if [[ $i -gt ${limit[index]} ]]; then ++ enable=0 ++ break ++ fi ++ let "index+=1" ++ done ++ fi ++ if [[ ${main} -lt 5 ]] || [[ ${main} -eq 5 ]] && [[ ${minor} -lt 11 ]] && [[ ${enable} -eq 1 ]]; then + isula update --kernel-memory 2000000000 $containername + fn_check_eq "$?" "0" "update failed" + +@@ -124,7 +141,7 @@ function do_test_t() + function do_test_t1() + { + containername=test_update1 +- containerid=`isula run -itd --memory 500M --name $containername busybox` ++ containerid=`isula run -itd --runtime $1 --memory 500M --name $containername busybox` + fn_check_eq "$?" "0" "run failed" + + isula inspect $containerid | grep "MemorySwap" | grep "1048576000" +@@ -146,16 +163,23 @@ function do_test_t1() + + ret=0 + +-do_test_t +-if [ $? -ne 0 ];then +- let "ret=$ret + 1" +-fi ++for element in ${RUNTIME_LIST[@]}; ++do ++ test="update test => (${element})" ++ msg_info "${test} starting..." + +-if [ -f "/sys/fs/cgroup/memory/memory.memsw.usage_in_bytes" ];then +- do_test_t1 ++ do_test_t $element + if [ $? -ne 0 ];then +- let "ret=$ret + 1" ++ let "ret=$ret + 1" ++ fi ++ ++ if [ -f "/sys/fs/cgroup/memory/memory.memsw.usage_in_bytes" ];then ++ do_test_t1 $element ++ if [ $? -ne 0 ];then ++ let "ret=$ret + 1" ++ fi + fi +-fi ++ msg_info "${test} finished with return ${ret}..." ++done + + show_result $ret "basic update" +diff --git a/CI/test_cases/helpers.sh b/CI/test_cases/helpers.sh +index 5ea4ff94..6b4eea24 100755 +--- a/CI/test_cases/helpers.sh ++++ b/CI/test_cases/helpers.sh +@@ -21,11 +21,14 @@ declare -a lines + + # Root directory of integration tests. + LCR_ROOT_PATH="/var/lib/isulad/engines/lcr" ++RUNTIME_ROOT_PATH="/var/lib/isulad/engines" + valgrind_log="/tmp/valgrind.log" + ISUALD_LOG="/var/lib/isulad/isulad.log" + ISULAD_ROOT_PATH="/var/lib/isulad" + ISULAD_RUN_ROOT_PATH="/var/run/isulad" + ++RUNTIME_LIST=(lcr runc) ++ + enable_native_network=0 + + declare -r -i FAILURE=1 +@@ -60,7 +63,7 @@ function fn_check_ne() { + } + + function testcontainer() { +- st=`isula inspect -f '{{json .State.Status}}' "$1"` ++ st=`isula inspect -f '{{json .State.Status}}' $3 "$1"` + if ! [[ "${st}" =~ "$2" ]];then + echo "expect status $2, but get ${st}" + TC_RET_T=$(($TC_RET_T+1)) +-- +2.25.1 + |