Merge "Use FilePusher as the target_preparer for resolv tests"
diff --git a/Android.bp b/Android.bp
index d02a403..85e2e9c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -192,11 +192,20 @@
     ],
 }
 
+filegroup {
+    name: "resolv_test_config_template",
+    srcs: [
+        "resolv_test_config_template.xml",
+    ],
+}
+
 // TODO: Move this test to tests/
 cc_test {
     name: "resolv_unit_test",
     test_suites: ["device-tests", "mts"],
     require_root: true,
+    // TODO: Remove after b/152303924 fixing
+    test_config_template: ":resolv_test_config_template",
     //TODO:  drop root privileges and make it be an real unit test.
     defaults: ["netd_defaults", "resolv_test_defaults"],
     srcs: [
diff --git a/resolv_test_config_template.xml b/resolv_test_config_template.xml
new file mode 100644
index 0000000..34df3be
--- /dev/null
+++ b/resolv_test_config_template.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<!-- Temporary solution for MTS coverage because MTS coverage can only run with FilesPusher.
+     See b/152303924 for details.
+-->
+<configuration description="Configuration for {MODULE} tests">
+   <option name="test-suite-tag" value="mts" />
+   <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+       <option name="cleanup" value="true" />
+       <option name="push" value="{MODULE}->/data/local/tmp/{MODULE}" />
+   </target_preparer>
+   <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
+   <test class="com.android.tradefed.testtype.GTest" >
+       <option name="native-test-device-path" value="/data/local/tmp" />
+       <option name="module-name" value="{MODULE}" />
+       <option name="runtime-hint" value="10m" />
+       <!-- test-timeout unit is ms, value = 10 min -->
+       <option name="native-test-timeout" value="600000" />
+   </test>
+</configuration>
diff --git a/tests/Android.bp b/tests/Android.bp
index b83bbab..054e2d4 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -111,7 +111,8 @@
     test_suites: ["device-tests", "mts"],
     // This won't work with test_config
     // require_root: true,
-    test_config: "resolv_stress_test_config.xml",
+    // TODO: Remove after b/152303924 fixing
+    test_config_template: ":resolv_test_config_template",
     defaults: ["netd_defaults", "resolv_test_defaults"],
     srcs: [
         "resolv_stress_test.cpp",
diff --git a/tests/resolv_gold_test_config.xml b/tests/resolv_gold_test_config.xml
index 30a9965..e70a7e6 100644
--- a/tests/resolv_gold_test_config.xml
+++ b/tests/resolv_gold_test_config.xml
@@ -15,9 +15,10 @@
 -->
 <configuration description="Configuration for resolv gold tests">
    <option name="test-suite-tag" value="mts" />
-   <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+   <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
        <option name="cleanup" value="true" />
        <option name="push" value="resolv_gold_test->/data/local/tmp/resolv_gold_test" />
+       <!-- Temporary solotuon for b/151392634 -->
        <option name="push" value="testdata->/data/local/tmp/testdata/" />
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
diff --git a/tests/resolv_stress_test_config.xml b/tests/resolv_stress_test_config.xml
deleted file mode 100644
index 09ebdbc..0000000
--- a/tests/resolv_stress_test_config.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-<configuration description="Config for resolv_stress_test.">
-    <option name="test-suite-tag" value="apct" />
-    <option name="test-suite-tag" value="apct-native" />
-    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
-        <option name="cleanup" value="true" />
-        <option name="push" value="resolv_stress_test->/data/local/tmp/resolv_stress_test" />
-    </target_preparer>
-    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
-
-    <test class="com.android.tradefed.testtype.GTest" >
-        <option name="native-test-device-path" value="/data/local/tmp" />
-        <option name="module-name" value="resolv_stress_test" />
-        <!--
-            On 2018-12-12, GetAddrInfoStressTest_Binder_100 suddenly jumped
-            from ~1xs to ~70s runtime in APCT continuous integration, causing
-            resolv_integration_test to flake with the default 60s timeout.
-            We're not sure what caused the regression, but it's not due to a change
-            in the Android image and unlikely to affect users.
-            Just bump the timeout to 120s for now.
-        -->
-        <option name="native-test-timeout" value="120000" />
-    </test>
-</configuration>