Add simpleperf cts test.

Bug: 27387280

Change-Id: If01e1cc9308959c479e7ab2b3c0620ac8233bf8e
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index 42c39b9..5debfcf 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -247,6 +247,7 @@
 
 ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
 cts_native_tests += bionic-unit-tests-cts
+cts_native_tests += simpleperf-unit-test-cts
 endif
 
 cts_ui_tests := \
diff --git a/tests/tests/simpleperf/Android.mk b/tests/tests/simpleperf/Android.mk
new file mode 100644
index 0000000..c8017cb
--- /dev/null
+++ b/tests/tests/simpleperf/Android.mk
@@ -0,0 +1,60 @@
+LOCAL_PATH := $(call my-dir)
+
+test_executable := simpleperf-unit-test-cts
+list_executable := $(test_executable)_list
+simpleperf_src_path := system/extras/simpleperf
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(test_executable)
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
+LOCAL_MULTILIB := both
+LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
+LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
+
+LOCAL_SHARED_LIBRARIES += \
+  libbacktrace \
+  libbacktrace_offline \
+  libbase \
+  liblog \
+  libutils \
+  libLLVM \
+
+LOCAL_WHOLE_STATIC_LIBRARIES = \
+  libsimpleperf_cts_test \
+
+LOCAL_STATIC_LIBRARIES += \
+  libgtest \
+  libziparchive \
+  libz \
+
+LOCAL_POST_LINK_CMD =  \
+  TMP_FILE=`mktemp` && \
+  (cd $(simpleperf_src_path)/testdata && \
+  zip - -0 -r . >$$TMP_FILE) && \
+  $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY) --add-section .testzipdata=$$TMP_FILE $(linked_module)
+
+LOCAL_CTS_TEST_PACKAGE := android.simpleperf
+include $(BUILD_CTS_EXECUTABLE)
+
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(list_executable)
+LOCAL_MODULE_HOST_OS := linux
+LOCAL_MULTILIB := first
+LOCAL_LDLIBS = -lrt
+
+LOCAL_SHARED_LIBRARIES := \
+  libbacktrace_offline \
+  libbacktrace \
+
+LOCAL_WHOLE_STATIC_LIBRARIES += \
+  libsimpleperf_cts_test \
+
+LOCAL_STATIC_LIBRARIES += \
+  libziparchive-host \
+  libbase \
+  liblog \
+  libz \
+  libutils \
+
+include $(BUILD_HOST_NATIVE_TEST)
\ No newline at end of file
diff --git a/tools/utils/buildCts.py b/tools/utils/buildCts.py
index 2eb5145..953a250 100755
--- a/tools/utils/buildCts.py
+++ b/tools/utils/buildCts.py
@@ -361,6 +361,7 @@
       'android.rsg' : [],
       'android.sax' : [],
       'android.signature' : [],
+      'android.simpleperf' : [],
       'android.speech' : [],
       'android.tests.appsecurity' : [],
       'android.text' : [],