Merge "Add pre-upload hook to run Winscope tests" into udc-dev

This commit is contained in:
TreeHugger Robot
2023-06-02 10:31:48 +00:00
committed by Android (Google) Code Review
2 changed files with 27 additions and 0 deletions

8
PREUPLOAD.cfg Normal file
View File

@@ -0,0 +1,8 @@
# Per-project `repo upload` hook settings.
# https://android.googlesource.com/platform/tools/repohooks
[Options]
ignore_merged_commits = true
[Hook Scripts]
winscope = ./tools/winscope/hooks/pre-upload ${PREUPLOAD_FILES}

19
tools/winscope/hooks/pre-upload Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
WINSCOPE_SRC_PATTERN="tools/winscope/"
match=false
for file in "$@"
do
if echo $file | grep --quiet "$WINSCOPE_SRC_PATTERN"
then
match=true
fi
done
# If there are changes to winscope files and npm is installed
if $match && (which node > /dev/null)
then
echo "Running winscope presubmit tests..."
npm run test:presubmit --prefix $WINSCOPE_SRC_PATTERN
fi