Move TestEnforceRRO test cases into test function

The test cases will need to reference buildDir, which is not
yet set at global variable initialization time.

Bug: 123510624
Test: TestEnforceRRO
Change-Id: I0dda0184dfab496c820e11ed76b7594a60d5d587
This commit is contained in:
Colin Cross
2019-02-01 11:44:44 -08:00
committed by Anton Hansson
parent cc2d11961c
commit 5c4791c71e

View File

@@ -106,13 +106,14 @@ func TestApp(t *testing.T) {
}
}
var testEnforceRROTests = []struct {
func TestEnforceRRO(t *testing.T) {
testCases := []struct {
name string
enforceRROTargets []string
enforceRROExcludedOverlays []string
overlayFiles map[string][]string
rroDirs map[string][]string
}{
}{
{
name: "no RRO",
enforceRROTargets: nil,
@@ -165,9 +166,8 @@ var testEnforceRROTests = []struct {
"bar": []string{"device/vendor/blah/overlay/bar/res"},
},
},
}
}
func TestEnforceRRO(t *testing.T) {
resourceOverlays := []string{
"device/vendor/blah/overlay",
"device/vendor/blah/overlay2",
@@ -196,7 +196,7 @@ func TestEnforceRRO(t *testing.T) {
}
`
for _, testCase := range testEnforceRROTests {
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
config := testConfig(nil)
config.TestProductVariables.ResourceOverlays = resourceOverlays