From: Mark Wooding Date: Fri, 6 Sep 2024 19:34:53 +0000 (+0100) Subject: soak: Allow arguments to be passed on to the test program. X-Git-Tag: 0.99.0~107 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/xyla/commitdiff_plain/4b24117eb217a721a5e04b8f9b10885e6ff2c9a2 soak: Allow arguments to be passed on to the test program. This also allows us to run it under valgrind(1), for example. --- diff --git a/soak b/soak index b8ba733..5e95d15 100755 --- a/soak +++ b/soak @@ -98,7 +98,8 @@ class Options (object): def __init__(me): op = OP.OptionParser\ (usage = "%prog [-y] [-c STEPS] [-f FILE] [-l LIMIT] " - "[-n STEPS] PROG") + "[-n STEPS] PROG [ARGS ...]") + op.disable_interspersed_args() for short, long, kw in \ [("-c", "--ckpt-steps", dict(type = "int", metavar = "STEPS", @@ -126,8 +127,8 @@ class Options (object): me.sync = opts.sync me.ckpt_steps = opts.ckpt_steps me.nsteps = opts.nsteps - if len(args) != 1: op.print_usage(SYS.stderr); SYS.exit(2) - me.testprog = args[0] + if len(args) < 1: op.print_usage(SYS.stderr); SYS.exit(2) + me.testprog = args class Level (object): def __init__(me, kind, base, limit, tree = "_"): @@ -222,7 +223,7 @@ def choices(): OPTS = Options() ST = State(OPTS) -KID = SUB.Popen([OPTS.testprog], stdin = SUB.PIPE, stdout = SUB.PIPE) +KID = SUB.Popen(OPTS.testprog, stdin = SUB.PIPE, stdout = SUB.PIPE) def fail(msg): SYS.stderr.write("%s: FAILED: %s\n" % (PROG, msg))