diff --git a/.ci/check_rare_string.sh b/.ci/check_rare_string.sh new file mode 100644 index 000000000..84bf3edbe --- /dev/null +++ b/.ci/check_rare_string.sh @@ -0,0 +1,55 @@ +#!/bin/bash + + + +function LOG_ERROR() +{ + local content=${1} + echo -e "\033[31m"${content}"\033[0m" +} + +function LOG_INFO() +{ + local content=${1} + echo -e "\033[32m"${content}"\033[0m" +} + +get_md5sum_cmd() { + local md5sum_cmd="md5sum" + if [ "$(uname)" == "Darwin" ]; then + md5sum_cmd="md5" + fi + echo "$md5sum_cmd" +} + +function checkConcatenatedRareString() { + + concatenatedString=${1} + log_file=${2} + md5sum_cmd=$(get_md5sum_cmd) + + md5_concatenatedString=$(echo -n "$concatenatedString" | $md5sum_cmd | awk '{print $1}') + + # compare rare string and stringFromGet + get_output=$(cat ${log_file}| grep "result=" | awk -F '[][]' '{print $4}' | awk NF | tail -n 1) + stringFromGet=$(echo "$get_output" | grep "Return values" | sed 's/Return values:\(.*\)/\1/' | tr -d '()') + md5_stringFromGet=$(echo -n "$stringFromGet" | $md5sum_cmd | awk '{print $1}') + if [ "$md5_concatenatedString" != "$md5_stringFromGet" ]; then + LOG_ERROR "error: check failed, the md5 values of rareString and stringFromGet are not equal, fail concatenatedString: ${concatenatedString}" + exit 1 + else + LOG_INFO "check success, concatenatedString: ${concatenatedString}" + fi +} + +main() { + concatenatedString=${1} + log_file=${2} + LOG_INFO "check rare string start, concatenatedString: ${concatenatedString}" + + checkConcatenatedRareString ${concatenatedString} ${log_file} + LOG_INFO "check rare string finished!" +} + +main "$@" + diff --git a/.ci/ci_cross_all_check.sh b/.ci/ci_cross_all_check.sh index 937bdc7c9..6d651f3cd 100644 --- a/.ci/ci_cross_all_check.sh +++ b/.ci/ci_cross_all_check.sh @@ -3,6 +3,7 @@ set -e ROOT=$(pwd)/demo/ PLUGIN_BRANCH=master +final_rare_input="" LOG_INFO() { local content=${1} @@ -14,6 +15,14 @@ LOG_ERROR() { echo -e "\033[31m[ERROR] ${content}\033[0m" } +prepare_rare_string() { + final_rare_input=$(bash ./gen_rare_string.sh) +} + +check_rare_string() { + bash ./check_rare_string.sh ${final_rare_input} ${ROOT}/WeCross-Console/logs/debug.log +} + check_log() { cd ${ROOT} error_log=routers-payment/127.0.0.1-8250-25500/logs/error.log @@ -62,6 +71,8 @@ demo_test() { ensure_bcos_nodes_running + prepare_rare_string + cd WeCross-Console/ bash start.sh <