aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTao Bao2017-11-02 00:21:55 -0500
committerTao Bao2017-11-02 00:34:51 -0500
commit54c1db4b3e6becf85f2b685f16425244b24138a6 (patch)
tree644d10709dc1d5f03d13e092e8569a7b04ff4377 /tests
parentdec77a454ed387bdef1f1b4540215fb41cd2345b (diff)
downloadplatform-bootable-recovery-54c1db4b3e6becf85f2b685f16425244b24138a6.tar.gz
platform-bootable-recovery-54c1db4b3e6becf85f2b685f16425244b24138a6.tar.xz
platform-bootable-recovery-54c1db4b3e6becf85f2b685f16425244b24138a6.zip
tests: Clean up the files in TemporaryDir.
~TemporaryDir() calls rmdir(2) directly, which works with empty directories only. Test: Run recovery_host_test; No leftover on host. Test; Run recovery_component_test on marlin; No leftover on device. Change-Id: Ib510efb16eeda61b34161e2b386499e6cb79a4ca
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);