summaryrefslogtreecommitdiffstats
path: root/tests/common
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-10-25 01:12:35 +0200
committerTianjie Xu <xunchang@google.com>2017-11-01 07:31:02 +0100
commit113fe05ee0d33dbafd0923be97d448feb27d8f4b (patch)
treed665193af5ff0664341e63e28173ef959900546c /tests/common
parentMerge "tests: Take the ownership of the FD when calling fdopen." (diff)
downloadandroid_bootable_recovery-113fe05ee0d33dbafd0923be97d448feb27d8f4b.tar
android_bootable_recovery-113fe05ee0d33dbafd0923be97d448feb27d8f4b.tar.gz
android_bootable_recovery-113fe05ee0d33dbafd0923be97d448feb27d8f4b.tar.bz2
android_bootable_recovery-113fe05ee0d33dbafd0923be97d448feb27d8f4b.tar.lz
android_bootable_recovery-113fe05ee0d33dbafd0923be97d448feb27d8f4b.tar.xz
android_bootable_recovery-113fe05ee0d33dbafd0923be97d448feb27d8f4b.tar.zst
android_bootable_recovery-113fe05ee0d33dbafd0923be97d448feb27d8f4b.zip
Diffstat (limited to 'tests/common')
-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