@@ -23,6 +23,11 @@ def parse_args() -> argparse.Namespace:
2323 required = True ,
2424 help = "Path to pcb2gcode binary to run." ,
2525 )
26+ parser .add_argument (
27+ "-n" , "--dry-run" ,
28+ action = "store_true" ,
29+ help = "Dry run (print the command that would be run instead of running it)" ,
30+ )
2631 parser .add_argument (
2732 "example_dir" ,
2833 help = "Example directory to run (e.g. a subdir of tests/data/gerbv_example)" ,
@@ -36,7 +41,7 @@ def main() -> None:
3641 code_coverage_enabled = args .code_coverage
3742 pcb2gcode_binary = args .pcb2gcode_binary
3843 pcb2gcode_binary = os .path .abspath (pcb2gcode_binary )
39-
44+ dry_run = args . dry_run
4045 have_valgrind = shutil .which ("valgrind" ) is not None
4146 return_code = 0
4247 try :
@@ -75,9 +80,13 @@ def main() -> None:
7580 cmd = [pcb2gcode_binary ]
7681
7782 start = time .perf_counter ()
78- result = subprocess .run (cmd , cwd = example_dir , stdout = subprocess .PIPE , stderr = subprocess .STDOUT , text = True )
79- print (result .stdout , end = "" )
80- return_code = result .returncode
83+ if dry_run :
84+ print (shlex .join (cmd ))
85+ return_code = 0
86+ else :
87+ result = subprocess .run (cmd , cwd = example_dir , stdout = subprocess .PIPE , stderr = subprocess .STDOUT , text = True )
88+ print (result .stdout , end = "" )
89+ return_code = result .returncode
8190 elapsed = time .perf_counter () - start
8291 print (f"real { elapsed :.3f} seconds" )
8392 if return_code != 0 :
0 commit comments