From 69a15dd7ba2f7e70daf7b3156719f2323e563767 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Fri, 20 Apr 2012 20:53:42 +0200
Subject: [PATCH] QA: Add default setting for tests

Commit 1010ec70b1 enabled all tests by default. In some scenarios where
the configuration is static one may not want newly added tests to be
run.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
(cherry picked from commit 59a8fe485e107df7fac3bfc85ff38b2bf006ab6c)
---
 qa/qa-sample.json | 3 +++
 qa/qa_config.py   | 9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/qa/qa-sample.json b/qa/qa-sample.json
index d7f4f3ade..5c71ce228 100644
--- a/qa/qa-sample.json
+++ b/qa/qa-sample.json
@@ -51,6 +51,9 @@
   },
 
   "tests": {
+    "# Whether tests are enabled or disabled by default": null,
+    "default": true,
+
     "env": true,
     "os": true,
     "tags": true,
diff --git a/qa/qa_config.py b/qa/qa_config.py
index b4cff14f9..e058a71d8 100644
--- a/qa/qa_config.py
+++ b/qa/qa_config.py
@@ -68,7 +68,14 @@ def TestEnabled(tests):
   """
   if isinstance(tests, basestring):
     tests = [tests]
-  return compat.all(cfg.get("tests", {}).get(t, True) for t in tests)
+
+  # Get settings for all tests
+  all_tests = cfg.get("tests", {})
+
+  # Get default setting
+  default = all_tests.get("default", True)
+
+  return compat.all(all_tests.get(name, default) for name in tests)
 
 
 def GetMasterNode():
-- 
GitLab