am 402ef734: am 81c1ef94: Merge "Add bionic unit tests to CTS."

* commit '402ef73407dec560dae6aade909fc41c1b71d29b':
  Add bionic unit tests to CTS.
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index 2c25d3d..755cb45 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -126,7 +126,8 @@
 # Native test executables that need to have associated test XMLs.
 cts_native_exes := \
 	NativeMediaTest_SL \
-	NativeMediaTest_XA
+	NativeMediaTest_XA \
+	bionic-unit-tests-cts \
 
 cts_ui_tests := \
 	CtsUiAutomatorTests
diff --git a/build/test_executable.mk b/build/test_executable.mk
index 8b445a3..74b3a95 100644
--- a/build/test_executable.mk
+++ b/build/test_executable.mk
@@ -27,7 +27,7 @@
 
 cts_executable_xml := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).xml
 
-$(cts_executable_xml): PRIVATE_PATH := $(LOCAL_PATH)
+$(cts_executable_xml): PRIVATE_PATH := $(cts_src_test_path)
 $(cts_executable_xml): PRIVATE_TEST_PACKAGE := $(LOCAL_CTS_TEST_PACKAGE)
 $(cts_executable_xml): PRIVATE_EXECUTABLE := $(LOCAL_MODULE)
 $(cts_executable_xml): $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES)) $(CTS_EXPECTATIONS) $(CTS_NATIVE_TEST_SCANNER) $(CTS_XML_GENERATOR)
diff --git a/tests/tests/bionic/Android.mk b/tests/tests/bionic/Android.mk
new file mode 100644
index 0000000..ac08b25
--- /dev/null
+++ b/tests/tests/bionic/Android.mk
@@ -0,0 +1,25 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+cts_src_test_path := bionic/tests
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE := bionic-unit-tests-cts
+
+LOCAL_ADDITION_DEPENDENCIES := \
+	$(LOCAL_PATH)/Android.mk \
+
+LOCAL_SHARED_LIBRARIES += \
+	libstlport \
+
+LOCAL_WHOLE_STATIC_LIBRARIES += \
+	libBionicTests \
+
+LOCAL_STATIC_LIBRARIES += \
+	libgtest \
+	libgtest_main \
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
+LOCAL_CTS_TEST_PACKAGE := android.bionic
+
+include $(BUILD_CTS_EXECUTABLE)
diff --git a/tests/tests/nativemedia/sl/Android.mk b/tests/tests/nativemedia/sl/Android.mk
index d999b57..90d8863 100644
--- a/tests/tests/nativemedia/sl/Android.mk
+++ b/tests/tests/nativemedia/sl/Android.mk
@@ -3,6 +3,8 @@
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
+cts_src_test_path := $(LOCAL_PATH)
+
 LOCAL_MODULE_TAGS := optional
 
 LOCAL_C_INCLUDES:= \
diff --git a/tests/tests/nativemedia/xa/Android.mk b/tests/tests/nativemedia/xa/Android.mk
index dad8acd..9ff2110 100644
--- a/tests/tests/nativemedia/xa/Android.mk
+++ b/tests/tests/nativemedia/xa/Android.mk
@@ -3,6 +3,8 @@
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
+cts_src_test_path := $(LOCAL_PATH)
+
 LOCAL_MODULE_TAGS := optional
 
 LOCAL_C_INCLUDES:= \
diff --git a/tools/cts-native-scanner/src/com/android/cts/nativescanner/TestScanner.java b/tools/cts-native-scanner/src/com/android/cts/nativescanner/TestScanner.java
index 0a1b207..370b509 100644
--- a/tools/cts-native-scanner/src/com/android/cts/nativescanner/TestScanner.java
+++ b/tools/cts-native-scanner/src/com/android/cts/nativescanner/TestScanner.java
@@ -78,11 +78,13 @@
         }
     }
 
-    // We want to find lines like TEST_F(SLObjectCreationTest, testAudioPlayerFromFdCreation) { ...
+    // We want to find lines like TEST_F(SLObjectCreationTest, testAudioPlayerFromFdCreation)
+    // or TEST(stdio, printf) { ...
     // and extract the "SLObjectCreationTest" as group #1,
     // "testAudioPlayerFromFdCreation" as group #2
+    // TODO: It would be better to concatenate the two parts.
     private static final Pattern METHOD_REGEX =
-            Pattern.compile("\\s*TEST_F\\((\\w+),\\s*(\\w+)\\).*");
+            Pattern.compile("\\s*TEST(?:_F)?\\((\\w+),\\s*(\\w+)\\).*");
 
     public void scanFile(Scanner scanner, List<String> testNames) {
         try {