From 31fbbb79d2d5cec1524ad80a2fc8359971104d1d Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Thu, 28 Sep 2023 14:30:04 +0200 Subject: [PATCH] net-test: packetdrill: run_all: add --dry_run mode It is useful to have an easy way to display the commands that are going to be executed: for debugging purposes, to relaunch one specific test with different arguments or from a different environment, etc. Now a new '--dry_run' parameter is available to only display commands and not execute anything. Signed-off-by: Matthieu Baerts --- gtests/net/packetdrill/run_all.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gtests/net/packetdrill/run_all.py b/gtests/net/packetdrill/run_all.py index e5ca0433..d4415acb 100755 --- a/gtests/net/packetdrill/run_all.py +++ b/gtests/net/packetdrill/run_all.py @@ -194,6 +194,13 @@ def RunTests(self, path): time_start = time.time() cmds = self.CmdsTests(tests) + + if self.args['dry_run']: + print('Dry-run mode:') + for cmd in cmds: + print(' '.join(cmd[0])) + return + self.StartPollTestSet(cmds) print( @@ -269,6 +276,7 @@ def ParseArgs(): args.add_argument('-p', '--parallelize_dirs', action='store_true') args.add_argument('-P', '--max_in_parallel', metavar='N', type=int, default=0, help="max number of tests running in parallel") + args.add_argument('--dry_run', action='store_true') args.add_argument('-s', '--subdirs', action='store_true') args.add_argument('-S', '--serialized', action='store_true') args.add_argument('-v', '--verbose', action='count', default=0,