diff options
author | 2020-03-25 17:03:14 +0000 | |
---|---|---|
committer | 2020-03-26 10:16:18 +0000 | |
commit | aacb4b84078eacbee31f168676750ca73514217e (patch) | |
tree | 052188480502b4074d9d1c90f3bcc3c0a4004104 | |
parent | 584e5996608a263feb8fd4241b78a83501a46868 (diff) |
Fix logical error in a gtest that caused intermittent failures.
The purpose of DexLayoutTest.DexFileLayoutFixedPoint test is to check
that dexlayout transformation is idempotent: repetitive applications of
dexlayout produce the same result. The tests runs dexlayout twice and
ensures that dexlayout(dexlayout(file)) = dexlayout(file).
However, the test erroneously discarded the result of the first run
and ended up checking dexlayout(file) = file, which happens to be true
most of the time (so the error went unnoticed for a while).
Test: m test-art-host-gtest-dexlayout_test64
Test: m test-art-host-gtest-dexlayout_test32
Change-Id: I07633a0e7678e640b144295470d285d1d89a9d8a
-rw-r--r-- | dexlayout/dexlayout_test.cc | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/dexlayout/dexlayout_test.cc b/dexlayout/dexlayout_test.cc index b4e023f9f6..3c37e6dffb 100644 --- a/dexlayout/dexlayout_test.cc +++ b/dexlayout/dexlayout_test.cc @@ -438,19 +438,13 @@ class DexLayoutTest : public CommonArtTest { // -v makes sure that the layout did not corrupt the dex file. std::vector<std::string> dexlayout_args = - { "-i", "-v", "-w", tmp_dir, "-o", tmp_name, "-p", profile_file, dex_file }; + { "-v", "-w", tmp_dir, "-o", tmp_name, "-p", profile_file, dex_file }; if (!DexLayoutExec(dexlayout_args, error_msg, /*pass_default_cdex_option=*/ false)) { return false; } // Recreate the profile with the new dex location. This is required so that the profile dex // location matches. - // For convenience we just copy the previous dex file to the new location so we can re-use it - // for profile generation. - - // Don't check the output. The exec cmd wrongfully coplains that the cp cmd fails. - std::vector<std::string> cp_args = {"/usr/bin/cp", dex_file, output_dex}; - art::Exec(cp_args, error_msg); CreateProfile(output_dex, profile_file); // -v makes sure that the layout did not corrupt the dex file. // -i since the checksum won't match from the first layout. |