summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2012-11-25 15:42:45 -0800
committerKenneth Graunke <kenneth@whitecape.org>2012-11-25 15:42:45 -0800
commit4df645cdadbcb6dcf3c31b682b66b3e1741be892 (patch)
tree987b411dc54fefef33477b1d5b7a402f7b66a58e
parent1f35192efe43f96420c2a440725203ed0ff29a57 (diff)
basic 'robyn list-runs' command
needs lots of work: --pretty option -t and -x filtering --since date?
-rw-r--r--framework/database.py5
-rwxr-xr-xprograms/listRuns.py76
-rwxr-xr-xrobyn6
3 files changed, 87 insertions, 0 deletions
diff --git a/framework/database.py b/framework/database.py
index 926e49f..b5cf4d0 100644
--- a/framework/database.py
+++ b/framework/database.py
@@ -60,6 +60,11 @@ class ResultDatabase:
cursor.execute('INSERT INTO runs VALUES(?,?,?,?)', (date, name, driver, sysinfo))
return date
+ def listRuns(self):
+ cursor = self.connection.cursor()
+ rs = cursor.execute('SELECT * FROM runs ORDER BY date DESC')
+ return [{'date': r[0], 'name': r[1], 'driver': r[2], 'sysinfo': r[3]} for r in rs]
+
def addPlaceholderResults(self, run, tests):
rows = [(run, test) for test in tests]
c = self.connection.cursor()
diff --git a/programs/listRuns.py b/programs/listRuns.py
new file mode 100755
index 0000000..8ea3f8a
--- /dev/null
+++ b/programs/listRuns.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python3
+#
+# Copyright © 2012 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+__all__ = ['main']
+
+from argparse import ArgumentParser
+import os
+import os.path as path
+import re
+import time
+import sys
+
+from framework.database import ResultDatabase
+import suites
+
+def parseArguments(argv, config):
+ p = ArgumentParser(prog='robyn run', description='A GPU test runner')
+ p.add_argument('-t', '--tests', action='append', dest='includeFilters',
+ metavar='<regexp>',
+ help='Include only runs matching this regular expression')
+ p.add_argument('-x', '--exclude', action='append', dest='excludeFilters',
+ default=[],
+ metavar='<regexp>',
+ help='Exclude runs matching this regular expression')
+ p.add_argument('-r', '--results', action='store', dest='database',
+ metavar='<results database>',
+ help='Specify an alternate result database (defaults to ~/.local/share/robyn/results.db))')
+
+ options = p.parse_args(argv)
+
+ # Override config file settings with the command line options.
+ rc_options = ['threads', 'database']
+ config.read_dict({'options': dict((k, v) for k, v in vars(options).items() if k in rc_options and v is not None)})
+
+ return options
+
+def main(argv, config):
+ args = parseArguments(argv, config)
+
+ # Compile filter regular expressions
+ includeFilters = None
+ if args.includeFilters:
+ includeFilters = [re.compile(x) for x in args.includeFilters]
+ excludeFilters = [re.compile(x) for x in args.excludeFilters]
+
+ # Connect to the database
+ db = ResultDatabase(config)
+
+ #runs = filterTests(db.listRuns(), includeFilters, excludeFilters)
+ runs = db.listRuns()
+
+ for run in runs:
+ print(run['name'], time.asctime(time.gmtime(run['date'])))
+
+if __name__ == '__main__':
+ main(sys.argv[1:])
diff --git a/robyn b/robyn
index d4f2ffc..c925da1 100755
--- a/robyn
+++ b/robyn
@@ -23,6 +23,7 @@
#
import sys
import programs.run
+import programs.listRuns
import framework.config
def usage():
@@ -36,6 +37,9 @@ Valid commands are:
- resume Resume an in-progress test run
- report Generate a report on the results.
+ Results management:
+ - list-runs List previous test runs
+
Suite management:
- list-suites List known test suites
- add-suite Add a new test suite to your .robynrc
@@ -53,5 +57,7 @@ args = sys.argv[2:]
if cmd == 'run':
programs.run.main(args, config)
+elif cmd == 'list-runs':
+ programs.listRuns.main(args, config)
else:
usage()