validate:launcher: Error out if valgrind is not available on the system
authorThibault Saunier <tsaunier@gnome.org>
Fri, 17 Apr 2015 17:56:17 +0000 (19:56 +0200)
committerThibault Saunier <tsaunier@gnome.org>
Fri, 17 Apr 2015 17:58:18 +0000 (19:58 +0200)
Summary:
When the user wants to use valgrind, make sure it is present on the
system before doing anything

Reviewers: gdesmott

Differential Revision: http://phabricator.freedesktop.org/D104

validate/launcher/main.py

index 74a442e..61f47df 100644 (file)
@@ -275,6 +275,14 @@ class LauncherConfig(Loggable):
                 self.testsuites_dir == DEFAULT_TESTSUITES_DIR:
             self.testsuites_dir = os.path.join(self.main_dir, self.clone_dir,
                                                "testsuites")
+        if self.valgrind:
+            try:
+                subprocess.check_output("valgrind --help", shell=True)
+            except subprocess.CalledProcessError:
+                printc("Want to use valgrind, but not avalaible on the system",
+                       Colors.FAIL)
+                return False
+
         return True
 
     def set_http_server_dir(self, path):