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

Commit 35816123 authored by Paul Duffin's avatar Paul Duffin
Browse files

Add test fixture support

Adds the test fixture support and converts a few tests to exercise the
code and show how it works.

Bug: 181070625
Test: m nothing
Change-Id: I0a2b40fff93b6041f9aa8c4ef0aba91da1bc8bf3
parent 30e3e9d2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ bootstrap_go_package {
        "deptag.go",
        "expand.go",
        "filegroup.go",
        "fixture.go",
        "hooks.go",
        "image.go",
        "license.go",
@@ -87,6 +88,7 @@ bootstrap_go_package {
        "depset_test.go",
        "deptag_test.go",
        "expand_test.go",
        "fixture_test.go",
        "license_kind_test.go",
        "license_test.go",
        "licenses_test.go",
+2 −0
Original line number Diff line number Diff line
@@ -44,3 +44,5 @@ func TestMain(m *testing.M) {

	os.Exit(run())
}

var emptyTestFixtureFactory = NewFixtureFactory(&buildDir)
+7 −4
Original line number Diff line number Diff line
@@ -305,10 +305,7 @@ func TestArchConfigFuchsia(buildDir string, env map[string]string, bp string, fs
	return testConfig
}

// TestArchConfig returns a Config object suitable for using for tests that
// need to run the arch mutator.
func TestArchConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) Config {
	testConfig := TestConfig(buildDir, env, bp, fs)
func modifyTestConfigToSupportArchMutator(testConfig Config) {
	config := testConfig.config

	config.Targets = map[OsType][]Target{
@@ -334,7 +331,13 @@ func TestArchConfig(buildDir string, env map[string]string, bp string, fs map[st
	config.TestProductVariables.DeviceArchVariant = proptools.StringPtr("armv8-a")
	config.TestProductVariables.DeviceSecondaryArch = proptools.StringPtr("arm")
	config.TestProductVariables.DeviceSecondaryArchVariant = proptools.StringPtr("armv7-a-neon")
}

// TestArchConfig returns a Config object suitable for using for tests that
// need to run the arch mutator.
func TestArchConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) Config {
	testConfig := TestConfig(buildDir, env, bp, fs)
	modifyTestConfigToSupportArchMutator(testConfig)
	return testConfig
}

+4 −0
Original line number Diff line number Diff line
@@ -24,6 +24,10 @@ func init() {
	RegisterBp2BuildMutator("filegroup", FilegroupBp2Build)
}

var PrepareForTestWithFilegroup = FixtureRegisterWithContext(func(ctx RegistrationContext) {
	ctx.RegisterModuleType("filegroup", FileGroupFactory)
})

// https://docs.bazel.build/versions/master/be/general.html#filegroup
type bazelFilegroupAttributes struct {
	Srcs bazel.LabelList

android/fixture.go

0 → 100644
+604 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading