quote-stress-test: accept arguments to test via the command-line
When the stress test reported a problem with quoting certain arguments, it is helpful to have a facility to play with those arguments in order to find out whether variations of those arguments are affected, too. Let's allow `test-run-command quote-stress-test -- <args>` to be used for that purpose. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@ -83,13 +83,21 @@ static int quote_stress_test(int argc, const char **argv)
|
|||||||
|
|
||||||
for (i = 0; i < trials; i++) {
|
for (i = 0; i < trials; i++) {
|
||||||
struct child_process cp = CHILD_PROCESS_INIT;
|
struct child_process cp = CHILD_PROCESS_INIT;
|
||||||
size_t arg_count = 1 + (my_random() % 5), arg_offset;
|
size_t arg_count, arg_offset;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
argv_array_clear(&args);
|
argv_array_clear(&args);
|
||||||
argv_array_pushl(&args, "test-run-command",
|
argv_array_pushl(&args, "test-run-command",
|
||||||
"quote-echo", NULL);
|
"quote-echo", NULL);
|
||||||
arg_offset = args.argc;
|
arg_offset = args.argc;
|
||||||
|
|
||||||
|
if (argc > 0) {
|
||||||
|
trials = 1;
|
||||||
|
arg_count = argc;
|
||||||
|
for (j = 0; j < arg_count; j++)
|
||||||
|
argv_array_push(&args, argv[j]);
|
||||||
|
} else {
|
||||||
|
arg_count = 1 + (my_random() % 5);
|
||||||
for (j = 0; j < arg_count; j++) {
|
for (j = 0; j < arg_count; j++) {
|
||||||
char buf[20];
|
char buf[20];
|
||||||
size_t min_len = 1;
|
size_t min_len = 1;
|
||||||
@ -103,6 +111,7 @@ static int quote_stress_test(int argc, const char **argv)
|
|||||||
|
|
||||||
argv_array_push(&args, buf);
|
argv_array_push(&args, buf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cp.argv = args.argv;
|
cp.argv = args.argv;
|
||||||
strbuf_reset(&out);
|
strbuf_reset(&out);
|
||||||
|
Reference in New Issue
Block a user