Show desktop notifications when tests complete.
Bug:
Change-Id: Ide0d8100c96af5190b8041d69794e4ffd1b88003
diff --git a/tools/notify.py b/tools/notify.py
new file mode 100644
index 0000000..f7ae50e
--- /dev/null
+++ b/tools/notify.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+try:
+ import gi
+ from gi.repository import Notify
+ Notify.init("R8 build tools")
+
+ def notify(message):
+ try:
+ Notify.Notification.new("R8 build tools", message).show()
+ except:
+ return
+
+except ImportError:
+ def notify(message):
+ return
diff --git a/tools/test.py b/tools/test.py
index b0255cb..2b68c88 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -14,6 +14,7 @@
import sys
import utils
import uuid
+import notify
ALL_ART_VMS = ["default", "7.0.0", "6.0.1", "5.1.1"]
BUCKET = 'r8-test-results'
@@ -149,4 +150,9 @@
return return_code
if __name__ == '__main__':
- sys.exit(Main())
+ return_code = Main()
+ if return_code != 0:
+ notify.notify("Tests failed.")
+ else:
+ notify.notify("Tests passed.")
+ sys.exit(return_code)