diff options
author | Nan Zhang <nanzhang@google.com> | 2017-07-12 12:55:28 -0700 |
---|---|---|
committer | Nan Zhang <nanzhang@google.com> | 2017-09-05 17:26:57 -0700 |
commit | d4e641b6e941d8aeeebdb17786037931184dc0a2 (patch) | |
tree | 8a34acc078b42934e8090b9b7f56c946d0547a51 /python/python_test.go | |
parent | ff2abe56dad74b822b7a17829840374a96f6390e (diff) | |
download | build_soong-d4e641b6e941d8aeeebdb17786037931184dc0a2.tar.gz build_soong-d4e641b6e941d8aeeebdb17786037931184dc0a2.tar.bz2 build_soong-d4e641b6e941d8aeeebdb17786037931184dc0a2.zip |
<Hermetic> Replace Soong Python bootstrap process with embedded
launcher.
For Python2, we bundle embedded launcher as bootstrapper within every
.par file. This feature is only enabled for linux_x86_64 for now. We
provide a user flag: hermetic_enabled within bp file. By default, Pyhon2
still use classic bootstrapping way to construct .par file and relys on
host interpreter. Once embedded_launcher is enabled, launcher will be
used to bootstrap .par file and execute user program.
For Python3, the launcher will be ready soon, and for now it still relys
on classic bootstrapping.
Test: Real example is used to test.
Bug: b/63018041
Change-Id: I28deba413d8ad3af407595e46f77d663e79a3705
Diffstat (limited to 'python/python_test.go')
-rw-r--r-- | python/python_test.go | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/python/python_test.go b/python/python_test.go index 4c30d95b..5e418778 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))) } |