diff options
author | 2017-09-28 12:36:15 -0400 | |
---|---|---|
committer | 2017-09-29 12:13:50 -0400 | |
commit | 5abc49b83537e4358206dd984cbb70a0ea6bf965 (patch) | |
tree | 8869f0d9e29b263772f1db22328dd89e7f55b17c /src/main/java/com | |
parent | 2317ef803e7e6639a70e43ccd1699a2a12c9f880 (diff) |
Small fixes to android_instrumentation_test.
BazelJUnitRunner swallows argv, so we cannot pass args to the android test runner as flags.
Also, trim the trailing newline off of the name of the test suite class.
RELNOTES: None
PiperOrigin-RevId: 170354472
Diffstat (limited to 'src/main/java/com')
2 files changed, 18 insertions, 12 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTest.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTest.java index 741c25e35c..78a21cc5a0 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTest.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTest.java @@ -296,8 +296,9 @@ public class AndroidInstrumentationTest implements RuleConfiguredTargetFactory { private static String getTestSuitePropertyName(RuleContext ruleContext) throws RuleErrorException { try { - return ResourceFileLoader.loadResource( - AndroidInstrumentationTest.class, TEST_SUITE_PROPERTY_NAME_FILE); + return ResourceFileLoader + .loadResource(AndroidInstrumentationTest.class, TEST_SUITE_PROPERTY_NAME_FILE) + .trim(); } catch (IOException e) { ruleContext.throwWithRuleError("Cannot load test suite property name: " + e.getMessage()); return null; 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 c4af683ddb..c09d1cef10 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 @@ -72,17 +72,22 @@ fixture_args="%fixture_args%" test_suite_property_name='%test_suite_property_name%' +argv=$(cat <<END +--adb="${adb}" \ +--device_broker_type="${device_broker_type}" \ +--device_script="${device_script}" \ +--data_deps="${data_deps}" \ +--test_label="${test_label}" \ +--apks_to_install="${apks_to_install}" \ +--fixture_scripts="$(printf "%s," "${!device_script_fixtures[@]}")" \ +--hermetic_server_script="${host_service_fixture}" \ +--hermetic_servers="${host_service_fixture_services}" \ +--data_deps="$(printf "%s," "${!device_script_fixtures[@]}")" +END +) + $test_entry_point \ --wrapper_script_flag=--jvm_flag=-D$test_suite_property_name=com.google.android.apps.common.testing.suite.AndroidDeviceTestSuite \ - --adb="${adb}" \ - --device_broker_type="${device_broker_type}" \ - --device_script="${device_script}" \ - --data_deps="${data_deps}" \ - --test_label="${test_label}" \ - --apks_to_install="${apks_to_install}" \ - --fixture_scripts="$(printf "%s," "${!device_script_fixtures[@]}")" \ - --hermetic_server_script="${host_service_fixture}" \ - --hermetic_servers="${host_service_fixture_services}" \ - --data_deps="$(printf "%s," "${!device_script_fixtures[@]}")" \ + --wrapper_script_flag=--jvm_flag=-Dargv="$argv" \ --test_filter="${ANDROID_TESTBRIDGE_TEST_ONLY}" \ "$@" |