Index: test/cctest/testcfg.py |
diff --git a/test/cctest/testcfg.py b/test/cctest/testcfg.py |
index 532edfc26df37cf157f89be4c279fdedc02645ff..b67002f53acede5f51c49703f5911923b3281394 100644 |
--- a/test/cctest/testcfg.py |
+++ b/test/cctest/testcfg.py |
@@ -25,11 +25,66 @@ |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-import test |
import os |
-from os.path import join, dirname, exists |
-import platform |
-import utils |
+import shutil |
+ |
+from testrunner.local import commands |
+from testrunner.local import testsuite |
+from testrunner.local import utils |
+from testrunner.objects import testcase |
+ |
+ |
+class CcTestSuite(testsuite.TestSuite): |
+ |
+ def __init__(self, name, root): |
+ super(CcTestSuite, self).__init__(name, root) |
+ self.serdes_dir = normpath(join(root, "..", "..", "out", ".serdes")) |
+ if exists(self.serdes_dir): |
+ shutil.rmtree(self.serdes_dir, True) |
+ os.makedirs(self.serdes_dir) |
+ |
+ def ListTests(self, context): |
+ shell = join(context.shell_dir, self.shell()) |
+ if utils.IsWindows(): |
+ shell += '.exe' |
+ output = commands.Execute([shell, '--list']) |
+ if output.exit_code != 0: |
+ print output.stdout |
+ print output.stderr |
+ return [] |
+ tests = [] |
+ for test_desc in output.stdout.strip().split(): |
+ raw_test, dependency = test_desc.split('<') |
+ if dependency != '': |
+ dependency = raw_test.split('/')[0] + '/' + dependency |
+ else: |
+ dependency = None |
+ test = testcase.TestCase(self, raw_test, dependency=dependency) |
+ tests.append(test) |
+ tests.sort() |
+ return tests |
+ |
+ def GetFlagsForTestCase(self, testcase, context): |
+ testname = testcase.path.split(os.path.sep)[-1] |
+ serialization_file = join(self.serdes_dir, "serdes_" + testname) |
+ serialization_file += ''.join(testcase.flags).replace('-', '_') |
+ return (testcase.flags + [testcase.path] + context.mode_flags + |
+ ["--testing_serialization_file=" + serialization_file]) |
+ |
+ def shell(self): |
+ return "cctest" |
+ |
+ |
+def GetSuite(name, root): |
+ return CcTestSuite(name, root) |
+ |
+ |
+# Deprecated definitions below. |
+# TODO(jkummerow): Remove when SCons is no longer supported. |
+ |
+ |
+from os.path import exists, join, normpath |
+import test |
class CcTestCase(test.TestCase): |