[Piglit] [PATCH 02/18] run.py: Split command parser out of run()
Dylan Baker
baker.dylan.c at gmail.com
Tue Aug 19 13:24:56 PDT 2014
This change is necessary to be able to regression test the parser, which
has grown quite large and complicated. The unit testing of the parser is
necessitated by changes coming later in this series.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/programs/run.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/framework/programs/run.py b/framework/programs/run.py
index c4c9189..78a905f 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -35,7 +35,8 @@ __all__ = ['run',
'resume']
-def run(input_):
+def _run_parser(input_):
+ """ Parser for piglit run command """
parser = argparse.ArgumentParser()
parser.add_argument("-n", "--name",
metavar="<test name>",
@@ -103,7 +104,17 @@ def run(input_):
type=path.realpath,
metavar="<Results Path>",
help="Path to results folder")
- args = parser.parse_args(input_)
+ return parser.parse_args(input_)
+
+
+def run(input_):
+ """ Function for piglit run command
+
+ This is a function because it allows it to be shared between piglit-run.py
+ and piglit run
+
+ """
+ args = _run_parser(input_)
# Disable Windows error message boxes for this and all child processes.
if sys.platform == 'win32':
--
2.0.4
More information about the Piglit
mailing list