From 113fe05ee0d33dbafd0923be97d448feb27d8f4b Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Tue, 24 Oct 2017 16:12:35 -0700 Subject: Fix the size mismatch in imgdiff As we construct the deflate entries of the target zip file with random data, the total size of the zip file may vary from case to case. This leads to occasional failures in the split test for deflate large apk files. This CL fixes the issue by adding two static zip files in the testdata instead of generating them dynamically. Bug: 67849209 Test: run the deflate_large_test repeatedly Change-Id: Iaeffad9205adefa10c9f62f9f088c33c4360a650 --- tests/common/test_constants.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'tests/common') 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 +#include + // 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 -- cgit v1.2.3