aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTreehugger Robot2017-11-03 13:51:34 -0500
committerGerrit Code Review2017-11-03 13:51:34 -0500
commit2cf44d08cfec085bba3da152e8a890dde6237b87 (patch)
tree57155cb3bdd2da1d7391ebb53f082e09ba508a8f /tests
parent439263cb833467a5de1566961cd007d5835a9bd3 (diff)
parent54c1db4b3e6becf85f2b685f16425244b24138a6 (diff)
downloadplatform-bootable-recovery-2cf44d08cfec085bba3da152e8a890dde6237b87.tar.gz
platform-bootable-recovery-2cf44d08cfec085bba3da152e8a890dde6237b87.tar.xz
platform-bootable-recovery-2cf44d08cfec085bba3da152e8a890dde6237b87.zip
Merge "tests: Clean up the files in TemporaryDir."
Diffstat (limited to 'tests')
-rw-r--r--tests/component/imgdiff_test.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/component/imgdiff_test.cpp b/tests/component/imgdiff_test.cpp
index 6de804e0..728b6cc7 100644
--- a/tests/component/imgdiff_test.cpp
+++ b/tests/component/imgdiff_test.cpp
@@ -657,19 +657,23 @@ static void construct_deflate_entry(const std::vector<std::tuple<std::string, si
657 } 657 }
658} 658}
659 659
660// Look for the generated source and patch pieces in the debug_dir and generate the target on 660// Look for the source and patch pieces in debug_dir. Generate a target piece from each pair.
661// each pair. Concatenate the split target and match against the orignal one. 661// Concatenate all the target pieces and match against the orignal one. Used pieces in debug_dir
662// will be cleaned up.
662static void GenerateAndCheckSplitTarget(const std::string& debug_dir, size_t count, 663static void GenerateAndCheckSplitTarget(const std::string& debug_dir, size_t count,
663 const std::string& tgt) { 664 const std::string& tgt) {
664 std::string patched; 665 std::string patched;
665 for (size_t i = 0; i < count; i++) { 666 for (size_t i = 0; i < count; i++) {
666 std::string split_src_path = android::base::StringPrintf("%s/src-%zu", debug_dir.c_str(), i); 667 std::string split_src_path = android::base::StringPrintf("%s/src-%zu", debug_dir.c_str(), i);
667 std::string split_patch_path = android::base::StringPrintf("%s/patch-%zu", debug_dir.c_str(), i);
668
669 std::string split_src; 668 std::string split_src;
670 std::string split_patch;
671 ASSERT_TRUE(android::base::ReadFileToString(split_src_path, &split_src)); 669 ASSERT_TRUE(android::base::ReadFileToString(split_src_path, &split_src));
670 ASSERT_EQ(0, unlink(split_src_path.c_str()));
671
672 std::string split_patch_path =
673 android::base::StringPrintf("%s/patch-%zu", debug_dir.c_str(), i);
674 std::string split_patch;
672 ASSERT_TRUE(android::base::ReadFileToString(split_patch_path, &split_patch)); 675 ASSERT_TRUE(android::base::ReadFileToString(split_patch_path, &split_patch));
676 ASSERT_EQ(0, unlink(split_patch_path.c_str()));
673 677
674 std::string split_tgt; 678 std::string split_tgt;
675 GenerateTarget(split_src, split_patch, &split_tgt); 679 GenerateTarget(split_src, split_patch, &split_tgt);