Add some verification on test_suite for test_module_config
During some migration, I created some modules where the derived module and base module were in different suites (one was in general-tests, one was in base-tests). This had the potential to create dangling symlinks for partial downloads from the test suites in tradefed. Bug: b/357880359 Test: go test ./ Test: m nothing Test: modified a Android.bp with test_module_config to change the suite to "device-tests" from "general-tests" and got the error as expected: error: cts/tests/libcore/luni/Android.bp:70:1: module "CtsLibcoreTestCases_dalvik_system" variant "android_common": Suite: [device-tests] listed but does not exist in base module: CtsLibcoreTestCases Change-Id: Ia8fa991914a47336fc2d0148f066824433db2ecd
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
@@ -174,6 +175,20 @@ func (m *testModuleConfigModule) validateTestSuites(ctx android.ModuleContext) b
|
||||
return false
|
||||
}
|
||||
|
||||
var extra_derived_suites []string
|
||||
// Ensure all suites listed are also in base.
|
||||
for _, s := range m.tradefedProperties.Test_suites {
|
||||
if !slices.Contains(m.provider.TestSuites, s) {
|
||||
extra_derived_suites = append(extra_derived_suites, s)
|
||||
}
|
||||
}
|
||||
if len(extra_derived_suites) != 0 {
|
||||
ctx.ModuleErrorf("Suites: [%s] listed but do not exist in base module: %s",
|
||||
strings.Join(extra_derived_suites, ", "),
|
||||
*m.tradefedProperties.Base)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user