From 9445f93e44e3513722aa3b80f4e2562aaf39f909 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Thu, 20 Jun 2024 04:18:41 -0400 Subject: [PATCH] chore: run foreach test repos script --- scripts/run_foreach_test_repos.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 scripts/run_foreach_test_repos.sh diff --git a/scripts/run_foreach_test_repos.sh b/scripts/run_foreach_test_repos.sh new file mode 100755 index 0000000..3c9ce55 --- /dev/null +++ b/scripts/run_foreach_test_repos.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -ex +tmp_dir=${1:-./tmp} +JOJ3=$(git rev-parse --show-toplevel)/build/joj3 +command=${2:-$JOJ3} +submodules_dir="$tmp_dir/submodules" +submodules=$(git config --file .gitmodules --get-regexp path | awk '{ print $2 }') +for submodule in $submodules; do + url=$(git config --file .gitmodules --get-regexp "submodule.$submodule.url" | awk '{ print $2 }') + repo_name=$(echo $url | rev | cut -d'/' -f 1 | rev | cut -d'.' -f 1) + submodule_dir="$submodules_dir/$repo_name/$submodule" + cd $submodule_dir + eval "$command" + if [[ $command == $JOJ3 ]]; then + if [ -f "./expected.json" ]; then + mv -f "joj3_result.json" "expected.json" + fi + fi + cd - +done