iSulad/0031-modify-CI-for-default-runtime-to-runc.patch

816 lines
28 KiB
Diff
Raw Normal View History

From c0d86490ba53bf9a33f7569dc31c4ec1ba54f073 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Tue, 21 Nov 2023 21:32:08 +0800
Subject: [PATCH 31/64] modify CI for default runtime to runc
Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
CI/test_cases/container_cases/cni_test.sh | 103 ++++++++++--------
.../container_cases/exec_additional_gids.sh | 26 +++--
CI/test_cases/container_cases/export.sh | 10 +-
.../hook_ignore_poststart_error.sh | 10 +-
.../container_cases/hook_spec_test.sh | 12 +-
...igdata_stream.sh => lcr_bigdata_stream.sh} | 32 +-----
.../container_cases/{exec.sh => lcr_exec.sh} | 2 +-
CI/test_cases/container_cases/nano_cpus.sh | 8 +-
CI/test_cases/container_cases/restart.sh | 14 ++-
CI/test_cases/container_cases/run.sh | 49 +++++----
..._stream_runc.sh => runc_bigdata_stream.sh} | 0
.../{exec_runc.sh => runc_exec.sh} | 0
CI/test_cases/container_cases/seccomp.sh | 12 +-
CI/test_cases/container_cases/stop.sh | 19 +++-
CI/test_cases/critest.sh | 6 +-
15 files changed, 166 insertions(+), 137 deletions(-)
rename CI/test_cases/container_cases/{bigdata_stream.sh => lcr_bigdata_stream.sh} (93%)
rename CI/test_cases/container_cases/{exec.sh => lcr_exec.sh} (97%)
rename CI/test_cases/container_cases/{bigdata_stream_runc.sh => runc_bigdata_stream.sh} (100%)
rename CI/test_cases/container_cases/{exec_runc.sh => runc_exec.sh} (100%)
diff --git a/CI/test_cases/container_cases/cni_test.sh b/CI/test_cases/container_cases/cni_test.sh
index bbc381dd..114cf2a3 100755
--- a/CI/test_cases/container_cases/cni_test.sh
+++ b/CI/test_cases/container_cases/cni_test.sh
@@ -37,6 +37,10 @@ function do_post()
start_isulad_with_valgrind
}
+# $1: pod runtime;
+# $2: pod config;
+# $3: eth0 ip;
+# $4: eth1 ip;
function do_test_help()
{
msg_info "this is $0 do_test"
@@ -53,7 +57,7 @@ function do_test_help()
TC_RET_T=$(($TC_RET_T+1))
fi
- sid=`crictl runp ${data_path}/$1`
+ sid=`crictl runp --runtime $1 ${data_path}/$2`
if [ $? -ne 0 ]; then
msg_err "Failed to run sandbox"
TC_RET_T=$(($TC_RET_T+1))
@@ -61,7 +65,7 @@ function do_test_help()
cnt=`ls /var/lib/cni/results/* | wc -l`
target_cnt=1
- if [ "x$3" != "x" ];then
+ if [ "x$4" != "x" ];then
target_cnt=2
fi
@@ -77,7 +81,7 @@ function do_test_help()
TC_RET_T=$(($TC_RET_T+1))
fi
- cid=`crictl create $sid ${data_path}/container-config.json ${data_path}/$1`
+ cid=`crictl create $sid ${data_path}/container-config.json ${data_path}/$2`
if [ $? -ne 0 ];then
msg_err "create container failed"
TC_RET_T=$(($TC_RET_T+1))
@@ -107,29 +111,29 @@ function do_test_help()
nsenter -t $con_pid -n ifconfig eth0
TC_RET_T=$(($TC_RET_T+1))
fi
- nsenter -t $pod_pid -n ifconfig eth0 | grep "$2"
+ nsenter -t $pod_pid -n ifconfig eth0 | grep "$3"
if [ $? -ne 0 ];then
- msg_err "expect ip: $1, get: "
+ msg_err "expect ip: $3, get: "
nsenter -t $pod_pid -n ifconfig eth0
TC_RET_T=$(($TC_RET_T+1))
fi
- crictl inspectp $sid | grep "$2"
+ crictl inspectp $sid | grep "$3"
if [ $? -ne 0 ];then
- msg_err "inspectp: expect ip: $1, get: "
+ msg_err "inspectp: expect ip: $3, get: "
crictl inspectp $sid
TC_RET_T=$(($TC_RET_T+1))
fi
- if [ "x$3" != "x" ];then
- nsenter -t $pod_pid -n ifconfig eth1 | grep "$3"
+ if [ "x$4" != "x" ];then
+ nsenter -t $pod_pid -n ifconfig eth1 | grep "$4"
if [ $? -ne 0 ];then
- msg_err "expect ip: $2, get: "
+ msg_err "expect ip: $4, get: "
nsenter -t $pod_pid -n ifconfig eth1
TC_RET_T=$(($TC_RET_T+1))
fi
- crictl inspectp $sid | grep "$3"
+ crictl inspectp $sid | grep "$4"
if [ $? -ne 0 ];then
- msg_err "inspectp expect ip: $2, get: "
+ msg_err "inspectp expect ip: $4, get: "
crictl inspectp $sid
TC_RET_T=$(($TC_RET_T+1))
fi
@@ -170,7 +174,7 @@ function do_test_help()
function default_cni_config()
{
- do_test_help "sandbox-config.json" "10\.1\."
+ do_test_help $1 "sandbox-config.json" "10\.1\."
}
function new_cni_config()
@@ -189,12 +193,12 @@ function new_cni_config()
fi
done
tail $ISUALD_LOG
- do_test_help "mutlnet_pod.json" "10\.2\." "10\.1\."
+ do_test_help $1 "mutlnet_pod.json" "10\.2\." "10\.1\."
}
function check_annotation_extension()
{
- sid=`crictl runp ${data_path}/sandbox-config.json`
+ sid=`crictl runp --runtime $1 ${data_path}/sandbox-config.json`
if [ $? -ne 0 ]; then
msg_err "Failed to run sandbox"
TC_RET_T=$(($TC_RET_T+1))
@@ -253,7 +257,7 @@ function check_rollback()
done
tail $ISUALD_LOG
- crictl runp ${data_path}/mutl_wrong_net_pod.json
+ crictl runp --runtime $1 ${data_path}/mutl_wrong_net_pod.json
if [ $? -eq 0 ]; then
msg_err "Run sandbox success with invalid cni configs"
TC_RET_T=$(($TC_RET_T+1))
@@ -302,13 +306,14 @@ function check_rollback()
# $2: expect ingress rate;
# $3: input egress rate;
# $4: expect egress rate;
+# $5: pod runtime;
function check_annotation_valid_bandwidth()
{
rm bandwidth.json
cp ${data_path}/mock_sandbox.json bandwidth.json
sed -i "s#ingressholder#$1#g" bandwidth.json
sed -i "s#engressholder#$3#g" bandwidth.json
- sid=`crictl runp bandwidth.json`
+ sid=`crictl runp --runtime $5 bandwidth.json`
if [ $? -ne 0 ]; then
msg_err "Failed to run sandbox"
TC_RET_T=$(($TC_RET_T+1))
@@ -345,6 +350,7 @@ function check_annotation_valid_bandwidth()
return $TC_RET_T
}
+# function not called
function check_annotation_invalid_bandwidth()
{
rm bandwidth.json
@@ -386,44 +392,51 @@ function check_annotation()
done
tail $ISUALD_LOG
- check_annotation_extension
+ check_annotation_extension $1
- check_annotation_valid_bandwidth "10.24k" "10240" "-1.024k" "-1024"
- check_annotation_valid_bandwidth "1024m" "2" "-1024m" "-1"
- check_annotation_valid_bandwidth "1.000001Ki" "1025" "-1.00001Ki" "-1024"
- check_annotation_valid_bandwidth "0.1Mi" "104858" "-0.01Mi" "-10485"
- check_annotation_valid_bandwidth "1.00001e2" "101" "-1.0001e2" "-100"
+ check_annotation_valid_bandwidth "10.24k" "10240" "-1.024k" "-1024" $1
+ check_annotation_valid_bandwidth "1024m" "2" "-1024m" "-1" $1
+ check_annotation_valid_bandwidth "1.000001Ki" "1025" "-1.00001Ki" "-1024" $1
+ check_annotation_valid_bandwidth "0.1Mi" "104858" "-0.01Mi" "-10485" $1
+ check_annotation_valid_bandwidth "1.00001e2" "101" "-1.0001e2" "-100" $1
return $TC_RET_T
}
-ret=0
+function do_test_t()
+{
+ local ret=0
+ local runtime=$1
+ local test="cni_test => (${runtime})"
+ msg_info "${test} starting..."
+
+ default_cni_config $runtime || ((ret++))
+
+ new_cni_config $runtime || ((ret++))
+
+ check_annotation $runtime || ((ret++))
-do_pre
-if [ $? -ne 0 ];then
- let "ret=$ret + 1"
-fi
+ check_rollback $runtime || ((ret++))
-default_cni_config
-if [ $? -ne 0 ];then
- let "ret=$ret + 1"
-fi
+ msg_info "${test} finished with return ${ret}..."
-new_cni_config
-if [ $? -ne 0 ];then
- let "ret=$ret + 1"
-fi
+ return $ret
+}
-check_annotation
-if [ $? -ne 0 ];then
- let "ret=$ret + 1"
-fi
+ret=0
-check_rollback
-if [ $? -ne 0 ];then
- let "ret=$ret + 1"
-fi
+for element in ${RUNTIME_LIST[@]};
+do
+ do_pre
+ if [ $? -ne 0 ];then
+ let "ret=$ret + 1"
+ fi
-do_post
+ do_test_t $element
+ if [ $? -ne 0 ];then
+ let "ret=$ret + 1"
+ fi
+ do_post
+done
show_result $ret "cni base test"
diff --git a/CI/test_cases/container_cases/exec_additional_gids.sh b/CI/test_cases/container_cases/exec_additional_gids.sh
index f24678d3..2edfd750 100755
--- a/CI/test_cases/container_cases/exec_additional_gids.sh
+++ b/CI/test_cases/container_cases/exec_additional_gids.sh
@@ -22,7 +22,6 @@
curr_path=$(dirname $(readlink -f "$0"))
data_path=$(realpath $curr_path/../data)
source ../helpers.sh
-test="exec additional gids test => test_exec_additional_gids"
test_log=$(mktemp /tmp/additional_gids_test_XXX)
USERNAME="user"
@@ -37,10 +36,14 @@ file_info="Keep it secret, keep it safe"
function additional_gids_test()
{
local ret=0
+ local runtime=$1
+ test="exec additional gids test => test_exec_additional_gids => $runtime"
+
+ msg_info "${test} starting..."
isula rm -f `isula ps -a -q`
- isula run -tid -n $cont_name ubuntu bash
+ isula run -tid --runtime $runtime -n $cont_name ubuntu bash
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container" && ((ret++))
isula exec $cont_name bash -c "groupadd --gid $USER_GID $USERNAME \
@@ -52,10 +55,13 @@ function additional_gids_test()
&& chmod 606 /app/sekrit.txt"
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - create user and group failed" && ((ret++))
+ # runc is not support exec --workdir
/usr/bin/expect <<- EOF > ${test_log} 2>&1
set timeout 10
-spawn isula exec -it --workdir /app -u $USERNAME $cont_name bash
+spawn isula exec -it -u $USERNAME $cont_name bash
expect "${USERNAME}*"
+send "cd /app\n"
+expect "*"
send "newgrp ${ADDITIONAL_GROUP}\n"
expect "*"
send "groups\n"
@@ -75,18 +81,18 @@ EOF
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - read error message failed" && ((ret++))
isula rm -f `isula ps -a -q`
+ rm -rf ${test_log}
+
+ msg_info "${test} finished with return ${ret}..."
return ${ret}
}
declare -i ans=0
-msg_info "${test} starting..."
-
-additional_gids_test || ((ans++))
-
-rm -rf ${test_log}
-
-msg_info "${test} finished with return ${ret}..."
+for element in ${RUNTIME_LIST[@]};
+do
+ additional_gids_test $element || ((ans++))
+done
show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/export.sh b/CI/test_cases/container_cases/export.sh
index eeef2809..1cff873d 100755
--- a/CI/test_cases/container_cases/export.sh
+++ b/CI/test_cases/container_cases/export.sh
@@ -26,7 +26,8 @@ function test_image_export()
{
local ret=0
local image="busybox"
- local test="export container test => (${FUNCNAME[@]})"
+ local runtime=$1
+ local test="export container test => (${FUNCNAME[@]}) => $runtime"
msg_info "${test} starting..."
@@ -36,7 +37,7 @@ function test_image_export()
isula images | grep busybox
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++))
- CONT=`isula run -itd busybox`
+ CONT=`isula run --runtime $runtime -itd busybox`
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++))
isula export -o export.tar ${CONT}
@@ -55,6 +56,9 @@ function test_image_export()
declare -i ans=0
-test_image_export || ((ans++))
+for element in ${RUNTIME_LIST[@]};
+do
+ test_image_export $element || ((ans++))
+done
show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/hook_ignore_poststart_error.sh b/CI/test_cases/container_cases/hook_ignore_poststart_error.sh
index 5c86a4c1..8c636f7e 100755
--- a/CI/test_cases/container_cases/hook_ignore_poststart_error.sh
+++ b/CI/test_cases/container_cases/hook_ignore_poststart_error.sh
@@ -28,7 +28,8 @@ function test_hook_ignore_poststart_error_spec()
{
local ret=0
local image="busybox"
- local test="container hook test => (${FUNCNAME[@]})"
+ local runtime=$1
+ local test="container hook test => (${FUNCNAME[@]}) => $runtime"
CONT=test_hook_spec
cp ${test_data_path}/poststart.sh /tmp/
@@ -40,7 +41,7 @@ function test_hook_ignore_poststart_error_spec()
isula images | grep busybox
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++))
- isula run -n $CONT -itd --hook-spec ${test_data_path}/oci_hook_poststart_check.json ${image} &
+ isula run -n $CONT -itd --runtime $runtime --hook-spec ${test_data_path}/oci_hook_poststart_check.json ${image} &
for a in `seq 20`
do
@@ -74,6 +75,9 @@ function test_hook_ignore_poststart_error_spec()
declare -i ans=0
-test_hook_ignore_poststart_error_spec || ((ans++))
+for element in ${RUNTIME_LIST[@]};
+do
+ test_hook_ignore_poststart_error_spec $1 || ((ans++))
+done
show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/hook_spec_test.sh b/CI/test_cases/container_cases/hook_spec_test.sh
index c88ed340..33b7c2e5 100755
--- a/CI/test_cases/container_cases/hook_spec_test.sh
+++ b/CI/test_cases/container_cases/hook_spec_test.sh
@@ -28,7 +28,8 @@ function test_hook_spec()
{
local ret=0
local image="busybox"
- local test="container hook test => (${FUNCNAME[@]})"
+ local runtime=$1
+ local test="container hook test => (${FUNCNAME[@]}) => $runtime"
msg_info "${test} starting..."
isula pull ${image}
@@ -37,7 +38,7 @@ function test_hook_spec()
isula images | grep busybox
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++))
- CONT=`isula run -itd --hook-spec ${test_data_path}/test-hookspec.json ${image}`
+ CONT=`isula run -itd --runtime $runtime --hook-spec ${test_data_path}/test-hookspec.json ${image}`
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++))
isula stop -t 0 ${CONT}
@@ -51,7 +52,7 @@ function test_hook_spec()
isula run -n $no_permission_container -itd --hook-spec ${test_data_path}/no_permission.json ${image} > $runlog 2>&1
[[ $? -ne 126 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to check exit code container with image: ${image}" && ((ret++))
- cat $runlog | grep "Permission denied"
+ cat $runlog | grep -i "Permission denied"
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to get no_permission output: ${image}" && ((ret++))
isula rm -f $no_permission_container
@@ -95,6 +96,9 @@ EOF
declare -i ans=0
-test_hook_spec || ((ans++))
+for element in ${RUNTIME_LIST[@]};
+do
+ test_hook_spec $element || ((ans++))
+done
show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/bigdata_stream.sh b/CI/test_cases/container_cases/lcr_bigdata_stream.sh
similarity index 93%
rename from CI/test_cases/container_cases/bigdata_stream.sh
rename to CI/test_cases/container_cases/lcr_bigdata_stream.sh
index 3bfc2d50..c8ecc48a 100755
--- a/CI/test_cases/container_cases/bigdata_stream.sh
+++ b/CI/test_cases/container_cases/lcr_bigdata_stream.sh
@@ -40,7 +40,7 @@ function set_up()
isula images | grep busybox
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - missing list image: ${image}" && ((ret++))
- CID=$(isula run -itd ${image} sh)
+ CID=$(isula run --runtime lcr -itd ${image} sh)
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with image: ${image}" && ((ret++))
isula exec -it $CID dd if=/dev/zero of=test_500M bs=1M count=500
@@ -389,33 +389,6 @@ function test_stream_with_kill_isulad()
return ${ret}
}
-function test_stream_with_runc()
-{
- local ret=0
- local image="busybox"
- local test="test_stream_with_runc => (${FUNCNAME[@]})"
- msg_info "${test} starting..."
-
- RUNCID=$(isula run -itd --runtime runc ${image} sh)
- isula exec -it $RUNCID dd if=/dev/zero of=test_500M bs=1M count=500
- [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to create bigdata" && ((ret++))
-
- isula exec -it $RUNCID cat test_500M > /home/iocopy_stream_data_500M
- [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to cat bigdata" && ((ret++))
-
- sync && sync
- total_size=$(stat -c"%s" /home/iocopy_stream_data_500M)
- [[ $total_size -ne 524288000 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stream iocopy loss data" && ((ret++))
-
- isula rm -f $RUNCID
- [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm container" && ((ret++))
-
- rm -rf /home/iocopy_stream_data_500M
-
- msg_info "${test} finished with return ${ret}..."
- return ${ret}
-}
-
function tear_down()
{
local ret=0
@@ -438,7 +411,7 @@ function test_memory_leak_with_bigdata_stream()
start_isulad_with_valgrind
- CID=$(isula run -itd ${image} sh)
+ CID=$(isula run --runtime lcr -itd ${image} sh)
isula exec -it $CID dd if=/dev/zero of=test_100M bs=1M count=100
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to create bigdata" && ((ret++))
@@ -477,7 +450,6 @@ test_stream_with_stop_lxc_monitor || ((ans++))
test_stream_with_kill_lxc_monitor || ((ans++))
test_stream_with_stop_isulad || ((ans++))
test_stream_with_kill_isulad || ((ans++))
-test_stream_with_runc || ((ans++))
tear_down || ((ans++))
test_memory_leak_with_bigdata_stream || ((ans++))
diff --git a/CI/test_cases/container_cases/exec.sh b/CI/test_cases/container_cases/lcr_exec.sh
similarity index 97%
rename from CI/test_cases/container_cases/exec.sh
rename to CI/test_cases/container_cases/lcr_exec.sh
index 96ceb884..4f51773d 100755
--- a/CI/test_cases/container_cases/exec.sh
+++ b/CI/test_cases/container_cases/lcr_exec.sh
@@ -30,7 +30,7 @@ function exec_workdir()
isula rm -f `isula ps -a -q`
- isula run -tid -n cont_workdir busybox sh
+ isula run -tid --runtime lcr -n cont_workdir busybox sh
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run container with --workdir" && ((ret++))
isula exec -ti --workdir /workdir cont_workdir pwd | grep "/workdir"
diff --git a/CI/test_cases/container_cases/nano_cpus.sh b/CI/test_cases/container_cases/nano_cpus.sh
index c679958d..85223038 100755
--- a/CI/test_cases/container_cases/nano_cpus.sh
+++ b/CI/test_cases/container_cases/nano_cpus.sh
@@ -26,7 +26,8 @@ function test_cpu_nano_spec()
{
local ret=0
local image="busybox"
- local test="container blkio nano test => (${FUNCNAME[@]})"
+ local runtime=$1
+ local test="container blkio nano test => (${FUNCNAME[@]}) => $runtime"
msg_info "${test} starting..."
@@ -108,6 +109,9 @@ function test_cpu_nano_spec()
declare -i ans=0
-test_cpu_nano_spec || ((ans++))
+for element in ${RUNTIME_LIST[@]};
+do
+ test_cpu_nano_spec $element || ((ans++))
+done
show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/restart.sh b/CI/test_cases/container_cases/restart.sh
index 5902af06..fddee1f7 100755
--- a/CI/test_cases/container_cases/restart.sh
+++ b/CI/test_cases/container_cases/restart.sh
@@ -26,7 +26,8 @@ source ../helpers.sh
function do_test_t()
{
containername=test_restart
- isula run --name $containername -td busybox
+
+ isula run --runtime $1 --name $containername -td busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -46,9 +47,12 @@ function do_test_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 restart"
diff --git a/CI/test_cases/container_cases/run.sh b/CI/test_cases/container_cases/run.sh
index ad449402..8ea3e514 100755
--- a/CI/test_cases/container_cases/run.sh
+++ b/CI/test_cases/container_cases/run.sh
@@ -25,7 +25,7 @@ source ../helpers.sh
function do_test_t()
{
- tid=`isula run -tid --name hostname busybox`
+ tid=`isula run --runtime $1 -tid --name hostname busybox`
chostname=`isula exec -it $tid hostname`
fn_check_eq "$chostname" "${tid:0:12}" "default hostname is id of container"
isula exec -it hostname env | grep HOSTNAME
@@ -37,7 +37,7 @@ function do_test_t()
containername=test_basic_run
containername2=container_to_join
- isula run --name $containername -td busybox
+ isula run --runtime $1 --name $containername -td busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -48,7 +48,7 @@ function do_test_t()
isula rm $containername
fn_check_eq "$?" "0" "rm failed"
- isula run --name $containername -td -v /dev/shm:/dev/shm busybox
+ isula run --runtime $1 --name $containername -td -v /dev/shm:/dev/shm busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -61,7 +61,7 @@ function do_test_t()
echo AA > /tmp/test_run_env
- isula run --name $containername -itd --user 100:100 -e AAA=BB -e BAA --env-file /tmp/test_run_env busybox
+ isula run --runtime $1 --name $containername -itd --user 100:100 -e AAA=BB -e BAA --env-file /tmp/test_run_env busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -72,18 +72,21 @@ function do_test_t()
isula rm $containername
fn_check_eq "$?" "0" "rm failed"
- isula run --name $containername -itd --external-rootfs / --read-only none sh
- fn_check_eq "$?" "0" "run container with host rootfs failed"
- testcontainer $containername running
+ # runc directly uses the root directory as external rootfs and will report the error pivot_root .: device or resource busy
+ if [ $runtime == "lcr" ]; then
+ isula run --runtime $1 --name $containername -itd --external-rootfs / --read-only none sh
+ fn_check_eq "$?" "0" "run container with host rootfs failed"
+ testcontainer $containername running
- isula stop -t 0 $containername
- fn_check_eq "$?" "0" "stop failed"
- testcontainer $containername exited
+ isula stop -t 0 $containername
+ fn_check_eq "$?" "0" "stop failed"
+ testcontainer $containername exited
- isula rm $containername
- fn_check_eq "$?" "0" "rm failed"
+ isula rm $containername
+ fn_check_eq "$?" "0" "rm failed"
+ fi
- isula run --name $containername -itd --net=host --pid=host --ipc=host --uts=host busybox
+ isula run --runtime $1 --name $containername -itd --net=host --pid=host --ipc=host --uts=host busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -94,7 +97,7 @@ function do_test_t()
isula rm $containername
fn_check_eq "$?" "0" "rm failed"
- isula run --name $containername -itd --net=none --pid=none --ipc=none --uts=none busybox
+ isula run --runtime $1 --name $containername -itd --net=none --pid=none --ipc=none --uts=none busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -105,11 +108,11 @@ function do_test_t()
isula rm $containername
fn_check_eq "$?" "0" "rm failed"
- isula run --name $containername2 -itd busybox
+ isula run --runtime $1 --name $containername2 -itd busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername2 running
- isula run --name $containername -itd --net=container:$containername2 --pid=container:$containername2 --ipc=container:$containername2 --uts=container:$containername2 busybox
+ isula run --runtime $1 --name $containername -itd --net=container:$containername2 --pid=container:$containername2 --ipc=container:$containername2 --uts=container:$containername2 busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -135,7 +138,7 @@ function do_run_remote_test_t()
local ret=0
local image="busybox"
local config='tcp://127.0.0.1:2890'
- local test="container start with --attach remote test => (${FUNCNAME[@]})"
+ local test="container start with --attach remote test => (${FUNCNAME[@]}) => $1"
check_valgrind_log
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stop isulad failed" && ((ret++))
@@ -144,13 +147,13 @@ function do_run_remote_test_t()
containername=run_remote
- isula run -ti -H "$config" --name $containername busybox xxx
+ isula run --runtime $1 -ti -H "$config" --name $containername busybox xxx
[[ $? -eq 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed check invalid run ${containername} remote" && ((ret++))
testcontainer $containername exited
isula rm -f -H "$config" $containername
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to rm container remote" && ((ret++))
- isula run -ti -H "$config" --name $containername busybox /bin/sh -c 'echo "hello"' | grep hello
+ isula run --runtime $1 -ti -H "$config" --name $containername busybox /bin/sh -c 'echo "hello"' | grep hello
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to run ${containername} remote" && ((ret++))
testcontainer $containername exited
@@ -169,8 +172,10 @@ function do_run_remote_test_t()
declare -i ans=0
-do_test_t || ((ans++))
-
-do_run_remote_test_t || ((ans++))
+for element in ${RUNTIME_LIST[@]};
+do
+ do_test_t $element || ((ans++))
+ do_run_remote_test_t $element || ((ans++))
+done
show_result ${ans} "${curr_path}/${0}"
diff --git a/CI/test_cases/container_cases/bigdata_stream_runc.sh b/CI/test_cases/container_cases/runc_bigdata_stream.sh
similarity index 100%
rename from CI/test_cases/container_cases/bigdata_stream_runc.sh
rename to CI/test_cases/container_cases/runc_bigdata_stream.sh
diff --git a/CI/test_cases/container_cases/exec_runc.sh b/CI/test_cases/container_cases/runc_exec.sh
similarity index 100%
rename from CI/test_cases/container_cases/exec_runc.sh
rename to CI/test_cases/container_cases/runc_exec.sh
diff --git a/CI/test_cases/container_cases/seccomp.sh b/CI/test_cases/container_cases/seccomp.sh
index 9e886d10..3cb08d84 100755
--- a/CI/test_cases/container_cases/seccomp.sh
+++ b/CI/test_cases/container_cases/seccomp.sh
@@ -39,8 +39,9 @@ function do_pre() {
function do_test() {
local ret=0
-
- msg_info "this is $0 do_test"
+ local runtime=$1
+ local test="seccomp test => (${runtime})"
+ msg_info "${test} starting..."
cid1=$(isula run -tid --security-opt seccomp=/etc/isulad/seccomp_default.json busybox sh)
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Failed to run container with the default seccomp profile" && ((ret++))
@@ -52,7 +53,7 @@ function do_test() {
--security-opt seccomp=${test_data_path}/seccomp_profile_without_archmap.json busybox sh)
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - Failed to run container with multiple seccomp profiles" && ((ret++))
- isula stop "${cid1}" "${cid2}" "${cid3}"
+ isula stop -t 0 "${cid1}" "${cid2}" "${cid3}"
isula rm -f $(isula ps -qa)
@@ -69,7 +70,10 @@ declare -i ans=0
do_pre || ((ans++))
-do_test || ((ans++))
+for element in ${RUNTIME_LIST[@]};
+do
+ do_test $element || ((ans++))
+done
do_post
diff --git a/CI/test_cases/container_cases/stop.sh b/CI/test_cases/container_cases/stop.sh
index 962e72f3..13292710 100755
--- a/CI/test_cases/container_cases/stop.sh
+++ b/CI/test_cases/container_cases/stop.sh
@@ -25,8 +25,12 @@ source ../helpers.sh
function do_test_t()
{
+ local runtime=$1
+ local test="start_test => (${runtime})"
+ msg_info "${test} starting..."
+
containername=test_stop
- isula run --name $containername -td busybox
+ isula run --runtime $runtime --name $containername -td busybox
fn_check_eq "$?" "0" "run failed"
testcontainer $containername running
@@ -61,14 +65,19 @@ function do_test_t()
isula rm $containername
fn_check_eq "$?" "0" "rm failed"
+ msg_info "${test} finished with return ${ret}..."
+
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 stop"
diff --git a/CI/test_cases/critest.sh b/CI/test_cases/critest.sh
index 044ce2ed..f8d4975e 100755
--- a/CI/test_cases/critest.sh
+++ b/CI/test_cases/critest.sh
@@ -130,7 +130,7 @@ function test_critest() {
function do_test_t() {
local ret=0
- local runtime="lcr"
+ local runtime="runc"
local test="critest => $runtime"
msg_info "${test} starting..."
echo "${test}" >> ${testcase_data}/critest.log
@@ -143,11 +143,11 @@ function do_test_t() {
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stop isulad failed" && ((ret++))
# replace default runtime
- sed -i 's/"default-runtime": "lcr"/"default-runtime": "runc"/g' /etc/isulad/daemon.json
+ sed -i 's/"default-runtime": "runc"/"default-runtime": "lcr"/g' /etc/isulad/daemon.json
start_isulad_without_valgrind --selinux-enabled --network-plugin cni
[[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - start isulad with selinux and cni failed" && ((ret++))
- runtime=runc
+ runtime=lcr
test="critest => $runtime"
msg_info "${test} starting..."
echo "${test}" >> ${testcase_data}/critest.log
--
2.42.0