framework: Smarter re-compile. Don't run if there are compile errors
Also, only show compile log if there are errors present.
Note: You will have to re-run make setup-in-place to make this work.
+ small style fixes in main.py
BUG=chromium-os:39367
TEST=run touchtests
Change-Id: I64306c94eda5519f11013289391061ae5326f651
Reviewed-on: https://gerrit.chromium.org/gerrit/44298
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@chromium.org>
Tested-by: Dennis Kempin <denniskempin@chromium.org>
diff --git a/framework/src/main.py b/framework/src/main.py
index 79c8071..f3d6dfb 100644
--- a/framework/src/main.py
+++ b/framework/src/main.py
@@ -5,12 +5,11 @@
# This module is the main module for the console interface. It takes care
# of parsing the command line arguments and formating the output
from optparse import OptionParser
-from os import path
+from subprocess import Popen, PIPE, STDOUT
from tempfile import NamedTemporaryFile
import json
import math
import os
-import pprint
import sys
from mtedit.editor import LogEditor
@@ -21,6 +20,7 @@
from test_factory import TestFactory
from test_runner import ParallelTestRunner as TestRunner
+
_help_text = """\
Multitouch Regression Test Suite:
---------------------------------
@@ -75,6 +75,22 @@
$ evemu-describe /path/to/device > platform.dat
"""
+
+def Compile():
+ if "SRC_DIR" not in os.environ:
+ print "Requires SRC_DIR env-var. Re-run $ sudo make setup-in-place"
+ sys.exit(-1)
+
+ dir = os.environ["SRC_DIR"]
+ print "Recompiling gestures/libevdev/replay..."
+ process = Popen(["make", "in-place"], cwd=dir,
+ stdout=PIPE, stderr=STDOUT)
+ ret = process.wait()
+ if ret != 0:
+ print process.stdout.read()
+ sys.exit(-1)
+
+
def Verify(device, glob):
verifier = TestVerifier(os.environ["TESTS_DIR"], device)
runner = TestRunner(os.environ["TESTS_DIR"], os.environ["XORG_CONF_DIR"])
@@ -85,7 +101,9 @@
report = verifier.Verify(case)
print report
+
def Run(glob, out_file=None, ref_file=None):
+ Compile()
print "Running tests..."
runner = TestRunner(os.environ["TESTS_DIR"], os.environ["XORG_CONF_DIR"])
results = runner.RunAll(glob)
@@ -159,7 +177,9 @@
print "\x1b[91mThere are regressions present in this test run!\x1b[0m"
exit(-1)
+
def Get(test_name, what, file=None):
+ Compile()
if file:
data = json.load(open(file))
results = data[test_name]
@@ -181,6 +201,7 @@
elif what == "return-activity":
return results["logs"]["activity"]
+
def Add(testname, activity_log, event_log):
"""
Adds a new test case.
@@ -191,6 +212,7 @@
if case:
print "Test \"" + case.name + "\" created"
+
def Main():
"""
Main entry point for the console interface
@@ -292,5 +314,6 @@
else:
Run(test_name, options.out, options.ref)
+
if __name__ == "__main__":
Main()