From a32fc8685dc0b81f9e10d99fdb248f33c0fa05f7 Mon Sep 17 00:00:00 2001 From: Yabin Cui Date: Thu, 3 Dec 2015 16:28:03 -0800 Subject: [PATCH] Don't use StringPrintf() in gtest runner. Change-Id: I0cd0b3cbb952c65b1c449e88ce12964b93029538 --- tests/Android.mk | 4 ---- tests/gtest_main.cpp | 10 ++++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/Android.mk b/tests/Android.mk index 7786a73cb..86c141a6b 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -236,8 +236,6 @@ libBionicGtestMain_cflags := $(test_cflags) libBionicGtestMain_cppflags := $(test_cppflags) -libBionicGtestMain_static_libraries := libbase - module := libBionicGtestMain module_tag := optional build_type := target @@ -262,8 +260,6 @@ libBionicCtsGtestMain_cflags := $(test_cflags) libBionicCtsGtestMain_cppflags := $(test_cppflags) -DUSING_GTEST_OUTPUT_FORMAT \ -libBionicCtsGtestMain_static_libraries := libbase - module := libBionicCtsGtestMain module_tag := optional build_type := target diff --git a/tests/gtest_main.cpp b/tests/gtest_main.cpp index b707a4abe..a662c73ac 100644 --- a/tests/gtest_main.cpp +++ b/tests/gtest_main.cpp @@ -34,8 +34,6 @@ #include #include -#include - #ifndef TEMP_FAILURE_RETRY /* Used to retry syscalls that can return EINTR. */ @@ -778,10 +776,10 @@ static void CollectChildTestResult(const ChildProcInfo& child_proc, TestCase& te int exitcode = WEXITSTATUS(child_proc.exit_status); testcase.SetTestResult(test_id, exitcode == 0 ? TEST_SUCCESS : TEST_FAILED); if (exitcode != 0) { - std::string s = android::base::StringPrintf("%s exited with exitcode %d.\n", - testcase.GetTestName(test_id).c_str(), - exitcode); - testcase.GetTest(test_id).AppendTestOutput(s); + char buf[1024]; + snprintf(buf, sizeof(buf), "%s exited with exitcode %d.\n", + testcase.GetTestName(test_id).c_str(), exitcode); + testcase.GetTest(test_id).AppendTestOutput(buf); } } }