summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-03-13 22:39:54 -0700
committerDan Albert <danalbert@google.com>2015-03-14 16:36:18 -0700
commit98ff77204cef9bb8f0f27420833233622060a09e (patch)
tree54d1196083e2e4dc4b53353a2a77be6abd265066 /adb
parentf1c2ba490ef979b3d347f08535ab8b817e917e62 (diff)
downloadsystem_core-98ff77204cef9bb8f0f27420833233622060a09e.zip
system_core-98ff77204cef9bb8f0f27420833233622060a09e.tar.gz
system_core-98ff77204cef9bb8f0f27420833233622060a09e.tar.bz2
Create libbase.
Move StringPrintf and the string based file I/O from libutils to libbase. Change-Id: I0297a6063874b9d92100e0dd5123fddfbda932fe
Diffstat (limited to 'adb')
-rw-r--r--adb/Android.mk5
-rw-r--r--adb/adb_io_test.cpp14
2 files changed, 9 insertions, 10 deletions
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 <string>
-#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());
}