Merge "Revert "Implement vts_config module""

This commit is contained in:
Treehugger Robot 2020-10-09 17:25:35 +00:00 committed by Gerrit Code Review
commit 38cfe29597
5 changed files with 1 additions and 141 deletions

View file

@ -55,7 +55,6 @@ bootstrap_go_package {
"util.go",
"variable.go",
"visibility.go",
"vts_config.go",
"writedocs.go",
// Lock down environment access last
@ -84,6 +83,5 @@ bootstrap_go_package {
"util_test.go",
"variable_test.go",
"visibility_test.go",
"vts_config_test.go",
],
}

View file

@ -1,74 +0,0 @@
// Copyright 2016 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package android
import (
"fmt"
"io"
"strings"
)
func init() {
RegisterModuleType("vts_config", VtsConfigFactory)
}
type vtsConfigProperties struct {
// Override the default (AndroidTest.xml) test manifest file name.
Test_config *string
// Additional test suites to add the test to.
Test_suites []string `android:"arch_variant"`
}
type VtsConfig struct {
ModuleBase
properties vtsConfigProperties
OutputFilePath OutputPath
}
func (me *VtsConfig) GenerateAndroidBuildActions(ctx ModuleContext) {
me.OutputFilePath = PathForModuleOut(ctx, me.BaseModuleName()).OutputPath
}
func (me *VtsConfig) AndroidMk() AndroidMkData {
androidMkData := AndroidMkData{
Class: "FAKE",
Include: "$(BUILD_SYSTEM)/suite_host_config.mk",
OutputFile: OptionalPathForPath(me.OutputFilePath),
}
androidMkData.Extra = []AndroidMkExtraFunc{
func(w io.Writer, outputFile Path) {
if me.properties.Test_config != nil {
fmt.Fprintf(w, "LOCAL_TEST_CONFIG := %s\n",
*me.properties.Test_config)
}
fmt.Fprintf(w, "LOCAL_COMPATIBILITY_SUITE := vts10 %s\n",
strings.Join(me.properties.Test_suites, " "))
},
}
return androidMkData
}
func InitVtsConfigModule(me *VtsConfig) {
me.AddProperties(&me.properties)
}
// vts_config generates a Vendor Test Suite (VTS10) configuration file from the
// <test_config> xml file and stores it in a subdirectory of $(HOST_OUT).
func VtsConfigFactory() Module {
module := &VtsConfig{}
InitVtsConfigModule(module)
InitAndroidArchModule(module /*TODO: or HostAndDeviceSupported? */, HostSupported, MultilibFirst)
return module
}

View file

@ -1,50 +0,0 @@
// Copyright 2018 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package android
import (
"testing"
)
func testVtsConfig(test *testing.T, bpFileContents string) *TestContext {
config := TestArchConfig(buildDir, nil, bpFileContents, nil)
ctx := NewTestArchContext()
ctx.RegisterModuleType("vts_config", VtsConfigFactory)
ctx.Register(config)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
FailIfErrored(test, errs)
_, errs = ctx.PrepareBuildActions(config)
FailIfErrored(test, errs)
return ctx
}
func TestVtsConfig(t *testing.T) {
t.Parallel()
ctx := testVtsConfig(t, `
vts_config { name: "plain"}
vts_config { name: "with_manifest", test_config: "manifest.xml" }
`)
variants := ctx.ModuleVariantsForTests("plain")
if len(variants) > 1 {
t.Errorf("expected 1, got %d", len(variants))
}
expectedOutputFilename := ctx.ModuleForTests(
"plain", variants[0]).Module().(*VtsConfig).OutputFilePath.Base()
if expectedOutputFilename != "plain" {
t.Errorf("expected plain, got %q", expectedOutputFilename)
}
}

View file

@ -953,8 +953,7 @@ var prebuiltTypes = map[string]string{
var soongModuleTypes = map[string]bool{}
var includePathToModule = map[string]string{
"test/vts/tools/build/Android.host_config.mk": "vts_config",
// The rest will be populated dynamically in androidScope below
// The content will be populated dynamically in androidScope below
}
func mapIncludePath(path string) (string, bool) {

View file

@ -1254,19 +1254,6 @@ prebuilt_firmware {
relative_install_path: "bar",
proprietary: true,
}
`,
},
{
desc: "vts_config",
in: `
include $(CLEAR_VARS)
LOCAL_MODULE := vtsconf
include test/vts/tools/build/Android.host_config.mk
`,
expected: `
vts_config {
name: "vtsconf",
}
`,
},
{