Update memtag code behavior to match comment.

Test: go test soong tests
Change-Id: I630c06f01c90256b1990c37b9236e8967a5fa316
This commit is contained in:
Liz Kammer 2021-06-22 16:57:27 -04:00
parent d56ddb5482
commit 7b920b4057
2 changed files with 13 additions and 9 deletions

View file

@ -293,9 +293,13 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
}
// cc_test targets default to SYNC MemTag unless explicitly set to ASYNC (via diag: {memtag_heap}).
if ctx.testBinary() && s.Memtag_heap == nil {
s.Memtag_heap = proptools.BoolPtr(true)
s.Diag.Memtag_heap = proptools.BoolPtr(true)
if ctx.testBinary() {
if s.Memtag_heap == nil {
s.Memtag_heap = proptools.BoolPtr(true)
}
if s.Diag.Memtag_heap == nil {
s.Diag.Memtag_heap = proptools.BoolPtr(true)
}
}
var globalSanitizers []string

View file

@ -359,9 +359,9 @@ func TestSanitizeMemtagHeap(t *testing.T) {
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_disable", variant), Async)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_sync", variant), Sync)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_no_override", variant), Async)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_async", variant), Async)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_disable", variant), Async)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_no_override", variant), Sync)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_async", variant), Sync)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_disable", variant), Sync)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_sync", variant), Sync)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_no_override", variant), Async)
@ -434,9 +434,9 @@ func TestSanitizeMemtagHeapWithSanitizeDevice(t *testing.T) {
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_disable", variant), Async)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_binary_override_default_sync", variant), Sync)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_no_override", variant), Async)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_async", variant), Async)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_disable", variant), Async)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_no_override", variant), Sync)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_async", variant), Sync)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_disable", variant), Sync)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_test_override_default_sync", variant), Sync)
checkHasMemtagNote(t, ctx.ModuleForTests("set_memtag_set_async_binary_no_override", variant), Async)