summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2018-01-11 09:41:00 -0800
committer Andreas Gampe <agampe@google.com> 2018-01-11 09:41:00 -0800
commit80ddf27b2f9475a0dfb6919cd63f73f59dc3bc10 (patch)
tree90626e4ff92dee82b849e6f57c0c13bebfb2f71f
parent29504326da13831fa3060ac507927c4d76aa556a (diff)
ART: Relax failure requirements for dex2oat watchdog test
The watchdog does not clean up any output. It is theoretically possible (though it should be very unlikely) that with the test configuration the dex2oat run finishes writing the output before the watchdog kills dex2oat. Bug: 63052624 Test: m test-art-host-gtest-dex2oat_test Change-Id: If5fc8936e18af8219f70de6f01c2ae7a993663a3
-rw-r--r--dex2oat/dex2oat_test.cc33
1 files changed, 21 insertions, 12 deletions
diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc
index f176cc2839..e98cb743a9 100644
--- a/dex2oat/dex2oat_test.cc
+++ b/dex2oat/dex2oat_test.cc
@@ -108,6 +108,8 @@ class Dex2oatTest : public Dex2oatEnvironmentTest {
[](const OatFile&) {});
}
+ bool test_accepts_odex_file_on_failure = false;
+
template <typename T>
void GenerateOdexForTest(
const std::string& dex_location,
@@ -124,7 +126,7 @@ class Dex2oatTest : public Dex2oatEnvironmentTest {
&error_msg,
extra_args,
use_fd);
- bool success = (status == 0);
+ bool success = (WIFEXITED(status) && WEXITSTATUS(status) == 0);
if (expect_success) {
ASSERT_TRUE(success) << error_msg << std::endl << output_;
@@ -146,16 +148,18 @@ class Dex2oatTest : public Dex2oatEnvironmentTest {
error_msg_ = error_msg;
- // Verify there's no loadable odex file.
- std::unique_ptr<OatFile> odex_file(OatFile::Open(odex_location.c_str(),
- odex_location.c_str(),
- nullptr,
- nullptr,
- false,
- /*low_4gb*/false,
- dex_location.c_str(),
- &error_msg));
- ASSERT_TRUE(odex_file.get() == nullptr);
+ if (!test_accepts_odex_file_on_failure) {
+ // Verify there's no loadable odex file.
+ std::unique_ptr<OatFile> odex_file(OatFile::Open(odex_location.c_str(),
+ odex_location.c_str(),
+ nullptr,
+ nullptr,
+ false,
+ /*low_4gb*/false,
+ dex_location.c_str(),
+ &error_msg));
+ ASSERT_TRUE(odex_file.get() == nullptr);
+ }
}
}
@@ -993,7 +997,12 @@ TEST_F(Dex2oatWatchdogTest, TestWatchdogOK) {
TEST_F(Dex2oatWatchdogTest, TestWatchdogTrigger) {
TEST_DISABLED_FOR_MEMORY_TOOL_VALGRIND(); // b/63052624
- TEST_DISABLED_WITHOUT_BAKER_READ_BARRIERS(); // b/63052624
+
+ // The watchdog is independent of dex2oat and will not delete intermediates. It is possible
+ // that the compilation succeeds and the file is completely written by the time the watchdog
+ // kills dex2oat (but the dex2oat threads must have been scheduled pretty badly).
+ test_accepts_odex_file_on_failure = true;
+
// Check with ten milliseconds.
RunTest(false, { "--watchdog-timeout=10" });
}