aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTianjie Xu2017-09-12 13:13:02 -0500
committerTianjie Xu2017-09-13 16:05:42 -0500
commit8ba7c45e0b6165fd0b3df72abf94bea459fcef85 (patch)
treefe912fe36107f72df8e2cd5f035954f75dd8e09c /tests
parent64307daf5b178af9c899f3a17be42fb294eeac1c (diff)
downloadplatform-bootable-recovery-8ba7c45e0b6165fd0b3df72abf94bea459fcef85.tar.gz
platform-bootable-recovery-8ba7c45e0b6165fd0b3df72abf94bea459fcef85.tar.xz
platform-bootable-recovery-8ba7c45e0b6165fd0b3df72abf94bea459fcef85.zip
Fix the dangling pointer when setting up arguments of imgdiff
Test: unit tests pass Change-Id: If884e805ccd4df73671ab3436eb90860786ff6c9
Diffstat (limited to 'tests')
-rw-r--r--tests/component/imgdiff_test.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/component/imgdiff_test.cpp b/tests/component/imgdiff_test.cpp
index 3163a57c..73516050 100644
--- a/tests/component/imgdiff_test.cpp
+++ b/tests/component/imgdiff_test.cpp
@@ -779,9 +779,10 @@ TEST(ImgdiffTest, zip_mode_store_large_apk) {
779 // Compute patch. 779 // Compute patch.
780 TemporaryFile patch_file; 780 TemporaryFile patch_file;
781 TemporaryDir debug_dir; 781 TemporaryDir debug_dir;
782 std::string debug_dir_arg = android::base::StringPrintf("--debug-dir=%s", debug_dir.path);
782 std::vector<const char*> args = { 783 std::vector<const char*> args = {
783 "imgdiff", "-z", "--block-limit=10", android::base::StringPrintf( 784 "imgdiff", "-z", "--block-limit=10", debug_dir_arg.c_str(), src_file.path, tgt_file.path,
784 "--debug-dir=%s", debug_dir.path).c_str(), src_file.path, tgt_file.path, patch_file.path, 785 patch_file.path,
785 }; 786 };
786 ASSERT_EQ(0, imgdiff(args.size(), args.data())); 787 ASSERT_EQ(0, imgdiff(args.size(), args.data()));
787 788
@@ -901,9 +902,10 @@ TEST(ImgdiffTest, zip_mode_no_match_source) {
901 // Compute patch. 902 // Compute patch.
902 TemporaryFile patch_file; 903 TemporaryFile patch_file;
903 TemporaryDir debug_dir; 904 TemporaryDir debug_dir;
905 std::string debug_dir_arg = android::base::StringPrintf("--debug-dir=%s", debug_dir.path);
904 std::vector<const char*> args = { 906 std::vector<const char*> args = {
905 "imgdiff", "-z", "--block-limit=10", android::base::StringPrintf( 907 "imgdiff", "-z", "--block-limit=10", debug_dir_arg.c_str(), src_file.path, tgt_file.path,
906 "--debug-dir=%s", debug_dir.path).c_str(), src_file.path, tgt_file.path, patch_file.path, 908 patch_file.path,
907 }; 909 };
908 ASSERT_EQ(0, imgdiff(args.size(), args.data())); 910 ASSERT_EQ(0, imgdiff(args.size(), args.data()));
909 911
@@ -940,9 +942,10 @@ TEST(ImgdiffTest, zip_mode_large_enough_limit) {
940 // Compute patch with a limit of 20 blocks. 942 // Compute patch with a limit of 20 blocks.
941 TemporaryFile patch_file; 943 TemporaryFile patch_file;
942 TemporaryDir debug_dir; 944 TemporaryDir debug_dir;
945 std::string debug_dir_arg = android::base::StringPrintf("--debug-dir=%s", debug_dir.path);
943 std::vector<const char*> args = { 946 std::vector<const char*> args = {
944 "imgdiff", "-z", "--block-limit=20", android::base::StringPrintf( 947 "imgdiff", "-z", "--block-limit=20", debug_dir_arg.c_str(), src_file.path, tgt_file.path,
945 "--debug-dir=%s", debug_dir.path).c_str(), src_file.path, tgt_file.path, patch_file.path, 948 patch_file.path,
946 }; 949 };
947 ASSERT_EQ(0, imgdiff(args.size(), args.data())); 950 ASSERT_EQ(0, imgdiff(args.size(), args.data()));
948 951