summaryrefslogtreecommitdiff
path: root/opengl/tests
diff options
context:
space:
mode:
authorKalle Raita <kraita@google.com>2016-11-17 15:23:17 -0800
committerKalle Raita <kraita@google.com>2016-11-17 15:34:51 -0800
commit454c92e07e7248b6d41c547842031ae37b053950 (patch)
treec0d5b025bd8d3db67ff506a40504ad632e0a2c12 /opengl/tests
parent0ad5eb4ac42791705dc484ec973ea789d11a08e2 (diff)
downloadnative-454c92e07e7248b6d41c547842031ae37b053950.tar.gz
Switch from deprecated tempnam to TemporaryFile
Bug: 32969944 Test: Compile for Marlin, execute 32bit/64bit EGLTest. Change-Id: I3d995dc7467deb1d348b94dbbc98aafc211c80cf
Diffstat (limited to 'opengl/tests')
-rw-r--r--opengl/tests/EGLTest/Android.mk1
-rw-r--r--opengl/tests/EGLTest/egl_cache_test.cpp15
2 files changed, 9 insertions, 7 deletions
diff --git a/opengl/tests/EGLTest/Android.mk b/opengl/tests/EGLTest/Android.mk
index 80e4867b2e..b7724509b2 100644
--- a/opengl/tests/EGLTest/Android.mk
+++ b/opengl/tests/EGLTest/Android.mk
@@ -17,6 +17,7 @@ LOCAL_SHARED_LIBRARIES := \
libbinder \
libutils \
libgui \
+ libbase \
LOCAL_C_INCLUDES := \
bionic/libc/private \
diff --git a/opengl/tests/EGLTest/egl_cache_test.cpp b/opengl/tests/EGLTest/egl_cache_test.cpp
index c5bf296e49..c974f63c13 100644
--- a/opengl/tests/EGLTest/egl_cache_test.cpp
+++ b/opengl/tests/EGLTest/egl_cache_test.cpp
@@ -21,9 +21,13 @@
#include <utils/Log.h>
+#include <android-base/test_utils.h>
+
#include "egl_cache.h"
#include "egl_display.h"
+#include <memory>
+
namespace android {
class EGLCacheTest : public ::testing::Test {
@@ -79,23 +83,20 @@ protected:
virtual void SetUp() {
EGLCacheTest::SetUp();
-
- char* tn = tempnam("/sdcard", "EGL_test-cache-");
- mFilename = tn;
- free(tn);
+ mTempFile.reset(new TemporaryFile());
}
virtual void TearDown() {
- unlink(mFilename.string());
+ mTempFile.reset(nullptr);
EGLCacheTest::TearDown();
}
- String8 mFilename;
+ std::unique_ptr<TemporaryFile> mTempFile;
};
TEST_F(EGLCacheSerializationTest, ReinitializedCacheContainsValues) {
uint8_t buf[4] = { 0xee, 0xee, 0xee, 0xee };
- mCache->setCacheFilename(mFilename);
+ mCache->setCacheFilename(&mTempFile->path[0]);
mCache->initialize(egl_display_t::get(EGL_DEFAULT_DISPLAY));
mCache->setBlob("abcd", 4, "efgh", 4);
mCache->terminate();