Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d5e8c2f authored by Elliott Hughes's avatar Elliott Hughes Committed by android-build-merger
Browse files

Merge "Fix lseek argument order."

am: 56543606

* commit '56543606':
  Fix lseek argument order.
parents 7c4c3e9b 56543606
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ TEST(io, ReadFdExactly_whole) {
  ASSERT_NE(-1, tf.fd);

  ASSERT_TRUE(android::base::WriteStringToFd(expected, tf.fd)) << strerror(errno);
  ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0));
  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));

  // Test reading the whole file.
  char buf[sizeof(expected)] = {};
@@ -57,7 +57,7 @@ TEST(io, ReadFdExactly_eof) {
  ASSERT_NE(-1, tf.fd);

  ASSERT_TRUE(android::base::WriteStringToFd(expected, tf.fd)) << strerror(errno);
  ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0));
  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));

  // Test that not having enough data will fail.
  char buf[sizeof(expected) + 1] = {};
@@ -71,7 +71,7 @@ TEST(io, ReadFdExactly_partial) {
  ASSERT_NE(-1, tf.fd);

  ASSERT_TRUE(android::base::WriteStringToFd(input, tf.fd)) << strerror(errno);
  ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0));
  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));

  // Test reading a partial file.
  char buf[sizeof(input) - 1] = {};
@@ -90,7 +90,7 @@ TEST(io, WriteFdExactly_whole) {
  // Test writing the whole string to the file.
  ASSERT_TRUE(WriteFdExactly(tf.fd, expected, sizeof(expected)))
    << strerror(errno);
  ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0));
  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));

  std::string s;
  ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s));
@@ -104,7 +104,7 @@ TEST(io, WriteFdExactly_partial) {

  // Test writing a partial string to the file.
  ASSERT_TRUE(WriteFdExactly(tf.fd, buf, sizeof(buf) - 2)) << strerror(errno);
  ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0));
  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));

  std::string expected(buf);
  expected.pop_back();
@@ -130,7 +130,7 @@ TEST(io, WriteFdExactly_string) {

  // Test writing a partial string to the file.
  ASSERT_TRUE(WriteFdExactly(tf.fd, str)) << strerror(errno);
  ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0));
  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));

  std::string s;
  ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s));
@@ -143,7 +143,7 @@ TEST(io, WriteFdFmt) {

    // Test writing a partial string to the file.
    ASSERT_TRUE(WriteFdFmt(tf.fd, "Foo%s%d", "bar", 123)) << strerror(errno);
    ASSERT_EQ(0, lseek(tf.fd, SEEK_SET, 0));
    ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET));

    std::string s;
    ASSERT_TRUE(android::base::ReadFdToString(tf.fd, &s));
+7 −7
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ TEST(logging, LOG) {
  {
    CapturedStderr cap;
    LOG(WARNING) << "foobar";
    ASSERT_EQ(0, lseek(cap.fd(), SEEK_SET, 0));
    ASSERT_EQ(0, lseek(cap.fd(), 0, SEEK_SET));

    std::string output;
    android::base::ReadFdToString(cap.fd(), &output);
@@ -155,7 +155,7 @@ TEST(logging, LOG) {
  {
    CapturedStderr cap;
    LOG(INFO) << "foobar";
    ASSERT_EQ(0, lseek(cap.fd(), SEEK_SET, 0));
    ASSERT_EQ(0, lseek(cap.fd(), 0, SEEK_SET));

    std::string output;
    android::base::ReadFdToString(cap.fd(), &output);
@@ -171,7 +171,7 @@ TEST(logging, LOG) {
  {
    CapturedStderr cap;
    LOG(DEBUG) << "foobar";
    ASSERT_EQ(0, lseek(cap.fd(), SEEK_SET, 0));
    ASSERT_EQ(0, lseek(cap.fd(), 0, SEEK_SET));

    std::string output;
    android::base::ReadFdToString(cap.fd(), &output);
@@ -182,7 +182,7 @@ TEST(logging, LOG) {
    android::base::ScopedLogSeverity severity(android::base::DEBUG);
    CapturedStderr cap;
    LOG(DEBUG) << "foobar";
    ASSERT_EQ(0, lseek(cap.fd(), SEEK_SET, 0));
    ASSERT_EQ(0, lseek(cap.fd(), 0, SEEK_SET));

    std::string output;
    android::base::ReadFdToString(cap.fd(), &output);
@@ -202,7 +202,7 @@ TEST(logging, LOG) {
    LOG(INFO) << (errno = 67890);
    EXPECT_EQ(12345, errno) << "errno was not restored";

    ASSERT_EQ(0, lseek(cap.fd(), SEEK_SET, 0));
    ASSERT_EQ(0, lseek(cap.fd(), 0, SEEK_SET));

    std::string output;
    android::base::ReadFdToString(cap.fd(), &output);
@@ -245,7 +245,7 @@ TEST(logging, PLOG) {
    CapturedStderr cap;
    errno = ENOENT;
    PLOG(INFO) << "foobar";
    ASSERT_EQ(0, lseek(cap.fd(), SEEK_SET, 0));
    ASSERT_EQ(0, lseek(cap.fd(), 0, SEEK_SET));

    std::string output;
    android::base::ReadFdToString(cap.fd(), &output);
@@ -264,7 +264,7 @@ TEST(logging, UNIMPLEMENTED) {
    CapturedStderr cap;
    errno = ENOENT;
    UNIMPLEMENTED(ERROR);
    ASSERT_EQ(0, lseek(cap.fd(), SEEK_SET, 0));
    ASSERT_EQ(0, lseek(cap.fd(), 0, SEEK_SET));

    std::string output;
    android::base::ReadFdToString(cap.fd(), &output);