Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_RUNTIME_COMMON_RUNTIME_TEST_H_ |
| 18 | #define ART_RUNTIME_COMMON_RUNTIME_TEST_H_ |
| 19 | |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 20 | #include <gtest/gtest.h> |
| 21 | #include <jni.h> |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 22 | |
Vladimir Marko | fdd4684 | 2020-03-25 14:57:17 +0000 | [diff] [blame] | 23 | #include <functional> |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 24 | #include <string> |
| 25 | |
Andreas Gampe | 170331f | 2017-12-07 18:41:03 -0800 | [diff] [blame] | 26 | #include <android-base/logging.h> |
| 27 | |
David Srbecky | 3e52aa4 | 2015-04-12 07:45:18 +0100 | [diff] [blame] | 28 | #include "arch/instruction_set.h" |
David Sehr | d5f8de8 | 2018-04-27 14:12:03 -0700 | [diff] [blame] | 29 | #include "base/common_art_test.h" |
Andreas Gampe | 7fbc4a5 | 2018-11-28 08:26:47 -0800 | [diff] [blame] | 30 | #include "base/locks.h" |
David Sehr | c431b9d | 2018-03-02 12:01:51 -0800 | [diff] [blame] | 31 | #include "base/os.h" |
Mathieu Chartier | 2daa134 | 2018-02-20 16:19:28 -0800 | [diff] [blame] | 32 | #include "base/unix_file/fd_file.h" |
| 33 | #include "dex/art_dex_file_loader.h" |
David Sehr | 9e734c7 | 2018-01-04 17:56:19 -0800 | [diff] [blame] | 34 | #include "dex/compact_dex_level.h" |
Mathieu Chartier | 3398c78 | 2016-09-30 10:27:43 -0700 | [diff] [blame] | 35 | // TODO: Add inl file and avoid including inl. |
| 36 | #include "obj_ptr-inl.h" |
Andreas Gampe | 5a0430d | 2019-01-04 14:33:57 -0800 | [diff] [blame] | 37 | #include "runtime_globals.h" |
Calin Juravle | c79470d | 2017-07-12 17:37:42 -0700 | [diff] [blame] | 38 | #include "scoped_thread_state_change-inl.h" |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 39 | |
| 40 | namespace art { |
| 41 | |
Vladimir Marko | fdd4684 | 2020-03-25 14:57:17 +0000 | [diff] [blame] | 42 | class MethodReference; |
| 43 | class TypeReference; |
| 44 | |
Andreas Gampe | 170331f | 2017-12-07 18:41:03 -0800 | [diff] [blame] | 45 | using LogSeverity = android::base::LogSeverity; |
| 46 | using ScopedLogSeverity = android::base::ScopedLogSeverity; |
| 47 | |
David Sehr | a8d23cb | 2019-04-08 11:29:11 -0700 | [diff] [blame] | 48 | template<class MirrorType> |
| 49 | static inline ObjPtr<MirrorType> MakeObjPtr(MirrorType* ptr) { |
| 50 | return ptr; |
| 51 | } |
| 52 | |
| 53 | template<class MirrorType> |
| 54 | static inline ObjPtr<MirrorType> MakeObjPtr(ObjPtr<MirrorType> ptr) { |
| 55 | return ptr; |
| 56 | } |
| 57 | |
| 58 | // OBJ pointer helpers to avoid needing .Decode everywhere. |
| 59 | #define EXPECT_OBJ_PTR_EQ(a, b) EXPECT_EQ(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr()) |
| 60 | #define ASSERT_OBJ_PTR_EQ(a, b) ASSERT_EQ(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr()) |
| 61 | #define EXPECT_OBJ_PTR_NE(a, b) EXPECT_NE(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr()) |
| 62 | #define ASSERT_OBJ_PTR_NE(a, b) ASSERT_NE(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr()) |
| 63 | |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 64 | class ClassLinker; |
| 65 | class CompilerCallbacks; |
| 66 | class DexFile; |
| 67 | class JavaVMExt; |
| 68 | class Runtime; |
| 69 | typedef std::vector<std::pair<std::string, const void*>> RuntimeOptions; |
Andreas Gampe | 26761f7 | 2017-07-20 18:00:39 -0700 | [diff] [blame] | 70 | class Thread; |
| 71 | class VariableSizedHandleScope; |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 72 | |
David Sehr | d5f8de8 | 2018-04-27 14:12:03 -0700 | [diff] [blame] | 73 | class CommonRuntimeTestImpl : public CommonArtTestImpl { |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 74 | public: |
Mathieu Chartier | 91c9116 | 2016-01-15 09:48:15 -0800 | [diff] [blame] | 75 | CommonRuntimeTestImpl(); |
| 76 | virtual ~CommonRuntimeTestImpl(); |
Andreas Gampe | 7747c8d | 2014-08-06 14:53:03 -0700 | [diff] [blame] | 77 | |
Andreas Gampe | 26761f7 | 2017-07-20 18:00:39 -0700 | [diff] [blame] | 78 | // A helper function to fill the heap. |
| 79 | static void FillHeap(Thread* self, |
| 80 | ClassLinker* class_linker, |
| 81 | VariableSizedHandleScope* handle_scope) |
| 82 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 83 | // A helper to set up a small heap (4M) to make FillHeap faster. |
| 84 | static void SetUpRuntimeOptionsForFillHeap(RuntimeOptions *options); |
| 85 | |
Mathieu Chartier | 2daa134 | 2018-02-20 16:19:28 -0800 | [diff] [blame] | 86 | template <typename Mutator> |
| 87 | bool MutateDexFile(File* output_dex, const std::string& input_jar, const Mutator& mutator) { |
| 88 | std::vector<std::unique_ptr<const DexFile>> dex_files; |
| 89 | std::string error_msg; |
| 90 | const ArtDexFileLoader dex_file_loader; |
| 91 | CHECK(dex_file_loader.Open(input_jar.c_str(), |
| 92 | input_jar.c_str(), |
Andreas Gampe | 98ea9d9 | 2018-10-19 14:06:15 -0700 | [diff] [blame] | 93 | /*verify=*/ true, |
| 94 | /*verify_checksum=*/ true, |
Mathieu Chartier | 2daa134 | 2018-02-20 16:19:28 -0800 | [diff] [blame] | 95 | &error_msg, |
| 96 | &dex_files)) << error_msg; |
| 97 | EXPECT_EQ(dex_files.size(), 1u) << "Only one input dex is supported"; |
| 98 | const std::unique_ptr<const DexFile>& dex = dex_files[0]; |
| 99 | CHECK(dex->EnableWrite()) << "Failed to enable write"; |
| 100 | DexFile* dex_file = const_cast<DexFile*>(dex.get()); |
| 101 | mutator(dex_file); |
| 102 | const_cast<DexFile::Header&>(dex_file->GetHeader()).checksum_ = dex_file->CalculateChecksum(); |
| 103 | if (!output_dex->WriteFully(dex->Begin(), dex->Size())) { |
| 104 | return false; |
| 105 | } |
| 106 | if (output_dex->Flush() != 0) { |
| 107 | PLOG(FATAL) << "Could not flush the output file."; |
| 108 | } |
| 109 | return true; |
| 110 | } |
| 111 | |
Vladimir Marko | 2b076df | 2019-02-20 11:27:52 +0000 | [diff] [blame] | 112 | void MakeInterpreted(ObjPtr<mirror::Class> klass) |
| 113 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 114 | |
Vladimir Marko | b9c29f6 | 2019-03-20 14:22:51 +0000 | [diff] [blame] | 115 | bool StartDex2OatCommandLine(/*out*/std::vector<std::string>* argv, |
Vladimir Marko | fdd4684 | 2020-03-25 14:57:17 +0000 | [diff] [blame] | 116 | /*out*/std::string* error_msg, |
| 117 | bool use_runtime_bcp_and_image = true); |
Vladimir Marko | 7a85e70 | 2018-12-03 18:47:23 +0000 | [diff] [blame] | 118 | |
David Srbecky | cf0c6ef | 2020-02-05 16:25:36 +0000 | [diff] [blame] | 119 | bool CompileBootImage(const std::vector<std::string>& extra_args, |
| 120 | const std::string& image_file_name_prefix, |
| 121 | ArrayRef<const std::string> dex_files, |
| 122 | ArrayRef<const std::string> dex_locations, |
| 123 | std::string* error_msg, |
| 124 | const std::string& use_fd_prefix = ""); |
| 125 | |
| 126 | bool CompileBootImage(const std::vector<std::string>& extra_args, |
| 127 | const std::string& image_file_name_prefix, |
| 128 | ArrayRef<const std::string> dex_files, |
| 129 | std::string* error_msg, |
| 130 | const std::string& use_fd_prefix = "") { |
| 131 | return CompileBootImage( |
| 132 | extra_args, image_file_name_prefix, dex_files, dex_files, error_msg, use_fd_prefix); |
| 133 | } |
| 134 | |
| 135 | bool RunDex2Oat(const std::vector<std::string>& args, std::string* error_msg); |
| 136 | |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 137 | protected: |
Mathieu Chartier | 91c9116 | 2016-01-15 09:48:15 -0800 | [diff] [blame] | 138 | // Allow subclases such as CommonCompilerTest to add extra options. |
| 139 | virtual void SetUpRuntimeOptions(RuntimeOptions* options ATTRIBUTE_UNUSED) {} |
| 140 | |
| 141 | // Called before the runtime is created. |
| 142 | virtual void PreRuntimeCreate() {} |
| 143 | |
| 144 | // Called after the runtime is created. |
| 145 | virtual void PostRuntimeCreate() {} |
| 146 | |
Calin Juravle | 7865ac7 | 2017-06-28 11:03:12 -0700 | [diff] [blame] | 147 | // Loads the test dex file identified by the given dex_name into a PathClassLoader. |
| 148 | // Returns the created class loader. |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 149 | jobject LoadDex(const char* dex_name) REQUIRES_SHARED(Locks::mutator_lock_); |
Calin Juravle | 7865ac7 | 2017-06-28 11:03:12 -0700 | [diff] [blame] | 150 | // Loads the test dex file identified by the given first_dex_name and second_dex_name |
| 151 | // into a PathClassLoader. Returns the created class loader. |
Nicolas Geoffray | d01f60c | 2016-10-28 14:45:48 +0100 | [diff] [blame] | 152 | jobject LoadMultiDex(const char* first_dex_name, const char* second_dex_name) |
| 153 | REQUIRES_SHARED(Locks::mutator_lock_); |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 154 | |
Nicolas Geoffray | e167273 | 2018-11-30 01:09:49 +0000 | [diff] [blame] | 155 | jobject LoadDexInPathClassLoader(const std::string& dex_name, |
| 156 | jobject parent_loader, |
| 157 | jobject shared_libraries = nullptr); |
Dan Zimmerman | b682ea4 | 2019-12-23 06:59:06 -0800 | [diff] [blame] | 158 | jobject LoadDexInPathClassLoader(const std::vector<std::string>& dex_names, |
| 159 | jobject parent_loader, |
| 160 | jobject shared_libraries = nullptr); |
Calin Juravle | 7865ac7 | 2017-06-28 11:03:12 -0700 | [diff] [blame] | 161 | jobject LoadDexInDelegateLastClassLoader(const std::string& dex_name, jobject parent_loader); |
David Brazdil | 1a9ac53 | 2019-03-05 11:57:13 +0000 | [diff] [blame] | 162 | jobject LoadDexInInMemoryDexClassLoader(const std::string& dex_name, jobject parent_loader); |
Dan Zimmerman | b682ea4 | 2019-12-23 06:59:06 -0800 | [diff] [blame] | 163 | jobject LoadDexInWellKnownClassLoader(const std::vector<std::string>& dex_names, |
Calin Juravle | 7865ac7 | 2017-06-28 11:03:12 -0700 | [diff] [blame] | 164 | jclass loader_class, |
Nicolas Geoffray | e167273 | 2018-11-30 01:09:49 +0000 | [diff] [blame] | 165 | jobject parent_loader, |
| 166 | jobject shared_libraries = nullptr); |
Calin Juravle | 7865ac7 | 2017-06-28 11:03:12 -0700 | [diff] [blame] | 167 | |
Vladimir Marko | fdd4684 | 2020-03-25 14:57:17 +0000 | [diff] [blame] | 168 | void VisitDexes(ArrayRef<const std::string> dexes, |
| 169 | const std::function<void(MethodReference)>& method_visitor, |
| 170 | const std::function<void(TypeReference)>& class_visitor, |
| 171 | size_t method_frequency = 1u, |
| 172 | size_t class_frequency = 1u); |
| 173 | |
| 174 | void GenerateProfile(ArrayRef<const std::string> dexes, |
| 175 | File* out_file, |
| 176 | size_t method_frequency = 1u, |
| 177 | size_t type_frequency = 1u); |
| 178 | |
Ian Rogers | 700a402 | 2014-05-19 16:49:03 -0700 | [diff] [blame] | 179 | std::unique_ptr<Runtime> runtime_; |
Richard Uhler | fbef44d | 2014-12-23 09:48:51 -0800 | [diff] [blame] | 180 | |
| 181 | // The class_linker_, java_lang_dex_file_, and boot_class_path_ are all |
| 182 | // owned by the runtime. |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 183 | ClassLinker* class_linker_; |
Richard Uhler | fbef44d | 2014-12-23 09:48:51 -0800 | [diff] [blame] | 184 | const DexFile* java_lang_dex_file_; |
| 185 | std::vector<const DexFile*> boot_class_path_; |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 186 | |
Calin Juravle | c79470d | 2017-07-12 17:37:42 -0700 | [diff] [blame] | 187 | // Get the dex files from a PathClassLoader or DelegateLastClassLoader. |
| 188 | // This only looks into the current class loader and does not recurse into the parents. |
Andreas Gampe | 81c6f8d | 2015-03-25 17:19:53 -0700 | [diff] [blame] | 189 | std::vector<const DexFile*> GetDexFiles(jobject jclass_loader); |
Calin Juravle | c79470d | 2017-07-12 17:37:42 -0700 | [diff] [blame] | 190 | std::vector<const DexFile*> GetDexFiles(ScopedObjectAccess& soa, |
| 191 | Handle<mirror::ClassLoader> class_loader) |
| 192 | REQUIRES_SHARED(Locks::mutator_lock_); |
Andreas Gampe | 81c6f8d | 2015-03-25 17:19:53 -0700 | [diff] [blame] | 193 | |
| 194 | // Get the first dex file from a PathClassLoader. Will abort if it is null. |
| 195 | const DexFile* GetFirstDexFile(jobject jclass_loader); |
| 196 | |
Andreas Gampe | bb9c6b1 | 2015-03-29 13:56:36 -0700 | [diff] [blame] | 197 | std::unique_ptr<CompilerCallbacks> callbacks_; |
| 198 | |
Przemyslaw Szczepaniak | a794c26 | 2016-07-25 17:31:06 +0100 | [diff] [blame] | 199 | virtual void SetUp(); |
Mathieu Chartier | 91c9116 | 2016-01-15 09:48:15 -0800 | [diff] [blame] | 200 | |
Przemyslaw Szczepaniak | a794c26 | 2016-07-25 17:31:06 +0100 | [diff] [blame] | 201 | virtual void TearDown(); |
Mathieu Chartier | 91c9116 | 2016-01-15 09:48:15 -0800 | [diff] [blame] | 202 | |
Przemyslaw Szczepaniak | a794c26 | 2016-07-25 17:31:06 +0100 | [diff] [blame] | 203 | // Called to finish up runtime creation and filling test fields. By default runs root |
| 204 | // initializers, initialize well-known classes, and creates the heap thread pool. |
| 205 | virtual void FinalizeSetup(); |
Vladimir Marko | 672c080 | 2019-07-26 13:03:13 +0100 | [diff] [blame] | 206 | |
David Srbecky | 6355d69 | 2020-03-26 14:10:26 +0000 | [diff] [blame] | 207 | // Returns the directory where the pre-compiled boot.art can be found. |
Vladimir Marko | 672c080 | 2019-07-26 13:03:13 +0100 | [diff] [blame] | 208 | static std::string GetImageDirectory(); |
| 209 | static std::string GetImageLocation(); |
| 210 | static std::string GetSystemImageFile(); |
| 211 | |
| 212 | static void EnterTransactionMode(); |
| 213 | static void ExitTransactionMode(); |
| 214 | static void RollbackAndExitTransactionMode() REQUIRES_SHARED(Locks::mutator_lock_); |
| 215 | static bool IsTransactionAborted(); |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 216 | }; |
| 217 | |
Mathieu Chartier | 91c9116 | 2016-01-15 09:48:15 -0800 | [diff] [blame] | 218 | template <typename TestType> |
| 219 | class CommonRuntimeTestBase : public TestType, public CommonRuntimeTestImpl { |
| 220 | public: |
| 221 | CommonRuntimeTestBase() {} |
| 222 | virtual ~CommonRuntimeTestBase() {} |
| 223 | |
| 224 | protected: |
Roland Levillain | f73caca | 2018-08-24 17:19:07 +0100 | [diff] [blame] | 225 | void SetUp() override { |
Mathieu Chartier | 91c9116 | 2016-01-15 09:48:15 -0800 | [diff] [blame] | 226 | CommonRuntimeTestImpl::SetUp(); |
| 227 | } |
| 228 | |
Roland Levillain | f73caca | 2018-08-24 17:19:07 +0100 | [diff] [blame] | 229 | void TearDown() override { |
Mathieu Chartier | 91c9116 | 2016-01-15 09:48:15 -0800 | [diff] [blame] | 230 | CommonRuntimeTestImpl::TearDown(); |
| 231 | } |
Mathieu Chartier | 91c9116 | 2016-01-15 09:48:15 -0800 | [diff] [blame] | 232 | }; |
| 233 | |
| 234 | using CommonRuntimeTest = CommonRuntimeTestBase<testing::Test>; |
| 235 | |
| 236 | template <typename Param> |
| 237 | using CommonRuntimeTestWithParam = CommonRuntimeTestBase<testing::TestWithParam<Param>>; |
| 238 | |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 239 | // Sets a CheckJni abort hook to catch failures. Note that this will cause CheckJNI to carry on |
| 240 | // rather than aborting, so be careful! |
| 241 | class CheckJniAbortCatcher { |
| 242 | public: |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 243 | CheckJniAbortCatcher(); |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 244 | |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 245 | ~CheckJniAbortCatcher(); |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 246 | |
Igor Murashkin | 367f3dd | 2016-09-01 17:00:24 -0700 | [diff] [blame] | 247 | void Check(const std::string& expected_text); |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 248 | void Check(const char* expected_text); |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 249 | |
| 250 | private: |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame] | 251 | static void Hook(void* data, const std::string& reason); |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 252 | |
Ian Rogers | 68d8b42 | 2014-07-17 11:09:10 -0700 | [diff] [blame] | 253 | JavaVMExt* const vm_; |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 254 | std::string actual_; |
| 255 | |
| 256 | DISALLOW_COPY_AND_ASSIGN(CheckJniAbortCatcher); |
| 257 | }; |
| 258 | |
Roland Levillain | 14d1307 | 2020-01-08 17:57:39 +0000 | [diff] [blame] | 259 | #define TEST_DISABLED() \ |
| 260 | do { \ |
| 261 | printf("WARNING: TEST DISABLED\n"); \ |
| 262 | return; \ |
| 263 | } while (false) |
| 264 | |
Andreas Gampe | 38aa0b5 | 2018-07-10 23:26:55 -0700 | [diff] [blame] | 265 | #define TEST_DISABLED_FOR_ARM() \ |
| 266 | if (kRuntimeISA == InstructionSet::kArm || kRuntimeISA == InstructionSet::kThumb2) { \ |
| 267 | printf("WARNING: TEST DISABLED FOR ARM\n"); \ |
| 268 | return; \ |
| 269 | } |
| 270 | |
| 271 | #define TEST_DISABLED_FOR_ARM64() \ |
| 272 | if (kRuntimeISA == InstructionSet::kArm64) { \ |
| 273 | printf("WARNING: TEST DISABLED FOR ARM64\n"); \ |
| 274 | return; \ |
| 275 | } |
| 276 | |
Roland Levillain | 19772bf | 2017-02-16 11:28:10 +0000 | [diff] [blame] | 277 | #define TEST_DISABLED_FOR_X86() \ |
Vladimir Marko | 33bff25 | 2017-11-01 14:35:42 +0000 | [diff] [blame] | 278 | if (kRuntimeISA == InstructionSet::kX86) { \ |
Roland Levillain | 19772bf | 2017-02-16 11:28:10 +0000 | [diff] [blame] | 279 | printf("WARNING: TEST DISABLED FOR X86\n"); \ |
Vladimir Marko | 57070da | 2017-02-14 16:16:30 +0000 | [diff] [blame] | 280 | return; \ |
| 281 | } |
| 282 | |
Evgeny Astigeevich | d2ac307 | 2020-01-29 11:51:40 +0000 | [diff] [blame] | 283 | #define TEST_DISABLED_FOR_X86_64() \ |
| 284 | if (kRuntimeISA == InstructionSet::kX86_64) { \ |
| 285 | printf("WARNING: TEST DISABLED FOR X86_64\n"); \ |
| 286 | return; \ |
| 287 | } |
| 288 | |
jessicahandojo | 3aaa37b | 2016-07-29 14:46:37 -0700 | [diff] [blame] | 289 | #define TEST_DISABLED_FOR_STRING_COMPRESSION() \ |
| 290 | if (mirror::kUseStringCompression) { \ |
| 291 | printf("WARNING: TEST DISABLED FOR STRING COMPRESSION\n"); \ |
| 292 | return; \ |
| 293 | } |
| 294 | |
Roland Levillain | 6d729a7 | 2017-06-30 18:34:01 +0100 | [diff] [blame] | 295 | #define TEST_DISABLED_WITHOUT_BAKER_READ_BARRIERS() \ |
| 296 | if (!kEmitCompilerReadBarrier || !kUseBakerReadBarrier) { \ |
| 297 | printf("WARNING: TEST DISABLED FOR GC WITHOUT BAKER READ BARRIER\n"); \ |
| 298 | return; \ |
| 299 | } |
| 300 | |
Alex Klyubin | 3856af0 | 2017-10-23 13:53:13 -0700 | [diff] [blame] | 301 | #define TEST_DISABLED_FOR_HEAP_POISONING() \ |
| 302 | if (kPoisonHeapReferences) { \ |
| 303 | printf("WARNING: TEST DISABLED FOR HEAP POISONING\n"); \ |
| 304 | return; \ |
| 305 | } |
Roland Levillain | f5dd114 | 2018-07-03 13:29:18 +0100 | [diff] [blame] | 306 | |
| 307 | #define TEST_DISABLED_FOR_MEMORY_TOOL_WITH_HEAP_POISONING_WITHOUT_READ_BARRIERS() \ |
| 308 | if (kRunningOnMemoryTool && kPoisonHeapReferences && !kEmitCompilerReadBarrier) { \ |
| 309 | printf("WARNING: TEST DISABLED FOR MEMORY TOOL WITH HEAP POISONING WITHOUT READ BARRIERS\n"); \ |
| 310 | return; \ |
| 311 | } |
| 312 | |
Nicolas Geoffray | 8d6651d | 2019-07-08 10:03:16 +0100 | [diff] [blame] | 313 | #define TEST_DISABLED_FOR_KERNELS_WITH_CACHE_SEGFAULT() \ |
| 314 | if (CacheOperationsMaySegFault()) { \ |
| 315 | printf("WARNING: TEST DISABLED ON KERNEL THAT SEGFAULT ON CACHE OPERATIONS\n"); \ |
| 316 | return; \ |
| 317 | } |
| 318 | |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 319 | } // namespace art |
| 320 | |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 321 | #endif // ART_RUNTIME_COMMON_RUNTIME_TEST_H_ |