summaryrefslogtreecommitdiffstats
path: root/tests/common
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-04-03 02:25:40 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-04-03 02:25:40 +0200
commit08d3e838229d13008816cdccd33a342edfd72a1c (patch)
tree96a6c47d7b6a2a1f667a3f69fdb43eb6b905a350 /tests/common
parentMerge "Do not skip the update installation if it's a retry" am: e566168c94 (diff)
parentMerge "tests: Pick up testdata with LOCAL_TEST_DATA." (diff)
downloadandroid_bootable_recovery-08d3e838229d13008816cdccd33a342edfd72a1c.tar
android_bootable_recovery-08d3e838229d13008816cdccd33a342edfd72a1c.tar.gz
android_bootable_recovery-08d3e838229d13008816cdccd33a342edfd72a1c.tar.bz2
android_bootable_recovery-08d3e838229d13008816cdccd33a342edfd72a1c.tar.lz
android_bootable_recovery-08d3e838229d13008816cdccd33a342edfd72a1c.tar.xz
android_bootable_recovery-08d3e838229d13008816cdccd33a342edfd72a1c.tar.zst
android_bootable_recovery-08d3e838229d13008816cdccd33a342edfd72a1c.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