summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2022-10-31 09:26:38 +0100
committer Treehugger Robot <treehugger-gerrit@google.com> 2022-10-31 10:14:11 +0000
commit4f1c9f9df127bfc62852650f09bd06603b9db354 (patch)
tree0b8122179d684305af79460c61652152f7210740
parent51dec0553069022efb2b41e8fe313c10fe13b208 (diff)
Initialize `Runtime` for `MutexTest`.
Test: m test-art-host-gtest Change-Id: I386847a163cdac79a593032191fcd3d878070ac4
-rw-r--r--runtime/base/mutex_test.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/base/mutex_test.cc b/runtime/base/mutex_test.cc
index f524d14c67..f1b4e49f69 100644
--- a/runtime/base/mutex_test.cc
+++ b/runtime/base/mutex_test.cc
@@ -16,12 +16,17 @@
#include "mutex-inl.h"
-#include "base/common_art_test.h"
+#include "common_runtime_test.h"
#include "thread-current-inl.h"
namespace art {
-class MutexTest : public CommonArtTest {};
+class MutexTest : public CommonRuntimeTest {
+ protected:
+ MutexTest() {
+ use_boot_image_ = true; // Make the Runtime creation cheaper.
+ }
+};
struct MutexTester {
static void AssertDepth(Mutex& mu, uint32_t expected_depth) {
@@ -37,6 +42,9 @@ struct MutexTester {
};
TEST_F(MutexTest, LockUnlock) {
+ // TODO: Remove `Mutex` dependency on `Runtime` or at least make sure it works
+ // without a `Runtime` with reasonable defaults (and without dumping stack for timeout).
+ ASSERT_TRUE(Runtime::Current() != nullptr);
Mutex mu("test mutex");
MutexTester::AssertDepth(mu, 0U);
mu.Lock(Thread::Current());