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 @@
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'),
]
for t in suite.tests:
self.assertEquals(['FAIL'], t.expected_outcomes)
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,
)
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__':
......
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