diff options
author | Tianjie Xu <xunchang@google.com> | 2018-04-24 20:30:29 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-04-24 20:30:29 +0200 |
commit | fe527cced417916bb6867178d0a57200747f169e (patch) | |
tree | 41aea266bc76d17c4eadaa6b789410c0d66a2e2d /tests/component/applypatch_test.cpp | |
parent | Merge "update_verifier: Move to Soong." (diff) | |
parent | Dump debug information for apply_patch unit tests (diff) | |
download | android_bootable_recovery-fe527cced417916bb6867178d0a57200747f169e.tar android_bootable_recovery-fe527cced417916bb6867178d0a57200747f169e.tar.gz android_bootable_recovery-fe527cced417916bb6867178d0a57200747f169e.tar.bz2 android_bootable_recovery-fe527cced417916bb6867178d0a57200747f169e.tar.lz android_bootable_recovery-fe527cced417916bb6867178d0a57200747f169e.tar.xz android_bootable_recovery-fe527cced417916bb6867178d0a57200747f169e.tar.zst android_bootable_recovery-fe527cced417916bb6867178d0a57200747f169e.zip |
Diffstat (limited to 'tests/component/applypatch_test.cpp')
-rw-r--r-- | tests/component/applypatch_test.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/component/applypatch_test.cpp b/tests/component/applypatch_test.cpp index f19f28c60..292d76e43 100644 --- a/tests/component/applypatch_test.cpp +++ b/tests/component/applypatch_test.cpp @@ -31,6 +31,7 @@ #include <vector> #include <android-base/file.h> +#include <android-base/logging.h> #include <android-base/stringprintf.h> #include <android-base/test_utils.h> #include <android-base/unique_fd.h> @@ -46,7 +47,7 @@ using namespace std::string_literals; static void sha1sum(const std::string& fname, std::string* sha1, size_t* fsize = nullptr) { - ASSERT_NE(nullptr, sha1); + ASSERT_TRUE(sha1 != nullptr); std::string data; ASSERT_TRUE(android::base::ReadFileToString(fname, &data)); @@ -68,6 +69,14 @@ static void mangle_file(const std::string& fname) { ASSERT_TRUE(android::base::WriteStringToFile(content, fname)); } +static void test_logger(android::base::LogId /* id */, android::base::LogSeverity severity, + const char* /* tag */, const char* /* file */, unsigned int /* line */, + const char* message) { + if (severity >= android::base::GetMinimumLogSeverity()) { + fprintf(stdout, "%s\n", message); + } +} + class ApplyPatchTest : public ::testing::Test { public: virtual void SetUp() override { @@ -109,6 +118,8 @@ class ApplyPatchModesTest : public ::testing::Test { protected: void SetUp() override { CacheLocation::location().set_cache_temp_source(cache_source.path); + android::base::InitLogging(nullptr, &test_logger); + android::base::SetMinimumLogSeverity(android::base::LogSeverity::DEBUG); } TemporaryFile cache_source; |