Remove usage of CHECK_NOTNULL
We want to switch to absl logging instead of glog. gtest and ceres are
going there, and we already have absl as a dependency. ABSL doesn't
have CHECK_NOTNULL, and we can move things over in an easier to review
fashion.
Change-Id: Ifd9a11ec34a2357cec43f88dba015db9c28ed2cf
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/events/logging/buffer_encoder_test.cc b/aos/events/logging/buffer_encoder_test.cc
index 7dda300..127fb4f 100644
--- a/aos/events/logging/buffer_encoder_test.cc
+++ b/aos/events/logging/buffer_encoder_test.cc
@@ -9,6 +9,7 @@
#include "gtest/gtest.h"
#include "aos/events/logging/buffer_encoder_param_test.h"
+#include "aos/testing/tmpdir.h"
namespace aos::logger::testing {
@@ -44,8 +45,7 @@
TEST(DummyDecoderTest, ReadsIntoExactBuffer) {
static const std::string kTestString{"Just some random words."};
- const char *const test_dir = CHECK_NOTNULL(getenv("TEST_TMPDIR"));
- const std::string file_path = std::string(test_dir) + "/foo";
+ const std::string file_path = aos::testing::TestTmpDir() + "/foo";
std::ofstream(file_path, std::ios::binary) << kTestString;
// Read the contents of the file into the buffer.
@@ -65,8 +65,7 @@
TEST(DummyDecoderTest, ReadsIntoLargerBuffer) {
static const std::string kTestString{"Just some random words."};
- const char *const test_dir = CHECK_NOTNULL(getenv("TEST_TMPDIR"));
- const std::string file_path = std::string(test_dir) + "/foo";
+ const std::string file_path = aos::testing::TestTmpDir() + "/foo";
std::ofstream(file_path, std::ios::binary) << kTestString;
DummyDecoder dummy_decoder(file_path.c_str());
@@ -84,8 +83,7 @@
TEST(DummyDecoderTest, ReadsRepeatedlyIntoSmallerBuffer) {
static const std::string kTestString{"Just some random words."};
- const char *const test_dir = CHECK_NOTNULL(getenv("TEST_TMPDIR"));
- const std::string file_path = std::string(test_dir) + "/foo";
+ const std::string file_path = aos::testing::TestTmpDir() + "/foo";
std::ofstream(file_path, std::ios::binary) << kTestString;
DummyDecoder dummy_decoder(file_path.c_str());