bionic tests: switch to using android-base/file.h for TemporaryFile
A matching definition of TemporaryFile exists in libbase now.
Test: compile
Bug: 119313545
Change-Id: I6f84dbf3af9a9c4b270a2532a36c9cb4c0f6bb8f
diff --git a/tests/sys_mman_test.cpp b/tests/sys_mman_test.cpp
index 22dc383..0b98198 100644
--- a/tests/sys_mman_test.cpp
+++ b/tests/sys_mman_test.cpp
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-#include <gtest/gtest.h>
-
+#include <fcntl.h>
#include <sys/mman.h>
#include <sys/user.h>
#include <sys/types.h>
#include <unistd.h>
-#include "TemporaryFile.h"
+#include <android-base/file.h>
+#include <gtest/gtest.h>
TEST(sys_mman, mmap_std) {
void* map = mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
@@ -82,7 +82,7 @@
ASSERT_EQ(0, munmap(map, sizeof(STRING_MSG)));
- tf.reopen();
+ tf.fd = open(tf.path, O_RDWR);
char buf[sizeof(STRING_MSG)];
memset(buf, 0, sizeof(STRING_MSG));
ASSERT_EQ(STR_SSIZE(STRING_MSG), read(tf.fd, buf, sizeof(STRING_MSG)));
@@ -153,7 +153,7 @@
memcpy(map, NEWPAGE1_MSG, sizeof(NEWPAGE1_MSG));
ASSERT_EQ(0, munmap(map, pagesize));
- tf.reopen();
+ tf.fd = open(tf.path, O_RDWR);
map = mmap(nullptr, pagesize, PROT_WRITE, MAP_SHARED, tf.fd, 2 * pagesize);
ASSERT_NE(MAP_FAILED, map);
close(tf.fd);
@@ -161,7 +161,7 @@
memcpy(map, NEWPAGE2_MSG, sizeof(NEWPAGE2_MSG));
ASSERT_EQ(0, munmap(map, pagesize));
- tf.reopen();
+ tf.fd = open(tf.path, O_RDWR);
char buf[pagesize];
ASSERT_EQ(static_cast<ssize_t>(pagesize), read(tf.fd, buf, pagesize));
ASSERT_STREQ(PAGE0_MSG, buf);