ATest: Host native test config auto-gen support.

Autogenerate HostGTest test config for better user
experience of hostside native tests.

BUG: 80298359

Test: . build/envsetup.sh ; lunch aosp_x86_64-eng ; make -j
      . build/envsetup.sh ; lunch aosp_x86_64-eng ; make -j hello_world_test
      . build/envsetup.sh ; lunch aosp_x86_64-eng ; make -j CtsLiblogTestCases_list

Change-Id: Iee1db17f8957d3c1cd80c9aae1996a72b48413d9
diff --git a/core/autogen_test_config.mk b/core/autogen_test_config.mk
index bf87c9d..a01d80f 100644
--- a/core/autogen_test_config.mk
+++ b/core/autogen_test_config.mk
@@ -26,7 +26,11 @@
 ifeq ($(LOCAL_NATIVE_BENCHMARK),true)
 autogen_test_config_template := $(NATIVE_BENCHMARK_TEST_CONFIG_TEMPLATE)
 else
-autogen_test_config_template := $(NATIVE_TEST_CONFIG_TEMPLATE)
+  ifeq ($(LOCAL_IS_HOST_MODULE),true)
+    autogen_test_config_template := $(NATIVE_HOST_TEST_CONFIG_TEMPLATE)
+  else
+    autogen_test_config_template := $(NATIVE_TEST_CONFIG_TEMPLATE)
+  endif
 endif
 # Auto generating test config file for native test
 $(autogen_test_config_file): PRIVATE_MODULE_NAME := $(LOCAL_MODULE)
diff --git a/core/config.mk b/core/config.mk
index b5ae2d5..9245ee9 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -171,6 +171,7 @@
 NATIVE_BENCHMARK_TEST_CONFIG_TEMPLATE := $(BUILD_SYSTEM)/native_benchmark_test_config_template.xml
 NATIVE_TEST_CONFIG_TEMPLATE := $(BUILD_SYSTEM)/native_test_config_template.xml
 EMPTY_TEST_CONFIG := $(BUILD_SYSTEM)/empty_test_config.xml
+NATIVE_HOST_TEST_CONFIG_TEMPLATE := $(BUILD_SYSTEM)/native_host_test_config_template.xml
 
 # Tool to generate TradeFed test config file automatically.
 AUTOGEN_TEST_CONFIG_SCRIPT := build/make/tools/auto_gen_test_config.py
diff --git a/core/native_host_test_config_template.xml b/core/native_host_test_config_template.xml
new file mode 100644
index 0000000..c0fcd1a
--- /dev/null
+++ b/core/native_host_test_config_template.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 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.
+-->
+<!-- This test config file is auto-generated. -->
+<configuration description="Runs {MODULE}.">
+    <option name="null-device" value="true" />
+    <test class="com.android.tradefed.testtype.HostGTest" >
+        <option name="module-name" value="{MODULE}" />
+    </test>
+</configuration>
+