Make lots of tests run in parallel

Putting t.Parallel() in each test makes them run in parallel.
Additional t.Parallel() could be added to each subtest, although
that requires making a local copy of the loop variable for
table driven tests.

Test: m checkbuild
Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
This commit is contained in:
Colin Cross 2020-09-18 14:25:31 -07:00
parent 56a8321c21
commit 323dc60712
117 changed files with 661 additions and 0 deletions

View file

@ -68,6 +68,7 @@ func customModuleFactory() Module {
}
func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testing.T) {
t.Parallel()
bp := `
custom {
name: "foo",
@ -103,6 +104,7 @@ func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testin
}
func TestGetDistForGoals(t *testing.T) {
t.Parallel()
testCases := []struct {
bp string
expectedAndroidMkLines []string

View file

@ -20,6 +20,7 @@ import (
)
func Test_mergeApexVariations(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in []ApexInfo

View file

@ -36,6 +36,7 @@ type NamedNoneFiltered struct {
}
func TestFilterArchStruct(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in interface{}
@ -274,6 +275,7 @@ func archTestModuleFactory() Module {
}
func TestArchMutator(t *testing.T) {
t.Parallel()
var buildOSVariants []string
var buildOS32Variants []string
switch runtime.GOOS {
@ -385,6 +387,7 @@ func TestArchMutator(t *testing.T) {
}
func TestArchMutatorNativeBridge(t *testing.T) {
t.Parallel()
bp := `
// This module is only enabled for x86.
module {

View file

@ -58,6 +58,7 @@ func (c *configType) SetDefaultConfig() {
// tests that ValidateConfigAnnotation works
func TestValidateConfigAnnotations(t *testing.T) {
t.Parallel()
config := configType{}
err := validateConfigAnnotations(&config)
expectedError := `Field configType.PopulateMe has tag json:"omitempty" which specifies to change its json field name to "omitempty".
@ -74,6 +75,7 @@ Did you mean to use an annotation of ",omitempty"?
// run validateConfigAnnotations against each type that might have json annotations
func TestProductConfigAnnotations(t *testing.T) {
t.Parallel()
err := validateConfigAnnotations(&productVariables{})
if err != nil {
t.Errorf(err.Error())
@ -86,6 +88,7 @@ func TestProductConfigAnnotations(t *testing.T) {
}
func TestMissingVendorConfig(t *testing.T) {
t.Parallel()
c := &config{}
if c.VendorConfig("test").Bool("not_set") {
t.Errorf("Expected false")

View file

@ -32,6 +32,7 @@ func testCSuiteConfig(test *testing.T, bpFileContents string) *TestContext {
}
func TestCSuiteConfig(t *testing.T) {
t.Parallel()
ctx := testCSuiteConfig(t, `
csuite_config { name: "plain"}
csuite_config { name: "with_manifest", test_config: "manifest.xml" }

View file

@ -59,6 +59,7 @@ func defaultsTestDefaultsFactory() Module {
}
func TestDefaults(t *testing.T) {
t.Parallel()
bp := `
defaults {
name: "transitive",
@ -102,6 +103,7 @@ func TestDefaults(t *testing.T) {
}
func TestDefaultsAllowMissingDependencies(t *testing.T) {
t.Parallel()
bp := `
defaults {
name: "defaults",

View file

@ -64,6 +64,7 @@ func ExampleDepSet_ToSortedList() {
// Tests based on Bazel's ExpanderTestBase.java to ensure compatibility
// https://github.com/bazelbuild/bazel/blob/master/src/test/java/com/google/devtools/build/lib/collect/nestedset/ExpanderTestBase.java
func TestDepSet(t *testing.T) {
t.Parallel()
a := PathForTesting("a")
b := PathForTesting("b")
c := PathForTesting("c")
@ -274,6 +275,7 @@ func TestDepSet(t *testing.T) {
}
func TestDepSetInvalidOrder(t *testing.T) {
t.Parallel()
orders := []DepSetOrder{POSTORDER, PREORDER, TOPOLOGICAL}
run := func(t *testing.T, order1, order2 DepSetOrder) {

View file

@ -163,6 +163,7 @@ var expandTestCases = []struct {
}
func TestExpand(t *testing.T) {
t.Parallel()
for _, test := range expandTestCases {
got, err := Expand(test.in, func(s string) (string, error) {
s, _, err := expander(s)
@ -179,6 +180,7 @@ func TestExpand(t *testing.T) {
}
func TestExpandNinjaEscaped(t *testing.T) {
t.Parallel()
for _, test := range expandTestCases {
got, err := ExpandNinjaEscaped(test.in, expander)
if err != nil && !test.err {

View file

@ -19,6 +19,7 @@ import (
)
func TestSrcIsModule(t *testing.T) {
t.Parallel()
type args struct {
s string
}
@ -66,6 +67,7 @@ func TestSrcIsModule(t *testing.T) {
}
func TestSrcIsModuleWithTag(t *testing.T) {
t.Parallel()
type args struct {
s string
}
@ -164,6 +166,7 @@ func depsModuleFactory() Module {
}
func TestErrorDependsOnDisabledModule(t *testing.T) {
t.Parallel()
ctx := NewTestContext()
ctx.RegisterModuleType("deps", depsModuleFactory)

View file

@ -59,6 +59,7 @@ func addMissingDependenciesMutator(ctx TopDownMutatorContext) {
}
func TestMutatorAddMissingDependencies(t *testing.T) {
t.Parallel()
bp := `
test {
name: "foo",
@ -92,6 +93,7 @@ func TestMutatorAddMissingDependencies(t *testing.T) {
}
func TestModuleString(t *testing.T) {
t.Parallel()
ctx := NewTestContext()
var moduleStrings []string
@ -190,6 +192,7 @@ func TestModuleString(t *testing.T) {
}
func TestFinalDepsPhase(t *testing.T) {
t.Parallel()
ctx := NewTestContext()
finalGot := map[string]int{}
@ -267,6 +270,7 @@ func TestFinalDepsPhase(t *testing.T) {
}
func TestNoCreateVariationsInFinalDeps(t *testing.T) {
t.Parallel()
ctx := NewTestContext()
checkErr := func() {

View file

@ -24,6 +24,7 @@ import (
)
func TestDependingOnModuleInSameNamespace(t *testing.T) {
t.Parallel()
ctx := setupTest(t,
map[string]string{
"dir1": `
@ -48,6 +49,7 @@ func TestDependingOnModuleInSameNamespace(t *testing.T) {
}
func TestDependingOnModuleInRootNamespace(t *testing.T) {
t.Parallel()
ctx := setupTest(t,
map[string]string{
".": `
@ -70,6 +72,7 @@ func TestDependingOnModuleInRootNamespace(t *testing.T) {
}
func TestImplicitlyImportRootNamespace(t *testing.T) {
t.Parallel()
_ = setupTest(t,
map[string]string{
".": `
@ -92,6 +95,7 @@ func TestImplicitlyImportRootNamespace(t *testing.T) {
}
func TestDependingOnBlueprintModuleInRootNamespace(t *testing.T) {
t.Parallel()
_ = setupTest(t,
map[string]string{
".": `
@ -114,6 +118,7 @@ func TestDependingOnBlueprintModuleInRootNamespace(t *testing.T) {
}
func TestDependingOnModuleInImportedNamespace(t *testing.T) {
t.Parallel()
ctx := setupTest(t,
map[string]string{
"dir1": `
@ -143,6 +148,7 @@ func TestDependingOnModuleInImportedNamespace(t *testing.T) {
}
func TestDependingOnModuleInNonImportedNamespace(t *testing.T) {
t.Parallel()
_, errs := setupTestExpectErrs(
map[string]string{
"dir1": `
@ -183,6 +189,7 @@ Module "a" can be found in these namespaces: ["dir1" "dir2"]`),
}
func TestDependingOnModuleByFullyQualifiedReference(t *testing.T) {
t.Parallel()
ctx := setupTest(t,
map[string]string{
"dir1": `
@ -210,6 +217,7 @@ func TestDependingOnModuleByFullyQualifiedReference(t *testing.T) {
}
func TestSameNameInTwoNamespaces(t *testing.T) {
t.Parallel()
ctx := setupTest(t,
map[string]string{
"dir1": `
@ -260,6 +268,7 @@ func TestSameNameInTwoNamespaces(t *testing.T) {
}
func TestSearchOrder(t *testing.T) {
t.Parallel()
ctx := setupTest(t,
map[string]string{
"dir1": `
@ -348,6 +357,7 @@ func TestSearchOrder(t *testing.T) {
}
func TestTwoNamespacesCanImportEachOther(t *testing.T) {
t.Parallel()
_ = setupTest(t,
map[string]string{
"dir1": `
@ -378,6 +388,7 @@ func TestTwoNamespacesCanImportEachOther(t *testing.T) {
}
func TestImportingNonexistentNamespace(t *testing.T) {
t.Parallel()
_, errs := setupTestExpectErrs(
map[string]string{
"dir1": `
@ -402,6 +413,7 @@ func TestImportingNonexistentNamespace(t *testing.T) {
}
func TestNamespacesDontInheritParentNamespaces(t *testing.T) {
t.Parallel()
_, errs := setupTestExpectErrs(
map[string]string{
"dir1": `
@ -433,6 +445,7 @@ Module "a" can be found in these namespaces: ["dir1"]`),
}
func TestModulesDoReceiveParentNamespace(t *testing.T) {
t.Parallel()
_ = setupTest(t,
map[string]string{
"dir1": `
@ -455,6 +468,7 @@ func TestModulesDoReceiveParentNamespace(t *testing.T) {
}
func TestNamespaceImportsNotTransitive(t *testing.T) {
t.Parallel()
_, errs := setupTestExpectErrs(
map[string]string{
"dir1": `
@ -496,6 +510,7 @@ Module "a" can be found in these namespaces: ["dir1"]`),
}
func TestTwoNamepacesInSameDir(t *testing.T) {
t.Parallel()
_, errs := setupTestExpectErrs(
map[string]string{
"dir1": `
@ -516,6 +531,7 @@ func TestTwoNamepacesInSameDir(t *testing.T) {
}
func TestNamespaceNotAtTopOfFile(t *testing.T) {
t.Parallel()
_, errs := setupTestExpectErrs(
map[string]string{
"dir1": `
@ -537,6 +553,7 @@ func TestNamespaceNotAtTopOfFile(t *testing.T) {
}
func TestTwoModulesWithSameNameInSameNamespace(t *testing.T) {
t.Parallel()
_, errs := setupTestExpectErrs(
map[string]string{
"dir1": `
@ -562,6 +579,7 @@ func TestTwoModulesWithSameNameInSameNamespace(t *testing.T) {
}
func TestDeclaringNamespaceInNonAndroidBpFile(t *testing.T) {
t.Parallel()
_, errs := setupTestFromFiles(
map[string][]byte{
"Android.bp": []byte(`
@ -585,6 +603,7 @@ func TestDeclaringNamespaceInNonAndroidBpFile(t *testing.T) {
// so that the generated .ninja file will have consistent names
func TestConsistentNamespaceNames(t *testing.T) {
t.Parallel()
ctx := setupTest(t,
map[string]string{
"dir1": "soong_namespace{}",
@ -604,6 +623,7 @@ func TestConsistentNamespaceNames(t *testing.T) {
// so that the generated .ninja file will have consistent names
func TestRename(t *testing.T) {
t.Parallel()
_ = setupTest(t,
map[string]string{
"dir1": `

View file

@ -343,6 +343,7 @@ var neverallowTests = []struct {
}
func TestNeverallow(t *testing.T) {
t.Parallel()
for _, test := range neverallowTests {
// Create a test per config to allow for test specific config, e.g. test rules.
config := TestConfig(buildDir, nil, "", test.fs)

View file

@ -20,6 +20,7 @@ import (
)
func TestOncePer_Once(t *testing.T) {
t.Parallel()
once := OncePer{}
key := NewOnceKey("key")
@ -36,6 +37,7 @@ func TestOncePer_Once(t *testing.T) {
}
func TestOncePer_Once_wait(t *testing.T) {
t.Parallel()
once := OncePer{}
key := NewOnceKey("key")
@ -51,6 +53,7 @@ func TestOncePer_Once_wait(t *testing.T) {
}
func TestOncePer_Get(t *testing.T) {
t.Parallel()
once := OncePer{}
key := NewOnceKey("key")
@ -67,6 +70,7 @@ func TestOncePer_Get(t *testing.T) {
}
func TestOncePer_Get_panic(t *testing.T) {
t.Parallel()
once := OncePer{}
key := NewOnceKey("key")
@ -82,6 +86,7 @@ func TestOncePer_Get_panic(t *testing.T) {
}
func TestOncePer_Get_wait(t *testing.T) {
t.Parallel()
once := OncePer{}
key := NewOnceKey("key")
@ -97,6 +102,7 @@ func TestOncePer_Get_wait(t *testing.T) {
}
func TestOncePer_OnceStringSlice(t *testing.T) {
t.Parallel()
once := OncePer{}
key := NewOnceKey("key")
@ -113,6 +119,7 @@ func TestOncePer_OnceStringSlice(t *testing.T) {
}
func TestOncePer_Once2StringSlice(t *testing.T) {
t.Parallel()
once := OncePer{}
key := NewOnceKey("key")
@ -129,6 +136,7 @@ func TestOncePer_Once2StringSlice(t *testing.T) {
}
func TestNewOnceKey(t *testing.T) {
t.Parallel()
once := OncePer{}
key1 := NewOnceKey("key")
key2 := NewOnceKey("key")
@ -146,6 +154,7 @@ func TestNewOnceKey(t *testing.T) {
}
func TestNewCustomOnceKey(t *testing.T) {
t.Parallel()
type key struct {
key string
}
@ -166,6 +175,7 @@ func TestNewCustomOnceKey(t *testing.T) {
}
func TestOncePerReentrant(t *testing.T) {
t.Parallel()
once := OncePer{}
key1 := NewOnceKey("key")
key2 := NewOnceKey("key")
@ -178,6 +188,7 @@ func TestOncePerReentrant(t *testing.T) {
// Test that a recovered panic in a Once function doesn't deadlock
func TestOncePerPanic(t *testing.T) {
t.Parallel()
once := OncePer{}
key := NewOnceKey("key")

View file

@ -56,6 +56,7 @@ var packageTests = []struct {
}
func TestPackage(t *testing.T) {
t.Parallel()
for _, test := range packageTests {
t.Run(test.name, func(t *testing.T) {
_, errs := testPackage(test.fs)

View file

@ -59,6 +59,7 @@ func (p *pathDepsMutatorTestModule) GenerateAndroidBuildActions(ctx ModuleContex
}
func TestPathDepsMutator(t *testing.T) {
t.Parallel()
tests := []struct {
name string
bp string

View file

@ -110,6 +110,7 @@ var validatePathTestCases = append(commonValidatePathTestCases, []strsTestCase{
}...)
func TestValidateSafePath(t *testing.T) {
t.Parallel()
for _, testCase := range validateSafePathTestCases {
t.Run(strings.Join(testCase.in, ","), func(t *testing.T) {
ctx := &configErrorWrapper{}
@ -123,6 +124,7 @@ func TestValidateSafePath(t *testing.T) {
}
func TestValidatePath(t *testing.T) {
t.Parallel()
for _, testCase := range validatePathTestCases {
t.Run(strings.Join(testCase.in, ","), func(t *testing.T) {
ctx := &configErrorWrapper{}
@ -136,6 +138,7 @@ func TestValidatePath(t *testing.T) {
}
func TestOptionalPath(t *testing.T) {
t.Parallel()
var path OptionalPath
checkInvalidOptionalPath(t, path)
@ -253,6 +256,7 @@ func pathTestConfig(buildDir string) Config {
}
func TestPathForModuleInstall(t *testing.T) {
t.Parallel()
testConfig := pathTestConfig("")
hostTarget := Target{Os: Linux, Arch: Arch{ArchType: X86}}
@ -657,6 +661,7 @@ func TestPathForModuleInstall(t *testing.T) {
}
func TestDirectorySortedPaths(t *testing.T) {
t.Parallel()
config := TestConfig("out", nil, "", map[string][]byte{
"Android.bp": nil,
"a.txt": nil,
@ -739,6 +744,7 @@ func TestDirectorySortedPaths(t *testing.T) {
}
func TestMaybeRel(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
base string
@ -796,6 +802,7 @@ func TestMaybeRel(t *testing.T) {
}
func TestPathForSource(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
buildDir string
@ -1028,6 +1035,7 @@ func testPathForModuleSrc(t *testing.T, buildDir string, tests []pathForModuleSr
}
func TestPathsForModuleSrc(t *testing.T) {
t.Parallel()
tests := []pathForModuleSrcTestCase{
{
name: "path",
@ -1123,6 +1131,7 @@ func TestPathsForModuleSrc(t *testing.T) {
}
func TestPathForModuleSrc(t *testing.T) {
t.Parallel()
tests := []pathForModuleSrcTestCase{
{
name: "path",
@ -1190,6 +1199,7 @@ func TestPathForModuleSrc(t *testing.T) {
}
func TestPathsForModuleSrc_AllowMissingDependencies(t *testing.T) {
t.Parallel()
bp := `
test {
name: "foo",

View file

@ -262,6 +262,7 @@ var prebuiltsTests = []struct {
}
func TestPrebuilts(t *testing.T) {
t.Parallel()
fs := map[string][]byte{
"prebuilt_file": nil,
"source_file": nil,

View file

@ -264,6 +264,7 @@ func ExampleRuleBuilderCommand_NinjaEscapedString() {
}
func TestRuleBuilder(t *testing.T) {
t.Parallel()
fs := map[string][]byte{
"dep_fixer": nil,
"input": nil,
@ -455,6 +456,7 @@ func testRuleBuilder_Build(ctx BuilderContext, in Path, out, outDep, outDir Writ
}
func TestRuleBuilder_Build(t *testing.T) {
t.Parallel()
fs := map[string][]byte{
"bar": nil,
"cp": nil,
@ -546,6 +548,7 @@ func TestRuleBuilder_Build(t *testing.T) {
}
func Test_ninjaEscapeExceptForSpans(t *testing.T) {
t.Parallel()
type args struct {
s string
spans [][2]int

View file

@ -38,6 +38,7 @@ func soongConfigTestModuleFactory() Module {
func (t soongConfigTestModule) GenerateAndroidBuildActions(ModuleContext) {}
func TestSoongConfigModule(t *testing.T) {
t.Parallel()
configBp := `
soong_config_module_type {
name: "acme_test_defaults",

View file

@ -20,6 +20,7 @@ import (
)
func Test_CanonicalizeToProperty(t *testing.T) {
t.Parallel()
tests := []struct {
name string
arg string
@ -66,6 +67,7 @@ func Test_CanonicalizeToProperty(t *testing.T) {
}
func Test_typeForPropertyFromPropertyStruct(t *testing.T) {
t.Parallel()
tests := []struct {
name string
ps interface{}
@ -186,6 +188,7 @@ func Test_typeForPropertyFromPropertyStruct(t *testing.T) {
}
func Test_createAffectablePropertiesType(t *testing.T) {
t.Parallel()
tests := []struct {
name string
affectableProperties []string

View file

@ -60,6 +60,7 @@ var firstUniqueStringsTestCases = []struct {
}
func TestFirstUniqueStrings(t *testing.T) {
t.Parallel()
f := func(t *testing.T, imp func([]string) []string, in, want []string) {
t.Helper()
out := imp(in)
@ -120,6 +121,7 @@ var lastUniqueStringsTestCases = []struct {
}
func TestLastUniqueStrings(t *testing.T) {
t.Parallel()
for _, testCase := range lastUniqueStringsTestCases {
out := LastUniqueStrings(testCase.in)
if !reflect.DeepEqual(out, testCase.out) {
@ -132,6 +134,7 @@ func TestLastUniqueStrings(t *testing.T) {
}
func TestJoinWithPrefix(t *testing.T) {
t.Parallel()
testcases := []struct {
name string
input []string
@ -171,6 +174,7 @@ func TestJoinWithPrefix(t *testing.T) {
}
func TestIndexList(t *testing.T) {
t.Parallel()
input := []string{"a", "b", "c"}
testcases := []struct {
@ -210,6 +214,7 @@ func TestIndexList(t *testing.T) {
}
func TestInList(t *testing.T) {
t.Parallel()
input := []string{"a"}
testcases := []struct {
@ -241,6 +246,7 @@ func TestInList(t *testing.T) {
}
func TestPrefixInList(t *testing.T) {
t.Parallel()
prefixes := []string{"a", "b"}
testcases := []struct {
@ -276,6 +282,7 @@ func TestPrefixInList(t *testing.T) {
}
func TestFilterList(t *testing.T) {
t.Parallel()
input := []string{"a", "b", "c", "c", "b", "d", "a"}
filter := []string{"a", "c"}
remainder, filtered := FilterList(input, filter)
@ -300,6 +307,7 @@ func TestFilterList(t *testing.T) {
}
func TestRemoveListFromList(t *testing.T) {
t.Parallel()
input := []string{"a", "b", "c", "d", "a", "c", "d"}
filter := []string{"a", "c"}
expected := []string{"b", "d", "d"}
@ -314,6 +322,7 @@ func TestRemoveListFromList(t *testing.T) {
}
func TestRemoveFromList(t *testing.T) {
t.Parallel()
testcases := []struct {
name string
key string
@ -417,6 +426,7 @@ func ExampleCopyOf_append() {
}
func TestSplitFileExt(t *testing.T) {
t.Parallel()
t.Run("soname with version", func(t *testing.T) {
root, suffix, ext := SplitFileExt("libtest.so.1.0.30")
expected := "libtest"
@ -482,6 +492,7 @@ func TestSplitFileExt(t *testing.T) {
}
func Test_Shard(t *testing.T) {
t.Parallel()
type args struct {
strings []string
shardSize int

View file

@ -112,6 +112,7 @@ var printfIntoPropertyTestCases = []printfIntoPropertyTestCase{
}
func TestPrintfIntoProperty(t *testing.T) {
t.Parallel()
for _, testCase := range printfIntoPropertyTestCases {
s := testCase.in
v := reflect.ValueOf(&s).Elem()
@ -157,6 +158,7 @@ func testProductVariableModuleFactoryFactory(props interface{}) func() Module {
}
func TestProductVariables(t *testing.T) {
t.Parallel()
ctx := NewTestContext()
// A module type that has a srcs property but not a cflags property.
ctx.RegisterModuleType("module1", testProductVariableModuleFactoryFactory(&struct {
@ -265,6 +267,7 @@ func productVariablesDefaultsTestDefaultsFactory() Module {
// Test a defaults module that supports more product variable properties than the target module.
func TestProductVariablesDefaults(t *testing.T) {
t.Parallel()
bp := `
defaults {
name: "defaults",

View file

@ -1140,6 +1140,7 @@ var visibilityTests = []struct {
}
func TestVisibility(t *testing.T) {
t.Parallel()
for _, test := range visibilityTests {
t.Run(test.name, func(t *testing.T) {
ctx, errs := testVisibility(buildDir, test.fs)

View file

@ -32,6 +32,7 @@ func testVtsConfig(test *testing.T, bpFileContents string) *TestContext {
}
func TestVtsConfig(t *testing.T) {
t.Parallel()
ctx := testVtsConfig(t, `
vts_config { name: "plain"}
vts_config { name: "with_manifest", test_config: "manifest.xml" }

View file

@ -1462,6 +1462,7 @@ runtime_resource_overlay {
}
func TestEndToEnd(t *testing.T) {
t.Parallel()
for i, test := range testCases {
expected, err := bpfix.Reformat(test.expected)
if err != nil {

View file

@ -89,6 +89,7 @@ var splitNTestCases = []struct {
}
func TestMakeStringSplitN(t *testing.T) {
t.Parallel()
for _, test := range splitNTestCases {
got := test.in.SplitN(test.sep, test.n)
gotString := dumpArray(got)
@ -118,6 +119,7 @@ var valueTestCases = []struct {
}
func TestMakeStringValue(t *testing.T) {
t.Parallel()
for _, test := range valueTestCases {
got := test.in.Value(nil)
if got != test.expected {
@ -161,6 +163,7 @@ var splitWordsTestCases = []struct {
}
func TestMakeStringWords(t *testing.T) {
t.Parallel()
for _, test := range splitWordsTestCases {
got := test.in.Words()
gotString := dumpArray(got)

View file

@ -37,6 +37,7 @@ var parserTestCases = []struct {
}
func TestParse(t *testing.T) {
t.Parallel()
for _, test := range parserTestCases {
t.Run(test.name, func(t *testing.T) {
p := NewParser(test.name, bytes.NewBufferString(test.in))

View file

@ -345,6 +345,7 @@ func ensureListEmpty(t *testing.T, result []string) {
// Minimal test
func TestBasicApex(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
apex_defaults {
name: "myapex-defaults",
@ -597,6 +598,7 @@ func TestBasicApex(t *testing.T) {
}
func TestDefaults(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex_defaults {
name: "myapex-defaults",
@ -671,6 +673,7 @@ func TestDefaults(t *testing.T) {
}
func TestApexManifest(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -692,6 +695,7 @@ func TestApexManifest(t *testing.T) {
}
func TestBasicZipApex(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -742,6 +746,7 @@ func TestBasicZipApex(t *testing.T) {
}
func TestApexWithStubs(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -934,6 +939,7 @@ func TestApexWithStubsWithMinSdkVersion(t *testing.T) {
}
func TestApexWithExplicitStubsDependency(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex2",
@ -1021,6 +1027,7 @@ func TestApexWithExplicitStubsDependency(t *testing.T) {
}
func TestApexWithRuntimeLibsDependency(t *testing.T) {
t.Parallel()
/*
myapex
|
@ -1090,6 +1097,7 @@ func TestApexWithRuntimeLibsDependency(t *testing.T) {
}
func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, "", func(fs map[string][]byte, config android.Config) {
bp := `
apex {
@ -1153,6 +1161,7 @@ func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) {
}
func TestRuntimeApexShouldInstallHwasanIfHwaddressSanitized(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, "", func(fs map[string][]byte, config android.Config) {
bp := `
apex {
@ -1214,6 +1223,7 @@ func TestRuntimeApexShouldInstallHwasanIfHwaddressSanitized(t *testing.T) {
}
func TestApexDependsOnLLNDKTransitively(t *testing.T) {
t.Parallel()
testcases := []struct {
name string
minSdkVersion string
@ -1303,6 +1313,7 @@ func TestApexDependsOnLLNDKTransitively(t *testing.T) {
}
func TestApexWithSystemLibsStubs(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -1393,6 +1404,7 @@ func TestApexWithSystemLibsStubs(t *testing.T) {
}
func TestApexMinSdkVersion_NativeModulesShouldBeBuiltAgainstStubs(t *testing.T) {
t.Parallel()
// there are three links between liba --> libz
// 1) myapex -> libx -> liba -> libz : this should be #29 link, but fallback to #28
// 2) otherapex -> liby -> liba -> libz : this should be #30 link
@ -1479,6 +1491,7 @@ func TestApexMinSdkVersion_NativeModulesShouldBeBuiltAgainstStubs(t *testing.T)
}
func TestApexMinSdkVersion_SupportsCodeNames(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -1528,6 +1541,7 @@ func TestApexMinSdkVersion_SupportsCodeNames(t *testing.T) {
}
func TestApexMinSdkVersion_DefaultsToLatest(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -1573,6 +1587,7 @@ func TestApexMinSdkVersion_DefaultsToLatest(t *testing.T) {
}
func TestPlatformUsesLatestStubsFromApexes(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -1620,6 +1635,7 @@ func TestPlatformUsesLatestStubsFromApexes(t *testing.T) {
}
func TestQApexesUseLatestStubsInBundledBuildsAndHWASAN(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -1659,6 +1675,7 @@ func TestQApexesUseLatestStubsInBundledBuildsAndHWASAN(t *testing.T) {
}
func TestQTargetApexUsesStaticUnwinder(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -1689,6 +1706,7 @@ func TestQTargetApexUsesStaticUnwinder(t *testing.T) {
}
func TestApexMinSdkVersion_ErrorIfIncompatibleStubs(t *testing.T) {
t.Parallel()
testApexError(t, `"libz" .*: not found a version\(<=29\)`, `
apex {
name: "myapex",
@ -1724,6 +1742,7 @@ func TestApexMinSdkVersion_ErrorIfIncompatibleStubs(t *testing.T) {
}
func TestApexMinSdkVersion_ErrorIfIncompatibleVersion(t *testing.T) {
t.Parallel()
testApexError(t, `module "mylib".*: should support min_sdk_version\(29\)`, `
apex {
name: "myapex",
@ -1752,6 +1771,7 @@ func TestApexMinSdkVersion_ErrorIfIncompatibleVersion(t *testing.T) {
}
func TestApexMinSdkVersion_Okay(t *testing.T) {
t.Parallel()
testApex(t, `
apex {
name: "myapex",
@ -1802,6 +1822,7 @@ func TestApexMinSdkVersion_Okay(t *testing.T) {
}
func TestJavaStableSdkVersion(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
expectedError string
@ -1919,6 +1940,7 @@ func TestJavaStableSdkVersion(t *testing.T) {
}
func TestApexMinSdkVersion_ErrorIfDepIsNewer(t *testing.T) {
t.Parallel()
testApexError(t, `module "mylib2".*: should support min_sdk_version\(29\) for "myapex"`, `
apex {
name: "myapex",
@ -1960,6 +1982,7 @@ func TestApexMinSdkVersion_ErrorIfDepIsNewer(t *testing.T) {
}
func TestApexMinSdkVersion_ErrorIfDepIsNewer_Java(t *testing.T) {
t.Parallel()
testApexError(t, `module "bar".*: should support min_sdk_version\(29\) for "myapex"`, `
apex {
name: "myapex",
@ -1995,6 +2018,7 @@ func TestApexMinSdkVersion_ErrorIfDepIsNewer_Java(t *testing.T) {
}
func TestApexMinSdkVersion_OkayEvenWhenDepIsNewer_IfItSatisfiesApexMinSdkVersion(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -2048,6 +2072,7 @@ func TestApexMinSdkVersion_OkayEvenWhenDepIsNewer_IfItSatisfiesApexMinSdkVersion
}
func TestFilesInSubDir(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -2110,6 +2135,7 @@ func TestFilesInSubDir(t *testing.T) {
}
func TestFilesInSubDirWhenNativeBridgeEnabled(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -2168,6 +2194,7 @@ func TestFilesInSubDirWhenNativeBridgeEnabled(t *testing.T) {
}
func TestUseVendor(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -2222,6 +2249,7 @@ func TestUseVendor(t *testing.T) {
}
func TestUseVendorNotAllowedForSystemApexes(t *testing.T) {
t.Parallel()
testApexError(t, `module "myapex" .*: use_vendor: not allowed`, `
apex {
name: "myapex",
@ -2254,6 +2282,7 @@ func TestUseVendorNotAllowedForSystemApexes(t *testing.T) {
}
func TestUseVendorFailsIfNotVendorAvailable(t *testing.T) {
t.Parallel()
testApexError(t, `dependency "mylib" of "myapex" missing variant:\n.*image:vendor`, `
apex {
name: "myapex",
@ -2278,6 +2307,7 @@ func TestUseVendorFailsIfNotVendorAvailable(t *testing.T) {
}
func TestVendorApex(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@ -2323,6 +2353,7 @@ func TestVendorApex(t *testing.T) {
}
func TestVendorApex_use_vndk_as_stable(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -2376,6 +2407,7 @@ func TestVendorApex_use_vndk_as_stable(t *testing.T) {
}
func TestApex_withPrebuiltFirmware(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
additionalProp string
@ -2412,6 +2444,7 @@ func TestApex_withPrebuiltFirmware(t *testing.T) {
}
func TestAndroidMk_UseVendorRequired(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@ -2446,6 +2479,7 @@ func TestAndroidMk_UseVendorRequired(t *testing.T) {
}
func TestAndroidMk_VendorApexRequired(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@ -2477,6 +2511,7 @@ func TestAndroidMk_VendorApexRequired(t *testing.T) {
}
func TestAndroidMkWritesCommonProperties(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@ -2506,6 +2541,7 @@ func TestAndroidMkWritesCommonProperties(t *testing.T) {
}
func TestStaticLinking(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -2550,6 +2586,7 @@ func TestStaticLinking(t *testing.T) {
}
func TestKeys(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex_keytest",
@ -2606,6 +2643,7 @@ func TestKeys(t *testing.T) {
}
func TestCertificate(t *testing.T) {
t.Parallel()
t.Run("if unspecified, it defaults to DefaultAppCertificate", func(t *testing.T) {
ctx, _ := testApex(t, `
apex {
@ -2734,6 +2772,7 @@ func TestCertificate(t *testing.T) {
}
func TestMacro(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -2861,6 +2900,7 @@ func TestMacro(t *testing.T) {
}
func TestHeaderLibsDependency(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -3004,6 +3044,7 @@ func ensureExactContents(t *testing.T, ctx *android.TestContext, moduleName, var
}
func TestVndkApexCurrent(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex",
@ -3057,6 +3098,7 @@ func TestVndkApexCurrent(t *testing.T) {
}
func TestVndkApexWithPrebuilt(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex",
@ -3139,6 +3181,7 @@ func vndkLibrariesTxtFiles(vers ...string) (result string) {
}
func TestVndkApexVersion(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex_v27",
@ -3205,6 +3248,7 @@ func TestVndkApexVersion(t *testing.T) {
}
func TestVndkApexErrorWithDuplicateVersion(t *testing.T) {
t.Parallel()
testApexError(t, `module "myapex_v27.*" .*: vndk_version: 27 is already defined in "myapex_v27.*"`, `
apex_vndk {
name: "myapex_v27",
@ -3251,6 +3295,7 @@ func TestVndkApexErrorWithDuplicateVersion(t *testing.T) {
}
func TestVndkApexNameRule(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex",
@ -3282,6 +3327,7 @@ func TestVndkApexNameRule(t *testing.T) {
}
func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex",
@ -3320,6 +3366,7 @@ func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) {
}
func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) {
t.Parallel()
testApexError(t, `module "myapex" .*: native_bridge_supported: .* doesn't support native bridge binary`, `
apex_vndk {
name: "myapex",
@ -3350,6 +3397,7 @@ func TestVndkApexDoesntSupportNativeBridgeSupported(t *testing.T) {
}
func TestVndkApexWithBinder32(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex_v27",
@ -3416,6 +3464,7 @@ func TestVndkApexWithBinder32(t *testing.T) {
}
func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex",
@ -3450,6 +3499,7 @@ func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) {
}
func TestDependenciesInApexManifest(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex_nodep",
@ -3554,6 +3604,7 @@ func TestDependenciesInApexManifest(t *testing.T) {
}
func TestApexName(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@ -3598,6 +3649,7 @@ func TestApexName(t *testing.T) {
}
func TestNonTestApex(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -3650,6 +3702,7 @@ func TestNonTestApex(t *testing.T) {
}
func TestTestApex(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex_test {
name: "myapex",
@ -3698,6 +3751,7 @@ func TestTestApex(t *testing.T) {
}
func TestApexWithTarget(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -3788,6 +3842,7 @@ func TestApexWithTarget(t *testing.T) {
}
func TestApexWithShBinary(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -3816,6 +3871,7 @@ func TestApexWithShBinary(t *testing.T) {
}
func TestApexInVariousPartition(t *testing.T) {
t.Parallel()
testcases := []struct {
propName, parition, flattenedPartition string
}{
@ -3860,6 +3916,7 @@ func TestApexInVariousPartition(t *testing.T) {
}
func TestFileContexts_FindInDefaultLocationIfNotSet(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -3878,6 +3935,7 @@ func TestFileContexts_FindInDefaultLocationIfNotSet(t *testing.T) {
}
func TestFileContexts_ShouldBeUnderSystemSepolicyForSystemApexes(t *testing.T) {
t.Parallel()
testApexError(t, `"myapex" .*: file_contexts: should be under system/sepolicy`, `
apex {
name: "myapex",
@ -3896,6 +3954,7 @@ func TestFileContexts_ShouldBeUnderSystemSepolicyForSystemApexes(t *testing.T) {
}
func TestFileContexts_ProductSpecificApexes(t *testing.T) {
t.Parallel()
testApexError(t, `"myapex" .*: file_contexts: cannot find`, `
apex {
name: "myapex",
@ -3933,6 +3992,7 @@ func TestFileContexts_ProductSpecificApexes(t *testing.T) {
}
func TestFileContexts_SetViaFileGroup(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -3960,6 +4020,7 @@ func TestFileContexts_SetViaFileGroup(t *testing.T) {
}
func TestApexKeyFromOtherModule(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex_key {
name: "myapex.key",
@ -3993,6 +4054,7 @@ func TestApexKeyFromOtherModule(t *testing.T) {
}
func TestPrebuilt(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
prebuilt_apex {
name: "myapex",
@ -4016,6 +4078,7 @@ func TestPrebuilt(t *testing.T) {
}
func TestPrebuiltFilenameOverride(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
prebuilt_apex {
name: "myapex",
@ -4033,6 +4096,7 @@ func TestPrebuiltFilenameOverride(t *testing.T) {
}
func TestPrebuiltOverrides(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
prebuilt_apex {
name: "myapex.prebuilt",
@ -4053,6 +4117,7 @@ func TestPrebuiltOverrides(t *testing.T) {
}
func TestApexWithTests(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
apex_test {
name: "myapex",
@ -4164,6 +4229,7 @@ func TestApexWithTests(t *testing.T) {
}
func TestInstallExtraFlattenedApexes(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@ -4187,6 +4253,7 @@ func TestInstallExtraFlattenedApexes(t *testing.T) {
}
func TestApexUsesOtherApex(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -4247,6 +4314,7 @@ func TestApexUsesOtherApex(t *testing.T) {
}
func TestApexUsesFailsIfNotProvided(t *testing.T) {
t.Parallel()
testApexError(t, `uses: "commonapex" does not provide native_shared_libs`, `
apex {
name: "myapex",
@ -4287,6 +4355,7 @@ func TestApexUsesFailsIfNotProvided(t *testing.T) {
}
func TestApexUsesFailsIfUseVenderMismatch(t *testing.T) {
t.Parallel()
testApexError(t, `use_vendor: "commonapex" has different value of use_vendor`, `
apex {
name: "myapex",
@ -4312,6 +4381,7 @@ func TestApexUsesFailsIfUseVenderMismatch(t *testing.T) {
}
func TestErrorsIfDepsAreNotEnabled(t *testing.T) {
t.Parallel()
testApexError(t, `module "myapex" .* depends on disabled module "libfoo"`, `
apex {
name: "myapex",
@ -4358,6 +4428,7 @@ func TestErrorsIfDepsAreNotEnabled(t *testing.T) {
}
func TestApexWithApps(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -4436,6 +4507,7 @@ func TestApexWithApps(t *testing.T) {
}
func TestApexWithAppImports(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -4484,6 +4556,7 @@ func TestApexWithAppImports(t *testing.T) {
}
func TestApexWithAppImportsPrefer(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -4525,6 +4598,7 @@ func TestApexWithAppImportsPrefer(t *testing.T) {
}
func TestApexWithTestHelperApp(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -4556,6 +4630,7 @@ func TestApexWithTestHelperApp(t *testing.T) {
}
func TestApexPropertiesShouldBeDefaultable(t *testing.T) {
t.Parallel()
// libfoo's apex_available comes from cc_defaults
testApexError(t, `requires "libfoo" that is not available for the APEX`, `
apex {
@ -4590,6 +4665,7 @@ func TestApexPropertiesShouldBeDefaultable(t *testing.T) {
}
func TestApexAvailable_DirectDep(t *testing.T) {
t.Parallel()
// libfoo is not available to myapex, but only to otherapex
testApexError(t, "requires \"libfoo\" that is not available for the APEX", `
apex {
@ -4625,6 +4701,7 @@ func TestApexAvailable_DirectDep(t *testing.T) {
}
func TestApexAvailable_IndirectDep(t *testing.T) {
t.Parallel()
// libbbaz is an indirect dep
testApexError(t, `requires "libbaz" that is not available for the APEX. Dependency path:
.*via tag apex\.dependencyTag.*name:sharedLib.*
@ -4669,6 +4746,7 @@ func TestApexAvailable_IndirectDep(t *testing.T) {
}
func TestApexAvailable_InvalidApexName(t *testing.T) {
t.Parallel()
testApexError(t, "\"otherapex\" is not a valid module name", `
apex {
name: "myapex",
@ -4728,6 +4806,7 @@ func TestApexAvailable_InvalidApexName(t *testing.T) {
}
func TestApexAvailable_CheckForPlatform(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -4790,6 +4869,7 @@ func TestApexAvailable_CheckForPlatform(t *testing.T) {
}
func TestApexAvailable_CreatedForApex(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -4824,6 +4904,7 @@ func TestApexAvailable_CreatedForApex(t *testing.T) {
}
func TestOverrideApex(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@ -4907,6 +4988,7 @@ func TestOverrideApex(t *testing.T) {
}
func TestLegacyAndroid10Support(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -4962,6 +5044,7 @@ var filesForSdkLibrary = map[string][]byte{
}
func TestJavaSDKLibrary(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -4994,6 +5077,7 @@ func TestJavaSDKLibrary(t *testing.T) {
}
func TestJavaSDKLibrary_WithinApex(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -5041,6 +5125,7 @@ func TestJavaSDKLibrary_WithinApex(t *testing.T) {
}
func TestJavaSDKLibrary_CrossBoundary(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -5086,6 +5171,7 @@ func TestJavaSDKLibrary_CrossBoundary(t *testing.T) {
}
func TestJavaSDKLibrary_ImportPreferred(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, ``,
withFiles(map[string][]byte{
"apex/a.java": nil,
@ -5171,6 +5257,7 @@ func TestJavaSDKLibrary_ImportPreferred(t *testing.T) {
}
func TestJavaSDKLibrary_ImportOnly(t *testing.T) {
t.Parallel()
testApexError(t, `java_libs: "foo" is not configured to be compiled into dex`, `
apex {
name: "myapex",
@ -5197,6 +5284,7 @@ func TestJavaSDKLibrary_ImportOnly(t *testing.T) {
}
func TestCompatConfig(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -5231,6 +5319,7 @@ func TestCompatConfig(t *testing.T) {
}
func TestRejectNonInstallableJavaLibrary(t *testing.T) {
t.Parallel()
testApexError(t, `"myjar" is not configured to be compiled into dex`, `
apex {
name: "myapex",
@ -5256,6 +5345,7 @@ func TestRejectNonInstallableJavaLibrary(t *testing.T) {
}
func TestCarryRequiredModuleNames(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@ -5294,6 +5384,7 @@ func TestCarryRequiredModuleNames(t *testing.T) {
}
func TestSymlinksFromApexToSystem(t *testing.T) {
t.Parallel()
bp := `
apex {
name: "myapex",
@ -5423,6 +5514,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
}
func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
apex {
name: "myapex",
@ -5474,6 +5566,7 @@ func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) {
}
func TestApexWithJniLibs(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -5515,6 +5608,7 @@ func TestApexWithJniLibs(t *testing.T) {
}
func TestApexMutatorsDontRunIfDisabled(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -5536,6 +5630,7 @@ func TestApexMutatorsDontRunIfDisabled(t *testing.T) {
}
func TestAppBundle(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -5566,6 +5661,7 @@ func TestAppBundle(t *testing.T) {
}
func TestAppSetBundle(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -5740,6 +5836,7 @@ func testNoUpdatableJarsInBootImage(t *testing.T, errmsg string, transformDexpre
}
func TestUpdatable_should_set_min_sdk_version(t *testing.T) {
t.Parallel()
testApexError(t, `"myapex" .*: updatable: updatable APEXes should set min_sdk_version`, `
apex {
name: "myapex",
@ -5756,6 +5853,7 @@ func TestUpdatable_should_set_min_sdk_version(t *testing.T) {
}
func TestNoUpdatableJarsInBootImage(t *testing.T) {
t.Parallel()
var err string
var transform func(*dexpreopt.GlobalConfig)
@ -5892,6 +5990,7 @@ func testApexPermittedPackagesRules(t *testing.T, errmsg, bp string, apexBootJar
}
func TestApexPermittedPackagesRules(t *testing.T) {
t.Parallel()
testcases := []struct {
name string
expectedError string
@ -5975,6 +6074,7 @@ func TestApexPermittedPackagesRules(t *testing.T) {
}
func TestTestFor(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -6032,6 +6132,7 @@ func intPtr(i int) *int {
}
func TestApexSet(t *testing.T) {
t.Parallel()
ctx, config := testApex(t, `
apex_set {
name: "myapex",
@ -6071,6 +6172,7 @@ func TestApexSet(t *testing.T) {
}
func TestNoStaticLinkingToStubsLib(t *testing.T) {
t.Parallel()
testApexError(t, `.*required by "mylib" is a native library providing stub.*`, `
apex {
name: "myapex",
@ -6107,6 +6209,7 @@ func TestNoStaticLinkingToStubsLib(t *testing.T) {
}
func TestApexKeysTxt(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -6147,6 +6250,7 @@ func TestApexKeysTxt(t *testing.T) {
}
func TestAllowedFiles(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex {
name: "myapex",
@ -6202,6 +6306,7 @@ func TestAllowedFiles(t *testing.T) {
}
func TestNonPreferredPrebuiltDependency(t *testing.T) {
t.Parallel()
_, _ = testApex(t, `
apex {
name: "myapex",

View file

@ -9,6 +9,7 @@ import (
)
func TestVndkApexForVndkLite(t *testing.T) {
t.Parallel()
ctx, _ := testApex(t, `
apex_vndk {
name: "myapex",
@ -62,6 +63,7 @@ func TestVndkApexForVndkLite(t *testing.T) {
}
func TestVndkApexUsesVendorVariant(t *testing.T) {
t.Parallel()
bp := `
apex_vndk {
name: "myapex",

View file

@ -66,6 +66,7 @@ func testContext(config android.Config) *android.TestContext {
}
func TestBpfDataDependency(t *testing.T) {
t.Parallel()
bp := `
bpf {
name: "bpf.o",

View file

@ -116,6 +116,7 @@ func implFilterListTest(t *testing.T, local_include_dirs []string, export_includ
}
func TestSimplifyKnownVariablesDuplicatingEachOther(t *testing.T) {
t.Parallel()
// TODO use []Expression{} once buildTree above can support it (which is after b/38325146 is done)
implFilterListTest(t, []string{"include"}, []string{"include"}, nil)
implFilterListTest(t, []string{"include1"}, []string{"include2"}, []string{"include1"})
@ -169,6 +170,7 @@ func runPass(t *testing.T, in, out string, innerTest func(*Fixer) error) {
}
func TestMergeMatchingProperties(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in string
@ -258,6 +260,7 @@ func TestMergeMatchingProperties(t *testing.T) {
}
func TestReorderCommonProperties(t *testing.T) {
t.Parallel()
var tests = []struct {
name string
in string
@ -344,6 +347,7 @@ func TestReorderCommonProperties(t *testing.T) {
}
func TestRemoveMatchingModuleListProperties(t *testing.T) {
t.Parallel()
var tests = []struct {
name string
in string
@ -499,6 +503,7 @@ func TestRemoveMatchingModuleListProperties(t *testing.T) {
}
func TestReplaceJavaStaticLibs(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in string
@ -557,6 +562,7 @@ func TestReplaceJavaStaticLibs(t *testing.T) {
}
func TestRewritePrebuilts(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in string
@ -623,6 +629,7 @@ func TestRewritePrebuilts(t *testing.T) {
}
func TestRewriteCtsModuleTypes(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in string
@ -694,6 +701,7 @@ func TestRewriteCtsModuleTypes(t *testing.T) {
}
func TestRewritePrebuiltEtc(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in string
@ -769,6 +777,7 @@ func TestRewritePrebuiltEtc(t *testing.T) {
}
func TestRewriteAndroidTest(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in string
@ -802,6 +811,7 @@ func TestRewriteAndroidTest(t *testing.T) {
}
func TestRewriteAndroidAppImport(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in string
@ -851,6 +861,7 @@ func TestRewriteAndroidAppImport(t *testing.T) {
}
func TestRemoveEmptyLibDependencies(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in string
@ -905,6 +916,7 @@ func TestRemoveEmptyLibDependencies(t *testing.T) {
}
func TestRemoveHidlInterfaceTypes(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in string
@ -936,6 +948,7 @@ func TestRemoveHidlInterfaceTypes(t *testing.T) {
}
func TestRemoveSoongConfigBoolVariable(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in string
@ -1000,6 +1013,7 @@ func TestRemoveSoongConfigBoolVariable(t *testing.T) {
}
func TestRemovePdkProperty(t *testing.T) {
t.Parallel()
tests := []struct {
name string
in string

View file

@ -128,6 +128,7 @@ const (
)
func TestFuchsiaDeps(t *testing.T) {
t.Parallel()
t.Helper()
bp := `
@ -165,6 +166,7 @@ func TestFuchsiaDeps(t *testing.T) {
}
func TestFuchsiaTargetDecl(t *testing.T) {
t.Parallel()
t.Helper()
bp := `
@ -191,6 +193,7 @@ func TestFuchsiaTargetDecl(t *testing.T) {
}
func TestVendorSrc(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library {
name: "libTest",
@ -321,6 +324,7 @@ func checkVndkLibrariesOutput(t *testing.T, ctx *android.TestContext, module str
}
func TestVndk(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libvndk",
@ -447,6 +451,7 @@ func TestVndk(t *testing.T) {
}
func TestVndkWithHostSupported(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library {
name: "libvndk_host_supported",
@ -481,6 +486,7 @@ func TestVndkWithHostSupported(t *testing.T) {
}
func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
t.Parallel()
bp := `
vndk_libraries_txt {
name: "llndk.libraries.txt",
@ -496,6 +502,7 @@ func TestVndkLibrariesTxtAndroidMk(t *testing.T) {
}
func TestVndkUsingCoreVariant(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libvndk",
@ -543,6 +550,7 @@ func TestVndkUsingCoreVariant(t *testing.T) {
}
func TestDataLibs(t *testing.T) {
t.Parallel()
bp := `
cc_test_library {
name: "test_lib",
@ -593,6 +601,7 @@ func TestDataLibs(t *testing.T) {
}
func TestDataLibsRelativeInstallPath(t *testing.T) {
t.Parallel()
bp := `
cc_test_library {
name: "test_lib",
@ -640,6 +649,7 @@ func TestDataLibsRelativeInstallPath(t *testing.T) {
}
func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
t.Parallel()
ctx := testCcNoVndk(t, `
cc_library {
name: "libvndk",
@ -663,6 +673,7 @@ func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
}
func TestVndkDepError(t *testing.T) {
t.Parallel()
// Check whether an error is emitted when a VNDK lib depends on a system lib.
testCcError(t, "dependency \".*\" of \".*\" missing variant", `
cc_library {
@ -842,6 +853,7 @@ func TestVndkDepError(t *testing.T) {
}
func TestDoubleLoadbleDep(t *testing.T) {
t.Parallel()
// okay to link : LLNDK -> double_loadable VNDK
testCc(t, `
cc_library {
@ -947,6 +959,7 @@ func TestDoubleLoadbleDep(t *testing.T) {
}
func TestVendorSnapshotCapture(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libvndk",
@ -1080,6 +1093,7 @@ func TestVendorSnapshotCapture(t *testing.T) {
}
func TestVendorSnapshotUse(t *testing.T) {
t.Parallel()
frameworkBp := `
cc_library {
name: "libvndk",
@ -1289,6 +1303,7 @@ func TestVendorSnapshotUse(t *testing.T) {
}
func TestVendorSnapshotSanitizer(t *testing.T) {
t.Parallel()
bp := `
vendor_snapshot_static {
name: "libsnapshot",
@ -1329,6 +1344,7 @@ func assertExcludeFromVendorSnapshotIs(t *testing.T, c *Module, expected bool) {
}
func TestVendorSnapshotExclude(t *testing.T) {
t.Parallel()
// This test verifies that the exclude_from_vendor_snapshot property
// makes its way from the Android.bp source file into the module data
@ -1436,6 +1452,7 @@ func TestVendorSnapshotExclude(t *testing.T) {
}
func TestVendorSnapshotExcludeInVendorProprietaryPathErrors(t *testing.T) {
t.Parallel()
// This test verifies that using the exclude_from_vendor_snapshot
// property on a module in a vendor proprietary path generates an
@ -1476,6 +1493,7 @@ func TestVendorSnapshotExcludeInVendorProprietaryPathErrors(t *testing.T) {
}
func TestVendorSnapshotExcludeWithVendorAvailable(t *testing.T) {
t.Parallel()
// This test verifies that using the exclude_from_vendor_snapshot
// property on a module that is vendor available generates an error. A
@ -1519,6 +1537,7 @@ func TestVendorSnapshotExcludeWithVendorAvailable(t *testing.T) {
}
func TestDoubleLoadableDepError(t *testing.T) {
t.Parallel()
// Check whether an error is emitted when a LLNDK depends on a non-double_loadable VNDK lib.
testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double_loadable", `
cc_library {
@ -1639,6 +1658,7 @@ func TestDoubleLoadableDepError(t *testing.T) {
}
func TestVndkExt(t *testing.T) {
t.Parallel()
// This test checks the VNDK-Ext properties.
bp := `
cc_library {
@ -1721,6 +1741,7 @@ func TestVndkExt(t *testing.T) {
}
func TestVndkExtWithoutBoardVndkVersion(t *testing.T) {
t.Parallel()
// This test checks the VNDK-Ext properties when BOARD_VNDK_VERSION is not set.
ctx := testCcNoVndk(t, `
cc_library {
@ -1751,6 +1772,7 @@ func TestVndkExtWithoutBoardVndkVersion(t *testing.T) {
}
func TestVndkExtWithoutProductVndkVersion(t *testing.T) {
t.Parallel()
// This test checks the VNDK-Ext properties when PRODUCT_PRODUCT_VNDK_VERSION is not set.
ctx := testCc(t, `
cc_library {
@ -1781,6 +1803,7 @@ func TestVndkExtWithoutProductVndkVersion(t *testing.T) {
}
func TestVndkExtError(t *testing.T) {
t.Parallel()
// This test ensures an error is emitted in ill-formed vndk-ext definition.
testCcError(t, "must set `vendor: true` or `product_specific: true` to set `extends: \".*\"`", `
cc_library {
@ -1866,6 +1889,7 @@ func TestVndkExtError(t *testing.T) {
}
func TestVndkExtInconsistentSupportSystemProcessError(t *testing.T) {
t.Parallel()
// This test ensures an error is emitted for inconsistent support_system_process.
testCcError(t, "module \".*\" with mismatched support_system_process", `
cc_library {
@ -1913,6 +1937,7 @@ func TestVndkExtInconsistentSupportSystemProcessError(t *testing.T) {
}
func TestVndkExtVendorAvailableFalseError(t *testing.T) {
t.Parallel()
// This test ensures an error is emitted when a VNDK-Ext library extends a VNDK library
// with `vendor_available: false`.
testCcError(t, "`extends` refers module \".*\" which does not have `vendor_available: true`", `
@ -1959,6 +1984,7 @@ func TestVndkExtVendorAvailableFalseError(t *testing.T) {
}
func TestVendorModuleUseVndkExt(t *testing.T) {
t.Parallel()
// This test ensures a vendor module can depend on a VNDK-Ext library.
testCc(t, `
cc_library {
@ -2011,6 +2037,7 @@ func TestVendorModuleUseVndkExt(t *testing.T) {
}
func TestVndkExtUseVendorLib(t *testing.T) {
t.Parallel()
// This test ensures a VNDK-Ext library can depend on a vendor library.
testCc(t, `
cc_library {
@ -2073,6 +2100,7 @@ func TestVndkExtUseVendorLib(t *testing.T) {
}
func TestProductVndkExtDependency(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libvndk",
@ -2138,6 +2166,7 @@ func TestProductVndkExtDependency(t *testing.T) {
}
func TestVndkSpExtUseVndkError(t *testing.T) {
t.Parallel()
// This test ensures an error is emitted if a VNDK-SP-Ext library depends on a VNDK
// library.
testCcError(t, "module \".*\" variant \".*\": \\(.*\\) should not link to \".*\"", `
@ -2220,6 +2249,7 @@ func TestVndkSpExtUseVndkError(t *testing.T) {
}
func TestVndkUseVndkExtError(t *testing.T) {
t.Parallel()
// This test ensures an error is emitted if a VNDK/VNDK-SP library depends on a
// VNDK-Ext/VNDK-SP-Ext library.
testCcError(t, "dependency \".*\" of \".*\" missing variant", `
@ -2359,6 +2389,7 @@ func TestVndkUseVndkExtError(t *testing.T) {
}
func TestEnforceProductVndkVersion(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libllndk",
@ -2433,6 +2464,7 @@ func TestEnforceProductVndkVersion(t *testing.T) {
}
func TestEnforceProductVndkVersionErrors(t *testing.T) {
t.Parallel()
testCcErrorProductVndk(t, "dependency \".*\" of \".*\" missing variant:\n.*image:product.VER", `
cc_library {
name: "libprod",
@ -2513,6 +2545,7 @@ func TestEnforceProductVndkVersionErrors(t *testing.T) {
}
func TestMakeLinkType(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libvndk",
@ -2706,6 +2739,7 @@ var splitListForSizeTestCases = []struct {
}
func TestSplitListForSize(t *testing.T) {
t.Parallel()
for _, testCase := range splitListForSizeTestCases {
out, _ := splitListForSize(android.PathsForTesting(testCase.in...), testCase.size)
@ -2891,6 +2925,7 @@ func parseModuleDeps(text string) (modulesInOrder []android.Path, allDeps map[an
}
func TestLinkReordering(t *testing.T) {
t.Parallel()
for _, testCase := range staticLinkDepOrderTestCases {
errs := []string{}
@ -2953,6 +2988,7 @@ func getOutputPaths(ctx *android.TestContext, variant string, moduleNames []stri
}
func TestStaticLibDepReordering(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library {
name: "a",
@ -2991,6 +3027,7 @@ func TestStaticLibDepReordering(t *testing.T) {
}
func TestStaticLibDepReorderingWithShared(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library {
name: "a",
@ -3037,6 +3074,7 @@ func checkEquals(t *testing.T, message string, expected, actual interface{}) {
}
func TestLlndkLibrary(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library {
name: "libllndk",
@ -3065,6 +3103,7 @@ func TestLlndkLibrary(t *testing.T) {
}
func TestLlndkHeaders(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
llndk_headers {
name: "libllndk_headers",
@ -3158,6 +3197,7 @@ const runtimeLibAndroidBp = `
`
func TestRuntimeLibs(t *testing.T) {
t.Parallel()
ctx := testCc(t, runtimeLibAndroidBp)
// runtime_libs for core variants use the module names without suffixes.
@ -3181,6 +3221,7 @@ func TestRuntimeLibs(t *testing.T) {
}
func TestExcludeRuntimeLibs(t *testing.T) {
t.Parallel()
ctx := testCc(t, runtimeLibAndroidBp)
variant := "android_arm64_armv8-a_shared"
@ -3193,6 +3234,7 @@ func TestExcludeRuntimeLibs(t *testing.T) {
}
func TestRuntimeLibsNoVndk(t *testing.T) {
t.Parallel()
ctx := testCcNoVndk(t, runtimeLibAndroidBp)
// If DeviceVndkVersion is not defined, then runtime_libs are copied as-is.
@ -3230,6 +3272,7 @@ const staticLibAndroidBp = `
`
func TestStaticLibDepExport(t *testing.T) {
t.Parallel()
ctx := testCc(t, staticLibAndroidBp)
// Check the shared version of lib2.
@ -3317,6 +3360,7 @@ func (ctx *mockContext) PropertyErrorf(property, format string, args ...interfac
}
func TestCompilerFlags(t *testing.T) {
t.Parallel()
for _, testCase := range compilerFlagsTestCases {
ctx := &mockContext{result: true}
CheckBadCompilerFlags(ctx, "", []string{testCase.in})
@ -3330,6 +3374,7 @@ func TestCompilerFlags(t *testing.T) {
}
func TestVendorPublicLibraries(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library_headers {
name: "libvendorpublic_headers",
@ -3396,6 +3441,7 @@ func TestVendorPublicLibraries(t *testing.T) {
}
func TestRecovery(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library_shared {
name: "librecovery",
@ -3431,6 +3477,7 @@ func TestRecovery(t *testing.T) {
}
func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
t.Parallel()
bp := `
cc_prebuilt_test_library_shared {
name: "test_lib",
@ -3477,6 +3524,7 @@ func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
}
func TestVersionedStubs(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library_shared {
name: "libFoo",
@ -3541,6 +3589,7 @@ func TestVersionedStubs(t *testing.T) {
}
func TestVersioningMacro(t *testing.T) {
t.Parallel()
for _, tc := range []struct{ moduleName, expected string }{
{"libc", "__LIBC_API__"},
{"libfoo", "__LIBFOO_API__"},
@ -3553,6 +3602,7 @@ func TestVersioningMacro(t *testing.T) {
}
func TestStaticExecutable(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_binary {
name: "static_test",
@ -3578,6 +3628,7 @@ func TestStaticExecutable(t *testing.T) {
}
func TestStaticDepsOrderWithStubs(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_binary {
name: "mybin",
@ -3618,6 +3669,7 @@ func TestStaticDepsOrderWithStubs(t *testing.T) {
}
func TestErrorsIfAModuleDependsOnDisabled(t *testing.T) {
t.Parallel()
testCcError(t, `module "libA" .* depends on disabled module "libB"`, `
cc_library {
name: "libA",
@ -3638,6 +3690,7 @@ func TestErrorsIfAModuleDependsOnDisabled(t *testing.T) {
// Simple smoke test for the cc_fuzz target that ensures the rule compiles
// correctly.
func TestFuzzTarget(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_fuzz {
name: "fuzz_smoke_test",
@ -3649,6 +3702,7 @@ func TestFuzzTarget(t *testing.T) {
}
func TestAidl(t *testing.T) {
t.Parallel()
}
func assertString(t *testing.T, got, expected string) {
@ -3679,6 +3733,7 @@ func assertMapKeys(t *testing.T, m map[string]string, expected []string) {
}
func TestDefaults(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_defaults {
name: "defaults",
@ -3743,6 +3798,7 @@ func TestDefaults(t *testing.T) {
}
func TestProductVariableDefaults(t *testing.T) {
t.Parallel()
bp := `
cc_defaults {
name: "libfoo_defaults",

View file

@ -19,6 +19,7 @@ import (
)
func TestIsThirdParty(t *testing.T) {
t.Parallel()
shouldFail := []string{
"external/foo/",
"vendor/bar/",

View file

@ -19,6 +19,7 @@ import (
)
func TestTidyChecksForDir(t *testing.T) {
t.Parallel()
testCases := []struct {
input string
expected string

View file

@ -21,6 +21,7 @@ import (
)
func TestGen(t *testing.T) {
t.Parallel()
t.Run("simple", func(t *testing.T) {
ctx := testCc(t, `
cc_library_shared {

View file

@ -30,6 +30,7 @@ func testGenruleContext(config android.Config) *android.TestContext {
}
func TestArchGenruleCmd(t *testing.T) {
t.Parallel()
fs := map[string][]byte{
"tool": nil,
"foo": nil,
@ -78,6 +79,7 @@ func TestArchGenruleCmd(t *testing.T) {
}
func TestLibraryGenruleCmd(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libboth",

View file

@ -20,6 +20,7 @@ import (
)
func TestLibraryHeaders(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_library_headers {
name: "headers",
@ -41,6 +42,7 @@ func TestLibraryHeaders(t *testing.T) {
}
func TestPrebuiltLibraryHeaders(t *testing.T) {
t.Parallel()
ctx := testCc(t, `
cc_prebuilt_library_headers {
name: "headers",

View file

@ -22,6 +22,7 @@ import (
)
func TestLibraryReuse(t *testing.T) {
t.Parallel()
t.Run("simple", func(t *testing.T) {
ctx := testCc(t, `
cc_library {
@ -190,6 +191,7 @@ func TestLibraryReuse(t *testing.T) {
}
func TestStubsVersions(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libfoo",
@ -213,6 +215,7 @@ func TestStubsVersions(t *testing.T) {
}
func TestStubsVersions_NotSorted(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libfoo",
@ -228,6 +231,7 @@ func TestStubsVersions_NotSorted(t *testing.T) {
}
func TestStubsVersions_ParseError(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libfoo",

View file

@ -19,6 +19,7 @@ import (
)
func TestLinkerScript(t *testing.T) {
t.Parallel()
t.Run("script", func(t *testing.T) {
testCc(t, `
cc_object {

View file

@ -43,6 +43,7 @@ func testPrebuilt(t *testing.T, bp string, fs map[string][]byte) *android.TestCo
}
func TestPrebuilt(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "liba",
@ -172,6 +173,7 @@ func TestPrebuilt(t *testing.T) {
}
func TestPrebuiltLibraryShared(t *testing.T) {
t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library_shared {
name: "libtest",
@ -189,6 +191,7 @@ func TestPrebuiltLibraryShared(t *testing.T) {
}
func TestPrebuiltLibraryStatic(t *testing.T) {
t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library_static {
name: "libtest",
@ -203,6 +206,7 @@ func TestPrebuiltLibraryStatic(t *testing.T) {
}
func TestPrebuiltLibrary(t *testing.T) {
t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library {
name: "libtest",
@ -229,6 +233,7 @@ func TestPrebuiltLibrary(t *testing.T) {
}
func TestPrebuiltLibraryStem(t *testing.T) {
t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library {
name: "libfoo",
@ -256,6 +261,7 @@ func TestPrebuiltLibraryStem(t *testing.T) {
}
func TestPrebuiltLibrarySharedStem(t *testing.T) {
t.Parallel()
ctx := testPrebuilt(t, `
cc_prebuilt_library_shared {
name: "libfoo",
@ -274,6 +280,7 @@ func TestPrebuiltLibrarySharedStem(t *testing.T) {
}
func TestPrebuiltSymlinkedHostBinary(t *testing.T) {
t.Parallel()
if android.BuildOs != android.Linux {
t.Skipf("Skipping host prebuilt testing that is only supported on %s not %s", android.Linux, android.BuildOs)
}

View file

@ -22,6 +22,7 @@ import (
)
func TestProto(t *testing.T) {
t.Parallel()
t.Run("simple", func(t *testing.T) {
ctx := testCc(t, `
cc_library_shared {

View file

@ -21,6 +21,7 @@ import (
)
func TestSdkMutator(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "libsdk",

View file

@ -109,6 +109,7 @@ var testDataTests = []struct {
}
func TestDataTests(t *testing.T) {
t.Parallel()
buildDir, err := ioutil.TempDir("", "soong_test_test")
if err != nil {
t.Fatal(err)

View file

@ -58,6 +58,7 @@ c
var f2 = bytesToZipArtifactFile("dir/f2", nil)
func Test_applyAllowLists(t *testing.T) {
t.Parallel()
type args struct {
diff zipDiff
allowLists []allowList

View file

@ -21,6 +21,7 @@ import (
)
func TestDiffTargetFilesLists(t *testing.T) {
t.Parallel()
zipArtifactFile := func(name string, crc32 uint32, size uint64) *ZipArtifactFile {
return &ZipArtifactFile{
File: &zip.File{

View file

@ -19,6 +19,7 @@ import (
)
func TestMatch(t *testing.T) {
t.Parallel()
testCases := []struct {
pattern, name string
match bool

View file

@ -37,6 +37,7 @@ type testDesc struct {
}
func TestSelectApks_ApkSet(t *testing.T) {
t.Parallel()
testCases := []testDesc{
{
protoText: `
@ -266,6 +267,7 @@ variant {
}
func TestSelectApks_ApexSet(t *testing.T) {
t.Parallel()
testCases := []testDesc{
{
protoText: `
@ -442,6 +444,7 @@ type testCaseWriteApks struct {
}
func TestWriteApks(t *testing.T) {
t.Parallel()
testCases := []testCaseWriteApks{
{
name: "splits",

View file

@ -51,6 +51,7 @@ var bytesToAsmTestCases = []struct {
}
func TestBytesToAsm(t *testing.T) {
t.Parallel()
for _, testcase := range bytesToAsmTestCases {
t.Run(testcase.name, func(t *testing.T) {
buf := bytes.Buffer{}

View file

@ -100,6 +100,7 @@ func linkerOffset() []elf.Symbol {
}
func TestCheckLinker(t *testing.T) {
t.Parallel()
cases := []struct {
name string
err error

View file

@ -93,6 +93,7 @@ warning: [options] bootstrap class path not set in conjunction with -source 1.9\
}
func TestJavacColorize(t *testing.T) {
t.Parallel()
for i, test := range testCases {
t.Run(strconv.Itoa(i), func(t *testing.T) {
buf := new(bytes.Buffer)
@ -110,6 +111,7 @@ func TestJavacColorize(t *testing.T) {
}
func TestSubprocess(t *testing.T) {
t.Parallel()
t.Run("failure", func(t *testing.T) {
exitCode, err := Main(ioutil.Discard, "test", []string{"sh", "-c", "exit 9"})
if err != nil {

View file

@ -85,6 +85,7 @@ func (tiz *testInputZip) IsOpen() bool {
}
func TestMergeZips(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
in [][]testZipEntry
@ -361,6 +362,7 @@ func (diz *DummyInpuZip) IsOpen() bool {
}
func TestInputZipsManager(t *testing.T) {
t.Parallel()
const nInputZips = 20
const nMaxOpenZips = 10
izm := NewInputZipsManager(20, 10)

View file

@ -21,6 +21,7 @@ import (
)
func TestSplitList(t *testing.T) {
t.Parallel()
testcases := []struct {
inputCount int
shardCount int

View file

@ -61,6 +61,7 @@ func setup(t *testing.T) string {
}
func TestInterposer(t *testing.T) {
t.Parallel()
interposer := setup(t)
logConfig := func(name string) paths.PathConfig {
@ -180,6 +181,7 @@ func TestInterposer(t *testing.T) {
}
func TestMissingPath(t *testing.T) {
t.Parallel()
interposer := setup(t)
err := os.Remove(interposer + "_origpath")
if err != nil {

View file

@ -64,6 +64,7 @@ func customModuleFactory() android.Module {
}
func TestGenerateBazelOverlayFromBlueprint(t *testing.T) {
t.Parallel()
testCases := []struct {
bp string
expectedBazelTarget string

View file

@ -416,6 +416,7 @@ func errorString(e error) string {
}
func TestZip2Zip(t *testing.T) {
t.Parallel()
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
inputBuf := &bytes.Buffer{}
@ -472,6 +473,7 @@ func TestZip2Zip(t *testing.T) {
}
func TestConstantPartOfPattern(t *testing.T) {
t.Parallel()
testCases := []struct{ in, out string }{
{
in: "",

View file

@ -61,6 +61,7 @@ func testModuleConfig(ctx android.PathContext, name, partition string) *ModuleCo
}
func TestDexPreopt(t *testing.T) {
t.Parallel()
config := android.TestConfig("out", nil, "", nil)
ctx := android.PathContextForTesting(config)
globalSoong := GlobalSoongConfigForTests(config)
@ -83,6 +84,7 @@ func TestDexPreopt(t *testing.T) {
}
func TestDexPreoptSystemOther(t *testing.T) {
t.Parallel()
config := android.TestConfig("out", nil, "", nil)
ctx := android.PathContextForTesting(config)
globalSoong := GlobalSoongConfigForTests(config)
@ -143,6 +145,7 @@ func TestDexPreoptSystemOther(t *testing.T) {
}
func TestDexPreoptProfile(t *testing.T) {
t.Parallel()
config := android.TestConfig("out", nil, "", nil)
ctx := android.PathContextForTesting(config)
globalSoong := GlobalSoongConfigForTests(config)

View file

@ -102,6 +102,7 @@ func testPrebuiltEtcError(t *testing.T, pattern, bp string) {
t.Fatalf("missing expected error %q (0 errors are returned)", pattern)
}
func TestPrebuiltEtcVariants(t *testing.T) {
t.Parallel()
ctx, _ := testPrebuiltEtc(t, `
prebuilt_etc {
name: "foo.conf",
@ -136,6 +137,7 @@ func TestPrebuiltEtcVariants(t *testing.T) {
}
func TestPrebuiltEtcOutputPath(t *testing.T) {
t.Parallel()
ctx, _ := testPrebuiltEtc(t, `
prebuilt_etc {
name: "foo.conf",
@ -151,6 +153,7 @@ func TestPrebuiltEtcOutputPath(t *testing.T) {
}
func TestPrebuiltEtcGlob(t *testing.T) {
t.Parallel()
ctx, _ := testPrebuiltEtc(t, `
prebuilt_etc {
name: "my_foo",
@ -175,6 +178,7 @@ func TestPrebuiltEtcGlob(t *testing.T) {
}
func TestPrebuiltEtcAndroidMk(t *testing.T) {
t.Parallel()
ctx, config := testPrebuiltEtc(t, `
prebuilt_etc {
name: "foo",
@ -211,6 +215,7 @@ func TestPrebuiltEtcAndroidMk(t *testing.T) {
}
func TestPrebuiltEtcRelativeInstallPathInstallDirPath(t *testing.T) {
t.Parallel()
ctx, _ := testPrebuiltEtc(t, `
prebuilt_etc {
name: "foo.conf",
@ -227,6 +232,7 @@ func TestPrebuiltEtcRelativeInstallPathInstallDirPath(t *testing.T) {
}
func TestPrebuiltEtcCannotSetRelativeInstallPathAndSubDir(t *testing.T) {
t.Parallel()
testPrebuiltEtcError(t, "relative_install_path is set. Cannot set sub_dir", `
prebuilt_etc {
name: "foo.conf",
@ -238,6 +244,7 @@ func TestPrebuiltEtcCannotSetRelativeInstallPathAndSubDir(t *testing.T) {
}
func TestPrebuiltEtcHost(t *testing.T) {
t.Parallel()
ctx, _ := testPrebuiltEtc(t, `
prebuilt_etc_host {
name: "foo.conf",
@ -253,6 +260,7 @@ func TestPrebuiltEtcHost(t *testing.T) {
}
func TestPrebuiltUserShareInstallDirPath(t *testing.T) {
t.Parallel()
ctx, _ := testPrebuiltEtc(t, `
prebuilt_usr_share {
name: "foo.conf",
@ -269,6 +277,7 @@ func TestPrebuiltUserShareInstallDirPath(t *testing.T) {
}
func TestPrebuiltUserShareHostInstallDirPath(t *testing.T) {
t.Parallel()
ctx, config := testPrebuiltEtc(t, `
prebuilt_usr_share_host {
name: "foo.conf",
@ -286,6 +295,7 @@ func TestPrebuiltUserShareHostInstallDirPath(t *testing.T) {
}
func TestPrebuiltFontInstallDirPath(t *testing.T) {
t.Parallel()
ctx, _ := testPrebuiltEtc(t, `
prebuilt_font {
name: "foo.conf",
@ -301,6 +311,7 @@ func TestPrebuiltFontInstallDirPath(t *testing.T) {
}
func TestPrebuiltFirmwareDirPath(t *testing.T) {
t.Parallel()
targetPath := buildDir + "/target/product/test_device"
tests := []struct {
description string
@ -337,6 +348,7 @@ func TestPrebuiltFirmwareDirPath(t *testing.T) {
}
func TestPrebuiltDSPDirPath(t *testing.T) {
t.Parallel()
targetPath := filepath.Join(buildDir, "/target/product/test_device")
tests := []struct {
description string

View file

@ -122,6 +122,7 @@ func testAgainstSeveralThreadcounts(t *testing.T, tester func(t *testing.T, numT
// end of utils, start of individual tests
func TestSingleFile(t *testing.T) {
t.Parallel()
runSimpleTest(t,
[]string{"findme.txt"},
[]string{"findme.txt"},
@ -129,6 +130,7 @@ func TestSingleFile(t *testing.T) {
}
func TestIncludeFiles(t *testing.T) {
t.Parallel()
runSimpleTest(t,
[]string{"findme.txt", "skipme.txt"},
[]string{"findme.txt"},
@ -136,6 +138,7 @@ func TestIncludeFiles(t *testing.T) {
}
func TestNestedDirectories(t *testing.T) {
t.Parallel()
runSimpleTest(t,
[]string{"findme.txt", "skipme.txt", "subdir/findme.txt", "subdir/skipme.txt"},
[]string{"findme.txt", "subdir/findme.txt"},
@ -143,6 +146,7 @@ func TestNestedDirectories(t *testing.T) {
}
func TestEmptyDirectory(t *testing.T) {
t.Parallel()
runSimpleTest(t,
[]string{},
[]string{},
@ -150,6 +154,7 @@ func TestEmptyDirectory(t *testing.T) {
}
func TestEmptyPath(t *testing.T) {
t.Parallel()
filesystem := newFs()
root := "/tmp"
fs.Create(t, filepath.Join(root, "findme.txt"), filesystem)
@ -170,6 +175,7 @@ func TestEmptyPath(t *testing.T) {
}
func TestFilesystemRoot(t *testing.T) {
t.Parallel()
testWithNumThreads := func(t *testing.T, numThreads int) {
filesystem := newFs()
@ -197,6 +203,7 @@ func TestFilesystemRoot(t *testing.T) {
}
func TestNonexistentDir(t *testing.T) {
t.Parallel()
filesystem := newFs()
fs.Create(t, "/tmp/findme.txt", filesystem)
@ -215,6 +222,7 @@ func TestNonexistentDir(t *testing.T) {
}
func TestExcludeDirs(t *testing.T) {
t.Parallel()
filesystem := newFs()
fs.Create(t, "/tmp/exclude/findme.txt", filesystem)
fs.Create(t, "/tmp/exclude/subdir/findme.txt", filesystem)
@ -243,6 +251,7 @@ func TestExcludeDirs(t *testing.T) {
}
func TestPruneFiles(t *testing.T) {
t.Parallel()
filesystem := newFs()
fs.Create(t, "/tmp/out/findme.txt", filesystem)
fs.Create(t, "/tmp/out/.ignore-out-dir", filesystem)
@ -275,6 +284,7 @@ func TestPruneFiles(t *testing.T) {
// TestRootDir tests that the value of RootDirs is used
// tests of the filesystem root are in TestFilesystemRoot
func TestRootDir(t *testing.T) {
t.Parallel()
filesystem := newFs()
fs.Create(t, "/tmp/a/findme.txt", filesystem)
fs.Create(t, "/tmp/a/subdir/findme.txt", filesystem)
@ -299,6 +309,7 @@ func TestRootDir(t *testing.T) {
}
func TestUncachedDir(t *testing.T) {
t.Parallel()
filesystem := newFs()
fs.Create(t, "/tmp/a/findme.txt", filesystem)
fs.Create(t, "/tmp/a/subdir/findme.txt", filesystem)
@ -326,6 +337,7 @@ func TestUncachedDir(t *testing.T) {
}
func TestSearchingForFilesExcludedFromCache(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/findme.txt", filesystem)
@ -353,6 +365,7 @@ func TestSearchingForFilesExcludedFromCache(t *testing.T) {
}
func TestRelativeFilePaths(t *testing.T) {
t.Parallel()
filesystem := newFs()
fs.Create(t, "/tmp/ignore/hi.txt", filesystem)
@ -397,6 +410,7 @@ func TestRelativeFilePaths(t *testing.T) {
// have to run this test with the race-detector (`go test -race src/android/soong/finder/*.go`)
// for there to be much chance of the test actually detecting any error that may be present
func TestRootDirsContainedInOtherRootDirs(t *testing.T) {
t.Parallel()
filesystem := newFs()
fs.Create(t, "/tmp/a/b/c/d/e/f/g/h/i/j/findme.txt", filesystem)
@ -418,6 +432,7 @@ func TestRootDirsContainedInOtherRootDirs(t *testing.T) {
}
func TestFindFirst(t *testing.T) {
t.Parallel()
filesystem := newFs()
fs.Create(t, "/tmp/a/hi.txt", filesystem)
fs.Create(t, "/tmp/b/hi.txt", filesystem)
@ -442,6 +457,7 @@ func TestFindFirst(t *testing.T) {
}
func TestConcurrentFindSameDirectory(t *testing.T) {
t.Parallel()
testWithNumThreads := func(t *testing.T, numThreads int) {
filesystem := newFs()
@ -493,6 +509,7 @@ func TestConcurrentFindSameDirectory(t *testing.T) {
}
func TestConcurrentFindDifferentDirectories(t *testing.T) {
t.Parallel()
filesystem := newFs()
// create a bunch of files and directories
@ -556,6 +573,7 @@ func TestConcurrentFindDifferentDirectories(t *testing.T) {
}
func TestStrangelyFormattedPaths(t *testing.T) {
t.Parallel()
filesystem := newFs()
fs.Create(t, "/tmp/findme.txt", filesystem)
@ -581,6 +599,7 @@ func TestStrangelyFormattedPaths(t *testing.T) {
}
func TestCorruptedCacheHeader(t *testing.T) {
t.Parallel()
filesystem := newFs()
fs.Create(t, "/tmp/findme.txt", filesystem)
@ -605,6 +624,7 @@ func TestCorruptedCacheHeader(t *testing.T) {
}
func TestCanUseCache(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/findme.txt", filesystem)
@ -651,6 +671,7 @@ func TestCanUseCache(t *testing.T) {
}
func TestCorruptedCacheBody(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/findme.txt", filesystem)
@ -715,6 +736,7 @@ func TestCorruptedCacheBody(t *testing.T) {
}
func TestStatCalls(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/a/findme.txt", filesystem)
@ -738,6 +760,7 @@ func TestStatCalls(t *testing.T) {
}
func TestFileAdded(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/ignoreme.txt", filesystem)
@ -780,6 +803,7 @@ func TestFileAdded(t *testing.T) {
}
func TestDirectoriesAdded(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/ignoreme.txt", filesystem)
@ -824,6 +848,7 @@ func TestDirectoriesAdded(t *testing.T) {
}
func TestDirectoryAndSubdirectoryBothUpdated(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/hi1.txt", filesystem)
@ -864,6 +889,7 @@ func TestDirectoryAndSubdirectoryBothUpdated(t *testing.T) {
}
func TestFileDeleted(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/ignoreme.txt", filesystem)
@ -904,6 +930,7 @@ func TestFileDeleted(t *testing.T) {
}
func TestDirectoriesDeleted(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/findme.txt", filesystem)
@ -959,6 +986,7 @@ func TestDirectoriesDeleted(t *testing.T) {
}
func TestDirectoriesMoved(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/findme.txt", filesystem)
@ -1017,6 +1045,7 @@ func TestDirectoriesMoved(t *testing.T) {
}
func TestDirectoriesSwapped(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/findme.txt", filesystem)
@ -1132,6 +1161,7 @@ func runFsReplacementTest(t *testing.T, fs1 *fs.MockFs, fs2 *fs.MockFs) {
}
func TestChangeOfDevice(t *testing.T) {
t.Parallel()
fs1 := newFs()
// not as fine-grained mounting controls as a real filesystem, but should be adequate
fs1.SetDeviceNumber(0)
@ -1143,6 +1173,7 @@ func TestChangeOfDevice(t *testing.T) {
}
func TestChangeOfUserOrHost(t *testing.T) {
t.Parallel()
fs1 := newFs()
fs1.SetViewId("me@here")
@ -1153,6 +1184,7 @@ func TestChangeOfUserOrHost(t *testing.T) {
}
func TestConsistentCacheOrdering(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
for i := 0; i < 5; i++ {
@ -1205,6 +1237,7 @@ func TestConsistentCacheOrdering(t *testing.T) {
}
func TestNumSyscallsOfSecondFind(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/findme.txt", filesystem)
@ -1235,6 +1268,7 @@ func TestNumSyscallsOfSecondFind(t *testing.T) {
}
func TestChangingParamsOfSecondFind(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/findme.txt", filesystem)
@ -1265,6 +1299,7 @@ func TestChangingParamsOfSecondFind(t *testing.T) {
}
func TestSymlinkPointingToFile(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/a/hi.txt", filesystem)
@ -1301,6 +1336,7 @@ func TestSymlinkPointingToFile(t *testing.T) {
}
func TestSymlinkPointingToDirectory(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/dir/hi.txt", filesystem)
@ -1335,6 +1371,7 @@ func TestSymlinkPointingToDirectory(t *testing.T) {
// TestAddPruneFile confirms that adding a prune-file (into a directory for which we
// already had a cache) causes the directory to be ignored
func TestAddPruneFile(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/out/hi.txt", filesystem)
@ -1373,6 +1410,7 @@ func TestAddPruneFile(t *testing.T) {
}
func TestUpdatingDbIffChanged(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/a/hi.txt", filesystem)
@ -1432,6 +1470,7 @@ func TestUpdatingDbIffChanged(t *testing.T) {
}
func TestDirectoryNotPermitted(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/hi.txt", filesystem)
@ -1480,6 +1519,7 @@ func TestDirectoryNotPermitted(t *testing.T) {
}
func TestFileNotPermitted(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/hi.txt", filesystem)
@ -1502,6 +1542,7 @@ func TestFileNotPermitted(t *testing.T) {
}
func TestCacheEntryPathUnexpectedError(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := newFs()
fs.Create(t, "/tmp/a/hi.txt", filesystem)

View file

@ -20,6 +20,7 @@ import (
)
func TestMockFs_LstatStatSymlinks(t *testing.T) {
t.Parallel()
// setup filesystem
filesystem := NewMockFs(nil)
Create(t, "/tmp/realdir/hi.txt", filesystem)

View file

@ -22,6 +22,7 @@ import (
)
func TestParseDirent(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
in []byte

View file

@ -125,6 +125,7 @@ func testConfig(bp string, fs map[string][]byte) android.Config {
}
func TestGenruleCmd(t *testing.T) {
t.Parallel()
testcases := []struct {
name string
prop string
@ -503,6 +504,7 @@ func TestGenruleCmd(t *testing.T) {
}
func TestGenruleHashInputs(t *testing.T) {
t.Parallel()
// The basic idea here is to verify that the sbox command (which is
// in the Command field of the generate rule) contains a hash of the
@ -590,6 +592,7 @@ func TestGenruleHashInputs(t *testing.T) {
}
func TestGenSrcs(t *testing.T) {
t.Parallel()
testcases := []struct {
name string
prop string
@ -682,6 +685,7 @@ func TestGenSrcs(t *testing.T) {
}
func TestGenruleDefaults(t *testing.T) {
t.Parallel()
bp := `
genrule_defaults {
name: "gen_defaults1",

View file

@ -21,6 +21,7 @@ import (
)
func TestGetJavaPackage(t *testing.T) {
t.Parallel()
type args struct {
r io.Reader
src string
@ -78,6 +79,7 @@ func TestGetJavaPackage(t *testing.T) {
}
func Test_javaIdentRune(t *testing.T) {
t.Parallel()
// runes that should be valid anywhere in an identifier
validAnywhere := []rune{
// letters, $, _

View file

@ -23,6 +23,7 @@ import (
)
func TestRequired(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
java_library {
name: "foo",
@ -42,6 +43,7 @@ func TestRequired(t *testing.T) {
}
func TestHostdex(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
java_library {
name: "foo",
@ -72,6 +74,7 @@ func TestHostdex(t *testing.T) {
}
func TestHostdexRequired(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
java_library {
name: "foo",
@ -103,6 +106,7 @@ func TestHostdexRequired(t *testing.T) {
}
func TestHostdexSpecificRequired(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
java_library {
name: "foo",
@ -136,6 +140,7 @@ func TestHostdexSpecificRequired(t *testing.T) {
}
func TestDistWithTag(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
java_library {
name: "foo_without_tag",
@ -172,6 +177,7 @@ func TestDistWithTag(t *testing.T) {
}
func TestDistWithDest(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
java_library {
name: "foo",
@ -208,6 +214,7 @@ func TestDistWithDest(t *testing.T) {
}
func TestDistsWithAllProperties(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
java_library {
name: "foo",
@ -265,6 +272,7 @@ func TestDistsWithAllProperties(t *testing.T) {
}
func TestDistsWithTag(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
java_library {
name: "foo_without_tag",
@ -312,6 +320,7 @@ func TestDistsWithTag(t *testing.T) {
}
func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
java_sdk_library {
name: "foo-shared_library",

View file

@ -67,6 +67,7 @@ func testApp(t *testing.T, bp string) *android.TestContext {
}
func TestApp(t *testing.T) {
t.Parallel()
for _, moduleType := range []string{"android_app", "android_library"} {
t.Run(moduleType, func(t *testing.T) {
ctx := testApp(t, moduleType+` {
@ -113,6 +114,7 @@ func TestApp(t *testing.T) {
}
func TestAppSplits(t *testing.T) {
t.Parallel()
ctx := testApp(t, `
android_app {
name: "foo",
@ -142,6 +144,7 @@ func TestAppSplits(t *testing.T) {
}
func TestAndroidAppSet(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
android_app_set {
name: "foo",
@ -170,6 +173,7 @@ func TestAndroidAppSet(t *testing.T) {
}
func TestAndroidAppSet_Variants(t *testing.T) {
t.Parallel()
bp := `
android_app_set {
name: "foo",
@ -235,6 +239,7 @@ func TestAndroidAppSet_Variants(t *testing.T) {
}
func TestPlatformAPIs(t *testing.T) {
t.Parallel()
testJava(t, `
android_app {
name: "foo",
@ -269,6 +274,7 @@ func TestPlatformAPIs(t *testing.T) {
}
func TestAndroidAppLinkType(t *testing.T) {
t.Parallel()
testJava(t, `
android_app {
name: "foo",
@ -358,6 +364,7 @@ func TestAndroidAppLinkType(t *testing.T) {
}
func TestUpdatableApps(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
bp string
@ -479,6 +486,7 @@ func TestUpdatableApps(t *testing.T) {
}
func TestUpdatableApps_TransitiveDepsShouldSetMinSdkVersion(t *testing.T) {
t.Parallel()
testJavaError(t, `module "bar".*: should support min_sdk_version\(29\)`, cc.GatherRequiredDepsForTest(android.Android)+`
android_app {
name: "foo",
@ -497,6 +505,7 @@ func TestUpdatableApps_TransitiveDepsShouldSetMinSdkVersion(t *testing.T) {
}
func TestUpdatableApps_JniLibsShouldShouldSupportMinSdkVersion(t *testing.T) {
t.Parallel()
testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
android_app {
name: "foo",
@ -517,6 +526,7 @@ func TestUpdatableApps_JniLibsShouldShouldSupportMinSdkVersion(t *testing.T) {
}
func TestUpdatableApps_JniLibShouldBeBuiltAgainstMinSdkVersion(t *testing.T) {
t.Parallel()
bp := cc.GatherRequiredDepsForTest(android.Android) + `
android_app {
name: "foo",
@ -571,6 +581,7 @@ func TestUpdatableApps_JniLibShouldBeBuiltAgainstMinSdkVersion(t *testing.T) {
}
func TestUpdatableApps_ErrorIfJniLibDoesntSupportMinSdkVersion(t *testing.T) {
t.Parallel()
bp := cc.GatherRequiredDepsForTest(android.Android) + `
android_app {
name: "foo",
@ -591,6 +602,7 @@ func TestUpdatableApps_ErrorIfJniLibDoesntSupportMinSdkVersion(t *testing.T) {
}
func TestUpdatableApps_ErrorIfDepSdkVersionIsHigher(t *testing.T) {
t.Parallel()
bp := cc.GatherRequiredDepsForTest(android.Android) + `
android_app {
name: "foo",
@ -620,6 +632,7 @@ func TestUpdatableApps_ErrorIfDepSdkVersionIsHigher(t *testing.T) {
}
func TestResourceDirs(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
prop string
@ -679,6 +692,7 @@ func TestResourceDirs(t *testing.T) {
}
func TestLibraryAssets(t *testing.T) {
t.Parallel()
bp := `
android_app {
name: "foo",
@ -780,6 +794,7 @@ func TestLibraryAssets(t *testing.T) {
}
func TestAndroidResources(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
enforceRROTargets []string
@ -1070,6 +1085,7 @@ func checkSdkVersion(t *testing.T, config android.Config, expectedSdkVersion str
}
func TestAppSdkVersion(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
sdkVersion string
@ -1152,6 +1168,7 @@ func TestAppSdkVersion(t *testing.T) {
}
func TestVendorAppSdkVersion(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
sdkVersion string
@ -1215,6 +1232,7 @@ func TestVendorAppSdkVersion(t *testing.T) {
}
func TestJNIABI(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
cc_library {
name: "libjni",
@ -1289,6 +1307,7 @@ func TestJNIABI(t *testing.T) {
}
func TestAppSdkVersionByPartition(t *testing.T) {
t.Parallel()
testJavaError(t, "sdk_version must have a value when the module is located at vendor or product", `
android_app {
name: "foo",
@ -1327,6 +1346,7 @@ func TestAppSdkVersionByPartition(t *testing.T) {
}
func TestJNIPackaging(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
cc_library {
name: "libjni",
@ -1418,6 +1438,7 @@ func TestJNIPackaging(t *testing.T) {
}
func TestJNISDK(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
cc_library {
name: "libjni",
@ -1535,6 +1556,7 @@ func TestJNISDK(t *testing.T) {
}
func TestCertificates(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
bp string
@ -1655,6 +1677,7 @@ func TestCertificates(t *testing.T) {
}
func TestRequestV4SigningFlag(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
bp string
@ -1715,6 +1738,7 @@ func TestRequestV4SigningFlag(t *testing.T) {
}
func TestPackageNameOverride(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
bp string
@ -1780,6 +1804,7 @@ func TestPackageNameOverride(t *testing.T) {
}
func TestInstrumentationTargetOverridden(t *testing.T) {
t.Parallel()
bp := `
android_app {
name: "foo",
@ -1809,6 +1834,7 @@ func TestInstrumentationTargetOverridden(t *testing.T) {
}
func TestOverrideAndroidApp(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
android_app {
name: "foo",
@ -2010,6 +2036,7 @@ func TestOverrideAndroidApp(t *testing.T) {
}
func TestOverrideAndroidAppDependency(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
android_app {
name: "foo",
@ -2052,6 +2079,7 @@ func TestOverrideAndroidAppDependency(t *testing.T) {
}
func TestOverrideAndroidTest(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
android_app {
name: "foo",
@ -2148,6 +2176,7 @@ func TestOverrideAndroidTest(t *testing.T) {
}
func TestAndroidTest_FixTestConfig(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
android_app {
name: "foo",
@ -2229,6 +2258,7 @@ func TestAndroidTest_FixTestConfig(t *testing.T) {
}
func TestAndroidAppImport(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
android_app_import {
name: "foo",
@ -2258,6 +2288,7 @@ func TestAndroidAppImport(t *testing.T) {
}
func TestAndroidAppImport_NoDexPreopt(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
android_app_import {
name: "foo",
@ -2279,6 +2310,7 @@ func TestAndroidAppImport_NoDexPreopt(t *testing.T) {
}
func TestAndroidAppImport_Presigned(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
android_app_import {
name: "foo",
@ -2307,6 +2339,7 @@ func TestAndroidAppImport_Presigned(t *testing.T) {
}
func TestAndroidAppImport_SigningLineage(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
android_app_import {
name: "foo",
@ -2328,6 +2361,7 @@ func TestAndroidAppImport_SigningLineage(t *testing.T) {
}
func TestAndroidAppImport_DefaultDevCert(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
android_app_import {
name: "foo",
@ -2357,6 +2391,7 @@ func TestAndroidAppImport_DefaultDevCert(t *testing.T) {
}
func TestAndroidAppImport_DpiVariants(t *testing.T) {
t.Parallel()
bp := `
android_app_import {
name: "foo",
@ -2435,6 +2470,7 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) {
}
func TestAndroidAppImport_Filename(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
android_app_import {
name: "foo",
@ -2482,6 +2518,7 @@ func TestAndroidAppImport_Filename(t *testing.T) {
}
func TestAndroidAppImport_ArchVariants(t *testing.T) {
t.Parallel()
// The test config's target arch is ARM64.
testCases := []struct {
name string
@ -2545,6 +2582,7 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) {
}
func TestAndroidTestImport(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
android_test_import {
name: "foo",
@ -2573,6 +2611,7 @@ func TestAndroidTestImport(t *testing.T) {
}
func TestAndroidTestImport_NoJinUncompressForPresigned(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
android_test_import {
name: "foo",
@ -2610,6 +2649,7 @@ func TestAndroidTestImport_NoJinUncompressForPresigned(t *testing.T) {
}
func TestAndroidTestImport_Preprocessed(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
android_test_import {
name: "foo",
@ -2646,6 +2686,7 @@ func TestAndroidTestImport_Preprocessed(t *testing.T) {
}
func TestStl(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
cc_library {
name: "libjni",
@ -2709,6 +2750,7 @@ func TestStl(t *testing.T) {
}
func TestUsesLibraries(t *testing.T) {
t.Parallel()
bp := `
java_sdk_library {
name: "foo",
@ -2852,6 +2894,7 @@ func TestUsesLibraries(t *testing.T) {
}
func TestCodelessApp(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
bp string
@ -2928,6 +2971,7 @@ func TestCodelessApp(t *testing.T) {
}
func TestEmbedNotice(t *testing.T) {
t.Parallel()
ctx, _ := testJavaWithFS(t, cc.GatherRequiredDepsForTest(android.Android)+`
android_app {
name: "foo",
@ -3037,6 +3081,7 @@ func TestEmbedNotice(t *testing.T) {
}
func TestUncompressDex(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
bp string
@ -3164,6 +3209,7 @@ func checkAapt2LinkFlag(t *testing.T, aapt2Flags, flagName, expectedValue string
}
func TestRuntimeResourceOverlay(t *testing.T) {
t.Parallel()
fs := map[string][]byte{
"baz/res/res/values/strings.xml": nil,
"bar/res/res/values/strings.xml": nil,
@ -3268,6 +3314,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
}
func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
java_defaults {
name: "rro_defaults",
@ -3327,6 +3374,7 @@ func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
}
func TestOverrideRuntimeResourceOverlay(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
runtime_resource_overlay {
name: "foo_overlay",

View file

@ -22,6 +22,7 @@ import (
)
func TestDeviceForHost(t *testing.T) {
t.Parallel()
bp := `
java_library {
name: "device_module",
@ -102,6 +103,7 @@ func TestDeviceForHost(t *testing.T) {
}
func TestHostForDevice(t *testing.T) {
t.Parallel()
bp := `
java_library_host {
name: "host_module",

View file

@ -84,6 +84,7 @@ func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOu
}
func TestDexpreoptBootJars(t *testing.T) {
t.Parallel()
ruleFile := "boot-foo.art"
expectedInputs := []string{
@ -114,6 +115,7 @@ func TestDexpreoptBootJars(t *testing.T) {
// Changes to the boot.zip structure may break the ART APK scanner.
func TestDexpreoptBootZip(t *testing.T) {
t.Parallel()
ruleFile := "boot.zip"
ctx := android.PathContextForTesting(testConfig(nil, "", nil))

View file

@ -19,6 +19,7 @@ import (
)
func TestDexpreoptEnabled(t *testing.T) {
t.Parallel()
tests := []struct {
name string
bp string

View file

@ -58,6 +58,7 @@ func testHiddenAPIUnbundled(t *testing.T, unbundled bool) (*android.TestContext,
}
func TestHiddenAPISingleton(t *testing.T) {
t.Parallel()
ctx, _ := testHiddenAPIBootJars(t, `
java_library {
name: "foo",
@ -75,6 +76,7 @@ func TestHiddenAPISingleton(t *testing.T) {
}
func TestHiddenAPISingletonWithPrebuilt(t *testing.T) {
t.Parallel()
ctx, _ := testHiddenAPIBootJars(t, `
java_import {
name: "foo",
@ -92,6 +94,7 @@ func TestHiddenAPISingletonWithPrebuilt(t *testing.T) {
}
func TestHiddenAPISingletonWithPrebuiltUseSource(t *testing.T) {
t.Parallel()
ctx, _ := testHiddenAPIBootJars(t, `
java_library {
name: "foo",
@ -121,6 +124,7 @@ func TestHiddenAPISingletonWithPrebuiltUseSource(t *testing.T) {
}
func TestHiddenAPISingletonWithPrebuiltOverrideSource(t *testing.T) {
t.Parallel()
ctx, _ := testHiddenAPIBootJars(t, `
java_library {
name: "foo",
@ -150,6 +154,7 @@ func TestHiddenAPISingletonWithPrebuiltOverrideSource(t *testing.T) {
}
func TestHiddenAPISingletonSdks(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
unbundledBuild bool

View file

@ -17,6 +17,7 @@ package java
import "testing"
func TestJacocoFilterToSpecs(t *testing.T) {
t.Parallel()
testCases := []struct {
name, in, out string
}{
@ -66,6 +67,7 @@ func TestJacocoFilterToSpecs(t *testing.T) {
}
func TestJacocoFiltersToZipCommand(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
includes, excludes []string

View file

@ -177,6 +177,7 @@ func moduleToPath(name string) string {
}
func TestJavaLinkType(t *testing.T) {
t.Parallel()
testJava(t, `
java_library {
name: "foo",
@ -265,6 +266,7 @@ func TestJavaLinkType(t *testing.T) {
}
func TestSimple(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@ -309,6 +311,7 @@ func TestSimple(t *testing.T) {
}
func TestExportedPlugins(t *testing.T) {
t.Parallel()
type Result struct {
library string
processors string
@ -392,6 +395,7 @@ func TestExportedPlugins(t *testing.T) {
}
func TestSdkVersionByPartition(t *testing.T) {
t.Parallel()
testJavaError(t, "sdk_version must have a value when the module is located at vendor or product", `
java_library {
name: "foo",
@ -427,6 +431,7 @@ func TestSdkVersionByPartition(t *testing.T) {
}
func TestArchSpecific(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@ -446,6 +451,7 @@ func TestArchSpecific(t *testing.T) {
}
func TestBinary(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library_host {
name: "foo",
@ -474,6 +480,7 @@ func TestBinary(t *testing.T) {
}
func TestHostBinaryNoJavaDebugInfoOverride(t *testing.T) {
t.Parallel()
bp := `
java_library {
name: "target_library",
@ -509,6 +516,7 @@ func TestHostBinaryNoJavaDebugInfoOverride(t *testing.T) {
}
func TestPrebuilts(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@ -604,6 +612,7 @@ func assertDeepEquals(t *testing.T, message string, expected interface{}, actual
}
func TestJavaSdkLibraryImport(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@ -660,6 +669,7 @@ func TestJavaSdkLibraryImport(t *testing.T) {
}
func TestJavaSdkLibraryImport_WithSource(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_sdk_library {
name: "sdklib",
@ -699,6 +709,7 @@ func TestJavaSdkLibraryImport_WithSource(t *testing.T) {
}
func TestJavaSdkLibraryImport_Preferred(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_sdk_library {
name: "sdklib",
@ -736,6 +747,7 @@ func TestJavaSdkLibraryImport_Preferred(t *testing.T) {
}
func TestDefaults(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_defaults {
name: "defaults",
@ -811,6 +823,7 @@ func TestDefaults(t *testing.T) {
}
func TestResources(t *testing.T) {
t.Parallel()
var table = []struct {
name string
prop string
@ -917,6 +930,7 @@ func TestResources(t *testing.T) {
}
func TestIncludeSrcs(t *testing.T) {
t.Parallel()
ctx, _ := testJavaWithFS(t, `
java_library {
name: "foo",
@ -984,6 +998,7 @@ func TestIncludeSrcs(t *testing.T) {
}
func TestGeneratedSources(t *testing.T) {
t.Parallel()
ctx, _ := testJavaWithFS(t, `
java_library {
name: "foo",
@ -1020,6 +1035,7 @@ func TestGeneratedSources(t *testing.T) {
}
func TestTurbine(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@ -1069,6 +1085,7 @@ func TestTurbine(t *testing.T) {
}
func TestSharding(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "bar",
@ -1087,6 +1104,7 @@ func TestSharding(t *testing.T) {
}
func TestDroiddoc(t *testing.T) {
t.Parallel()
ctx, _ := testJavaWithFS(t, `
droiddoc_exported_dir {
name: "droiddoc-templates-sdk",
@ -1165,6 +1183,7 @@ func TestDroiddoc(t *testing.T) {
}
func TestDroiddocArgsAndFlagsCausesError(t *testing.T) {
t.Parallel()
testJavaError(t, "flags is set. Cannot set args", `
droiddoc_exported_dir {
name: "droiddoc-templates-sdk",
@ -1211,6 +1230,7 @@ func TestDroiddocArgsAndFlagsCausesError(t *testing.T) {
}
func TestDroidstubs(t *testing.T) {
t.Parallel()
ctx, _ := testJavaWithFS(t, `
droiddoc_exported_dir {
name: "droiddoc-templates-sdk",
@ -1267,6 +1287,7 @@ func TestDroidstubs(t *testing.T) {
}
func TestDroidstubsWithSystemModules(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
droidstubs {
name: "stubs-source-system-modules",
@ -1326,6 +1347,7 @@ func checkSystemModulesUseByDroidstubs(t *testing.T, ctx *android.TestContext, m
}
func TestJarGenrules(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@ -1380,6 +1402,7 @@ func TestJarGenrules(t *testing.T) {
}
func TestExcludeFileGroupInSrcs(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@ -1406,6 +1429,7 @@ func TestExcludeFileGroupInSrcs(t *testing.T) {
}
func TestJavaLibrary(t *testing.T) {
t.Parallel()
config := testConfig(nil, "", map[string][]byte{
"libcore/Android.bp": []byte(`
java_library {
@ -1419,6 +1443,7 @@ func TestJavaLibrary(t *testing.T) {
}
func TestJavaSdkLibrary(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
droiddoc_exported_dir {
name: "droiddoc-templates-sdk",
@ -1557,6 +1582,7 @@ func TestJavaSdkLibrary(t *testing.T) {
}
func TestJavaSdkLibrary_DoNotAccessImplWhenItIsNotBuilt(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_sdk_library {
name: "foo",
@ -1582,6 +1608,7 @@ func TestJavaSdkLibrary_DoNotAccessImplWhenItIsNotBuilt(t *testing.T) {
}
func TestJavaSdkLibrary_UseSourcesFromAnotherSdkLibrary(t *testing.T) {
t.Parallel()
testJava(t, `
java_sdk_library {
name: "foo",
@ -1600,6 +1627,7 @@ func TestJavaSdkLibrary_UseSourcesFromAnotherSdkLibrary(t *testing.T) {
}
func TestJavaSdkLibrary_AccessOutputFiles_MissingScope(t *testing.T) {
t.Parallel()
testJavaError(t, `"foo" does not provide api scope system`, `
java_sdk_library {
name: "foo",
@ -1618,6 +1646,7 @@ func TestJavaSdkLibrary_AccessOutputFiles_MissingScope(t *testing.T) {
}
func TestJavaSdkLibrary_Deps(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_sdk_library {
name: "sdklib",
@ -1640,6 +1669,7 @@ func TestJavaSdkLibrary_Deps(t *testing.T) {
}
func TestJavaSdkLibraryImport_AccessOutputFiles(t *testing.T) {
t.Parallel()
testJava(t, `
java_sdk_library_import {
name: "foo",
@ -1663,6 +1693,7 @@ func TestJavaSdkLibraryImport_AccessOutputFiles(t *testing.T) {
}
func TestJavaSdkLibraryImport_AccessOutputFiles_Invalid(t *testing.T) {
t.Parallel()
bp := `
java_sdk_library_import {
name: "foo",
@ -1711,6 +1742,7 @@ func TestJavaSdkLibraryImport_AccessOutputFiles_Invalid(t *testing.T) {
}
func TestJavaSdkLibrary_InvalidScopes(t *testing.T) {
t.Parallel()
testJavaError(t, `module "foo": enabled api scope "system" depends on disabled scope "public"`, `
java_sdk_library {
name: "foo",
@ -1729,6 +1761,7 @@ func TestJavaSdkLibrary_InvalidScopes(t *testing.T) {
}
func TestJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
t.Parallel()
testJava(t, `
java_sdk_library {
name: "foo",
@ -1743,6 +1776,7 @@ func TestJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
}
func TestJavaSdkLibrary_ModuleLib(t *testing.T) {
t.Parallel()
testJava(t, `
java_sdk_library {
name: "foo",
@ -1759,6 +1793,7 @@ func TestJavaSdkLibrary_ModuleLib(t *testing.T) {
}
func TestJavaSdkLibrary_SystemServer(t *testing.T) {
t.Parallel()
testJava(t, `
java_sdk_library {
name: "foo",
@ -1775,6 +1810,7 @@ func TestJavaSdkLibrary_SystemServer(t *testing.T) {
}
func TestJavaSdkLibrary_MissingScope(t *testing.T) {
t.Parallel()
testJavaError(t, `requires api scope module-lib from foo but it only has \[\] available`, `
java_sdk_library {
name: "foo",
@ -1794,6 +1830,7 @@ func TestJavaSdkLibrary_MissingScope(t *testing.T) {
}
func TestJavaSdkLibrary_FallbackScope(t *testing.T) {
t.Parallel()
testJava(t, `
java_sdk_library {
name: "foo",
@ -1814,6 +1851,7 @@ func TestJavaSdkLibrary_FallbackScope(t *testing.T) {
}
func TestJavaSdkLibrary_DefaultToStubs(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_sdk_library {
name: "foo",
@ -1889,6 +1927,7 @@ func (ctx *mockContext) PropertyErrorf(property, format string, args ...interfac
}
func TestCompilerFlags(t *testing.T) {
t.Parallel()
for _, testCase := range compilerFlagsTestCases {
ctx := &mockContext{result: true}
CheckKotlincFlags(ctx, []string{testCase.in})
@ -1919,6 +1958,7 @@ func checkPatchModuleFlag(t *testing.T, ctx *android.TestContext, moduleName str
}
func TestPatchModule(t *testing.T) {
t.Parallel()
t.Run("Java language level 8", func(t *testing.T) {
// Test with legacy javac -source 1.8 -target 1.8
bp := `
@ -1984,6 +2024,7 @@ func TestPatchModule(t *testing.T) {
}
func TestJavaSystemModules(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_system_modules {
name: "system-modules",
@ -2018,6 +2059,7 @@ func TestJavaSystemModules(t *testing.T) {
}
func TestJavaSystemModulesImport(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_system_modules_import {
name: "system-modules",
@ -2048,6 +2090,7 @@ func TestJavaSystemModulesImport(t *testing.T) {
}
func TestJavaLibraryWithSystemModules(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "lib-with-source-system-modules",
@ -2104,6 +2147,7 @@ func checkBootClasspathForSystemModule(t *testing.T, ctx *android.TestContext, m
}
func TestAidlExportIncludeDirsFromImports(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@ -2128,6 +2172,7 @@ func TestAidlExportIncludeDirsFromImports(t *testing.T) {
}
func TestDataNativeBinaries(t *testing.T) {
t.Parallel()
ctx, config := testJava(t, `
java_test_host {
name: "foo",

View file

@ -22,6 +22,7 @@ import (
)
func TestCollectJavaLibraryPropertiesAddLibsDeps(t *testing.T) {
t.Parallel()
expected := []string{"Foo", "Bar"}
module := LibraryFactory().(*Library)
module.properties.Libs = append(module.properties.Libs, expected...)
@ -35,6 +36,7 @@ func TestCollectJavaLibraryPropertiesAddLibsDeps(t *testing.T) {
}
func TestCollectJavaLibraryPropertiesAddStaticLibsDeps(t *testing.T) {
t.Parallel()
expected := []string{"Foo", "Bar"}
module := LibraryFactory().(*Library)
module.properties.Static_libs = append(module.properties.Static_libs, expected...)
@ -48,6 +50,7 @@ func TestCollectJavaLibraryPropertiesAddStaticLibsDeps(t *testing.T) {
}
func TestCollectJavaLibraryPropertiesAddScrs(t *testing.T) {
t.Parallel()
expected := []string{"Foo", "Bar"}
module := LibraryFactory().(*Library)
module.expandIDEInfoCompiledSrcs = append(module.expandIDEInfoCompiledSrcs, expected...)
@ -61,6 +64,7 @@ func TestCollectJavaLibraryPropertiesAddScrs(t *testing.T) {
}
func TestCollectJavaLibraryPropertiesAddAidlIncludeDirs(t *testing.T) {
t.Parallel()
expected := []string{"Foo", "Bar"}
module := LibraryFactory().(*Library)
module.deviceProperties.Aidl.Include_dirs = append(module.deviceProperties.Aidl.Include_dirs, expected...)
@ -74,6 +78,7 @@ func TestCollectJavaLibraryPropertiesAddAidlIncludeDirs(t *testing.T) {
}
func TestCollectJavaLibraryPropertiesAddJarjarRules(t *testing.T) {
t.Parallel()
expected := "Jarjar_rules.txt"
module := LibraryFactory().(*Library)
module.expandJarjarRules = android.PathForTesting(expected)

View file

@ -22,6 +22,7 @@ import (
)
func TestKotlin(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@ -84,6 +85,7 @@ func TestKotlin(t *testing.T) {
}
func TestKapt(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@ -163,6 +165,7 @@ func TestKapt(t *testing.T) {
}
func TestKaptEncodeFlags(t *testing.T) {
t.Parallel()
// Compares the kaptEncodeFlags against the results of the example implementation at
// https://kotlinlang.org/docs/reference/kapt.html#apjavac-options-encoding
tests := []struct {

View file

@ -20,6 +20,7 @@ import (
)
func TestNoPlugin(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@ -44,6 +45,7 @@ func TestNoPlugin(t *testing.T) {
}
func TestPlugin(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",
@ -83,6 +85,7 @@ func TestPlugin(t *testing.T) {
}
func TestPluginGeneratesApi(t *testing.T) {
t.Parallel()
ctx, _ := testJava(t, `
java_library {
name: "foo",

View file

@ -27,6 +27,7 @@ import (
)
func TestClasspath(t *testing.T) {
t.Parallel()
var classpathTestcases = []struct {
name string
unbundled bool

View file

@ -23,6 +23,7 @@ import (
)
func TestParse(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
input string
@ -339,6 +340,7 @@ func BenchmarkParsing(b *testing.B) {
}
func TestDepPrint(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
input Deps

View file

@ -54,6 +54,7 @@ cc_library_shared {
}
func TestEndToEnd(t *testing.T) {
t.Parallel()
for i, test := range testCases {
expected, err := bpfix.Reformat(test.expected)
if err != nil {

View file

@ -326,6 +326,7 @@ var (
)
func TestPythonModule(t *testing.T) {
t.Parallel()
for _, d := range data {
t.Run(d.desc, func(t *testing.T) {
config := android.TestConfig(buildDir, nil, "", d.mockFiles)

View file

@ -22,6 +22,7 @@ import (
)
func TestTemplate(t *testing.T) {
t.Parallel()
tests := []struct {
name string
params *REParams
@ -67,6 +68,7 @@ func TestTemplate(t *testing.T) {
}
func TestNoVarTemplate(t *testing.T) {
t.Parallel()
params := &REParams{
Labels: map[string]string{"type": "compile", "lang": "cpp", "compiler": "clang"},
Inputs: []string{"$in"},
@ -83,6 +85,7 @@ func TestNoVarTemplate(t *testing.T) {
}
func TestTemplateDeterminism(t *testing.T) {
t.Parallel()
r := &REParams{
Labels: map[string]string{"type": "compile", "lang": "cpp", "compiler": "clang"},
Inputs: []string{"$in"},

View file

@ -23,6 +23,7 @@ import (
// Test that rustlibs default linkage is correct for binaries.
func TestBinaryLinkage(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_binary {
name: "fizz-buzz",
@ -86,6 +87,7 @@ func TestBinaryPreferRlib(t *testing.T) {
// Test that the path returned by HostToolPath is correct
func TestHostToolPath(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_binary_host {
name: "fizz-buzz",
@ -100,6 +102,7 @@ func TestHostToolPath(t *testing.T) {
// Test that the flags being passed to rust_binary modules are as expected
func TestBinaryFlags(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_binary_host {
name: "fizz-buzz",
@ -143,6 +146,7 @@ func TestStaticBinaryFlags(t *testing.T) {
}
func TestLinkObjects(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_binary {
name: "fizz-buzz",
@ -162,6 +166,7 @@ func TestLinkObjects(t *testing.T) {
// Test that stripped versions are correctly generated and used.
func TestStrippedBinary(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_binary {
name: "foo",

View file

@ -20,6 +20,7 @@ import (
)
func TestRustBindgen(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_bindgen {
name: "libbindgen",
@ -66,6 +67,7 @@ func TestRustBindgen(t *testing.T) {
}
func TestRustBindgenCustomBindgen(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_bindgen {
name: "libbindgen",

View file

@ -17,6 +17,7 @@ package rust
import "testing"
func TestSourceProviderCollision(t *testing.T) {
t.Parallel()
testRustError(t, "multiple source providers generate the same filename output: bindings.rs", `
rust_binary {
name: "source_collider",

View file

@ -21,6 +21,7 @@ import (
)
func TestClippy(t *testing.T) {
t.Parallel()
bp := `
// foo uses the default value of clippy_lints

View file

@ -23,6 +23,7 @@ import (
// Test that feature flags are being correctly generated.
func TestFeaturesToFlags(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_library_host_dylib {
name: "libfoo",
@ -44,6 +45,7 @@ func TestFeaturesToFlags(t *testing.T) {
// Test that we reject multiple source files.
func TestEnforceSingleSourceFile(t *testing.T) {
t.Parallel()
singleSrcError := "srcs can only contain one path for a rust file and source providers prefixed by \":\""
@ -78,6 +80,7 @@ func TestEnforceSingleSourceFile(t *testing.T) {
}
func TestInstallDir(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_library_dylib {
name: "libfoo",
@ -108,6 +111,7 @@ func TestInstallDir(t *testing.T) {
}
func TestLints(t *testing.T) {
t.Parallel()
bp := `
// foo uses the default value of lints
@ -180,6 +184,7 @@ func TestLints(t *testing.T) {
// Test that devices are linking the stdlib dynamically
func TestStdDeviceLinkage(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_binary {
name: "fizz",

View file

@ -23,6 +23,7 @@ import (
// Test that coverage flags are being correctly generated.
func TestCoverageFlags(t *testing.T) {
t.Parallel()
ctx := testRustCov(t, `
rust_library {
name: "libfoo_cov",
@ -98,6 +99,7 @@ func TestCoverageFlags(t *testing.T) {
// Test coverage files are included correctly
func TestCoverageZip(t *testing.T) {
t.Parallel()
ctx := testRustCov(t, `
rust_library {
name: "libfoo",
@ -174,6 +176,7 @@ func TestCoverageZip(t *testing.T) {
}
func TestCoverageDeps(t *testing.T) {
t.Parallel()
ctx := testRustCov(t, `
rust_binary {
name: "fizz",

View file

@ -23,6 +23,7 @@ import (
// Test that variants are being generated correctly, and that crate-types are correct.
func TestLibraryVariants(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_library_host {
@ -71,6 +72,7 @@ func TestLibraryVariants(t *testing.T) {
// Test that dylibs are not statically linking the standard library.
func TestDylibPreferDynamic(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_library_host_dylib {
name: "libfoo",
@ -86,6 +88,7 @@ func TestDylibPreferDynamic(t *testing.T) {
}
func TestValidateLibraryStem(t *testing.T) {
t.Parallel()
testRustError(t, "crate_name must be defined.", `
rust_library_host {
name: "libfoo",
@ -123,6 +126,7 @@ func TestValidateLibraryStem(t *testing.T) {
}
func TestSharedLibrary(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_ffi_shared {
name: "libfoo",
@ -145,6 +149,7 @@ func TestSharedLibrary(t *testing.T) {
}
func TestStaticLibraryLinkage(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_ffi_static {
name: "libfoo",
@ -162,6 +167,7 @@ func TestStaticLibraryLinkage(t *testing.T) {
// Test that variants pull in the right type of rustlib autodep
func TestAutoDeps(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_library_host {
@ -209,6 +215,7 @@ func TestAutoDeps(t *testing.T) {
// Test that stripped versions are correctly generated and used.
func TestStrippedLibrary(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_library_dylib {
name: "libfoo",
@ -240,6 +247,7 @@ func TestStrippedLibrary(t *testing.T) {
}
func TestLibstdLinkage(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_library {
name: "libfoo",

View file

@ -20,6 +20,7 @@ import (
)
func TestRustProtobuf(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_protobuf {
name: "librust_proto",

View file

@ -135,6 +135,7 @@ func testRustError(t *testing.T, pattern string, bp string) {
// Test that we can extract the link path from a lib path.
func TestLinkPathFromFilePath(t *testing.T) {
t.Parallel()
barPath := android.PathForTesting("out/soong/.intermediates/external/libbar/libbar/linux_glibc_x86_64_shared/libbar.so")
libName := linkPathFromFilePath(barPath)
expectedResult := "out/soong/.intermediates/external/libbar/libbar/linux_glibc_x86_64_shared/"
@ -146,6 +147,7 @@ func TestLinkPathFromFilePath(t *testing.T) {
// Test to make sure dependencies are being picked up correctly.
func TestDepsTracking(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_ffi_host_static {
name: "libstatic",
@ -207,6 +209,7 @@ func TestDepsTracking(t *testing.T) {
}
func TestSourceProviderDeps(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_binary {
name: "fizz-buzz-dep",
@ -294,6 +297,7 @@ func TestSourceProviderDeps(t *testing.T) {
}
func TestSourceProviderTargetMismatch(t *testing.T) {
t.Parallel()
// This might error while building the dependency tree or when calling depsToPaths() depending on the lunched
// target, which results in two different errors. So don't check the error, just confirm there is one.
testRustError(t, ".*", `
@ -316,6 +320,7 @@ func TestSourceProviderTargetMismatch(t *testing.T) {
// Test to make sure proc_macros use host variants when building device modules.
func TestProcMacroDeviceDeps(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_library_host_rlib {
name: "libbar",
@ -343,6 +348,7 @@ func TestProcMacroDeviceDeps(t *testing.T) {
// Test that no_stdlibs suppresses dependencies on rust standard libraries
func TestNoStdlibs(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_binary {
name: "fizz-buzz",
@ -358,6 +364,7 @@ func TestNoStdlibs(t *testing.T) {
// Test that libraries provide both 32-bit and 64-bit variants.
func TestMultilib(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_library_rlib {
name: "libfoo",

View file

@ -21,6 +21,7 @@ import (
var stemRequiredError = "source_stem property is undefined but required for rust_bindgen modules"
func TestSourceProviderRequiredFields(t *testing.T) {
t.Parallel()
testRustError(t, stemRequiredError, `
rust_bindgen {
name: "libbindgen",

View file

@ -22,6 +22,7 @@ import (
)
func TestRustTest(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_test_host {
name: "my_test",
@ -37,6 +38,7 @@ func TestRustTest(t *testing.T) {
}
func TestRustTestLinkage(t *testing.T) {
t.Parallel()
ctx := testRust(t, `
rust_test {
name: "my_test",

View file

@ -180,6 +180,7 @@ func (t removeFredTransformation) transformPropertySetAfterContents(name string,
}
func TestTransformRemoveProperty(t *testing.T) {
t.Parallel()
helper := &TestHelper{t}
@ -195,6 +196,7 @@ func TestTransformRemoveProperty(t *testing.T) {
}
func TestTransformRemovePropertySet(t *testing.T) {
t.Parallel()
helper := &TestHelper{t}

View file

@ -40,6 +40,7 @@ func testSdkWithCc(t *testing.T, bp string) *testSdkResult {
// Contains tests for SDK members provided by the cc package.
func TestSingleDeviceOsAssumption(t *testing.T) {
t.Parallel()
// Mock a module with DeviceSupported() == true.
s := &sdk{}
android.InitAndroidArchModule(s, android.DeviceSupported, android.MultilibCommon)
@ -54,6 +55,7 @@ func TestSingleDeviceOsAssumption(t *testing.T) {
}
func TestSdkIsCompileMultilibBoth(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -84,6 +86,7 @@ func TestSdkIsCompileMultilibBoth(t *testing.T) {
}
func TestSdkCompileMultilibOverride(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -175,6 +178,7 @@ sdk_snapshot {
}
func TestBasicSdkWithCc(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -281,6 +285,7 @@ func TestBasicSdkWithCc(t *testing.T) {
// Make sure the sdk can use host specific cc libraries static/shared and both.
func TestHostSdkWithCc(t *testing.T) {
t.Parallel()
testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -304,6 +309,7 @@ func TestHostSdkWithCc(t *testing.T) {
// Make sure the sdk can use cc libraries static/shared and both.
func TestSdkWithCc(t *testing.T) {
t.Parallel()
testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -334,6 +340,7 @@ func TestSdkWithCc(t *testing.T) {
}
func TestSnapshotWithObject(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -405,6 +412,7 @@ sdk_snapshot {
}
func TestSnapshotWithCcDuplicateHeaders(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -446,6 +454,7 @@ include/Test.h -> include/include/Test.h
// handling is tested with the sanitize clauses (but note there's a lot of
// built-in logic in sanitize.go that can affect those flags).
func TestSnapshotWithCcSharedLibraryCommonProperties(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -559,6 +568,7 @@ arm64/include/Arm64Test.h -> arm64/include/arm64/include/Arm64Test.h
}
func TestSnapshotWithCcBinary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
module_exports {
name: "mymodule_exports",
@ -623,6 +633,7 @@ module_exports_snapshot {
}
func TestMultipleHostOsTypesSnapshotWithCcBinary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
module_exports {
name: "myexports",
@ -749,6 +760,7 @@ module_exports_snapshot {
}
func TestSnapshotWithSingleHostOsType(t *testing.T) {
t.Parallel()
ctx, config := testSdkContext(`
cc_defaults {
name: "mydefaults",
@ -912,6 +924,7 @@ module_exports_snapshot {
// Test that we support the necessary flags for the linker binary, which is
// special in several ways.
func TestSnapshotWithCcStaticNocrtBinary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
module_exports {
name: "mymodule_exports",
@ -1014,6 +1027,7 @@ module_exports_snapshot {
}
func TestSnapshotWithCcSharedLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -1107,6 +1121,7 @@ include/Test.h -> include/include/Test.h
}
func TestSnapshotWithCcSharedLibrarySharedLibs(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -1301,6 +1316,7 @@ sdk_snapshot {
}
func TestHostSnapshotWithCcSharedLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -1418,6 +1434,7 @@ include/Test.h -> include/include/Test.h
}
func TestMultipleHostOsTypesSnapshotWithCcSharedLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -1543,6 +1560,7 @@ sdk_snapshot {
}
func TestSnapshotWithCcStaticLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
module_exports {
name: "myexports",
@ -1627,6 +1645,7 @@ include/Test.h -> include/include/Test.h
}
func TestHostSnapshotWithCcStaticLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
module_exports {
name: "myexports",
@ -1741,6 +1760,7 @@ include/Test.h -> include/include/Test.h
}
func TestSnapshotWithCcLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
module_exports {
name: "myexports",
@ -1838,6 +1858,7 @@ include/Test.h -> include/include/Test.h
}
func TestHostSnapshotWithMultiLib64(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
module_exports {
name: "myexports",
@ -1945,6 +1966,7 @@ include/Test.h -> include/include/Test.h
}
func TestSnapshotWithCcHeadersLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -1993,6 +2015,7 @@ include/Test.h -> include/include/Test.h
}
func TestHostSnapshotWithCcHeadersLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -2075,6 +2098,7 @@ include/Test.h -> include/include/Test.h
}
func TestDeviceAndHostSnapshotWithCcHeadersLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -2170,6 +2194,7 @@ include-host/HostTest.h -> linux_glibc/include/include-host/HostTest.h
}
func TestSystemSharedLibPropagation(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -2407,6 +2432,7 @@ sdk_snapshot {
}
func TestStubsLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -2485,6 +2511,7 @@ sdk_snapshot {
}
func TestDeviceAndHostSnapshotWithStubsLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
@ -2601,6 +2628,7 @@ sdk_snapshot {
}
func TestUniqueHostSoname(t *testing.T) {
t.Parallel()
result := testSdkWithCc(t, `
sdk {
name: "mysdk",

View file

@ -20,6 +20,7 @@ import (
// Ensure that module_exports generates a module_exports_snapshot module.
func TestModuleExportsSnapshot(t *testing.T) {
t.Parallel()
packageBp := `
module_exports {
name: "myexports",

View file

@ -92,6 +92,7 @@ java_import {
// Contains tests for SDK members provided by the java package.
func TestSdkDependsOnSourceEvenWhenPrebuiltPreferred(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -141,6 +142,7 @@ sdk_snapshot {
}
func TestBasicSdkWithJavaLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -220,6 +222,7 @@ func TestBasicSdkWithJavaLibrary(t *testing.T) {
}
func TestSnapshotWithJavaHeaderLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -272,6 +275,7 @@ aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
}
func TestHostSnapshotWithJavaHeaderLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -332,6 +336,7 @@ aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
}
func TestDeviceAndHostSnapshotWithJavaHeaderLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -398,6 +403,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaImplLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
module_exports {
name: "myexports",
@ -451,6 +457,7 @@ aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
}
func TestHostSnapshotWithJavaImplLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
module_exports {
name: "myexports",
@ -511,6 +518,7 @@ aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
}
func TestSnapshotWithJavaTest(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
module_exports {
name: "myexports",
@ -561,6 +569,7 @@ module_exports_snapshot {
}
func TestHostSnapshotWithJavaTest(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
module_exports {
name: "myexports",
@ -633,6 +642,7 @@ func testSdkWithDroidstubs(t *testing.T, bp string) *testSdkResult {
// directly or indirectly from an APEX as droidstubs can never be a part of an
// apex.
func TestBasicSdkWithDroidstubs(t *testing.T) {
t.Parallel()
testSdkWithDroidstubs(t, `
sdk {
name: "mysdk",
@ -663,6 +673,7 @@ func TestBasicSdkWithDroidstubs(t *testing.T) {
}
func TestSnapshotWithDroidstubs(t *testing.T) {
t.Parallel()
result := testSdkWithDroidstubs(t, `
module_exports {
name: "myexports",
@ -708,6 +719,7 @@ module_exports_snapshot {
}
func TestHostSnapshotWithDroidstubs(t *testing.T) {
t.Parallel()
result := testSdkWithDroidstubs(t, `
module_exports {
name: "myexports",
@ -762,6 +774,7 @@ module_exports_snapshot {
}
func TestSnapshotWithJavaSystemModules(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -856,6 +869,7 @@ sdk_snapshot {
}
func TestHostSnapshotWithJavaSystemModules(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -934,6 +948,7 @@ sdk_snapshot {
}
func TestDeviceAndHostSnapshotWithOsSpecificMembers(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
module_exports {
name: "myexports",
@ -1061,6 +1076,7 @@ module_exports_snapshot {
}
func TestSnapshotWithJavaSdkLibrary(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -1165,6 +1181,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_SdkVersion_None(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -1229,6 +1246,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -1296,6 +1314,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_ApiScopes(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -1386,6 +1405,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_ModuleLib(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -1497,6 +1517,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_SystemServer(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",
@ -1587,6 +1608,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_NamingScheme(t *testing.T) {
t.Parallel()
result := testSdkWithJava(t, `
sdk {
name: "mysdk",

View file

@ -35,6 +35,7 @@ func TestMain(m *testing.M) {
}
func TestDepNotInRequiredSdks(t *testing.T) {
t.Parallel()
testSdkError(t, `module "myjavalib".*depends on "otherlib".*that isn't part of the required SDKs:.*`, `
sdk {
name: "mysdk",
@ -95,6 +96,7 @@ func TestDepNotInRequiredSdks(t *testing.T) {
// Ensure that prebuilt modules have the same effective visibility as the source
// modules.
func TestSnapshotVisibility(t *testing.T) {
t.Parallel()
packageBp := `
package {
default_visibility: ["//other/foo"],
@ -302,6 +304,7 @@ func TestPrebuiltVisibilityProperty_AddPrivate(t *testing.T) {
}
func TestSDkInstall(t *testing.T) {
t.Parallel()
sdk := `
sdk {
name: "mysdk",
@ -346,6 +349,7 @@ func (p *testPropertiesStruct) String() string {
var _ propertiesContainer = (*testPropertiesStruct)(nil)
func TestCommonValueOptimization(t *testing.T) {
t.Parallel()
common := &testPropertiesStruct{name: "common"}
structs := []propertiesContainer{
&testPropertiesStruct{
@ -443,6 +447,7 @@ func TestCommonValueOptimization(t *testing.T) {
}
func TestCommonValueOptimization_InvalidArchSpecificVariants(t *testing.T) {
t.Parallel()
common := &testPropertiesStruct{name: "common"}
structs := []propertiesContainer{
&testPropertiesStruct{

View file

@ -61,6 +61,7 @@ func testShBinary(t *testing.T, bp string) (*android.TestContext, android.Config
}
func TestShTestSubDir(t *testing.T) {
t.Parallel()
ctx, config := testShBinary(t, `
sh_test {
name: "foo",
@ -81,6 +82,7 @@ func TestShTestSubDir(t *testing.T) {
}
func TestShTest(t *testing.T) {
t.Parallel()
ctx, config := testShBinary(t, `
sh_test {
name: "foo",
@ -111,6 +113,7 @@ func TestShTest(t *testing.T) {
}
func TestShTest_dataModules(t *testing.T) {
t.Parallel()
ctx, config := testShBinary(t, `
sh_test {
name: "foo",
@ -170,6 +173,7 @@ func TestShTest_dataModules(t *testing.T) {
}
func TestShTestHost(t *testing.T) {
t.Parallel()
ctx, _ := testShBinary(t, `
sh_test_host {
name: "foo",
@ -190,6 +194,7 @@ func TestShTestHost(t *testing.T) {
}
func TestShTestHost_dataDeviceModules(t *testing.T) {
t.Parallel()
ctx, config := testShBinary(t, `
sh_test_host {
name: "foo",

View file

@ -20,6 +20,7 @@ import (
)
func TestElfSymbolTable(t *testing.T) {
t.Parallel()
testCases := []struct {
file *mockElfFile
symbol string

View file

@ -21,6 +21,7 @@ import (
)
func TestMachoSymbolTable(t *testing.T) {
t.Parallel()
testCases := []struct {
file *macho.File
symbol string

View file

@ -21,6 +21,7 @@ import (
)
func TestPESymbolTable(t *testing.T) {
t.Parallel()
testCases := []struct {
file *pe.File
symbol string

View file

@ -21,6 +21,7 @@ import (
)
func TestCopyAndInject(t *testing.T) {
t.Parallel()
s := "abcdefghijklmnopqrstuvwxyz"
testCases := []struct {
offset uint64

View file

@ -158,6 +158,7 @@ func test(t *testing.T, bp string) *android.TestContext {
}
func TestSyspropLibrary(t *testing.T) {
t.Parallel()
ctx := test(t, `
sysprop_library {
name: "sysprop-platform",

Some files were not shown because too many files have changed in this diff Show more