summaryrefslogtreecommitdiffstats
path: root/tests/common
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-03-31 05:43:45 +0200
committerTao Bao <tbao@google.com>2018-04-02 23:14:29 +0200
commit9d91e898317fe19051d486fb76271a89603b5de8 (patch)
treeeca8a8644a29dea0d2df7eb42d95bdae4a7527a1 /tests/common
parentMerge "Move a few modules to Soong." (diff)
downloadandroid_bootable_recovery-9d91e898317fe19051d486fb76271a89603b5de8.tar
android_bootable_recovery-9d91e898317fe19051d486fb76271a89603b5de8.tar.gz
android_bootable_recovery-9d91e898317fe19051d486fb76271a89603b5de8.tar.bz2
android_bootable_recovery-9d91e898317fe19051d486fb76271a89603b5de8.tar.lz
android_bootable_recovery-9d91e898317fe19051d486fb76271a89603b5de8.tar.xz
android_bootable_recovery-9d91e898317fe19051d486fb76271a89603b5de8.tar.zst
android_bootable_recovery-9d91e898317fe19051d486fb76271a89603b5de8.zip
Diffstat (limited to 'tests/common')
-rw-r--r--tests/common/test_constants.h15
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/common/test_constants.h b/tests/common/test_constants.h
index 514818e0a..b6c27a754 100644
--- a/tests/common/test_constants.h
+++ b/tests/common/test_constants.h
@@ -17,10 +17,10 @@
#ifndef _OTA_TEST_CONSTANTS_H
#define _OTA_TEST_CONSTANTS_H
-#include <stdlib.h>
-
#include <string>
+#include <android-base/file.h>
+
// Zip entries in ziptest_valid.zip.
static const std::string kATxtContents("abcdefghabcdefgh\n");
static const std::string kBTxtContents("abcdefgh\n");
@@ -32,14 +32,9 @@ static const std::string kATxtSha1Sum("32c96a03dc8cd20097940f351bca6261ee5a1643"
// echo -n -e "abcdefgh\n" | sha1sum
static const std::string kBTxtSha1Sum("e414af7161c9554089f4106d6f1797ef14a73666");
-static std::string from_testdata_base(const std::string& 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;
+[[maybe_unused]] static std::string from_testdata_base(const std::string& fname) {
+ static std::string exec_dir = android::base::GetExecutableDirectory();
+ return exec_dir + "/testdata/" + fname;
}
#endif // _OTA_TEST_CONSTANTS_H