iSulad/0067-runc-add-ci-for-runc.patch
zhangxiaoyu 68738aa0f1 upgrade from upstream
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
2023-06-01 12:04:54 +08:00

1622 lines
70 KiB
Diff

From 8a7abeec4620bd5c11098439e239081faa4f045e Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Sat, 13 May 2023 10:26:47 +0800
Subject: [PATCH 67/79] =?UTF-8?q?=E3=80=90runc=E3=80=91add=20ci=20for=20ru?=
=?UTF-8?q?nc?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
CI/test_cases/container_cases/annotaion.sh | 31 +++-
.../container_cases/bind_special_dir.sh | 15 +-
.../check_fd_leakage_of_isulad.sh | 31 +++-
CI/test_cases/container_cases/cpu_rt.sh | 88 ++++++----
CI/test_cases/container_cases/create.sh | 41 +++--
.../container_cases/cri_default_namespace.sh | 28 +--
.../container_cases/cri_exec_sync.sh | 154 +++++++++++++++++
CI/test_cases/container_cases/cri_stream.sh | 51 +++++-
CI/test_cases/container_cases/exec_runc.sh | 23 ++-
CI/test_cases/container_cases/kill.sh | 19 ++-
CI/test_cases/container_cases/log_test.sh | 160 +++++++++++-------
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 | 51 ++++--
CI/test_cases/helpers.sh | 5 +-
17 files changed, 592 insertions(+), 213 deletions(-)
create mode 100755 CI/test_cases/container_cases/cri_exec_sync.sh
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..ee8cd0f5 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,12 @@ 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`
+ # when create container in container, runc not support to mount /dev
+ if [ $runtime == "runc" ]; then
+ c_id=`isula run -itd -v -itd --runtime=$runtime -v /sys/fs:/sys/fs:rw,rshared -v /proc:/proc -v /dev/pts:/dev/pts:rw busybox sh`
+ else
+ 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`
+ fi
[[ $? -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 +57,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/cpu_rt.sh b/CI/test_cases/container_cases/cpu_rt.sh
index 3dcf4791..3b17aa75 100644
--- 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_exec_sync.sh b/CI/test_cases/container_cases/cri_exec_sync.sh
new file mode 100755
index 00000000..97ea01ca
--- /dev/null
+++ b/CI/test_cases/container_cases/cri_exec_sync.sh
@@ -0,0 +1,154 @@
+#!/bin/bash
+#
+# attributes: cri exec sync test
+# concurrent: NA
+# spend time: 14
+
+#######################################################################
+##- Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
+# - iSulad licensed under the Mulan PSL v2.
+# - You can use this software according to the terms and conditions of the Mulan PSL v2.
+# - You may obtain a copy of Mulan PSL v2 at:
+# - http://license.coscl.org.cn/MulanPSL2
+# - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
+# - IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
+# - PURPOSE.
+# - See the Mulan PSL v2 for more details.
+##- @Description:CI
+##- @Author: zhongtao
+##- @Create: 2023-04-18
+#######################################################################
+
+curr_path=$(dirname $(readlink -f "$0"))
+data_path=$(realpath $curr_path/criconfigs)
+pause_img_path=$(realpath $curr_path/test_data)
+source ../helpers.sh
+
+function do_pre()
+{
+ local ret=0
+ local image="busybox"
+ local podimage="mirrorgooglecontainers/pause-amd64"
+ local test="set_up => (${FUNCNAME[@]})"
+
+ msg_info "${test} starting..."
+
+ 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
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to stop isulad" && return ${FAILURE}
+
+ start_isulad_with_valgrind
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to start isulad" && return ${FAILURE}
+
+ isula load -i ${pause_img_path}/pause.tar
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to load pause image" && return ${FAILURE}
+
+ crictl pull ${image}
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to pull image: ${image}" && return ${FAILURE}
+
+ crictl images | grep ${podimage}
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${podimage}" && ((ret++))
+
+ 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)
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to create container" && ((ret++))
+
+ crictl start $cid
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to start container" && ((ret++))
+
+ msg_info "${test} finished with return ${ret}..."
+ return ${ret}
+}
+
+function test_cri_exec_sync_fun()
+{
+ local ret=0
+ local test="test_cri_exec_sync_fun => (${FUNCNAME[@]})"
+ msg_info "${test} starting..."
+
+ crictl exec -s ${cid} xxx 2>&1
+ [[ $? -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to catch exec sync error msg" && ((ret++))
+
+ crictl exec -s ${cid} date
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to exec sync" && ((ret++))
+
+ crictl exec -s --timeout 2 ${cid} ls
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to exec sync with timeout" && ((ret++))
+
+ crictl exec -s --timeout 2 ${cid} sleep 898989 2>&1 | grep "timeout"
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to catch exec sync timeout error msg" && ((ret++))
+
+ crictl exec -s --timeout 2 ${cid} ps 2>&1 | grep "sleep 898989"
+ [[ $? -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - residual exec process" && ((ret++))
+
+ 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++))
+
+ crictl rm $cid
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm container" && ((ret++))
+
+ crictl stopp $sid
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to stop sandbox" && ((ret++))
+
+ 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
+ start_isulad_with_valgrind
+}
+
+function do_test_t()
+{
+ local ret=0
+ local runtime=$1
+ local test="cri_exec_sync_test => (${runtime})"
+ msg_info "${test} starting..."
+
+ set_up $runtime || ((ret++))
+
+ test_cri_exec_sync_fun || ((ret++))
+
+ tear_down || ((ret++))
+
+ msg_info "${test} finished with return ${ret}..."
+
+ return $ret
+}
+
+declare -i ans=0
+
+do_pre || ((ans++))
+
+for element in ${RUNTIME_LIST[@]};
+do
+ do_test_t $element || ((ans++))
+done
+
+do_post
+
+show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/cri_stream.sh b/CI/test_cases/container_cases/cri_stream.sh
index 6c89ab38..8b5440d3 100755
--- a/CI/test_cases/container_cases/cri_stream.sh
+++ b/CI/test_cases/container_cases/cri_stream.sh
@@ -9,7 +9,7 @@ data_path=$(realpath $curr_path/criconfigs)
pause_img_path=$(realpath $curr_path/test_data)
source ../helpers.sh
-function set_up()
+function do_pre()
{
local ret=0
local image="busybox"
@@ -36,7 +36,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 +141,49 @@ 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
+
stop_isulad_without_valgrind
start_isulad_with_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/exec_runc.sh b/CI/test_cases/container_cases/exec_runc.sh
index 74dc92e0..ab394735 100755
--- a/CI/test_cases/container_cases/exec_runc.sh
+++ b/CI/test_cases/container_cases/exec_runc.sh
@@ -26,7 +26,7 @@ test="exec_runc_test => (${FUNCNAME[@]})"
function exec_runc_test()
{
local ret=0
- local image="busybox"
+ local image="ubuntu"
local container_name="test_busybox"
isula pull ${image}
@@ -42,7 +42,7 @@ function exec_runc_test()
[[ "x$ID" == "x" ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to get container ID" && ((ret++))
isula exec -it $container_name date
- [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to exec" && ((ret++))
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to exec date" && ((ret++))
ls /var/run/isulad/runc/${ID}/exec/
ls /var/run/isulad/runc/${ID}/exec/ | wc -l | grep 0
@@ -55,6 +55,25 @@ function exec_runc_test()
ls /var/run/isulad/runc/${ID}/exec/ | wc -l | grep 0
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - residual dir after failed exec" && ((ret++))
+ isula exec -ti $container_name dd if=/dev/zero of=test2 bs=1GB count=2
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to exec dd" && ((ret++))
+
+ isula exec $container_name cat test2 &> test_exec
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to exec cat" && ((ret++))
+
+ ls -l -h test_exec
+ ls -l -h test_exec 2>&1 | grep "1.9G"
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - exec data loss" && ((ret++))
+
+ isula exec $container_name bash -c "sleep 999 & exit"
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to exec backgrounder" && ((ret++))
+
+ isula exec -ti $container_name bash -c "sleep 999 & exit"
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - resize failed" && ((ret++))
+
+ rm test_exec
+ [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm test_execs" && ((ret++))
+
isula rm -f ${container_name}
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - remove container ${container_name} failed" && ((ret++))
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..34bc3149 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,75 +207,113 @@ 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
+ mkdir shim_sh
+ cat >> ./shim_sh/msg.sh << EOF
+#!/bin/bash
+dd if=/dev/zero of=/home/file bs=2M count=100
+for i in {1..10}
+do
+ cat /home/file > /dev/stderr &
+ cat /home/file > /dev/stdout &
+ echo "cat done"
+ sleep 1
+done
+echo "done"
+EOF
+ cat $curr_path/shim_sh/msg.sh
+ cid=`isula run -id --runtime $1 -v $curr_path/shim_sh:/home/shim --log-driver=json-file --log-opt="max-file=3" busybox:latest /bin/sh -x /home/shim/msg.sh`
+
+ isula wait $cid
+
+ logcount=`ls ${RUNTIME_ROOT_PATH}/$1/$cid/console.log* | wc -l`
+ [[ $logcount -ne 3 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - max-file didn't effective" && ((ret++))
+
+ rm -rf shim_sh
isula rm -f `isula ps -aq`
return $TC_RET_T
}
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/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 f6ca95f9..39049b54 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
@@ -99,8 +99,28 @@ function do_test_t()
fn_check_eq "$?" "0" "stop failed"
testcontainer $containername exited
- isula update --kernel-memory 2000000000 $containername
- fn_check_eq "$?" "0" "update failed"
+ main=$(uname -r | awk -F . '{print $1}')
+ minor=$(uname -r | awk -F . '{print $2}')
+ 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"
isula start $containername
fn_check_eq "$?" "0" "start failed"
@@ -120,7 +140,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"
@@ -142,16 +162,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 a11e676c..f7bb7c93 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)
+
declare -r -i FAILURE=1
function is_overlay_driver() {
@@ -58,7 +61,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