summaryrefslogtreecommitdiffstats
path: root/tests/common/test_constants.h
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-11-01 19:56:46 +0100
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-11-01 19:56:46 +0100
commitdec77a454ed387bdef1f1b4540215fb41cd2345b (patch)
tree6758cf559adb75c5ac807fe48dc33067d15710af /tests/common/test_constants.h
parentMerge "update_verifier: Fix the wrong computation with group_range_count." (diff)
parentFix the size mismatch in imgdiff (diff)
downloadandroid_bootable_recovery-dec77a454ed387bdef1f1b4540215fb41cd2345b.tar
android_bootable_recovery-dec77a454ed387bdef1f1b4540215fb41cd2345b.tar.gz
android_bootable_recovery-dec77a454ed387bdef1f1b4540215fb41cd2345b.tar.bz2
android_bootable_recovery-dec77a454ed387bdef1f1b4540215fb41cd2345b.tar.lz
android_bootable_recovery-dec77a454ed387bdef1f1b4540215fb41cd2345b.tar.xz
android_bootable_recovery-dec77a454ed387bdef1f1b4540215fb41cd2345b.tar.zst
android_bootable_recovery-dec77a454ed387bdef1f1b4540215fb41cd2345b.zip
Diffstat (limited to 'tests/common/test_constants.h')
-rw-r--r--tests/common/test_constants.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/common/test_constants.h b/tests/common/test_constants.h
index f6b6922a4..514818e0a 100644
--- a/tests/common/test_constants.h
+++ b/tests/common/test_constants.h
@@ -19,6 +19,8 @@
#include <stdlib.h>
+#include <string>
+
// Zip entries in ziptest_valid.zip.
static const std::string kATxtContents("abcdefghabcdefgh\n");
static const std::string kBTxtContents("abcdefgh\n");
@@ -30,10 +32,14 @@ static const std::string kATxtSha1Sum("32c96a03dc8cd20097940f351bca6261ee5a1643"
// echo -n -e "abcdefgh\n" | sha1sum
static const std::string kBTxtSha1Sum("e414af7161c9554089f4106d6f1797ef14a73666");
-static const char* data_root = getenv("ANDROID_DATA");
-
static std::string from_testdata_base(const std::string& fname) {
- return std::string(data_root) + "/nativetest/recovery/testdata/" + fname;
+#ifdef __ANDROID__
+ static std::string data_root = getenv("ANDROID_DATA");
+#else
+ static std::string data_root = std::string(getenv("ANDROID_PRODUCT_OUT")) + "/data";
+#endif
+
+ return data_root + "/nativetest/recovery/testdata/" + fname;
}
#endif // _OTA_TEST_CONSTANTS_H