Merge "Remove unused function 'getVintfXml'"
diff --git a/harnesses/tradefed/tests/src/com/android/compatibility/common/tradefed/config/ConfigurationFactoryTest.java b/harnesses/tradefed/tests/src/com/android/compatibility/common/tradefed/config/ConfigurationFactoryTest.java
new file mode 100644
index 0000000..2343f13
--- /dev/null
+++ b/harnesses/tradefed/tests/src/com/android/compatibility/common/tradefed/config/ConfigurationFactoryTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.tradefed.config;
+
+import com.android.tradefed.config.ConfigurationException;
+import com.android.tradefed.config.ConfigurationFactory;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Unit tests for {@link ConfigurationFactory} imported from Trade Federation to check vts
+ * configuration loading.
+ */
+@RunWith(JUnit4.class)
+public class ConfigurationFactoryTest {
+ private ConfigurationFactory mConfigFactory;
+
+ @Before
+ public void setUp() throws Exception {
+ mConfigFactory = (ConfigurationFactory) ConfigurationFactory.getInstance();
+ }
+
+ /**
+ * Sanity test to ensure all config names on classpath are loadable.
+ */
+ @Test
+ public void testLoadAllConfigs() throws ConfigurationException {
+ // we dry-run the templates otherwise it will always fail.
+ mConfigFactory.loadAllConfigs(false);
+ }
+
+ /**
+ * Sanity test to ensure all configs on classpath can be fully loaded and parsed.
+ */
+ @Test
+ public void testLoadAndPrintAllConfigs() throws ConfigurationException {
+ // Printing the help involves more checks since it tries to resolve the config objects.
+ mConfigFactory.loadAndPrintAllConfigs();
+ }
+}
\ No newline at end of file
diff --git a/harnesses/tradefed/tests/src/com/android/tradefed/VtsUnitTests.java b/harnesses/tradefed/tests/src/com/android/tradefed/VtsUnitTests.java
index f7dc182..0a446cf 100644
--- a/harnesses/tradefed/tests/src/com/android/tradefed/VtsUnitTests.java
+++ b/harnesses/tradefed/tests/src/com/android/tradefed/VtsUnitTests.java
@@ -15,6 +15,7 @@
*/
package com.android.tradefed;
+import com.android.compatibility.common.tradefed.config.ConfigurationFactoryTest;
import com.android.tradefed.device.metric.VtsCoverageCollectorTest;
import com.android.tradefed.device.metric.VtsHalTraceCollectorTest;
import com.android.tradefed.presubmit.VtsConfigLoadingTest;
@@ -45,6 +46,8 @@
@RunWith(Suite.class)
@SuiteClasses({
// NOTE: please keep classes sorted lexicographically in each group
+ // config
+ ConfigurationFactoryTest.class,
// device
VtsCoverageCollectorTest.class,
VtsDevicePreparerTest.class,
diff --git a/testcases/template/binary_test/binary_test_case.py b/testcases/template/binary_test/binary_test_case.py
index 335658f..3313191 100644
--- a/testcases/template/binary_test/binary_test_case.py
+++ b/testcases/template/binary_test/binary_test_case.py
@@ -52,6 +52,7 @@
name_appendix: string, appendix attached to the test name in display,
typically contains info of parameters used in the test,
e.e. service name used for hal hidl test.
+ filter_file: string, a path pointing to the file containing the filters.
'''
def __init__(self,
@@ -79,6 +80,7 @@
self.envp = envp
self.args = args
self.name_appendix = name_appendix
+ self.filter_file = None
def __str__(self):
return self._GenerateDisplayName()
diff --git a/testcases/template/gtest_binary_test/gtest_binary_test.py b/testcases/template/gtest_binary_test/gtest_binary_test.py
index 9765a47..643b2e4 100644
--- a/testcases/template/gtest_binary_test/gtest_binary_test.py
+++ b/testcases/template/gtest_binary_test/gtest_binary_test.py
@@ -16,6 +16,7 @@
import logging
import os
+import tempfile
import xml.etree.ElementTree
from vts.runners.host import asserts
@@ -127,19 +128,17 @@
if test_suite.endswith('.'):
test_suite = test_suite[:-1]
- #if not self.batch_mode:
- # Avoid batch mode as it creates overly large filters
- return test_cases
+ if not self.batch_mode:
+ return test_cases
# Gtest batch mode
- # test_names = map(lambda test: test.full_name, test_cases)
- #test_names = {}
+ test_names = map(lambda test: test.full_name, test_cases)
- #gtest_batch = gtest_test_case.GtestTestCase(
- # path, '', path, tag, self.PutTag, working_directory,
- # ld_library_path, profiling_library_path, envp=envp)
- #gtest_batch.full_name = ':'.join(test_names)
- #return [gtest_batch]
+ gtest_batch = gtest_test_case.GtestTestCase(
+ path, '', path, tag, self.PutTag, working_directory,
+ ld_library_path, profiling_library_path, envp=envp)
+ gtest_batch.full_name = ':'.join(test_names)
+ return [gtest_batch]
# @Override
def VerifyTestResult(self, test_case, command_results):
@@ -279,8 +278,18 @@
for test_case in self.testcases:
logging.info('Running %s test cases in batch.',
len(test_case.full_name.split(':')))
+ gtest_filter_flag=('--gtest_filter={test}').format(test = test_case)
+ dst = '/data/local/tmp/filter_file'
+ temp = tempfile.NamedTemporaryFile()
+ try:
+ temp.write(gtest_filter_flag)
+ self._dut.adb.push('{src} {dst}'.format(src=temp.name, dst=dst))
+ finally:
+ temp.close()
+ test_case.filter_file = dst
self.RunTestCase(test_case)
+ self.shell.Execute('rm %s' % dst)
self.runGeneratedTests(
test_func=self._VerifyBatchResult,
settings=self._gtest_results,
diff --git a/testcases/template/gtest_binary_test/gtest_test_case.py b/testcases/template/gtest_binary_test/gtest_test_case.py
index 29d842f..a6be4d8 100644
--- a/testcases/template/gtest_binary_test/gtest_test_case.py
+++ b/testcases/template/gtest_binary_test/gtest_test_case.py
@@ -58,10 +58,15 @@
self.output_file_path = output_file_path
if not test_name:
test_name = self.full_name
- return [('{cmd} --gtest_filter={test} '
+
+ gtest_filter_flag = ('--gtest_filter={test}').format(test=test_name)
+ if self.filter_file:
+ gtest_filter_flag='--gtest_flagfile=%s' % self.filter_file
+
+ return [('{cmd} {filter_flag} '
'--gtest_output=xml:{output_file_path}').format(
cmd=super(GtestTestCase, self).GetRunCommand(),
- test = test_name,
+ filter_flag = gtest_filter_flag,
output_file_path=self.output_file_path),
'cat {output} && rm -rf {output}'.format(
output=self.output_file_path)]
diff --git a/tools/build/tasks/list/vts_test_bin_package_list.mk b/tools/build/tasks/list/vts_test_bin_package_list.mk
index 6bd82cd..e25e3d4 100644
--- a/tools/build/tasks/list/vts_test_bin_package_list.mk
+++ b/tools/build/tasks/list/vts_test_bin_package_list.mk
@@ -16,6 +16,7 @@
vts_test_bin_packages := \
android.hardware.tests.msgq@1.0-service-benchmark \
android.hardware.tests.msgq@1.0-service-test \
+ ashmemd_test \
fiemap_writer_test \
fmq_test \
gsi_boot_test \
diff --git a/tools/vts-tradefed/res/config/cts-on-gsi-exclude.xml b/tools/vts-tradefed/res/config/cts-on-gsi-exclude.xml
index 3dd665e..01c2281 100644
--- a/tools/vts-tradefed/res/config/cts-on-gsi-exclude.xml
+++ b/tools/vts-tradefed/res/config/cts-on-gsi-exclude.xml
@@ -21,9 +21,6 @@
<option name="compatibility:test-arg" value="com.android.tradefed.testtype.HostTest:exclude-annotation:android.platform.test.annotations.RestrictedBuildTest" />
<option name="compatibility:test-arg" value="com.android.compatibility.common.tradefed.testtype.JarHostTest:exclude-annotation:android.platform.test.annotations.RestrictedBuildTest" />
- <!-- Exclude tests applicable only to instant mode -->
- <include name="cts-exclude-instant" />
-
<!-- Radio system of a general system image is not checked -->
<option name="compatibility:exclude-filter" value="CtsTelephonyTestCases" />
<option name="compatibility:exclude-filter" value="CtsTelephony2TestCases" />
diff --git a/tools/vts-tradefed/res/config/cts-on-gsi.xml b/tools/vts-tradefed/res/config/cts-on-gsi.xml
index 11c0594..e4694d5 100644
--- a/tools/vts-tradefed/res/config/cts-on-gsi.xml
+++ b/tools/vts-tradefed/res/config/cts-on-gsi.xml
@@ -17,6 +17,8 @@
<include name="common-preparers" />
<target_preparer class="com.android.tradefed.targetprep.VtsDeviceInfoCollector" />
<include name="cts-base" />
+ <!-- CTS-on-GSI is not expected to run parameterized modules -->
+ <option name="compatibility:enable-parameterized-modules" value="false" />
<include name="cts-on-gsi-exclude" />