diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2012-11-30 01:59:27 -0800 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2012-11-30 01:59:27 -0800 |
commit | fa010f88017958f2861b4ac7231fbaf6cd2a5695 (patch) | |
tree | d41f40b6e978f0943d4faa40bc4aed6c517e92cb | |
parent | baa71300e92818957e357d3dcb18c147150c1126 (diff) |
Add resume command.
PROBLEMS WITH THIS:
We're still loading the suite...and don't record things like --platform?
-rw-r--r-- | framework/database.py | 5 | ||||
-rwxr-xr-x | programs/resume.py | 87 | ||||
-rwxr-xr-x | robyn | 3 | ||||
-rw-r--r-- | suites/__init__.py | 2 |
4 files changed, 96 insertions, 1 deletions
diff --git a/framework/database.py b/framework/database.py index 5cc0950..de8053c 100644 --- a/framework/database.py +++ b/framework/database.py @@ -69,6 +69,11 @@ class ResultDatabase: rs = cursor.execute('SELECT * FROM runs ORDER BY date DESC') return [{'name': r[0], 'date': r[1], 'driver': r[2], 'sysinfo': r[3]} for r in rs] + def mostRecentRun(self): + cursor = self.connection.cursor() + rs = cursor.execute('SELECT name FROM runs ORDER BY date DESC LIMIT 1') + return rs[0][0] + def addPlaceholderResults(self, run, tests): rows = [(run, test) for test in tests] c = self.connection.cursor() diff --git a/programs/resume.py b/programs/resume.py new file mode 100755 index 0000000..1063fe9 --- /dev/null +++ b/programs/resume.py @@ -0,0 +1,87 @@ +#!/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'] + +import argparse +from argparse import ArgumentParser +import os +import os.path as path +import re +import sys + +from framework.database import ResultDatabase +from framework.runner import resume +from framework.filters import filterTests +import suites + +def parseArguments(argv, config): + p = ArgumentParser(prog='robyn resume', description='A GPU test runner') + p.add_argument('-d', '--dry-run', action='store_true', + help='Do not actually run tests, but show what would be performed', + default=False) + p.add_argument('-t', '--tests', action='append', dest='includeFilters', + metavar='<regexp>', + help='Run only matching tests (regular expression)') + p.add_argument('-x', '--exclude', action='append', dest='excludeFilters', + default=[], + metavar='<regexp>', + help='Exclude matching tests (regular expression)') + p.add_argument('-c', '--threads', action='store', type=int, + metavar='<thread count>', + help='Number of tests to run concurrently') + 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))') + p.add_argument('name', nargs='?', metavar='<name of test run>') + + 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] + + # Load the test lists + allTests = suites.loadTestLists(config) + tests = filterTests(allTests, includeFilters, excludeFilters) + + # Connect to the database + db = ResultDatabase(config) + + # "Resume" the new test run + resume(db, config, args, tests, args.name) + +if __name__ == '__main__': + main(sys.argv[1:]) @@ -23,6 +23,7 @@ # import sys import programs.run +import programs.resume import programs.report import programs.listRuns import framework.config @@ -58,6 +59,8 @@ args = sys.argv[2:] if cmd == 'run': programs.run.main(args, config) +elif cmd == 'resume': + programs.resume.main(args, config) elif cmd == 'report': programs.report.main(args, config) elif cmd == 'list-runs': diff --git a/suites/__init__.py b/suites/__init__.py index ec5a42a..47c59d4 100644 --- a/suites/__init__.py +++ b/suites/__init__.py @@ -24,7 +24,7 @@ def loadPlugins(config): return plugins -def loadTestLists(config, desiredSuites): +def loadTestLists(config, desiredSuites = None): '''Generate the necessary test lists! desiredSuites may be None (to load all test suites). |