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
diff --git a/dexlayout/dexlayout_test.cc b/dexlayout/dexlayout_test.cc
index b4e023f..3c37e6d 100644
--- a/dexlayout/dexlayout_test.cc
+++ b/dexlayout/dexlayout_test.cc
@@ -438,19 +438,13 @@
// -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.