Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

test: add option to force a corruption point

Signed-off-by: Felipe Contreras <felipe.contreras@nokia.com>
  • Loading branch information...
commit 282b2fb730cfcd4760b7cf05527fecde12e41b62 1 parent e1b2e4f
Felipe Contreras authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 dsp_test.c
21 dsp_test.c
View
@@ -27,6 +27,8 @@ static int ntimes;
static bool do_fault;
static bool do_ping;
static bool do_write;
+static bool do_corruption;
+static unsigned long corruption_point;
static int dsp_handle;
static void *proc;
@@ -95,6 +97,8 @@ configure_dsp_node(void *node,
msg.arg_2 = (uint32_t) output_buffer->map;
if (do_fault)
msg.arg_2 = 0x12345678;
+ if (do_corruption)
+ msg.arg_2 = corruption_point;
dsp_node_put_message(dsp_handle, node, &msg, -1);
}
@@ -160,6 +164,12 @@ static void run_dmm(struct dsp_node *node, unsigned long times)
dmm_buffer_allocate(input_buffer, input_buffer_size);
dmm_buffer_allocate(output_buffer, output_buffer_size);
+ if (do_corruption) {
+ char *ptr = input_buffer->data;
+ for (unsigned i = 0; i < input_buffer->size; i++)
+ ptr[i] = 0x6b;
+ }
+
dmm_buffer_map(output_buffer);
dmm_buffer_map(input_buffer);
@@ -288,6 +298,17 @@ static void handle_options(int *argc, const char ***argv)
(*argc)--;
}
+ if (!strcmp(cmd, "-c") || !strcmp(cmd, "--corrupt")) {
+ if (*argc < 2) {
+ pr_err("bad option");
+ exit(-1);
+ }
+ do_corruption = 1;
+ corruption_point = strtoll((*argv)[1], NULL, 16);
+ (*argv)++;
+ (*argc)--;
+ }
+
if (!strcmp(cmd, "-f") || !strcmp(cmd, "--fault"))
do_fault = 1;
Please sign in to comment.
Something went wrong with that request. Please try again.