Call SetShmBase() in init_rs
The ShmEventLoop rust test was using /dev/shm/aos and breaking out of
the sandbox. Fix that.
Change-Id: I14db8b500a03a66fef41399c4cea334ff79b217f
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/testing/gtest_main.cc b/aos/testing/gtest_main.cc
index 21f141f..2fb77fe 100644
--- a/aos/testing/gtest_main.cc
+++ b/aos/testing/gtest_main.cc
@@ -7,6 +7,7 @@
#include "gtest/gtest.h"
#include "aos/init.h"
+#include "aos/testing/tmpdir.h"
DEFINE_bool(print_logs, false,
"Print the log messages as they are being generated.");
@@ -14,7 +15,6 @@
"Print all log messages to FILE instead of standard output.");
namespace aos {
-void SetShmBase(const std::string_view base) __attribute__((weak));
namespace testing {
@@ -48,12 +48,7 @@
// Point shared memory away from /dev/shm if we are testing. We don't care
// about RT in this case, so if it is backed by disk, we are fine.
- if (::aos::SetShmBase) {
- const char *tmpdir_c_str = getenv("TEST_TMPDIR");
- if (tmpdir_c_str != nullptr) {
- aos::SetShmBase(tmpdir_c_str);
- }
- }
+ aos::testing::SetTestShmBase();
return RUN_ALL_TESTS();
}