diff options
Diffstat (limited to 'test/ioctl/mock.c')
-rw-r--r-- | test/ioctl/mock.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/test/ioctl/mock.c b/test/ioctl/mock.c index a97a357..1fb3ec1 100644 --- a/test/ioctl/mock.c +++ b/test/ioctl/mock.c @@ -58,19 +58,19 @@ void end_mock_cmds(void) #define execute_ioctl(cmd, mock_cmd) ({ \ check((cmd)->opcode == (mock_cmd)->opcode, \ - "got opcode %" PRIu8 ", expected %" PRIu8, \ + "got opcode 0x%" PRIx8 ", expected 0x%" PRIx8, \ (cmd)->opcode, (mock_cmd)->opcode); \ check((cmd)->flags == (mock_cmd)->flags, \ - "got flags %" PRIu8 ", expected %" PRIu8, \ + "got flags 0x%" PRIx8 ", expected 0x%" PRIx8, \ (cmd)->flags, (mock_cmd)->flags); \ check((cmd)->nsid == (mock_cmd)->nsid, \ - "got nsid %" PRIu32 ", expected %" PRIu32, \ + "got nsid 0x%" PRIx32 ", expected 0x%" PRIx32, \ (cmd)->nsid, (mock_cmd)->nsid); \ check((cmd)->cdw2 == (mock_cmd)->cdw2, \ - "got cdw2 %" PRIu32 ", expected %" PRIu32, \ + "got cdw2 0x%" PRIx32 ", expected 0x%" PRIx32, \ (cmd)->cdw2, (mock_cmd)->cdw2); \ check((cmd)->cdw3 == (mock_cmd)->cdw3, \ - "got cdw3 %" PRIu32 ", expected %" PRIu32, \ + "got cdw3 0x%" PRIx32 ", expected 0x%" PRIx32, \ (cmd)->cdw3, (mock_cmd)->cdw3); \ check((cmd)->metadata_len == (mock_cmd)->metadata_len, \ "got metadata_len %" PRIu32 ", expected %" PRIu32, \ @@ -90,29 +90,30 @@ void end_mock_cmds(void) cmp(data, (mock_cmd)->in_data, data_len, "incorrect data"); \ } \ check((cmd)->cdw10 == (mock_cmd)->cdw10, \ - "got cdw10 %" PRIu32 ", expected %" PRIu32, \ + "got cdw10 0x%" PRIx32 ", expected 0x%" PRIx32, \ (cmd)->cdw10, (mock_cmd)->cdw10); \ check((cmd)->cdw11 == (mock_cmd)->cdw11, \ - "got cdw11 %" PRIu32 ", expected %" PRIu32, \ + "got cdw11 0x%" PRIx32 ", expected 0x%" PRIx32, \ (cmd)->cdw11, (mock_cmd)->cdw11); \ check((cmd)->cdw12 == (mock_cmd)->cdw12, \ - "got cdw12 %" PRIu32 ", expected %" PRIu32, \ + "got cdw12 0x%" PRIx32 ", expected 0x%" PRIx32, \ (cmd)->cdw12, (mock_cmd)->cdw12); \ check((cmd)->cdw13 == (mock_cmd)->cdw13, \ - "got cdw13 %" PRIu32 ", expected %" PRIu32, \ + "got cdw13 0x%" PRIx32 ", expected 0x%" PRIx32, \ (cmd)->cdw13, (mock_cmd)->cdw13); \ check((cmd)->cdw14 == (mock_cmd)->cdw14, \ - "got cdw14 %" PRIu32 ", expected %" PRIu32, \ + "got cdw14 0x%" PRIx32 ", expected 0x%" PRIx32, \ (cmd)->cdw14, (mock_cmd)->cdw14); \ check((cmd)->cdw15 == (mock_cmd)->cdw15, \ - "got cdw15 %" PRIu32 ", expected %" PRIu32, \ + "got cdw15 0x%" PRIx32 ", expected 0x%" PRIx32, \ (cmd)->cdw15, (mock_cmd)->cdw15); \ check((cmd)->timeout_ms == (mock_cmd)->timeout_ms, \ "got timeout_ms %" PRIu32 ", expected %" PRIu32, \ (cmd)->timeout_ms, (mock_cmd)->timeout_ms); \ (cmd)->result = (mock_cmd)->result; \ - if ((mock_cmd)->out_data) { \ - memcpy(data, (mock_cmd)->out_data, data_len); \ + const void *out_data = (mock_cmd)->out_data; \ + if (out_data) { \ + memcpy(data, out_data, (mock_cmd)->out_data_len ?: data_len); \ } \ }) |