blob: 86f6e728140fd21022f0e2445623f3138b8977ea [file] [log] [blame]
Sasha Smundakff36da02019-02-12 17:12:08 -08001// Copyright 2016 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package android
16
17import (
18 "fmt"
19 "io"
20)
21
Sasha Smundakff36da02019-02-12 17:12:08 -080022func init() {
23 RegisterModuleType("vts_config", VtsConfigFactory)
24}
25
26type vtsConfigProperties struct {
Patrice Arruda3cec2722019-03-13 14:01:12 -070027 // Override the default (AndroidTest.xml) test manifest file name.
Sasha Smundakff36da02019-02-12 17:12:08 -080028 Test_config *string
29}
30
31type VtsConfig struct {
32 ModuleBase
33 properties vtsConfigProperties
34 OutputFilePath OutputPath
35}
36
37func (me *VtsConfig) GenerateAndroidBuildActions(ctx ModuleContext) {
38 me.OutputFilePath = PathForModuleOut(ctx, me.BaseModuleName()).OutputPath
39}
40
41func (me *VtsConfig) AndroidMk() AndroidMkData {
42 androidMkData := AndroidMkData{
43 Class: "FAKE",
karenluoc0318192019-10-10 21:26:26 -040044 Include: "$(BUILD_SYSTEM)/suite_host_config.mk",
Sasha Smundakff36da02019-02-12 17:12:08 -080045 OutputFile: OptionalPathForPath(me.OutputFilePath),
46 }
karenluoc0318192019-10-10 21:26:26 -040047 androidMkData.Extra = []AndroidMkExtraFunc{
48 func(w io.Writer, outputFile Path) {
49 if me.properties.Test_config != nil {
Sasha Smundakff36da02019-02-12 17:12:08 -080050 fmt.Fprintf(w, "LOCAL_TEST_CONFIG := %s\n",
51 *me.properties.Test_config)
karenluoc0318192019-10-10 21:26:26 -040052 }
53 fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE := vts")
54 },
Sasha Smundakff36da02019-02-12 17:12:08 -080055 }
56 return androidMkData
57}
58
59func InitVtsConfigModule(me *VtsConfig) {
60 me.AddProperties(&me.properties)
61}
62
Patrice Arruda3cec2722019-03-13 14:01:12 -070063// vts_config generates a Vendor Test Suite (VTS) configuration file from the
64// <test_config> xml file and stores it in a subdirectory of $(HOST_OUT).
Sasha Smundakff36da02019-02-12 17:12:08 -080065func VtsConfigFactory() Module {
66 module := &VtsConfig{}
67 InitVtsConfigModule(module)
68 InitAndroidArchModule(module /*TODO: or HostAndDeviceSupported? */, HostSupported, MultilibFirst)
69 return module
70}