summaryrefslogtreecommitdiff
path: root/python/python_test.go
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2023-01-30 20:02:27 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-01-30 20:02:27 +0000
commit56080ddc08240386bf1174f99d2b057ddc258198 (patch)
treecb53d8ccec5c086fa3700294f22146eee4e348a0 /python/python_test.go
parentf21f25f172e414605c0f344affd269f1498b765a (diff)
parent5c503d1c434603370c442fbe29f330cc3f77e439 (diff)
Merge "Precompile python sources"
Diffstat (limited to 'python/python_test.go')
-rw-r--r--python/python_test.go27
1 files changed, 19 insertions, 8 deletions
diff --git a/python/python_test.go b/python/python_test.go
index 6f4223a7c..75a6a899b 100644
--- a/python/python_test.go
+++ b/python/python_test.go
@@ -18,10 +18,10 @@ import (
"fmt"
"os"
"path/filepath"
- "regexp"
"testing"
"android/soong/android"
+ "android/soong/cc"
)
type pyModule struct {
@@ -33,8 +33,10 @@ type pyModule struct {
}
var (
- buildNamePrefix = "soong_python_test"
- moduleVariantErrTemplate = "%s: module %q variant %q: "
+ buildNamePrefix = "soong_python_test"
+ // We allow maching almost anything before the actual variant so that the os/arch variant
+ // is matched.
+ moduleVariantErrTemplate = `%s: module %q variant "[a-zA-Z0-9_]*%s": `
pkgPathErrTemplate = moduleVariantErrTemplate +
"pkg_path: %q must be a relative path contained in par file."
badIdentifierErrTemplate = moduleVariantErrTemplate +
@@ -323,17 +325,26 @@ func TestPythonModule(t *testing.T) {
if d.desc != "module with duplicate runfile path" {
continue
}
- errorPatterns := make([]string, len(d.errors))
- for i, s := range d.errors {
- errorPatterns[i] = regexp.QuoteMeta(s)
- }
+ d.mockFiles[filepath.Join("common", bpFile)] = []byte(`
+python_library {
+ name: "py3-stdlib",
+ host_supported: true,
+}
+cc_binary {
+ name: "py3-launcher",
+ host_supported: true,
+}
+`)
t.Run(d.desc, func(t *testing.T) {
result := android.GroupFixturePreparers(
android.PrepareForTestWithDefaults,
+ android.PrepareForTestWithArchMutator,
+ android.PrepareForTestWithAllowMissingDependencies,
+ cc.PrepareForTestWithCcDefaultModules,
PrepareForTestWithPythonBuildComponents,
d.mockFiles.AddToFixture(),
- ).ExtendWithErrorHandler(android.FixtureExpectsAllErrorsToMatchAPattern(errorPatterns)).
+ ).ExtendWithErrorHandler(android.FixtureExpectsAllErrorsToMatchAPattern(d.errors)).
RunTest(t)
if len(result.Errs) > 0 {