diff --git a/testing/tps/tps/cli.py b/testing/tps/tps/cli.py index e6848f07a38b..2b38e6d784d6 100644 --- a/testing/tps/tps/cli.py +++ b/testing/tps/tps/cli.py @@ -71,7 +71,9 @@ def main(): config = json.loads(configcontent) rlock = RLock() - + + print 'using result file', options.resultfile + extensionDir = config.get("extensiondir") if not extensionDir or extensionDir == '__EXTENSIONDIR__': extensionDir = os.path.join(os.getcwd(), "..", "..", "services", "sync", "tps") diff --git a/testing/tps/tps/testrunner.py b/testing/tps/tps/testrunner.py index 3779fdc6babb..6f70d8031a4e 100644 --- a/testing/tps/tps/testrunner.py +++ b/testing/tps/tps/testrunner.py @@ -132,8 +132,16 @@ class TPSTestRunner(object): print msg def writeToResultFile(self, postdata, body=None, - sendTo='crossweave@mozilla.com'): + sendTo=['crossweave@mozilla.com']): """Writes results to test file""" + + results = {'results': []} + + if os.access(self.resultfile, os.F_OK): + f = open(self.resultfile, 'r') + results = json.loads(f.read()) + f.close() + f = open(self.resultfile, 'w') if body is not None: postdata['body'] = body @@ -145,8 +153,7 @@ class TPSTestRunner(object): postdata['firefoxrunnerurl'] = self.firefoxRunner.url postdata['sendTo'] = sendTo - results = {} - results['results'] = postdata + results['results'].append(postdata) f.write(json.dumps(results, indent=2)) f.close() @@ -339,7 +346,13 @@ class TPSTestRunner(object): traceback.print_exc() else: try: - self.writeToResultFile(self.postdata) + + if self.numfailed > 0 or self.numpassed == 0: + To = self.config['email'].get('notificationlist') + else: + To = self.config['email'].get('passednotificationlist') + self.writeToResultFile(self.postdata, + sendTo=To) except: traceback.print_exc() try: