Skip to content

Commit

Permalink
run tests on all changed dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul2393 committed May 28, 2024
1 parent ee22d5a commit 43c1296
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions internal/kokoro/presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ fi
CHANGED_DIRS=$(echo "$SIGNIFICANT_CHANGES" | tr ' ' '\n' | cut -d/ -f1 | sort -u |
tr '\n' ' ' | xargs ls -d 2>/dev/null || true)

# Check if "." is in the list of changed directories, filter other directories if so.
if echo "$CHANGED_DIRS" | grep -qw "\."; then
echo "Detected changes in the root directory, running tests in all submodules"
CHANGED_DIRS="."
fi

echo "Running tests only in changed submodules: $CHANGED_DIRS"
for d in $CHANGED_DIRS; do
# Check if "." is in the list of changed directories, which means the root
if [ $d == "." ]; then
pushd $(dirname $i)
runPresubmitTests
popd
continue
fi
for i in $(find "$d" -name go.mod); do
pushd $(dirname $i)
runPresubmitTests
Expand Down

0 comments on commit 43c1296

Please sign in to comment.