summaryrefslogtreecommitdiffstats
path: root/tests/component/updater_test.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-05-22 01:05:56 +0200
committerTao Bao <tbao@google.com>2018-07-07 06:12:19 +0200
commit91a649ab62c9cf60ae9d02dd38c23fc23f98a1f3 (patch)
tree0300e0c2d1f901f89d35f93f791174d6693b1296 /tests/component/updater_test.cpp
parentMerge "tests: Split unit tests out of component/applypatch_test.cpp." (diff)
downloadandroid_bootable_recovery-91a649ab62c9cf60ae9d02dd38c23fc23f98a1f3.tar
android_bootable_recovery-91a649ab62c9cf60ae9d02dd38c23fc23f98a1f3.tar.gz
android_bootable_recovery-91a649ab62c9cf60ae9d02dd38c23fc23f98a1f3.tar.bz2
android_bootable_recovery-91a649ab62c9cf60ae9d02dd38c23fc23f98a1f3.tar.lz
android_bootable_recovery-91a649ab62c9cf60ae9d02dd38c23fc23f98a1f3.tar.xz
android_bootable_recovery-91a649ab62c9cf60ae9d02dd38c23fc23f98a1f3.tar.zst
android_bootable_recovery-91a649ab62c9cf60ae9d02dd38c23fc23f98a1f3.zip
Diffstat (limited to 'tests/component/updater_test.cpp')
-rw-r--r--tests/component/updater_test.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/component/updater_test.cpp b/tests/component/updater_test.cpp
index fe4f45e15..e8abb5350 100644
--- a/tests/component/updater_test.cpp
+++ b/tests/component/updater_test.cpp
@@ -46,6 +46,7 @@
#include "otautil/paths.h"
#include "otautil/print_sha1.h"
#include "otautil/sysutil.h"
+#include "private/commands.h"
#include "updater/blockimg.h"
#include "updater/install.h"
#include "updater/updater.h"
@@ -150,6 +151,9 @@ class UpdaterTest : public ::testing::Test {
Paths::Get().set_last_command_file(temp_last_command_.path);
Paths::Get().set_stash_directory_base(temp_stash_base_.path);
+ // Enable a special command "abort" to simulate interruption.
+ Command::abort_allowed_ = true;
+
last_command_file_ = temp_last_command_.path;
image_file_ = image_temp_file_.path;
}
@@ -580,7 +584,7 @@ TEST_F(UpdaterTest, block_image_update_fail) {
"2",
"stash " + src_hash + " 2,0,2",
"free " + src_hash,
- "fail",
+ "abort",
// clang-format on
};
@@ -714,7 +718,7 @@ TEST_F(UpdaterTest, last_command_update) {
"stash " + block1_hash + " 2,0,1",
"move " + block1_hash + " 2,1,2 1 2,0,1",
"stash " + block3_hash + " 2,2,3",
- "fail",
+ "abort",
// clang-format on
};
@@ -859,6 +863,9 @@ class ResumableUpdaterTest : public testing::TestWithParam<size_t> {
Paths::Get().set_last_command_file(temp_last_command_.path);
Paths::Get().set_stash_directory_base(temp_stash_base_.path);
+ // Enable a special command "abort" to simulate interruption.
+ Command::abort_allowed_ = true;
+
index_ = GetParam();
image_file_ = image_temp_file_.path;
last_command_file_ = temp_last_command_.path;
@@ -1030,7 +1037,7 @@ TEST_P(ResumableUpdaterTest, InterruptVerifyResume) {
<< g_transfer_list[kTransferListHeaderLines + index_] << ")";
std::vector<std::string> transfer_list_copy{ g_transfer_list };
- transfer_list_copy[kTransferListHeaderLines + index_] = "fail";
+ transfer_list_copy[kTransferListHeaderLines + index_] = "abort";
g_entries["transfer_list"] = android::base::Join(transfer_list_copy, '\n');