
On Mon, Oct 19, 2020 at 04:03:36PM +0800, Yu Chuan wrote:
[Why] Openeuler release two kinds of iso type now, we need to skip the released iso type that not used for dailybuild.
[How] 1. Confirm whether the purpose is dailybuild by iso name. 2. Exit 0 while the released iso is not used for dailybuild.
Signed-off-by: Yu Chuan <13186087857@163.com> --- tests/iso2rootfs | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/tests/iso2rootfs b/tests/iso2rootfs index 89328f2f4a9b..9e891d585681 100755 --- a/tests/iso2rootfs +++ b/tests/iso2rootfs @@ -22,6 +22,12 @@ log_info() echo "[INFO] $*" }
+exit_info() +{ + log_info "$@" + exit 0 +} + die() { echo "[ERROR] $*" >&2 @@ -56,6 +62,26 @@ check_yaml_vars() done }
+check_iso_name() +{ + local skipped_iso_prefixes + case ${iso_os} in + "openeuler") + skipped_iso_prefixes=("openEuler-2.0-SP8")
感觉这样的测试没抓住问题的本质 -- 想要的是xxx, 测试的却是yyy. 有什么办法直接测试xxx? 这样的测试就有鲁棒性. 上面的列表将来需要更新, 会有长期维护代价. Thanks, Fengguang
+ ;; + *) + return + ;; + esac + + local prefix + for prefix in "${skipped_iso_prefixes[@]}" + do + [[ ${ISO_NAME} != ${prefix}* ]] || + exit_info "${iso_os} haven't release new iso for openEuler, no need to generate rootfs" + done +} + get_daily_iso_checksum() { ISO_URL="$(curl "${iso_url_file}")" @@ -63,8 +89,10 @@ get_daily_iso_checksum() local pub_ip=$(echo "${iso_url_file}" | grep -oEw "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}") ISO_URL="$(curl "${iso_url_file}" |sed -r "s/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/${pub_ip}/g")" } + ISO_NAME=$(basename "$ISO_URL") ISO_CHECKSUM_URL="${ISO_URL}.sha256sum" + check_iso_name
curl -o "${CHECKSUM_FILE_CACHE}.tmp" "${ISO_CHECKSUM_URL}" SHA256SUM_NET=$(awk '{print $1}' "${CHECKSUM_FILE_CACHE}.tmp") @@ -118,9 +146,8 @@ check_sha256sum_update()
if [ "$SHA256SUM_CACHE" == "$SHA256SUM_NET" ] then - log_info "${iso_os} haven't release new iso, no need to generate rootfs" rm -f "${CHECKSUM_FILE_CACHE}.tmp" - exit 0 + exit_info "${iso_os} haven't release new iso, no need to generate rootfs" else log_info "${iso_os} release a new iso, start to generate rootfs ..." return -- 2.23.0