Skip to content

Commit

Permalink
net-test: packetdrill: run_all: add --dry_run mode
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
matttbe authored and nealcardwell committed Sep 29, 2023
1 parent 90e6d74 commit 31fbbb7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gtests/net/packetdrill/run_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 31fbbb7

Please sign in to comment.