patchoat: take directories instead of filenames
patchoat was already ignoring the basename part of the filename passed
to it for both --output-image-file and --output-image-relocation-file.
We can therefore just pass in the directories instead.
Bug: 72828459
Test: make test-art-host-gtest-patchoat_test
Change-Id: I1a699d1f6746f068078ae768d30690431578d84e
diff --git a/patchoat/patchoat_test.cc b/patchoat/patchoat_test.cc
index 69c6bfa..ac3abd0 100644
--- a/patchoat/patchoat_test.cc
+++ b/patchoat/patchoat_test.cc
@@ -137,32 +137,32 @@
}
bool RelocateBootImage(const std::string& input_image_location,
- const std::string& output_image_filename,
+ const std::string& output_image_directory,
off_t base_offset_delta,
std::string* error_msg) {
std::vector<std::string> argv = BasePatchoatCommand(input_image_location, base_offset_delta);
- argv.push_back("--output-image-file=" + output_image_filename);
+ argv.push_back("--output-image-directory=" + output_image_directory);
return RunDex2OatOrPatchoat(argv, error_msg);
}
bool VerifyBootImage(const std::string& input_image_location,
- const std::string& output_image_filename,
+ const std::string& output_image_directory,
off_t base_offset_delta,
std::string* error_msg) {
std::vector<std::string> argv = BasePatchoatCommand(input_image_location, base_offset_delta);
- argv.push_back("--output-image-file=" + output_image_filename);
+ argv.push_back("--output-image-directory=" + output_image_directory);
argv.push_back("--verify");
return RunDex2OatOrPatchoat(argv, error_msg);
}
bool GenerateBootImageRelFile(const std::string& input_image_location,
- const std::string& output_rel_filename,
+ const std::string& output_rel_directory,
off_t base_offset_delta,
std::string* error_msg) {
std::vector<std::string> argv = BasePatchoatCommand(input_image_location, base_offset_delta);
- argv.push_back("--output-image-relocation-file=" + output_rel_filename);
+ argv.push_back("--output-image-relocation-directory=" + output_rel_directory);
return RunDex2OatOrPatchoat(argv, error_msg);
}
@@ -375,7 +375,7 @@
ASSERT_EQ(0, symlink(dex2oat_orig_dir.c_str(), dex2oat_orig_with_arch_dir.c_str()));
if (!RelocateBootImage(
dex2oat_orig_dir + "/boot.art",
- patchoat_dir + "/boot.art",
+ patchoat_dir,
base_addr_delta,
&error_msg)) {
FAIL() << "RelocateBootImage failed: " << error_msg;
@@ -467,7 +467,7 @@
off_t base_addr_delta = 0x100000;
if (!GenerateBootImageRelFile(
dex2oat_orig_dir + "/boot.art",
- dex2oat_orig_dir + "/boot.art.rel",
+ dex2oat_orig_dir,
base_addr_delta,
&error_msg)) {
FAIL() << "RelocateBootImage failed: " << error_msg;
@@ -483,7 +483,7 @@
base_addr_delta -= 0x10000;
if (!RelocateBootImage(
dex2oat_orig_dir + "/boot.art",
- relocated_dir + "/boot.art",
+ relocated_dir,
base_addr_delta,
&error_msg)) {
FAIL() << "RelocateBootImage failed: " << error_msg;
@@ -524,7 +524,7 @@
// Assert that verification works with the .rel files.
if (!VerifyBootImage(
dex2oat_orig_dir + "/boot.art",
- relocated_dir + "/boot.art",
+ relocated_dir,
base_addr_delta,
&error_msg)) {
FAIL() << "VerifyBootImage failed: " << error_msg;