Ensure that the native tests are run from /data/nativetest to match TF.
Also cleanup a missing test from test_defs.xml Change-Id: I9b50bd3f5c7a100a86dd550d367c8ed9a9f2bd62
This commit is contained in:
committed by
Lorenzo Colitti
parent
c046b48bd6
commit
a0bcd58532
@@ -149,6 +149,25 @@ def GetProductOut():
|
||||
return path
|
||||
|
||||
|
||||
def GetTargetNativeTestPath():
|
||||
"""Returns the full pathname to target/product data/nativetest/ directory.
|
||||
|
||||
Assumes build environment has been properly configured by envsetup &
|
||||
lunch/choosecombo.
|
||||
|
||||
Returns:
|
||||
The absolute file path of the Android target native test directory.
|
||||
|
||||
Raises:
|
||||
AbortError: if Android target native test directory could not be found.
|
||||
"""
|
||||
path = os.path.join(GetProductOut(), "data", "nativetest")
|
||||
if not os.path.exists(path):
|
||||
logger.Log("Error: Target native test path could not be found")
|
||||
raise errors.AbortError
|
||||
return path
|
||||
|
||||
|
||||
def GetTargetSystemBin():
|
||||
"""Returns the full pathname to the target/product system/bin directory.
|
||||
|
||||
|
||||
@@ -132,10 +132,6 @@ See test_defs.xsd for more information.
|
||||
build_path="frameworks/base/libs/androidfw/tests"
|
||||
description="Framework libandroidfw unit tests." />
|
||||
|
||||
<test-native name="libutils"
|
||||
build_path="frameworks/native/libs/utils/tests"
|
||||
description="Framework libutils unit tests." />
|
||||
|
||||
<test-native name="libinput"
|
||||
build_path="frameworks/native/libs/input/tests"
|
||||
description="Framework libinput unit tests." />
|
||||
|
||||
@@ -60,8 +60,8 @@ class NativeTestSuite(test_suite.AbstractTestSuite):
|
||||
host_list = self._FilterOutMissing(android_build.GetHostBin(), source_list)
|
||||
logger.SilentLog("Host tests %s" % host_list)
|
||||
|
||||
# Target tests are under $ANDROID_PRODUCT_OUT/system/bin.
|
||||
target_list = self._FilterOutMissing(android_build.GetTargetSystemBin(),
|
||||
# Target tests are under $ANDROID_PRODUCT_OUT/data/nativetest.
|
||||
target_list = self._FilterOutMissing(android_build.GetTargetNativeTestPath(),
|
||||
source_list)
|
||||
logger.SilentLog("Target tests %s" % target_list)
|
||||
|
||||
@@ -82,7 +82,7 @@ class NativeTestSuite(test_suite.AbstractTestSuite):
|
||||
# Run on the device
|
||||
logger.Log("\nRunning on target")
|
||||
for f in target_list:
|
||||
full_path = os.path.join(os.sep, "system", "bin", f)
|
||||
full_path = os.path.join(os.sep, "data", "nativetest", f)
|
||||
|
||||
# Single quotes are needed to prevent the shell splitting it.
|
||||
output = adb.SendShellCommand("'%s 2>&1;echo -n exit code:$?'" %
|
||||
@@ -132,17 +132,38 @@ class NativeTestSuite(test_suite.AbstractTestSuite):
|
||||
path: Where the binaries should be.
|
||||
sources: List of tests source path.
|
||||
Returns:
|
||||
A list of test binaries built from the sources.
|
||||
A list of relative paths to the test binaries built from the sources.
|
||||
"""
|
||||
binaries = []
|
||||
for f in sources:
|
||||
binary = os.path.basename(f)
|
||||
binary = os.path.splitext(binary)[0]
|
||||
full_path = os.path.join(path, binary)
|
||||
if os.path.exists(full_path):
|
||||
found = self._FindFileRecursively(path, binary)
|
||||
if found:
|
||||
binary = os.path.relpath(os.path.abspath(found),
|
||||
os.path.abspath(path))
|
||||
binaries.append(binary)
|
||||
return binaries
|
||||
|
||||
def _FindFileRecursively(self, path, match):
|
||||
"""Finds the first executable binary in a given path that matches the name.
|
||||
|
||||
Args:
|
||||
path: Where to search for binaries. Can be nested directories.
|
||||
binary: Which binary to search for.
|
||||
Returns:
|
||||
first matched file in the path or None if none is found.
|
||||
"""
|
||||
for root, dirs, files in os.walk(path):
|
||||
for f in files:
|
||||
if f == match:
|
||||
return os.path.join(root, f)
|
||||
for d in dirs:
|
||||
found = self._FindFileRecursively(os.path.join(root, d), match)
|
||||
if found:
|
||||
return found
|
||||
return None
|
||||
|
||||
def _RunHostCommand(self, binary, valgrind=False):
|
||||
"""Run a command on the host (opt using valgrind).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user