Skip to content

Commit

Permalink
tests: pipe: fix error with optimization disabled
Browse files Browse the repository at this point in the history
The various struct pipe_sequence were not located in memory
accessible to user mode. With optimization turned on, they
weren't in memory at all, but with code coverage enabled
the arrays were actually being read, resulting in memory
access failures from user mode.

Fix them by placing in ROM, they never get modified.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  • Loading branch information
Andrew Boie authored and nashif committed May 2, 2019
1 parent 646f617 commit 1d4cc15
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/kernel/pipe/pipe/src/test_pipe.c
Expand Up @@ -51,7 +51,7 @@ struct pipe_sequence {
int return_value;
};

static struct pipe_sequence single_elements[] = {
static const struct pipe_sequence single_elements[] = {
{ 0, ALL_BYTES, 0, 0 },
{ 1, ALL_BYTES, 1, RETURN_SUCCESS },
{ PIPE_SIZE - 1, ALL_BYTES, PIPE_SIZE - 1, RETURN_SUCCESS },
Expand All @@ -71,7 +71,7 @@ static struct pipe_sequence single_elements[] = {
{ PIPE_SIZE + 1, NO_CONSTRAINT, PIPE_SIZE, RETURN_SUCCESS }
};

static struct pipe_sequence multiple_elements[] = {
static const struct pipe_sequence multiple_elements[] = {
{ PIPE_SIZE / 3, ALL_BYTES, PIPE_SIZE / 3, RETURN_SUCCESS, },
{ PIPE_SIZE / 3, ALL_BYTES, PIPE_SIZE / 3, RETURN_SUCCESS, },
{ PIPE_SIZE / 3, ALL_BYTES, PIPE_SIZE / 3, RETURN_SUCCESS, },
Expand All @@ -90,7 +90,7 @@ static struct pipe_sequence multiple_elements[] = {
{ PIPE_SIZE / 3, NO_CONSTRAINT, 0, RETURN_SUCCESS }
};

static struct pipe_sequence wait_elements[] = {
static const struct pipe_sequence wait_elements[] = {
{ 1, ALL_BYTES, 1, RETURN_SUCCESS },
{ PIPE_SIZE - 1, ALL_BYTES, PIPE_SIZE - 1, RETURN_SUCCESS },
{ PIPE_SIZE, ALL_BYTES, PIPE_SIZE, RETURN_SUCCESS },
Expand All @@ -101,7 +101,7 @@ static struct pipe_sequence wait_elements[] = {
{ PIPE_SIZE + 1, ATLEAST_1, PIPE_SIZE + 1, RETURN_SUCCESS }
};

static struct pipe_sequence timeout_elements[] = {
static const struct pipe_sequence timeout_elements[] = {
{ 0, ALL_BYTES, 0, 0 },
{ 1, ALL_BYTES, 0, -EAGAIN },
{ PIPE_SIZE - 1, ALL_BYTES, 0, -EAGAIN },
Expand Down

0 comments on commit 1d4cc15

Please sign in to comment.