summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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" });
}