diff options
-rw-r--r-- | framework/database.py | 5 | ||||
-rw-r--r-- | framework/runner.py | 30 | ||||
-rwxr-xr-x | programs/run.py | 4 |
3 files changed, 38 insertions, 1 deletions
diff --git a/framework/database.py b/framework/database.py index e89a2e7..2404d7d 100644 --- a/framework/database.py +++ b/framework/database.py @@ -66,3 +66,8 @@ class ResultDatabase: c.execute('BEGIN IMMEDIATE TRANSACTION') c.executemany('INSERT INTO results(run_id, test_name) VALUES(?,?)', rows) c.execute('END TRANSACTION') + + def findPlaceholders(self, run): + c = self.connection.cursor() + xs = c.execute('SELECT test_name FROM results WHERE run_id = ? AND result IS NULL', [run]) + return [x[0] for x in xs] diff --git a/framework/runner.py b/framework/runner.py new file mode 100644 index 0000000..a8eeebe --- /dev/null +++ b/framework/runner.py @@ -0,0 +1,30 @@ +# +# 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__ = ['processQueue'] + +def resume(db, config, args, tests, runID): + todo = db.findPlaceholders(runID) + print('Scheduling the following tests to be run:') + for test in todo: + print(test) diff --git a/programs/run.py b/programs/run.py index 69a1ae1..e436847 100755 --- a/programs/run.py +++ b/programs/run.py @@ -32,6 +32,7 @@ import os.path as path import sys from framework.database import ResultDatabase +from framework.runner import resume import suites def parseArguments(argv, config): @@ -84,7 +85,8 @@ def main(argv, config): # Populate results with "not run yet" db.addPlaceholderResults(runID, tests.keys()) - # Resume + # "Resume" the new test run + resume(db, config, args, tests, runID) if __name__ == '__main__': main(sys.argv[1:]) |