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