diff options
| -rw-r--r-- | libartbase/base/common_art_test.h | 18 | ||||
| -rw-r--r-- | libartbase/base/unix_file/fd_file_test.cc | 12 |
2 files changed, 21 insertions, 9 deletions
diff --git a/libartbase/base/common_art_test.h b/libartbase/base/common_art_test.h index 1a0b910ced..5da6ac9920 100644 --- a/libartbase/base/common_art_test.h +++ b/libartbase/base/common_art_test.h @@ -228,7 +228,7 @@ class CommonArtTestImpl { protected: static bool IsHost() { - return !kIsTargetBuild; + return !art::kIsTargetBuild; } // Returns ${ANDROID_BUILD_TOP}. Ensure it has tailing /. @@ -310,44 +310,44 @@ using CommonArtTestWithParam = CommonArtTestBase<testing::TestWithParam<Param>>; std::vector<pid_t> GetPidByName(const std::string& process_name); #define TEST_DISABLED_FOR_TARGET() \ - if (kIsTargetBuild) { \ + if (art::kIsTargetBuild) { \ GTEST_SKIP() << "WARNING: TEST DISABLED FOR TARGET"; \ } #define TEST_DISABLED_FOR_HOST() \ - if (!kIsTargetBuild) { \ + if (!art::kIsTargetBuild) { \ GTEST_SKIP() << "WARNING: TEST DISABLED FOR HOST"; \ } #define TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS() \ - if (!kHostStaticBuildEnabled) { \ + if (!art::kHostStaticBuildEnabled) { \ GTEST_SKIP() << "WARNING: TEST DISABLED FOR NON-STATIC HOST BUILDS"; \ } #define TEST_DISABLED_FOR_DEBUG_BUILD() \ - if (kIsDebugBuild) { \ + if (art::kIsDebugBuild) { \ GTEST_SKIP() << "WARNING: TEST DISABLED FOR DEBUG BUILD"; \ } #define TEST_DISABLED_FOR_MEMORY_TOOL() \ - if (kRunningOnMemoryTool) { \ + if (art::kRunningOnMemoryTool) { \ GTEST_SKIP() << "WARNING: TEST DISABLED FOR MEMORY TOOL"; \ } #define TEST_DISABLED_FOR_HEAP_POISONING() \ - if (kPoisonHeapReferences) { \ + if (art::kPoisonHeapReferences) { \ GTEST_SKIP() << "WARNING: TEST DISABLED FOR HEAP POISONING"; \ } } // namespace art #define TEST_DISABLED_FOR_MEMORY_TOOL_WITH_HEAP_POISONING() \ - if (kRunningOnMemoryTool && kPoisonHeapReferences) { \ + if (art::kRunningOnMemoryTool && art::kPoisonHeapReferences) { \ GTEST_SKIP() << "WARNING: TEST DISABLED FOR MEMORY TOOL WITH HEAP POISONING"; \ } #define TEST_DISABLED_FOR_USER_BUILD() \ if (std::string build_type = android::base::GetProperty("ro.build.type", ""); \ - kIsTargetBuild && build_type != "userdebug" && build_type != "eng") { \ + art::kIsTargetBuild && build_type != "userdebug" && build_type != "eng") { \ GTEST_SKIP() << "WARNING: TEST DISABLED FOR USER BUILD"; \ } diff --git a/libartbase/base/unix_file/fd_file_test.cc b/libartbase/base/unix_file/fd_file_test.cc index d5c3056393..374edc96e7 100644 --- a/libartbase/base/unix_file/fd_file_test.cc +++ b/libartbase/base/unix_file/fd_file_test.cc @@ -326,6 +326,9 @@ void FdFileTest::TestDataMatches(const FdFile* src, // Test that the file created by FdFileTest::CreateSparseSourceFile is sparse on the test // environment. TEST_F(FdFileTest, CopySparseCreateSparseFile) { + // Disable on host as sparsity is filesystem dependent and some hosts may break test assumptions. + TEST_DISABLED_FOR_HOST(); + // Create file with no empty prefix or suffix. std::unique_ptr<art::ScratchFile> src1; ASSERT_NO_FATAL_FAILURE(CreateSparseSourceFile(/*empty_prefix=*/0, /*empty_suffix=*/0, src1)); @@ -350,6 +353,9 @@ TEST_F(FdFileTest, CopySparseCreateSparseFile) { // Test complete copies of the source file produced by FdFileTest::CreateSparseSourceFile. TEST_F(FdFileTest, CopySparseFullCopy) { + // Disable on host as sparsity is filesystem dependent and some hosts may break test assumptions. + TEST_DISABLED_FOR_HOST(); + auto verify_fullcopy = [&](size_t empty_prefix, size_t empty_suffix) { SCOPED_TRACE(testing::Message() << "prefix:" << empty_prefix << ", suffix:" << empty_suffix); @@ -417,6 +423,9 @@ size_t FdFileTest::GetFilesystemBlockSize() { // Test partial copies of the source file produced by FdFileTest::CreateSparseSourceFile. TEST_F(FdFileTest, CopySparsePartialCopy) { + // Disable on host as sparsity is filesystem dependent and some hosts may break test assumptions. + TEST_DISABLED_FOR_HOST(); + size_t blocksize = GetFilesystemBlockSize(); ASSERT_GT(blocksize, 0u); @@ -502,6 +511,9 @@ TEST_F(FdFileTest, CopySparsePartialCopy) { // Test the case where the destination file's FD offset is non-zero before the copy. TEST_F(FdFileTest, CopySparseToNonZeroOffset) { + // Disable on host as sparsity is filesystem dependent and some hosts may break test assumptions. + TEST_DISABLED_FOR_HOST(); + std::unique_ptr<art::ScratchFile> src; ASSERT_NO_FATAL_FAILURE(CreateSparseSourceFile(/*empty_prefix=*/0u, /*empty_suffix=*/0u, src)); |