summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Android.mk8
-rw-r--r--tests/component/applypatch_test.cpp13
-rw-r--r--tests/component/update_verifier_test.cpp9
3 files changed, 16 insertions, 14 deletions
diff --git a/tests/Android.mk b/tests/Android.mk
index b29ff50f6..fd4497858 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -74,14 +74,6 @@ ifeq ($(AB_OTA_UPDATER),true)
LOCAL_CFLAGS += -DAB_OTA_UPDATER=1
endif
-ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
-LOCAL_CFLAGS += -DPRODUCT_SUPPORTS_VERITY=1
-endif
-
-ifeq ($(BOARD_AVB_ENABLE),true)
-LOCAL_CFLAGS += -DBOARD_AVB_ENABLE=1
-endif
-
LOCAL_MODULE := recovery_component_test
LOCAL_COMPATIBILITY_SUITE := device-tests
LOCAL_C_INCLUDES := bootable/recovery
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;
diff --git a/tests/component/update_verifier_test.cpp b/tests/component/update_verifier_test.cpp
index 1544bb2a4..f6ef6dcfd 100644
--- a/tests/component/update_verifier_test.cpp
+++ b/tests/component/update_verifier_test.cpp
@@ -17,6 +17,8 @@
#include <string>
#include <android-base/file.h>
+#include <android-base/properties.h>
+#include <android-base/strings.h>
#include <android-base/test_utils.h>
#include <gtest/gtest.h>
#include <update_verifier/update_verifier.h>
@@ -24,11 +26,8 @@
class UpdateVerifierTest : public ::testing::Test {
protected:
void SetUp() override {
-#if defined(PRODUCT_SUPPORTS_VERITY) || defined(BOARD_AVB_ENABLE)
- verity_supported = true;
-#else
- verity_supported = false;
-#endif
+ std::string verity_mode = android::base::GetProperty("ro.boot.veritymode", "");
+ verity_supported = android::base::EqualsIgnoreCase(verity_mode, "enforcing");
}
bool verity_supported;