From 3768bcaced32f848a4db6de57e65a8f7581f9722 Mon Sep 17 00:00:00 2001
From: Eugine Blikh <bigbes@gmail.com>
Date: Wed, 26 Jun 2013 19:03:06 +0400
Subject: [PATCH] Fix bugs: 1) Temporary result files weren't deleted, if
 test's skipcond failed. 2) Vardir is removed when tests started. 3) Sort
 tests and test-suites by name 4) Added cleanup to box/lua.test

---
 test/box/lua.test            |  1 +
 test/lib/tarantool_server.py |  2 +-
 test/lib/test_suite.py       |  3 ++-
 test/test-run.py             | 14 ++++++++++----
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/test/box/lua.test b/test/box/lua.test
index ecfe136e51..c5f711ff0c 100644
--- a/test/box/lua.test
+++ b/test/box/lua.test
@@ -681,3 +681,4 @@ exec admin  "lua box.tuple.new({false})"
 exec admin "lua t = box.tuple.new('abc')"
 exec admin "lua t"
 exec admin "lua t:bsize()"
+exec admin silent "lua box.delete(0, 8989)"
diff --git a/test/lib/tarantool_server.py b/test/lib/tarantool_server.py
index e7d28d8a2e..5ae0eb9f10 100644
--- a/test/lib/tarantool_server.py
+++ b/test/lib/tarantool_server.py
@@ -118,7 +118,7 @@ class TarantoolServer(Server):
             self.memcached = MemcachedConnection('localhost', self.memcached_port)
 
     def find_tests(self, test_suite, suite_path):
-        for test_name in glob.glob(os.path.join(suite_path, "*.test")):
+        for test_name in sorted(glob.glob(os.path.join(suite_path, "*.test"))):
             for test_pattern in test_suite.args.tests:
                 if test_name.find(test_pattern) != -1:
                     test_suite.tests.append(FuncTest(test_name, test_suite.args, test_suite.ini))
diff --git a/test/lib/test_suite.py b/test/lib/test_suite.py
index 3fd86625cc..768086630d 100644
--- a/test/lib/test_suite.py
+++ b/test/lib/test_suite.py
@@ -126,7 +126,8 @@ class Test:
 
         if self.skip:
             print "[ skip ]"
-
+            if os.path.exists(self.tmp_result):
+                os.remove(self.tmp_result)
         elif self.is_executed_ok and self.is_equal_result and self.is_valgrind_clean:
             print "[ pass ]"
             if os.path.exists(self.tmp_result):
diff --git a/test/test-run.py b/test/test-run.py
index d00255fa03..4e971867aa 100755
--- a/test/test-run.py
+++ b/test/test-run.py
@@ -24,12 +24,14 @@ __author__ = "Konstantin Osipov <kostja.osipov@gmail.com>"
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 
-import argparse
-import os.path
 import os
-import time
 import sys
+import time
 import string
+import shutil
+import os.path
+import argparse
+
 from lib.test_suite import TestSuite
 
 #
@@ -148,6 +150,9 @@ def setenv():
 #######################################################################
 # Program body
 #######################################################################
+def purge(vardir):
+    if os.path.exists(vardir):
+        shutil.rmtree(vardir)
 
 def main():
     setenv()
@@ -166,6 +171,7 @@ def main():
 
     try:
         print "Started", " ".join(sys.argv)
+        purge(options.args.vardir)
         suite_names = []
         if options.args.suites != []:
             suite_names = options.args.suites
@@ -174,7 +180,7 @@ def main():
                 if "suite.ini" in names:
                     suite_names.append(os.path.basename(root))
 
-        suites = [TestSuite(suite_name, options.args) for suite_name in suite_names]
+        suites = [TestSuite(suite_name, options.args) for suite_name in sorted(suite_names)]
         
         for suite in suites:
             failed_tests += suite.run_all()
-- 
GitLab