mirror of
https://github.com/ceph/ceph
synced 2025-02-24 19:47:44 +00:00
test/librados: fix endian bugs in checksum test cases
We're seeing test failures when running rados/test.sh in Teuthology on a big-endian platform (IBM Z). These are all related to calls to the checksum operations, which expect little-endian inputs and outputs, but are in many places called with native-endian types from the test code. One test case, LibRadosAio::RoundTrip3 in aio.cc, already uses ceph_le types to address this problem, and this test actually completes successfully on IBM Z. This patch changes the other test case performing checksum operations accordingly. With this patch in place, rados/test.sh now completed successfully. Fixes: https://tracker.ceph.com/issues/47516 Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
This commit is contained in:
parent
f09fb275a7
commit
2e66216b0c
@ -381,7 +381,7 @@ TEST_F(CReadOpsTest, Checksum) {
|
||||
|
||||
{
|
||||
rados_read_op_t op = rados_create_read_op();
|
||||
uint64_t init_value = -1;
|
||||
ceph_le64 init_value = init_le64(-1);
|
||||
rados_read_op_checksum(op, LIBRADOS_CHECKSUM_TYPE_XXHASH64,
|
||||
reinterpret_cast<char *>(&init_value),
|
||||
sizeof(init_value), 0, len, 0, NULL, 0, NULL);
|
||||
@ -390,8 +390,8 @@ TEST_F(CReadOpsTest, Checksum) {
|
||||
}
|
||||
|
||||
{
|
||||
uint32_t init_value = -1;
|
||||
uint32_t crc[2];
|
||||
ceph_le32 init_value = init_le32(-1);
|
||||
ceph_le32 crc[2];
|
||||
rados_read_op_t op = rados_create_read_op();
|
||||
rados_read_op_checksum(op, LIBRADOS_CHECKSUM_TYPE_CRC32C,
|
||||
reinterpret_cast<char *>(&init_value),
|
||||
@ -407,7 +407,7 @@ TEST_F(CReadOpsTest, Checksum) {
|
||||
}
|
||||
|
||||
{
|
||||
uint32_t init_value = -1;
|
||||
ceph_le32 init_value = init_le32(-1);
|
||||
int rval;
|
||||
rados_read_op_t op = rados_create_read_op();
|
||||
rados_read_op_checksum(op, LIBRADOS_CHECKSUM_TYPE_XXHASH32,
|
||||
@ -419,8 +419,8 @@ TEST_F(CReadOpsTest, Checksum) {
|
||||
}
|
||||
|
||||
{
|
||||
uint32_t init_value = -1;
|
||||
uint32_t crc[3];
|
||||
ceph_le32 init_value = init_le32(-1);
|
||||
ceph_le32 crc[3];
|
||||
int rval;
|
||||
rados_read_op_t op = rados_create_read_op();
|
||||
rados_read_op_checksum(op, LIBRADOS_CHECKSUM_TYPE_CRC32C,
|
||||
|
@ -111,8 +111,8 @@ TEST_F(LibRadosIo, Checksum) {
|
||||
|
||||
uint32_t expected_crc = ceph_crc32c(-1, reinterpret_cast<const uint8_t*>(buf),
|
||||
sizeof(buf));
|
||||
uint32_t init_value = -1;
|
||||
uint32_t crc[2];
|
||||
ceph_le32 init_value = init_le32(-1);
|
||||
ceph_le32 crc[2];
|
||||
ASSERT_EQ(0, rados_checksum(ioctx, "foo", LIBRADOS_CHECKSUM_TYPE_CRC32C,
|
||||
reinterpret_cast<char*>(&init_value),
|
||||
sizeof(init_value), sizeof(buf), 0, 0,
|
||||
|
@ -707,11 +707,11 @@ public:
|
||||
|
||||
typedef ::testing::Types<
|
||||
LibRadosChecksumParams<LIBRADOS_CHECKSUM_TYPE_XXHASH32,
|
||||
Checksummer::xxhash32, uint32_t>,
|
||||
Checksummer::xxhash32, ceph_le32>,
|
||||
LibRadosChecksumParams<LIBRADOS_CHECKSUM_TYPE_XXHASH64,
|
||||
Checksummer::xxhash64, uint64_t>,
|
||||
Checksummer::xxhash64, ceph_le64>,
|
||||
LibRadosChecksumParams<LIBRADOS_CHECKSUM_TYPE_CRC32C,
|
||||
Checksummer::crc32c, uint32_t>
|
||||
Checksummer::crc32c, ceph_le32>
|
||||
> LibRadosChecksumTypes;
|
||||
|
||||
TYPED_TEST_SUITE(LibRadosChecksum, LibRadosChecksumTypes);
|
||||
|
Loading…
Reference in New Issue
Block a user