summaryrefslogtreecommitdiffstats
path: root/tests/manual/recovery_test.cpp
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-04-03 11:31:37 +0200
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-04-03 11:31:37 +0200
commitf3103cc08b325bbc18cb95f3d1797e59296ce4e6 (patch)
tree96a6c47d7b6a2a1f667a3f69fdb43eb6b905a350 /tests/manual/recovery_test.cpp
parentSnap for 4693670 from 966fffcd1760038cbfd0680aec7c5792aa1b68a5 to qt-release (diff)
parentMerge "tests: Pick up testdata with LOCAL_TEST_DATA." am: 6b6c21af28 am: 8028dc1ce4 (diff)
downloadandroid_bootable_recovery-f3103cc08b325bbc18cb95f3d1797e59296ce4e6.tar
android_bootable_recovery-f3103cc08b325bbc18cb95f3d1797e59296ce4e6.tar.gz
android_bootable_recovery-f3103cc08b325bbc18cb95f3d1797e59296ce4e6.tar.bz2
android_bootable_recovery-f3103cc08b325bbc18cb95f3d1797e59296ce4e6.tar.lz
android_bootable_recovery-f3103cc08b325bbc18cb95f3d1797e59296ce4e6.tar.xz
android_bootable_recovery-f3103cc08b325bbc18cb95f3d1797e59296ce4e6.tar.zst
android_bootable_recovery-f3103cc08b325bbc18cb95f3d1797e59296ce4e6.zip
Diffstat (limited to 'tests/manual/recovery_test.cpp')
-rw-r--r--tests/manual/recovery_test.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/manual/recovery_test.cpp b/tests/manual/recovery_test.cpp
index 64e3b59e6..224ed5b68 100644
--- a/tests/manual/recovery_test.cpp
+++ b/tests/manual/recovery_test.cpp
@@ -34,7 +34,6 @@
static const std::string myFilename = "/data/misc/recovery/inject.txt";
static const std::string myContent = "Hello World\nWelcome to my recovery\n";
static const std::string kLocale = "zu";
-static const std::string kResourceTestDir = "/data/nativetest/recovery/";
// Failure is expected on systems that do not deliver either the
// recovery-persist or recovery-refresh executables. Tests also require
@@ -108,19 +107,20 @@ static int png_filter(const dirent* de) {
return 1;
}
-// Find out all png files to test under /data/nativetest/recovery/.
+// Find out all the PNG files to test, which stay under the same dir with the executable.
static std::vector<std::string> add_files() {
+ std::string exec_dir = android::base::GetExecutableDirectory();
std::vector<std::string> files;
- for (const std::string& str : image_dir) {
- std::string dir_path = kResourceTestDir + str;
+ for (const std::string& image : image_dir) {
+ std::string dir_path = exec_dir + "/" + image;
dirent** namelist;
int n = scandir(dir_path.c_str(), &namelist, png_filter, alphasort);
if (n == -1) {
- printf("Failed to scan dir %s: %s\n", kResourceTestDir.c_str(), strerror(errno));
+ printf("Failed to scan dir %s: %s\n", exec_dir.c_str(), strerror(errno));
return files;
}
if (n == 0) {
- printf("No file is added for test in %s\n", kResourceTestDir.c_str());
+ printf("No file is added for test in %s\n", exec_dir.c_str());
}
while (n--) {