Merge "Switch required to data to be bundled in host-unit-tests"
diff --git a/toolchain-extras/Android.bp b/toolchain-extras/Android.bp
index b1c4d02..b49da95 100644
--- a/toolchain-extras/Android.bp
+++ b/toolchain-extras/Android.bp
@@ -80,6 +80,31 @@
sdk_version: "minimum",
}
+cc_library_static {
+ name: "libprofile-clang-extras_cfi_support",
+ defaults: ["libprofile-clang-defaults"],
+
+ native_bridge_supported: true,
+ vendor_available: true,
+ product_available: true,
+ vndk: {
+ enabled: true,
+ },
+ ramdisk_available: true,
+ vendor_ramdisk_available: true,
+ recovery_available: true,
+
+ stl: "none",
+ system_shared_libs: [],
+ header_libs: ["libc_headers"],
+ sanitize: {
+ cfi: true,
+ config: {
+ cfi_assembly_support: true,
+ },
+ },
+}
+
cc_test {
name: "libprofile-extras-test",
srcs: [
diff --git a/toolchain-extras/profile-extras-test.cpp b/toolchain-extras/profile-extras-test.cpp
index 38acf73..aef007c 100644
--- a/toolchain-extras/profile-extras-test.cpp
+++ b/toolchain-extras/profile-extras-test.cpp
@@ -20,19 +20,26 @@
#include "profile-extras.h"
-static int flush_count = 0;
+static int dump_count = 0;
+static int reset_count = 0;
extern "C" {
-void __gcov_flush() {
- flush_count++;
+void __gcov_dump() {
+ dump_count++;
+}
+
+void __gcov_reset() {
+ reset_count++;
}
}
TEST(profile_extras, smoke) {
- flush_count = 0;
+ dump_count = 0;
+ reset_count = 0;
- ASSERT_EQ(0, flush_count);
+ ASSERT_EQ(0, dump_count);
kill(getpid(), COVERAGE_FLUSH_SIGNAL);
sleep(2);
- ASSERT_EQ(1, flush_count);
+ ASSERT_EQ(1, dump_count);
+ ASSERT_EQ(1, reset_count);
}
diff --git a/toolchain-extras/profile-extras.cpp b/toolchain-extras/profile-extras.cpp
index 93f7f8f..55a9b99 100644
--- a/toolchain-extras/profile-extras.cpp
+++ b/toolchain-extras/profile-extras.cpp
@@ -29,13 +29,15 @@
extern "C" {
-void __gcov_flush(void);
+void __gcov_dump(void);
+void __gcov_reset(void);
// storing SIG_ERR helps us detect (unlikely) looping.
static sighandler_t chained_gcov_signal_handler = SIG_ERR;
static void gcov_signal_handler(int signum) {
- __gcov_flush();
+ __gcov_dump();
+ __gcov_reset();
if (chained_gcov_signal_handler != SIG_ERR &&
chained_gcov_signal_handler != SIG_IGN &&
chained_gcov_signal_handler != SIG_DFL) {