mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-07 03:40:15 +00:00
parent
61454178c0
commit
d5051c439d
@ -37,7 +37,9 @@ namespace Test_fifo_pipe {
|
|||||||
static char const* TEST_DATA_FILENAME { "/ro/test-data.bin" };
|
static char const* TEST_DATA_FILENAME { "/ro/test-data.bin" };
|
||||||
static char const* SEND_FILENAME { "/dev/send-pipe/in" };
|
static char const* SEND_FILENAME { "/dev/send-pipe/in" };
|
||||||
static char const* RECEIVE_FILENAME { "/dev/receive-pipe/out" };
|
static char const* RECEIVE_FILENAME { "/dev/receive-pipe/out" };
|
||||||
enum { BUF_SIZE = 4*1024 };
|
|
||||||
|
/* create a buffer that isn't a multiple of the pipe size */
|
||||||
|
enum { BUF_SIZE = 16 * 1024 + 42 };
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t copy(int src, int dest)
|
static size_t copy(int src, int dest)
|
||||||
@ -126,14 +128,14 @@ class Test_fifo_pipe::Test
|
|||||||
|
|
||||||
size_t total_received_bytes { 0 };
|
size_t total_received_bytes { 0 };
|
||||||
while (true) {
|
while (true) {
|
||||||
/* read test data */
|
|
||||||
auto const test_data_num = read(test_data_file, test_data, BUF_SIZE);
|
|
||||||
/* read piped data */
|
/* read piped data */
|
||||||
auto const pipe_data_num = read(receive_file, receive_buffer, BUF_SIZE);
|
auto const pipe_data_num = read(receive_file, receive_buffer, BUF_SIZE);
|
||||||
|
/* read test data */
|
||||||
|
auto const test_data_num = read(test_data_file, test_data, pipe_data_num);
|
||||||
if (pipe_data_num > 0) {
|
if (pipe_data_num > 0) {
|
||||||
/* compare piped data to test data */
|
/* compare piped data to test data */
|
||||||
auto const diff_offset = Genode::memcmp(test_data, receive_buffer, test_data_num);
|
auto const diff_offset = Genode::memcmp(test_data, receive_buffer, test_data_num);
|
||||||
if (pipe_data_num != test_data_num || (0 != diff_offset)) {
|
if (0 != diff_offset) {
|
||||||
error("writing to pipe failed. Data sent not equal data received. diff_offset=", diff_offset);
|
error("writing to pipe failed. Data sent not equal data received. diff_offset=", diff_offset);
|
||||||
error("total_received_bytes=", total_received_bytes);
|
error("total_received_bytes=", total_received_bytes);
|
||||||
error("pipe_data_num=", pipe_data_num, " test_data_num=", test_data_num);
|
error("pipe_data_num=", pipe_data_num, " test_data_num=", test_data_num);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user