File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ import argparse
2
+ import subprocess
3
+ import sys
4
+ import os
5
+ import shlex
6
+
7
+ # shlex.split() splits according to shell quoting rules
8
+ WIZARD = shlex .split (os .getenv ("TEST_RUNTIME_EXE" , "wizeng.x86-64-linux" ))
9
+
10
+ parser = argparse .ArgumentParser ()
11
+ parser .add_argument ("--version" , action = "store_true" )
12
+ parser .add_argument ("--test-file" , action = "store" )
13
+ parser .add_argument ("--arg" , action = "append" , default = [])
14
+ parser .add_argument ("--env" , action = "append" , default = [])
15
+ parser .add_argument ("--dir" , action = "append" , default = [])
16
+
17
+ args = parser .parse_args ()
18
+
19
+ if args .version :
20
+ # ensure no args when version is queried
21
+ subprocess .run (WIZARD [0 :1 ] + ["-version" ])
22
+ sys .exit (0 )
23
+
24
+ TEST_FILE = args .test_file
25
+ PROG_ARGS = args .arg
26
+ ENV_ARGS = None if len (args .env ) == 0 else f'--env={ "," .join (args .env )} '
27
+ DIR_ARGS = None if len (args .dir ) == 0 else f'--dir={ "," .join (args .dir )} '
28
+
29
+ r = subprocess .run ([arg for arg in WIZARD + [ENV_ARGS , DIR_ARGS , TEST_FILE ] + PROG_ARGS if arg ])
30
+ sys .exit (r .returncode )
You can’t perform that action at this time.
0 commit comments