From aa8879673bb24e7f7af87c1919e44ed03db0c783 Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja.osipov@gmail.com>
Date: Mon, 7 Feb 2011 19:03:03 +0300
Subject: [PATCH] Test-runner: add ability to disable and skip tests

---
 test/box/suite.ini     |  2 ++
 test/lib/test_suite.py | 21 ++++++++++++++-------
 test/test-run.py       |  3 ---
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/test/box/suite.ini b/test/box/suite.ini
index cd1e2c9161..d6c665eeb3 100644
--- a/test/box/suite.ini
+++ b/test/box/suite.ini
@@ -1,3 +1,5 @@
 [default]
 description = tarantool/silverbox, minimal configuration
 config = tarantool.cfg
+# put disabled tests here
+#disabled = sql.test
diff --git a/test/lib/test_suite.py b/test/lib/test_suite.py
index 22d61dbb3b..65e475971c 100644
--- a/test/lib/test_suite.py
+++ b/test/lib/test_suite.py
@@ -82,10 +82,6 @@ class Test:
     exception. The exception is raised only if is_force flag is
     not set."""
 
-    sys.stdout.write(string.ljust(self.name, 31))
-# for better diagnostics in case of a long-running test
-    sys.stdout.flush()
-
     diagnostics = "unknown"
     save_stdout = sys.stdout
     admin = AdminConnection(self.suite_ini["host"],
@@ -213,6 +209,10 @@ class TestSuite:
     config.read(os.path.join(suite_path, "suite.ini"))
     self.ini.update(dict(config.items("default")))
     self.ini["config"] = os.path.join(suite_path, self.ini["config"])
+    if self.ini.has_key("disabled"):
+      self.ini["disabled"] = dict.fromkeys(self.ini["disabled"].split(" "))
+    else:
+      self.ini["disabled"] = dict()
 # import the necessary module for test suite client
 
 # now read the server config, we need some properties from it
@@ -252,9 +252,16 @@ class TestSuite:
     self.ini["server"] = server
 
     for test in self.tests:
-      test.run()
-      if not test.passed():
-        failed_tests.append(test.name)
+      sys.stdout.write(string.ljust(test.name, 31))
+# for better diagnostics in case of a long-running test
+      sys.stdout.flush()
+
+      if os.path.basename(test.name) in self.ini["disabled"]:
+        print "[ skip ]"
+      else:
+        test.run()
+        if not test.passed():
+          failed_tests.append(test.name)
 
     print shortsep
     if len(failed_tests):
diff --git a/test/test-run.py b/test/test-run.py
index 6c82171943..9bb91bbe61 100755
--- a/test/test-run.py
+++ b/test/test-run.py
@@ -32,9 +32,6 @@ from lib.test_suite import TestSuite, TestRunException
 #
 # Run a collection of tests.
 #
-# @todo
-# --gdb
-# put class definitions into separate files
 
 class Options:
   """Handle options of test-runner"""
-- 
GitLab