Skip to content

Commit

Permalink
[test] Fix test/wasm-spec/update.sh for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
titzer committed Nov 27, 2024
1 parent 93c9588 commit f304709
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
30 changes: 21 additions & 9 deletions test/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions test/wasm-spec/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f304709

Please sign in to comment.