Merge changes I63b5e69b,I85c6af63 am: a800e1ee9d
Change-Id: I6e4bb6f4255bcd11d8ab5528d62360ed7dfd6b5c
This commit is contained in:
commit
e37779bfea
4 changed files with 45 additions and 8 deletions
|
|
@ -5,6 +5,12 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "liblp_test"
|
"name": "liblp_test"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fiemap_image_test_presubmit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fiemap_writer_test"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,4 +104,34 @@ cc_test {
|
||||||
srcs: [
|
srcs: [
|
||||||
"image_test.cpp",
|
"image_test.cpp",
|
||||||
],
|
],
|
||||||
|
test_suites: ["device-tests"],
|
||||||
|
auto_gen_config: true,
|
||||||
|
require_root: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
/* BUG(148874852) temporary test */
|
||||||
|
cc_test {
|
||||||
|
name: "fiemap_image_test_presubmit",
|
||||||
|
cppflags: [
|
||||||
|
"-DSKIP_TEST_IN_PRESUBMIT",
|
||||||
|
],
|
||||||
|
static_libs: [
|
||||||
|
"libdm",
|
||||||
|
"libext4_utils",
|
||||||
|
"libfs_mgr",
|
||||||
|
"liblp",
|
||||||
|
],
|
||||||
|
shared_libs: [
|
||||||
|
"libbase",
|
||||||
|
"libcrypto",
|
||||||
|
"libcrypto_utils",
|
||||||
|
"libcutils",
|
||||||
|
"liblog",
|
||||||
|
],
|
||||||
|
srcs: [
|
||||||
|
"image_test.cpp",
|
||||||
|
],
|
||||||
|
test_suites: ["device-tests"],
|
||||||
|
auto_gen_config: true,
|
||||||
|
require_root: true,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -526,11 +526,7 @@ static bool IsValidExtent(const fiemap_extent* extent, std::string_view file_pat
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsLastExtent(const fiemap_extent* extent) {
|
static bool IsLastExtent(const fiemap_extent* extent) {
|
||||||
if (!(extent->fe_flags & FIEMAP_EXTENT_LAST)) {
|
return !!(extent->fe_flags & FIEMAP_EXTENT_LAST);
|
||||||
LOG(ERROR) << "Extents are being received out-of-order";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool FiemapToExtents(struct fiemap* fiemap, std::vector<struct fiemap_extent>* extents,
|
static bool FiemapToExtents(struct fiemap* fiemap, std::vector<struct fiemap_extent>* extents,
|
||||||
|
|
@ -552,7 +548,10 @@ static bool FiemapToExtents(struct fiemap* fiemap, std::vector<struct fiemap_ext
|
||||||
fiemap_extent* next = &fiemap->fm_extents[i];
|
fiemap_extent* next = &fiemap->fm_extents[i];
|
||||||
|
|
||||||
// Make sure extents are returned in order
|
// Make sure extents are returned in order
|
||||||
if (next != last_extent && IsLastExtent(next)) return false;
|
if (next != last_extent && IsLastExtent(next)) {
|
||||||
|
LOG(ERROR) << "Extents are being received out-of-order";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if extent's flags are valid
|
// Check if extent's flags are valid
|
||||||
if (!IsValidExtent(next, file_path)) return false;
|
if (!IsValidExtent(next, file_path)) return false;
|
||||||
|
|
@ -592,8 +591,7 @@ static bool ReadFiemap(int file_fd, const std::string& file_path,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t fiemap_size =
|
uint64_t fiemap_size = sizeof(struct fiemap) + num_extents * sizeof(struct fiemap_extent);
|
||||||
sizeof(struct fiemap_extent) + num_extents * sizeof(struct fiemap_extent);
|
|
||||||
auto buffer = std::unique_ptr<void, decltype(&free)>(calloc(1, fiemap_size), free);
|
auto buffer = std::unique_ptr<void, decltype(&free)>(calloc(1, fiemap_size), free);
|
||||||
if (buffer == nullptr) {
|
if (buffer == nullptr) {
|
||||||
LOG(ERROR) << "Failed to allocate memory for fiemap";
|
LOG(ERROR) << "Failed to allocate memory for fiemap";
|
||||||
|
|
|
||||||
|
|
@ -212,6 +212,9 @@ TEST_F(ImageTest, DirectMount) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ImageTest, IndirectMount) {
|
TEST_F(ImageTest, IndirectMount) {
|
||||||
|
#ifdef SKIP_TEST_IN_PRESUBMIT
|
||||||
|
GTEST_SKIP() << "WIP failure b/148874852";
|
||||||
|
#endif
|
||||||
// Create a simple wrapper around the base device that we'll mount from
|
// Create a simple wrapper around the base device that we'll mount from
|
||||||
// instead. This will simulate the code paths for dm-crypt/default-key/bow
|
// instead. This will simulate the code paths for dm-crypt/default-key/bow
|
||||||
// and force us to use device-mapper rather than loop devices.
|
// and force us to use device-mapper rather than loop devices.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue