diff options
author | 2018-01-24 21:37:16 -0800 | |
---|---|---|
committer | 2018-01-24 21:38:53 -0800 | |
commit | 652f9e52465508b75d52452dbdd88e51ff582200 (patch) | |
tree | 01e080448afa59a8cb62fe7caeb0c6f6046c3832 /src/main/java/com/google/devtools/build/lib/rules/android/android_instrumentation_test_template.txt | |
parent | 91c8f20b054d8bc3c3a860197fab69167218af67 (diff) |
Set $DISPLAY=:0 by default for android_instrumentation_test for Android emulators to show up.
RELNOTES: None.
PiperOrigin-RevId: 183188581
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/android_instrumentation_test_template.txt')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/android_instrumentation_test_template.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/android_instrumentation_test_template.txt b/src/main/java/com/google/devtools/build/lib/rules/android/android_instrumentation_test_template.txt index 3f74a951ab..b5aaf1d40e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/android_instrumentation_test_template.txt +++ b/src/main/java/com/google/devtools/build/lib/rules/android/android_instrumentation_test_template.txt @@ -87,6 +87,16 @@ $@ END ) +# Export the default DISPLAY variable to :0 if DISPLAY is not set, which is the +# case in sandboxing. This will allow Android emulators to show up by default. +# The DISPLAY variable can also be set with --action_env. +# e.g. `bazel test //... --action_env=DISPLAY=:42` +# To disable DISPLAY, set +# android_instrumentation_test.args = [ "--enable_display=false" ] +if [[ -z "${DISPLAY-}" ]]; then + export DISPLAY=:0 +fi + $test_entry_point \ --wrapper_script_flag=--jvm_flag=-D$test_suite_property_name=com.google.android.apps.common.testing.suite.AndroidDeviceTestSuite \ --wrapper_script_flag=--jvm_flag=-Dargv="$argv" |