summaryrefslogtreecommitdiffstats
path: root/tests/common/test_constants.h
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-11-01 20:15:40 +0100
committerandroid-build-merger <android-build-merger@google.com>2017-11-01 20:15:40 +0100
commit03860d07758e610a846408013644a57ed5b69312 (patch)
treefa8381b588d465ac28be58aa61efadafbc0cbb83 /tests/common/test_constants.h
parentMerge "update_verifier: Fix the wrong computation with group_range_count." am: 011af6e1a9 am: 78fa902920 (diff)
parentMerge "Fix the size mismatch in imgdiff" am: dec77a454e (diff)
downloadandroid_bootable_recovery-03860d07758e610a846408013644a57ed5b69312.tar
android_bootable_recovery-03860d07758e610a846408013644a57ed5b69312.tar.gz
android_bootable_recovery-03860d07758e610a846408013644a57ed5b69312.tar.bz2
android_bootable_recovery-03860d07758e610a846408013644a57ed5b69312.tar.lz
android_bootable_recovery-03860d07758e610a846408013644a57ed5b69312.tar.xz
android_bootable_recovery-03860d07758e610a846408013644a57ed5b69312.tar.zst
android_bootable_recovery-03860d07758e610a846408013644a57ed5b69312.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