Skip to content

Commit eb7add5

Browse files
lrgirdwolgirdwood
authored andcommitted
testbench: add a option for specifying the number of copy() iterations
All the user to specify the number of copies. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent b8d6760 commit eb7add5

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

tools/testbench/include/testbench/common_test.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <stdint.h>
1010
#include <stddef.h>
11+
#include <stdbool.h>
1112
#include <time.h>
1213
#include <stdio.h>
1314
#include <sof/sof.h>
@@ -45,6 +46,8 @@ struct testbench_prm {
4546
int sched_id;
4647
int max_pipeline_id;
4748
enum sof_ipc_frame frame_fmt;
49+
int copy_iterations;
50+
bool copy_check;
4851
};
4952

5053
struct shared_lib_table {

tools/testbench/testbench.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ static void print_usage(char *executable)
145145
printf("%s -i in.txt -o out.txt -t test.tplg ", executable);
146146
printf("-r 48000 -R 96000 -c 2");
147147
printf("-b S16_LE -a vol=libsof_volume.so\n");
148+
printf("-C number of copy() iterations\n");
148149
}
149150

150151
/* free components */
@@ -175,7 +176,7 @@ static void parse_input_args(int argc, char **argv, struct testbench_prm *tp)
175176
int option = 0;
176177
int ret = 0;
177178

178-
while ((option = getopt(argc, argv, "hdi:o:t:b:a:r:R:c:")) != -1) {
179+
while ((option = getopt(argc, argv, "hdi:o:t:b:a:r:R:c:C:")) != -1) {
179180
switch (option) {
180181
/* input sample file */
181182
case 'i':
@@ -223,6 +224,12 @@ static void parse_input_args(int argc, char **argv, struct testbench_prm *tp)
223224
debug = 1;
224225
break;
225226

227+
/* number of pipeline copy() iterations */
228+
case 'C':
229+
tp->copy_iterations = atoi(optarg);
230+
tp->copy_check = true;
231+
break;
232+
226233
/* print usage */
227234
default:
228235
fprintf(stderr, "unknown option %c\n", option);
@@ -262,6 +269,7 @@ int main(int argc, char **argv)
262269
tp.output_file_num = 0;
263270
tp.channels = TESTBENCH_NCH;
264271
tp.max_pipeline_id = 0;
272+
tp.copy_check = false;
265273

266274
/* command line arguments*/
267275
parse_input_args(argc, argv, &tp);
@@ -358,9 +366,15 @@ int main(int argc, char **argv)
358366
pipeline_schedule_copy(curr_p, 0);
359367
}
360368
}
369+
370+
/* are we bailing out after a fixed number of iterations ? */
371+
if (tp.copy_check) {
372+
if (--tp.copy_iterations == 0)
373+
break;
374+
}
361375
}
362376

363-
if (!frcd->fs.reached_eof)
377+
if (!frcd->fs.reached_eof && !tp.copy_check)
364378
printf("warning: possible pipeline xrun\n");
365379

366380
/* reset and free pipeline */

0 commit comments

Comments
 (0)