From 98ff77204cef9bb8f0f27420833233622060a09e Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Fri, 13 Mar 2015 22:39:54 -0700 Subject: Create libbase. Move StringPrintf and the string based file I/O from libutils to libbase. Change-Id: I0297a6063874b9d92100e0dd5123fddfbda932fe --- adb/Android.mk | 5 ++--- adb/adb_io_test.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'adb') diff --git a/adb/Android.mk b/adb/Android.mk index 8171611..7cfbcb9 100644 --- a/adb/Android.mk +++ b/adb/Android.mk @@ -90,7 +90,7 @@ LOCAL_MODULE := adbd_test LOCAL_CFLAGS := -DADB_HOST=0 $(LIBADB_CFLAGS) LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) LOCAL_STATIC_LIBRARIES := libadbd -LOCAL_SHARED_LIBRARIES := liblog libcutils libutils +LOCAL_SHARED_LIBRARIES := liblog libbase libcutils include $(BUILD_NATIVE_TEST) include $(CLEAR_VARS) @@ -98,12 +98,11 @@ LOCAL_CLANG := $(ADB_CLANG) LOCAL_MODULE := adb_test LOCAL_CFLAGS := -DADB_HOST=1 $(LIBADB_CFLAGS) LOCAL_SRC_FILES := $(LIBADB_TEST_SRCS) services.cpp -LOCAL_SHARED_LIBRARIES := liblog +LOCAL_SHARED_LIBRARIES := liblog libbase LOCAL_STATIC_LIBRARIES := \ libadb \ libcrypto_static \ libcutils \ - libutils \ ifeq ($(HOST_OS),linux) LOCAL_LDLIBS += -lrt -ldl -lpthread diff --git a/adb/adb_io_test.cpp b/adb/adb_io_test.cpp index 330d9ce..0c69bc9 100644 --- a/adb/adb_io_test.cpp +++ b/adb/adb_io_test.cpp @@ -24,7 +24,7 @@ #include -#include "utils/file.h" +#include "base/file.h" class TemporaryFile { public: @@ -55,7 +55,7 @@ TEST(io, ReadFdExactly_whole) { TemporaryFile tf; ASSERT_NE(-1, tf.fd); - ASSERT_TRUE(android::WriteStringToFd(expected, tf.fd)) << strerror(errno); + ASSERT_TRUE(android::base::WriteStringToFd(expected, tf.fd)) << strerror(errno); ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0)); // Test reading the whole file. @@ -69,7 +69,7 @@ TEST(io, ReadFdExactly_eof) { TemporaryFile tf; ASSERT_NE(-1, tf.fd); - ASSERT_TRUE(android::WriteStringToFd(expected, tf.fd)) << strerror(errno); + ASSERT_TRUE(android::base::WriteStringToFd(expected, tf.fd)) << strerror(errno); ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0)); // Test that not having enough data will fail. @@ -83,7 +83,7 @@ TEST(io, ReadFdExactly_partial) { TemporaryFile tf; ASSERT_NE(-1, tf.fd); - ASSERT_TRUE(android::WriteStringToFd(input, tf.fd)) << strerror(errno); + ASSERT_TRUE(android::base::WriteStringToFd(input, tf.fd)) << strerror(errno); ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0)); // Test reading a partial file. @@ -106,7 +106,7 @@ TEST(io, WriteFdExactly_whole) { ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0)); std::string s; - ASSERT_TRUE(android::ReadFdToString(tf.fd, &s)); + ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s)); EXPECT_STREQ(expected, s.c_str()); } @@ -123,7 +123,7 @@ TEST(io, WriteFdExactly_partial) { expected.pop_back(); std::string s; - ASSERT_TRUE(android::ReadFdToString(tf.fd, &s)); + ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s)); EXPECT_EQ(expected, s); } @@ -137,6 +137,6 @@ TEST(io, WriteStringFully) { ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0)); std::string s; - ASSERT_TRUE(android::ReadFdToString(tf.fd, &s)); + ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s)); EXPECT_STREQ(str, s.c_str()); } -- cgit v1.1