diff options
author | Elliott Hughes <enh@google.com> | 2017-12-15 13:55:53 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2017-12-15 13:55:53 -0800 |
commit | a7f12944d4154a445ee774683e27447d609de540 (patch) | |
tree | 7e2683233d0a36b825f630b1fc0f069e306463e8 /tests/stdio_test.cpp | |
parent | 59a6ee963f96eedf01df7db1e57397ff71852b15 (diff) |
A few more trivial tests.
Based on gaps in the list of functions not referenced by the test
executable.
Bug: N/A
Test: ran tests
Change-Id: I73c238e7cf360f94670c7cd13eb954341c940b7b
Diffstat (limited to 'tests/stdio_test.cpp')
-rw-r--r-- | tests/stdio_test.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp index e060cd9de..d0d91309e 100644 --- a/tests/stdio_test.cpp +++ b/tests/stdio_test.cpp @@ -1719,17 +1719,13 @@ TEST(STDIO_TEST, fdopen_CLOEXEC) { ASSERT_TRUE(fd != -1); // This fd doesn't have O_CLOEXEC... - int flags = fcntl(fd, F_GETFD); - ASSERT_TRUE(flags != -1); - ASSERT_EQ(0, flags & FD_CLOEXEC); + AssertCloseOnExec(fd, false); FILE* fp = fdopen(fd, "re"); ASSERT_TRUE(fp != NULL); // ...but the new one does. - flags = fcntl(fileno(fp), F_GETFD); - ASSERT_TRUE(flags != -1); - ASSERT_EQ(FD_CLOEXEC, flags & FD_CLOEXEC); + AssertCloseOnExec(fileno(fp), true); fclose(fp); close(fd); @@ -1740,16 +1736,12 @@ TEST(STDIO_TEST, freopen_CLOEXEC) { ASSERT_TRUE(fp != NULL); // This FILE* doesn't have O_CLOEXEC... - int flags = fcntl(fileno(fp), F_GETFD); - ASSERT_TRUE(flags != -1); - ASSERT_EQ(0, flags & FD_CLOEXEC); + AssertCloseOnExec(fileno(fp), false); fp = freopen("/proc/version", "re", fp); // ...but the new one does. - flags = fcntl(fileno(fp), F_GETFD); - ASSERT_TRUE(flags != -1); - ASSERT_EQ(FD_CLOEXEC, flags & FD_CLOEXEC); + AssertCloseOnExec(fileno(fp), true); fclose(fp); } |