Added basic span reader test.
Might as well right better tests when writing sorting v2. Backfilling
is needed here before we can build up further.
Change-Id: Ibe805cb031eba3eac4bb3d65dfa318c52e6487e2
diff --git a/aos/testing/BUILD b/aos/testing/BUILD
index ce67b84..e70b5a4 100644
--- a/aos/testing/BUILD
+++ b/aos/testing/BUILD
@@ -86,3 +86,11 @@
],
visibility = ["//visibility:public"],
)
+
+cc_library(
+ name = "tmpdir",
+ testonly = True,
+ srcs = ["tmpdir.cc"],
+ hdrs = ["tmpdir.h"],
+ visibility = ["//visibility:public"],
+)
diff --git a/aos/testing/tmpdir.cc b/aos/testing/tmpdir.cc
new file mode 100644
index 0000000..15e3c13
--- /dev/null
+++ b/aos/testing/tmpdir.cc
@@ -0,0 +1,18 @@
+#include "aos/testing/tmpdir.h"
+
+#include <cstdlib>
+#include <string>
+
+namespace aos {
+namespace testing {
+
+std::string TestTmpDir() {
+ const char *tmp_dir = std::getenv("TEST_TMPDIR");
+ if (tmp_dir != nullptr) {
+ return tmp_dir;
+ }
+ return "/tmp";
+}
+
+} // namespace testing
+} // namespace aos
diff --git a/aos/testing/tmpdir.h b/aos/testing/tmpdir.h
new file mode 100644
index 0000000..7e64342
--- /dev/null
+++ b/aos/testing/tmpdir.h
@@ -0,0 +1,15 @@
+#ifndef AOS_TESTING_TMPDIR_H_
+#define AOS_TESTING_TMPDIR_H_
+
+#include <string>
+
+namespace aos {
+namespace testing {
+
+// Returns a usable temporary directory.
+std::string TestTmpDir();
+
+} // namespace testing
+} // namespace aos
+
+#endif // AOS_TESTING_TMPDIR_H_