summaryrefslogtreecommitdiffstats
path: root/tests/component
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2016-11-03 19:31:25 +0100
committerandroid-build-merger <android-build-merger@google.com>2016-11-03 19:31:25 +0100
commit5d9f36e3b34af98141748a3b7c900ed17c7775d6 (patch)
treeac787748f226a7bec3462de6b14491601607b464 /tests/component
parentMerge "applypatch: Add testcases for applypatch executable." am: 5696526ba4 am: 4fc42365ac am: 24356d778f (diff)
parentMerge "tests: Set up testdata path for continuous native tests." am: 4011bb161a am: a98b4e4bef (diff)
downloadandroid_bootable_recovery-5d9f36e3b34af98141748a3b7c900ed17c7775d6.tar
android_bootable_recovery-5d9f36e3b34af98141748a3b7c900ed17c7775d6.tar.gz
android_bootable_recovery-5d9f36e3b34af98141748a3b7c900ed17c7775d6.tar.bz2
android_bootable_recovery-5d9f36e3b34af98141748a3b7c900ed17c7775d6.tar.lz
android_bootable_recovery-5d9f36e3b34af98141748a3b7c900ed17c7775d6.tar.xz
android_bootable_recovery-5d9f36e3b34af98141748a3b7c900ed17c7775d6.tar.zst
android_bootable_recovery-5d9f36e3b34af98141748a3b7c900ed17c7775d6.zip
Diffstat (limited to '')
-rw-r--r--tests/component/applypatch_test.cpp7
-rw-r--r--tests/component/verifier_test.cpp11
2 files changed, 2 insertions, 16 deletions
diff --git a/tests/component/applypatch_test.cpp b/tests/component/applypatch_test.cpp
index f95ebed5d..1a0b19113 100644
--- a/tests/component/applypatch_test.cpp
+++ b/tests/component/applypatch_test.cpp
@@ -37,9 +37,6 @@
#include "common/test_constants.h"
#include "print_sha1.h"
-static const std::string DATA_PATH = getenv("ANDROID_DATA");
-static const std::string TESTDATA_PATH = "/recovery/testdata";
-
static void sha1sum(const std::string& fname, std::string* sha1, size_t* fsize = nullptr) {
ASSERT_NE(nullptr, sha1);
@@ -72,10 +69,6 @@ static bool file_cmp(const std::string& f1, const std::string& f2) {
return c1 == c2;
}
-static std::string from_testdata_base(const std::string& fname) {
- return DATA_PATH + NATIVE_TEST_PATH + TESTDATA_PATH + "/" + fname;
-}
-
class ApplyPatchTest : public ::testing::Test {
public:
static void SetUpTestCase() {
diff --git a/tests/component/verifier_test.cpp b/tests/component/verifier_test.cpp
index 7f9a71408..60a78f5c3 100644
--- a/tests/component/verifier_test.cpp
+++ b/tests/component/verifier_test.cpp
@@ -37,9 +37,6 @@
#include "ui.h"
#include "verifier.h"
-static const char* DATA_PATH = getenv("ANDROID_DATA");
-static const char* TESTDATA_PATH = "/recovery/testdata/";
-
RecoveryUI* ui = NULL;
class MockUI : public RecoveryUI {
@@ -92,17 +89,13 @@ class VerifierTest : public testing::TestWithParam<std::vector<std::string>> {
virtual void SetUp() {
std::vector<std::string> args = GetParam();
- std::string package =
- android::base::StringPrintf("%s%s%s%s", DATA_PATH, NATIVE_TEST_PATH,
- TESTDATA_PATH, args[0].c_str());
+ std::string package = from_testdata_base(args[0]);
if (sysMapFile(package.c_str(), &memmap) != 0) {
FAIL() << "Failed to mmap " << package << ": " << strerror(errno) << "\n";
}
for (auto it = ++(args.cbegin()); it != args.cend(); ++it) {
- std::string public_key_file = android::base::StringPrintf(
- "%s%s%stestkey_%s.txt", DATA_PATH, NATIVE_TEST_PATH,
- TESTDATA_PATH, it->c_str());
+ std::string public_key_file = from_testdata_base("testkey_" + *it + ".txt");
ASSERT_TRUE(load_keys(public_key_file.c_str(), certs));
}
}