summaryrefslogtreecommitdiff
path: root/python/test.go
diff options
context:
space:
mode:
author Nan Zhang <nanzhang@google.com> 2017-11-15 17:59:56 -0800
committer Nan Zhang <nanzhang@google.com> 2017-11-30 13:55:49 -0800
commit3bba05962dc4329c6e3d28544775db591574ba7b (patch)
tree8ebc182125ea5934c824a583c07b123ffa1010f7 /python/test.go
parente261615792dbe84250fea54c26ca7972293d23c6 (diff)
Change Python in Soong to support device side build.
Add python_test to generate executables for both host and device side. And change python_library_host to python_library. installation for python device test will be under target/product/generic_arm[64]/data/nativetest[64]. Bug: b/69114465 Test: m clean && m -j Device Test: adb root; adb push nan_devicetest /data; adb shell; ./nan_devicetest print(sys.path) ['/data/nan_devicetest/runfiles', '/data/nan_devicetest', '/data/nan_devicetest/internal', '/data/nan_devicetest/internal/stdlib'] Change-Id: If8317070a3aa1b6dab2e84b8df2d037f495d7247
Diffstat (limited to 'python/test.go')
-rw-r--r--python/test.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/python/test.go b/python/test.go
index de2b13e1b..825e63cc4 100644
--- a/python/test.go
+++ b/python/test.go
@@ -22,6 +22,7 @@ import (
func init() {
android.RegisterModuleType("python_test_host", PythonTestHostFactory)
+ android.RegisterModuleType("python_test", PythonTestFactory)
}
type testDecorator struct {
@@ -29,13 +30,18 @@ type testDecorator struct {
}
func (test *testDecorator) install(ctx android.ModuleContext, file android.Path) {
- test.binaryDecorator.baseInstaller.install(ctx, file)
+ test.binaryDecorator.pythonInstaller.dir = "nativetest"
+ test.binaryDecorator.pythonInstaller.dir64 = "nativetest64"
+
+ test.binaryDecorator.pythonInstaller.relative = ctx.ModuleName()
+
+ test.binaryDecorator.pythonInstaller.install(ctx, file)
}
func NewTest(hod android.HostOrDeviceSupported) *Module {
module, binary := NewBinary(hod)
- binary.baseInstaller = NewPythonInstaller("nativetest")
+ binary.pythonInstaller = NewPythonInstaller("nativetest", "nativetest64")
test := &testDecorator{binaryDecorator: binary}
@@ -50,3 +56,10 @@ func PythonTestHostFactory() android.Module {
return module.Init()
}
+
+func PythonTestFactory() android.Module {
+ module := NewTest(android.HostAndDeviceSupported)
+ module.multilib = android.MultilibBoth
+
+ return module.Init()
+}