summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2012-11-25 14:43:21 -0800
committerKenneth Graunke <kenneth@whitecape.org>2012-11-25 14:43:21 -0800
commit322c7693e224c7eec25a929b575d87709fc183a3 (patch)
treeac3c9ee39e0ed11d9927383e89ed8aba7b555fb7
parent4f6d5a372075cb0462ce0bd6a56a8e1e9dcae8d5 (diff)
WE CAN ACTUALLY RUN TESTS!
-rw-r--r--framework/config.py1
-rw-r--r--framework/process.py3
-rw-r--r--framework/runner.py20
-rw-r--r--framework/test.py7
-rwxr-xr-xprograms/run.py5
5 files changed, 25 insertions, 11 deletions
diff --git a/framework/config.py b/framework/config.py
index f9125b8..c211316 100644
--- a/framework/config.py
+++ b/framework/config.py
@@ -35,6 +35,7 @@ def load():
config.read_dict({'options': {
'platform': 'glx',
'threads': 5,
+ 'timeout': 3.0,
'database': path.join(xdg.save_data_path('robyn'), 'results.db')
}})
diff --git a/framework/process.py b/framework/process.py
index 9bfa836..1986f50 100644
--- a/framework/process.py
+++ b/framework/process.py
@@ -20,10 +20,11 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
+import os
+import subprocess
import sys
import time
from threading import Thread, Timer
-import subprocess
__all__ = ['runProgram']
diff --git a/framework/runner.py b/framework/runner.py
index a8eeebe..e52d73f 100644
--- a/framework/runner.py
+++ b/framework/runner.py
@@ -21,10 +21,20 @@
# IN THE SOFTWARE.
#
-__all__ = ['processQueue']
+from framework.threading import processQueue
+
+__all__ = ['resume']
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)
+ placeholders = db.findPlaceholders(runID)
+
+ timeout = float(config['options']['timeout'])
+ def runTest(data):
+ name, test = data
+
+ result = test.run(timeout)
+ print(name + ':', result['status'])
+
+ todo = [(name, tests[name]) for name in placeholders]
+
+ processQueue(todo, runTest, int(config['options']['threads']))
diff --git a/framework/test.py b/framework/test.py
index cdcb905..2f90c81 100644
--- a/framework/test.py
+++ b/framework/test.py
@@ -34,12 +34,15 @@ class Test:
def __init__(self, command):
self.command = command
- def run(self):
+ def run(self, timeout):
out, err, exitcode, finished = runProgram(self.command, timeout)
return {'out': out, 'err': err, 'exitcode': exitcode,
'status': self.resultStatus(out, err, exitcode, finished)}
+ def interpretResult(self, out, err, exitcode):
+ raise NotImplemented
+
def resultStatus(self, out, err, exitcode, finished):
if not finished:
return 'timeout'
@@ -49,6 +52,6 @@ class Test:
# 0xc0000094 EXCEPTION_INT_DIVIDE_BY_ZERO
return 'crash'
- return self.suite.interpretResult(out)
+ return self.interpretResult(out, err, exitcode)
diff --git a/programs/run.py b/programs/run.py
index 787d37c..67e5722 100755
--- a/programs/run.py
+++ b/programs/run.py
@@ -81,12 +81,11 @@ def main(argv, config):
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, args.suites)
tests = filterTests(allTests, includeFilters, excludeFilters)
- #for test in sorted(tests.keys()):
- # print(test)
-
+ # Connect to the database
db = ResultDatabase(config)
# Create test run in database