diff options
Diffstat (limited to 'python/python_test.go')
-rw-r--r-- | python/python_test.go | 27 |
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 { |