summaryrefslogtreecommitdiff
path: root/python/python_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'python/python_test.go')
-rw-r--r--python/python_test.go28
1 files changed, 12 insertions, 16 deletions
diff --git a/python/python_test.go b/python/python_test.go
index 4c30d95be..5e418778e 100644
--- a/python/python_test.go
+++ b/python/python_test.go
@@ -28,7 +28,7 @@ import (
"android/soong/android"
)
-type pyBinary struct {
+type pyModule struct {
name string
actualVersion string
pyRunfiles []string
@@ -41,7 +41,7 @@ var (
buildNamePrefix = "soong_python_test"
moduleVariantErrTemplate = "%s: module %q variant %q: "
pkgPathErrTemplate = moduleVariantErrTemplate +
- "pkg_path: %q is not a valid format."
+ "pkg_path: %q must be a relative path contained in par file."
badIdentifierErrTemplate = moduleVariantErrTemplate +
"srcs: the path %q contains invalid token %q."
dupRunfileErrTemplate = moduleVariantErrTemplate +
@@ -58,7 +58,7 @@ var (
mockFiles map[string][]byte
errors []string
- expectedBinaries []pyBinary
+ expectedBinaries []pyModule
}{
{
desc: "module without any src files",
@@ -278,7 +278,7 @@ var (
stubTemplateHost: []byte(`PYTHON_BINARY = '%interpreter%'
MAIN_FILE = '%main%'`),
},
- expectedBinaries: []pyBinary{
+ expectedBinaries: []pyModule{
{
name: "bin",
actualVersion: "PY3",
@@ -363,14 +363,10 @@ func expectModule(t *testing.T, ctx *android.TestContext, buildDir, name, varian
expParSpec string, expDepsParSpecs []string) (testErrs []error) {
module := ctx.ModuleForTests(name, variant)
- base, baseOk := module.Module().(*pythonBaseModule)
+ base, baseOk := module.Module().(*Module)
if !baseOk {
t.Fatalf("%s is not Python module!", name)
}
- sub, subOk := base.subModule.(*pythonBinaryBase)
- if !subOk {
- t.Fatalf("%s is not Python binary!", name)
- }
actPyRunfiles := []string{}
for _, path := range base.srcsPathMappings {
@@ -381,28 +377,28 @@ func expectModule(t *testing.T, ctx *android.TestContext, buildDir, name, varian
testErrs = append(testErrs, errors.New(fmt.Sprintf(
`binary "%s" variant "%s" has unexpected pyRunfiles: %q!`,
base.Name(),
- base.properties.ActualVersion,
+ base.properties.Actual_version,
actPyRunfiles)))
}
- if !reflect.DeepEqual(sub.depsPyRunfiles, expDepsPyRunfiles) {
+ if !reflect.DeepEqual(base.depsPyRunfiles, expDepsPyRunfiles) {
testErrs = append(testErrs, errors.New(fmt.Sprintf(
`binary "%s" variant "%s" has unexpected depsPyRunfiles: %q!`,
base.Name(),
- base.properties.ActualVersion,
- sub.depsPyRunfiles)))
+ base.properties.Actual_version,
+ base.depsPyRunfiles)))
}
if base.parSpec.soongParArgs() != strings.Replace(expParSpec, "@prefix@", buildDir, 1) {
testErrs = append(testErrs, errors.New(fmt.Sprintf(
`binary "%s" variant "%s" has unexpected parSpec: %q!`,
base.Name(),
- base.properties.ActualVersion,
+ base.properties.Actual_version,
base.parSpec.soongParArgs())))
}
actDepsParSpecs := []string{}
- for i, p := range sub.depsParSpecs {
+ for i, p := range base.depsParSpecs {
actDepsParSpecs = append(actDepsParSpecs, p.soongParArgs())
expDepsParSpecs[i] = strings.Replace(expDepsParSpecs[i], "@prefix@", buildDir, 1)
}
@@ -411,7 +407,7 @@ func expectModule(t *testing.T, ctx *android.TestContext, buildDir, name, varian
testErrs = append(testErrs, errors.New(fmt.Sprintf(
`binary "%s" variant "%s" has unexpected depsParSpecs: %q!`,
base.Name(),
- base.properties.ActualVersion,
+ base.properties.Actual_version,
actDepsParSpecs)))
}