From a4d1281ccc40dfc51b313d69f800049e99510600 Mon Sep 17 00:00:00 2001 From: jikai Date: Tue, 9 Jul 2024 12:31:49 +0000 Subject: [PATCH 223/226] fix bug in ci test Signed-off-by: jikai --- CI/test_cases/container_cases/run.sh | 5 ++--- CI/test_cases/helpers.sh | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CI/test_cases/container_cases/run.sh b/CI/test_cases/container_cases/run.sh index 80485457..3f1607fa 100755 --- a/CI/test_cases/container_cases/run.sh +++ b/CI/test_cases/container_cases/run.sh @@ -28,9 +28,8 @@ function do_test_t() containername=test_basic_run tid=$(isula run --name $containername -td busybox) - hostname=$(isula exec -it $containername hostname) - clean_hostname=$(echo "$hostname" | sed 's/[\x01-\x1F\x7F]//g') - fn_check_eq "${clean_hostname}" "${tid:0:12}" "default hostname is not id of container" + hostname=$(isula exec $containername hostname) + fn_check_eq "${hostname}" "${tid:0:12}" "default hostname is not id of container" isula exec -it $containername env | grep HOSTNAME fn_check_eq "$?" "0" "check HOSTNAME env failed" isula stop -t 0 $tid diff --git a/CI/test_cases/helpers.sh b/CI/test_cases/helpers.sh index f7bb7c93..3ad024b9 100755 --- a/CI/test_cases/helpers.sh +++ b/CI/test_cases/helpers.sh @@ -46,15 +46,16 @@ function cut_output_lines() { return $retval } +# use string compare to check the result function fn_check_eq() { - if [[ "$1" -ne "$2" ]];then + if [[ "x$1" != "x$2" ]];then echo "$3" TC_RET_T=$(($TC_RET_T+1)) fi } function fn_check_ne() { - if [[ "$1" -eq "$2" ]];then + if [[ "x$1" = "x$2" ]];then echo "$3" TC_RET_T=$(($TC_RET_T+1)) fi -- 2.33.0