Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 1 changed file with 21 additions and 0 deletions. Show diff stats Hide diff stats

  1. +21 0 dsp_test.c
21 dsp_test.c
@@ -27,6 +27,8 @@ static int ntimes;
27 27 static bool do_fault;
28 28 static bool do_ping;
29 29 static bool do_write;
  30 +static bool do_corruption;
  31 +static unsigned long corruption_point;
30 32
31 33 static int dsp_handle;
32 34 static void *proc;
@@ -95,6 +97,8 @@ configure_dsp_node(void *node,
95 97 msg.arg_2 = (uint32_t) output_buffer->map;
96 98 if (do_fault)
97 99 msg.arg_2 = 0x12345678;
  100 + if (do_corruption)
  101 + msg.arg_2 = corruption_point;
98 102 dsp_node_put_message(dsp_handle, node, &msg, -1);
99 103 }
100 104
@@ -160,6 +164,12 @@ static void run_dmm(struct dsp_node *node, unsigned long times)
160 164 dmm_buffer_allocate(input_buffer, input_buffer_size);
161 165 dmm_buffer_allocate(output_buffer, output_buffer_size);
162 166
  167 + if (do_corruption) {
  168 + char *ptr = input_buffer->data;
  169 + for (unsigned i = 0; i < input_buffer->size; i++)
  170 + ptr[i] = 0x6b;
  171 + }
  172 +
163 173 dmm_buffer_map(output_buffer);
164 174 dmm_buffer_map(input_buffer);
165 175
@@ -288,6 +298,17 @@ static void handle_options(int *argc, const char ***argv)
288 298 (*argc)--;
289 299 }
290 300
  301 + if (!strcmp(cmd, "-c") || !strcmp(cmd, "--corrupt")) {
  302 + if (*argc < 2) {
  303 + pr_err("bad option");
  304 + exit(-1);
  305 + }
  306 + do_corruption = 1;
  307 + corruption_point = strtoll((*argv)[1], NULL, 16);
  308 + (*argv)++;
  309 + (*argc)--;
  310 + }
  311 +
291 312 if (!strcmp(cmd, "-f") || !strcmp(cmd, "--fault"))
292 313 do_fault = 1;
293 314

0 comments on commit 282b2fb

Please sign in to comment.
Something went wrong with that request. Please try again.