Prebuilt replacing source should not change partition
This reveals unintended mistake (setting a wrong target partition) at build-time instead of runtime, which is much harder to debug. Bug: 280368661 Test: m nothing (soong test) Change-Id: Ic5e5e97ba918e24f7a59aceb405c2b105e28cccc
This commit is contained in:
@@ -497,6 +497,52 @@ func TestPrebuilts(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func testPrebuiltError(t *testing.T, expectedError, bp string) {
|
||||
t.Helper()
|
||||
fs := MockFS{
|
||||
"prebuilt_file": nil,
|
||||
}
|
||||
GroupFixturePreparers(
|
||||
PrepareForTestWithArchMutator,
|
||||
PrepareForTestWithPrebuilts,
|
||||
PrepareForTestWithOverrides,
|
||||
fs.AddToFixture(),
|
||||
FixtureRegisterWithContext(registerTestPrebuiltModules),
|
||||
).
|
||||
ExtendWithErrorHandler(FixtureExpectsAtLeastOneErrorMatchingPattern(expectedError)).
|
||||
RunTestWithBp(t, bp)
|
||||
}
|
||||
|
||||
func TestPrebuiltShouldNotChangePartition(t *testing.T) {
|
||||
testPrebuiltError(t, `partition is different`, `
|
||||
source {
|
||||
name: "foo",
|
||||
vendor: true,
|
||||
}
|
||||
prebuilt {
|
||||
name: "foo",
|
||||
prefer: true,
|
||||
srcs: ["prebuilt_file"],
|
||||
}`)
|
||||
}
|
||||
|
||||
func TestPrebuiltShouldNotChangePartition_WithOverride(t *testing.T) {
|
||||
testPrebuiltError(t, `partition is different`, `
|
||||
source {
|
||||
name: "foo",
|
||||
vendor: true,
|
||||
}
|
||||
override_source {
|
||||
name: "bar",
|
||||
base: "foo",
|
||||
}
|
||||
prebuilt {
|
||||
name: "bar",
|
||||
prefer: true,
|
||||
srcs: ["prebuilt_file"],
|
||||
}`)
|
||||
}
|
||||
|
||||
func registerTestPrebuiltBuildComponents(ctx RegistrationContext) {
|
||||
registerTestPrebuiltModules(ctx)
|
||||
|
||||
|
Reference in New Issue
Block a user