summaryrefslogtreecommitdiff
path: root/piglit-print-commands.py
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2016-03-30 11:18:35 -0700
committerDylan Baker <dylan@pnwbakers.com>2016-05-02 17:54:04 -0700
commit5b65303f2e19a3980b4df4bdf8e8bd5f6ab519df (patch)
tree05fba36e68725448615c43a3ea1e14d5049053bd /piglit-print-commands.py
parent72aa818819904f495bdce496bbfeb4527598181f (diff)
framework: split a function out of main piglit-print-command.py
This was a closure, but it really doesn't need to be, or really should be. This rips it out and does a little bit of style cleanup. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Diffstat (limited to 'piglit-print-commands.py')
-rwxr-xr-xpiglit-print-commands.py30
1 files changed, 16 insertions, 14 deletions
diff --git a/piglit-print-commands.py b/piglit-print-commands.py
index 68977ccaa..17779e394 100755
--- a/piglit-print-commands.py
+++ b/piglit-print-commands.py
@@ -35,6 +35,21 @@ from framework.programs import parsers
from framework.test import Test, GleanTest
+def get_command(test, piglit_dir):
+ """Get just the name of the command with a path relative to bin."""
+ command = ''
+ if isinstance(test, GleanTest):
+ for var, val in test.env.items():
+ command += "{}='{}'".format(var, val)
+
+ # Make the test command relative to the piglit_dir
+ test_command = test.command[:]
+ test_command[0] = os.path.relpath(test_command[0], piglit_dir)
+
+ command += ' '.join(test_command)
+ return command
+
+
def main():
input_ = [i.decode('utf-8') for i in sys.argv[1:]]
parser = argparse.ArgumentParser(parents=[parsers.CONFIG])
@@ -64,23 +79,10 @@ def main():
profile_ = profile.load_test_profile(args.testProfile)
- def getCommand(test):
- command = ''
- if isinstance(test, GleanTest):
- for var, val in test.env.items():
- command += var + "='" + val + "' "
-
- # Make the test command relative to the piglit_dir
- testCommand = test.command[:]
- testCommand[0] = os.path.relpath(testCommand[0], piglit_dir)
-
- command += ' '.join(testCommand)
- return command
-
profile_._prepare_test_list()
for name, test in profile_.test_list.items():
assert(isinstance(test, Test))
- print(name, ':::', getCommand(test))
+ print(name, ':::', get_command(test, piglit_dir))
if __name__ == "__main__":