Commit 4eec4449 authored by Tamer Tas's avatar Tamer Tas Committed by Commit Bot

[testrunner] add tests for loading TestSuite from disk

- Removed the old test.
- Created a fake test suite and added a test for loading it with a TestConfig

R=machenbach@chromium.org
CC=​​yangguo@chromium.org,sergiyb@chromium.org

Bug: v8:8174
Change-Id: Ib7587ceec9e31ecd4cb8f45c3158e73c79a9bc5b
Reviewed-on: https://chromium-review.googlesource.com/c/1396082Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Tamer Tas <tmrts@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58593}
parent 3ddd7bb1
#!/usr/bin/env python
# Copyright 2019 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
from testrunner.local import testsuite
class TestSuite(testsuite.TestSuite):
pass
def GetSuite(*args, **kwargs):
return TestSuite(*args, **kwargs)
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import os import os
import sys import sys
import tempfile
import unittest import unittest
# Needed because the test runner contains relative imports. # Needed because the test runner contains relative imports.
...@@ -14,25 +15,36 @@ sys.path.append(TOOLS_PATH) ...@@ -14,25 +15,36 @@ sys.path.append(TOOLS_PATH)
from testrunner.local.testsuite import TestSuite from testrunner.local.testsuite import TestSuite
from testrunner.objects.testcase import TestCase from testrunner.objects.testcase import TestCase
from testrunner.test_config import TestConfig
class TestSuiteTest(unittest.TestCase): class TestSuiteTest(unittest.TestCase):
def test_fail_ok_outcome(self): def setUp(self):
suite = TestSuite('foo', 'bar') test_dir = os.path.dirname(__file__)
suite.rules = { self.test_root = os.path.join(test_dir, "fake_testsuite")
'': { self.test_config = TestConfig(
'foo/bar': set(['FAIL_OK']), command_prefix=[],
'baz/bar': set(['FAIL']), extra_flags=[],
}, isolates=False,
} mode_flags=[],
suite.prefix_rules = {} no_harness=False,
suite.tests = [ noi18n=False,
TestCase(suite, 'foo/bar', 'foo/bar'), random_seed=0,
TestCase(suite, 'baz/bar', 'baz/bar'), run_skipped=False,
] shell_dir='fake_testsuite/fake_d8',
timeout=10,
for t in suite.tests: verbose=False,
self.assertEquals(['FAIL'], t.expected_outcomes) )
def testLoadingTestSuite(self):
suite = TestSuite.LoadTestSuite(self.test_root, self.test_config)
self.assertEquals(suite.name, "fake_testsuite")
self.assertEquals(suite.test_config, self.test_config)
# Verify that no tests are loaded yet.
self.assertIsNone(suite.tests)
self.assertIsNone(suite.statusfile)
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment