From f3047099b1a9eeecd108f94693fbdac48bf35054 Mon Sep 17 00:00:00 2001 From: "Ben L. Titzer" Date: Wed, 27 Nov 2024 11:05:08 -0500 Subject: [PATCH] [test] Fix test/wasm-spec/update.sh for CI --- test/common.sh | 30 +++++++++++++++++++++--------- test/wasm-spec/update.sh | 14 +++++++------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/test/common.sh b/test/common.sh index d10f052a..17d0689a 100644 --- a/test/common.sh +++ b/test/common.sh @@ -176,15 +176,27 @@ function check_exit { } function update_proposal_repo { - b=$1 + p=$1 REPOS=${WIZENG_LOC}/wasm-spec/repos - REPO=${REPOS}/$b/ - if [ ! -d "$DIR" ]; then + REPO=${REPOS}/$p/ + if [ ! -d "$REPO" ]; then mkdir -p $REPOS pushd $REPOS echo "##+git clone [$REPO]" - # TODO: check whether repo exists publicly - git clone --depth 1 https://github.com/WebAssembly/$b 2>&1 | cat -A + # check whether repo exists publicly + remote=https://github.com/WebAssembly/$p + curl -s https://api.github.com/repos/WebAssembly/$p > $REPOS/check.$p + if [ "$?" != 0 ]; then + echo "##-fail: no such repo: $remote" + return 1 + else + grep status $REPOS/check.$p | grep 404 > /dev/null + if [ $? = 0 ]; then + echo "##-fail: proposal not found: $remote" + return 1 + fi + fi + git clone --depth 1 $remote 2>&1 | cat -A check_exit $? popd else @@ -209,11 +221,11 @@ function update_proposal_repo { } function make_proposal_tests { - b=$1 - REPO=${WIZENG_LOC}/wasm-spec/repos/$b + p=$1 + REPO=${WIZENG_LOC}/wasm-spec/repos/$p WASM=${REPO}/interpreter/wasm - SRC=${WIZENG_LOC}/test/wasm-spec/src/$b - BIN=${WIZENG_LOC}/test/wasm-spec/bin/$b + SRC=${WIZENG_LOC}/test/wasm-spec/src/$p + BIN=${WIZENG_LOC}/test/wasm-spec/bin/$p mkdir -p $BIN mkdir -p $SRC # clean up old tests diff --git a/test/wasm-spec/update.sh b/test/wasm-spec/update.sh index 419e5566..c650114b 100755 --- a/test/wasm-spec/update.sh +++ b/test/wasm-spec/update.sh @@ -11,16 +11,16 @@ WIZENG_LOC=${WIZENG_LOC:=$(cd $DIR/.. && pwd)} . $DIR/../common.sh update -BRANCHES="$@" +PROPOSALS="$@" if [ "$#" = 0 ]; then - BRANCHES=spec + PROPOSALS=spec fi -for b in $BRANCHES; do - printf "Updating proposal ${CYAN}%-22s${NORM} " $b - update_proposal_repo $b | $PROGRESS || exit $? - printf "Building tests ${CYAN}%-22s${NORM} " $b - make_proposal_tests $b | $PROGRESS || exit $? +for p in $PROPOSALS; do + printf "Updating proposal ${CYAN}%-22s${NORM} " $p + update_proposal_repo $p | $PROGRESS || exit $? + printf "Building tests ${CYAN}%-22s${NORM} " $p + make_proposal_tests $p | $PROGRESS || exit $? done