[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/1396082 Reviewed-by: Michael Achenbach <machenbach@chromium.org> Commit-Queue: Tamer Tas <tmrts@chromium.org> Cr-Commit-Position: refs/heads/master@{#58593}
This commit is contained in:
parent
3ddd7bb1eb
commit
4eec444957
15
tools/testrunner/local/fake_testsuite/testcfg.py
Normal file
15
tools/testrunner/local/fake_testsuite/testcfg.py
Normal file
@ -0,0 +1,15 @@
|
||||
#!/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 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
# Needed because the test runner contains relative imports.
|
||||
@ -14,25 +15,36 @@ sys.path.append(TOOLS_PATH)
|
||||
|
||||
from testrunner.local.testsuite import TestSuite
|
||||
from testrunner.objects.testcase import TestCase
|
||||
from testrunner.test_config import TestConfig
|
||||
|
||||
|
||||
class TestSuiteTest(unittest.TestCase):
|
||||
def test_fail_ok_outcome(self):
|
||||
suite = TestSuite('foo', 'bar')
|
||||
suite.rules = {
|
||||
'': {
|
||||
'foo/bar': set(['FAIL_OK']),
|
||||
'baz/bar': set(['FAIL']),
|
||||
},
|
||||
}
|
||||
suite.prefix_rules = {}
|
||||
suite.tests = [
|
||||
TestCase(suite, 'foo/bar', 'foo/bar'),
|
||||
TestCase(suite, 'baz/bar', 'baz/bar'),
|
||||
]
|
||||
def setUp(self):
|
||||
test_dir = os.path.dirname(__file__)
|
||||
self.test_root = os.path.join(test_dir, "fake_testsuite")
|
||||
self.test_config = TestConfig(
|
||||
command_prefix=[],
|
||||
extra_flags=[],
|
||||
isolates=False,
|
||||
mode_flags=[],
|
||||
no_harness=False,
|
||||
noi18n=False,
|
||||
random_seed=0,
|
||||
run_skipped=False,
|
||||
shell_dir='fake_testsuite/fake_d8',
|
||||
timeout=10,
|
||||
verbose=False,
|
||||
)
|
||||
|
||||
for t in suite.tests:
|
||||
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__':
|
||||
|
Loading…
Reference in New Issue
Block a user