SF: Enable address sanitizer for the unittest
Not only will it catch issues in the code covered by the test, but it
will also catch issues in how the test injects fakes and similar objects
into the code under test.
In terms of runtime costs, it makes the tests about 2x slower, so now it
takes 200ms to run instead of 100ms.
Bug: None
Test: atest libsurfaceflinger_unittest
Change-Id: I8de3e65c4e7e16cef9f03ed0ba038216971b957d
diff --git a/services/surfaceflinger/tests/unittests/Android.bp b/services/surfaceflinger/tests/unittests/Android.bp
index f1f0fbf..d5122bc 100644
--- a/services/surfaceflinger/tests/unittests/Android.bp
+++ b/services/surfaceflinger/tests/unittests/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 The Android Open Source Project
+// Copyright 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,6 +16,12 @@
name: "libsurfaceflinger_unittest",
defaults: ["libsurfaceflinger_defaults"],
test_suites: ["device-tests"],
+ sanitize: {
+ // Using the address sanitizer not only helps uncover issues in the code
+ // covered by the tests, but also covers some of the tricky injection of
+ // fakes the unit tests currently do.
+ address: true,
+ },
srcs: [
":libsurfaceflinger_sources",
"DisplayIdentificationTest.cpp",