From f111b897671313f2db83bd8b74b344b55a199eef Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja.osipov@gmail.com>
Date: Fri, 25 Feb 2011 13:19:06 +0300
Subject: [PATCH] test-run.py: return a non-zero exit status on failue

Return a non-zero exit status if there are test
failures, even if run with --force. This necessary to
correctly identify a test failure in buildbot run.
---
 test/lib/test_suite.py | 5 +++++
 test/test-run.py       | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/test/lib/test_suite.py b/test/lib/test_suite.py
index 6608c64d66..6a4bec88eb 100644
--- a/test/lib/test_suite.py
+++ b/test/lib/test_suite.py
@@ -296,4 +296,9 @@ class TestSuite:
     if self.args.valgrind and check_valgrind_log(self.ini["valgrind_log"]):
       print "  Error! There were warnings/errors in valgrind log file:"
       print_tail_n(self.ini["valgrind_log"], 20)
+      return 1
+
+    return len(failed_tests)
+
+
 
diff --git a/test/test-run.py b/test/test-run.py
index 69ecdfaa23..78bd629ede 100755
--- a/test/test-run.py
+++ b/test/test-run.py
@@ -147,6 +147,7 @@ def main():
   # Change the current working directory to where all test
   # collections are supposed to reside.
   os.chdir(os.path.dirname(sys.argv[0]))
+  failed_tests = 0
 
   try:
     print "Started", " ".join(sys.argv)
@@ -155,14 +156,14 @@ def main():
       suites.append(TestSuite(suite_name, options.args))
 
     for suite in suites:
-      suite.run_all()
+      failed_tests = suite.run_all()
   except RuntimeError as e:
     print "\nFatal error: {0}. Execution aborted.".format(e)
     return (-1)
   finally:
     os.chdir(oldcwd)
 
-  return 0
+  return -failed_tests 
 
 if __name__ == "__main__":
   exit(main())
-- 
GitLab