am d4fbb1a8: Merge "Fix dprintf test."

* commit 'd4fbb1a8617285ab1d29324308aa016377fc36f3':
  Fix dprintf test.
This commit is contained in:
Christopher Ferris 2014-05-29 22:44:25 +00:00 committed by Android Git Automerger
commit 9d73fa3fad

View File

@ -61,16 +61,15 @@ TEST(stdio, dprintf) {
ASSERT_EQ(rc, 6); ASSERT_EQ(rc, 6);
lseek(tf.fd, SEEK_SET, 0); lseek(tf.fd, SEEK_SET, 0);
FILE* tfile = fdopen(tf.fd, "r");
ASSERT_TRUE(tfile != NULL);
char buf[6]; char buf[7];
int bytes_to_read = 6; ASSERT_EQ(buf, fgets(buf, sizeof(buf), tfile));
do {
int bytes_read = read(tf.fd, buf, bytes_to_read);
ASSERT_TRUE(bytes_to_read >= 0);
bytes_to_read -= bytes_read;
} while (bytes_to_read > 0);
ASSERT_STREQ("hello\n", buf); ASSERT_STREQ("hello\n", buf);
// Make sure there isn't anything else in the file.
ASSERT_EQ(NULL, fgets(buf, sizeof(buf), tfile));
fclose(tfile);
} }
TEST(stdio, getdelim) { TEST(stdio, getdelim) {