From 3fb3b05fdf5af697b368c90bb401e6dfc4437bba Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Fri, 14 Aug 2020 15:01:01 -0700 Subject: [PATCH] Custom Gradle home and add .vpython file (flutter/engine#20425) --- engine/src/flutter/testing/scenario_app/.gitignore | 3 +++ engine/src/flutter/testing/scenario_app/README.md | 1 + .../scenario_app/android/gradle-home/.vpython | 11 +++++++++++ .../scenario_app/android/gradle-home/bin/python | 14 ++++++++++++++ .../testing/scenario_app/run_android_tests.sh | 4 +++- 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 engine/src/flutter/testing/scenario_app/android/gradle-home/.vpython create mode 100755 engine/src/flutter/testing/scenario_app/android/gradle-home/bin/python diff --git a/engine/src/flutter/testing/scenario_app/.gitignore b/engine/src/flutter/testing/scenario_app/.gitignore index 6dc8f6e23d1..b9de2ce97b1 100644 --- a/engine/src/flutter/testing/scenario_app/.gitignore +++ b/engine/src/flutter/testing/scenario_app/.gitignore @@ -5,3 +5,6 @@ build/ ios/Scenarios/*.framework/ android/app/libs/flutter.jar android/app/src/main/jniLibs/arm64-v8a/libapp.so +android/gradle-home/.cache + +!.vpython diff --git a/engine/src/flutter/testing/scenario_app/README.md b/engine/src/flutter/testing/scenario_app/README.md index 628f4024386..e827b9d6a4a 100644 --- a/engine/src/flutter/testing/scenario_app/README.md +++ b/engine/src/flutter/testing/scenario_app/README.md @@ -48,6 +48,7 @@ The test is run on a x86 emulator. To run the test locally, you must create an e hw.lcd.density = 480 hw.lcd.height = 1920 hw.lcd.width = 1080 +lcd.depth = 16 ``` This file is typically located in your `$HOME/.android/avd/` folder. diff --git a/engine/src/flutter/testing/scenario_app/android/gradle-home/.vpython b/engine/src/flutter/testing/scenario_app/android/gradle-home/.vpython new file mode 100644 index 00000000000..741711e4e06 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/gradle-home/.vpython @@ -0,0 +1,11 @@ +# +# "vpython" specification file for build +# +# Pillow is required by com.facebook.testing.screenshot. + +python_version: "2.7" + +wheel: < + name: "infra/python/wheels/pillow/${vpython_platform}" + version: "version:6.0.0" +> diff --git a/engine/src/flutter/testing/scenario_app/android/gradle-home/bin/python b/engine/src/flutter/testing/scenario_app/android/gradle-home/bin/python new file mode 100755 index 00000000000..367e9b679d4 --- /dev/null +++ b/engine/src/flutter/testing/scenario_app/android/gradle-home/bin/python @@ -0,0 +1,14 @@ +#!/bin/bash + +# This script is added to the PATH on LUCI when executing the junit tests. +# The Python scripts used to compare the screenshots are contained in a jar file. +# As a result, vpython cannot find the .vpython spec file because it's outside +# of the jar file. + +set -e + +SCRIPT_DIR="$( dirname "${BASH_SOURCE[0]}" )" + +echo "Running from $SCRIPT_DIR/bin/python" + +vpython -vpython-spec "$SCRIPT_DIR/../.vpython" "$@" diff --git a/engine/src/flutter/testing/scenario_app/run_android_tests.sh b/engine/src/flutter/testing/scenario_app/run_android_tests.sh index fa274316b5a..0be65f86b6e 100755 --- a/engine/src/flutter/testing/scenario_app/run_android_tests.sh +++ b/engine/src/flutter/testing/scenario_app/run_android_tests.sh @@ -9,8 +9,10 @@ set -e cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd +GRADLE_USER_HOME=$(pwd)/android/gradle-home/.cache + pushd android -set -o pipefail && ./gradlew app:verifyDebugAndroidTestScreenshotTest +set -o pipefail && ./gradlew app:verifyDebugAndroidTestScreenshotTest --gradle-user-home "$GRADLE_USER_HOME" popd