Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 323dc607 authored by Colin Cross's avatar Colin Cross
Browse files

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
parent 56a8321c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import (
)

func Test_mergeApexVariations(t *testing.T) {
	t.Parallel()
	tests := []struct {
		name        string
		in          []ApexInfo
+3 −0
Original line number Diff line number Diff line
@@ -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 {
+3 −0
Original line number Diff line number Diff line
@@ -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")
+1 −0
Original line number Diff line number Diff line
@@ -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" }
Loading