Commit 7aca2b8f authored by Liviu Rau's avatar Liviu Rau Committed by V8 LUCI CQ

[test] Cleanup

Unused imports and some deprecation related updates.

Bug: v8:12785
Change-Id: Ia3998a75f0c3b83eef4134741c1bda5f3d49c6f4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3678840Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Liviu Rau <liviurau@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80883}
parent 9d12255c
......@@ -676,22 +676,22 @@ class BaseTestRunner(object):
# Set no_simd_hardware on architectures without Simd enabled.
if self.build_config.arch == 'mips64el' or \
self.build_config.arch == 'mipsel':
no_simd_hardware = not simd_mips
no_simd_hardware = not simd_mips
if self.build_config.arch == 'loong64':
no_simd_hardware = True
no_simd_hardware = True
# S390 hosts without VEF1 do not support Simd.
if self.build_config.arch == 's390x' and \
not self.build_config.simulator_run and \
not utils.IsS390SimdSupported():
no_simd_hardware = True
no_simd_hardware = True
# Ppc64 processors earlier than POWER9 do not support Simd instructions
if self.build_config.arch == 'ppc64' and \
not self.build_config.simulator_run and \
utils.GuessPowerProcessorVersion() < 9:
no_simd_hardware = True
no_simd_hardware = True
return {
"arch": self.build_config.arch,
......
......@@ -13,7 +13,6 @@ import time
from ..local.android import (
android_driver, CommandFailedException, TimeoutException)
from ..local import utils
from ..objects import output
BASE_DIR = os.path.normpath(
......
......@@ -3,10 +3,8 @@
# 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, statusfile
from testrunner.objects.testcase import TestCase
class TestLoader(testsuite.TestLoader):
def _list_test_filenames(self):
......@@ -27,7 +25,7 @@ class TestSuite(testsuite.TestSuite):
return TestLoader
def _test_class(self):
return testsuite.TestCase
return TestCase
def GetSuite(*args, **kwargs):
return TestSuite(*args, **kwargs)
......@@ -7,14 +7,9 @@ from contextlib import contextmanager
from multiprocessing import Process, Queue
import os
import signal
import time
import traceback
try:
from queue import Empty # Python 3
except ImportError:
from Queue import Empty # Python 2
from queue import Empty
from . import command
from . import utils
......@@ -27,11 +22,7 @@ def setup_testing():
global Process
del Queue
del Process
try:
from queue import Queue # Python 3
except ImportError:
from Queue import Queue # Python 2
from queue import Queue
from threading import Thread as Process
# Monkeypatch threading Queue to look like multiprocessing Queue.
Queue.cancel_join_thread = lambda self: None
......
......@@ -83,7 +83,7 @@ class StatusFileTest(unittest.TestCase):
self.assertRaises(
SyntaxError, lambda: statusfile._EvalExpression(
'system==linux and mode=release', variables))
self.assertEquals(
self.assertEqual(
statusfile.VARIANT_EXPRESSION,
statusfile._EvalExpression('system==linux and variant==default',
variables))
......@@ -92,41 +92,41 @@ class StatusFileTest(unittest.TestCase):
rules, prefix_rules = statusfile.ReadStatusFile(
TEST_STATUS_FILE % 'system==linux', make_variables())
self.assertEquals(
self.assertEqual(
{
'foo/bar': set(['PASS', 'SKIP']),
'baz/bar': set(['PASS', 'FAIL', 'SLOW']),
},
rules[''],
)
self.assertEquals(
self.assertEqual(
{
'foo/': set(['SLOW', 'FAIL']),
},
prefix_rules[''],
)
self.assertEquals({}, rules['default'])
self.assertEquals({}, prefix_rules['default'])
self.assertEqual({}, rules['default'])
self.assertEqual({}, prefix_rules['default'])
def test_read_statusfile_section_false(self):
rules, prefix_rules = statusfile.ReadStatusFile(
TEST_STATUS_FILE % 'system==windows', make_variables())
self.assertEquals(
self.assertEqual(
{
'foo/bar': set(['PASS', 'SKIP']),
'baz/bar': set(['PASS', 'FAIL']),
},
rules[''],
)
self.assertEquals(
self.assertEqual(
{
'foo/': set(['PASS', 'SLOW']),
},
prefix_rules[''],
)
self.assertEquals({}, rules['default'])
self.assertEquals({}, prefix_rules['default'])
self.assertEqual({}, rules['default'])
self.assertEqual({}, prefix_rules['default'])
def test_read_statusfile_section_variant(self):
rules, prefix_rules = statusfile.ReadStatusFile(
......@@ -134,26 +134,26 @@ class StatusFileTest(unittest.TestCase):
make_variables(),
)
self.assertEquals(
self.assertEqual(
{
'foo/bar': set(['PASS', 'SKIP']),
'baz/bar': set(['PASS', 'FAIL']),
},
rules[''],
)
self.assertEquals(
self.assertEqual(
{
'foo/': set(['PASS', 'SLOW']),
},
prefix_rules[''],
)
self.assertEquals(
self.assertEqual(
{
'baz/bar': set(['PASS', 'SLOW']),
},
rules['default'],
)
self.assertEquals(
self.assertEqual(
{
'foo/': set(['FAIL']),
},
......
......@@ -26,16 +26,13 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import fnmatch
import imp
import itertools
import os
from contextlib import contextmanager
from . import command
from . import statusfile
from . import utils
from ..objects.testcase import TestCase
from .variants import ALL_VARIANTS, ALL_VARIANT_FLAGS
......
......@@ -3,10 +3,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import itertools
import os
import sys
import tempfile
import unittest
# Needed because the test runner contains relative imports.
......@@ -14,8 +12,7 @@ TOOLS_PATH = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(TOOLS_PATH)
from testrunner.local.testsuite import TestSuite, TestGenerator
from testrunner.objects.testcase import TestCase
from testrunner.local.testsuite import TestSuite
from testrunner.test_config import TestConfig
......@@ -42,8 +39,8 @@ class TestSuiteTest(unittest.TestCase):
"standard_runner")
def testLoadingTestSuites(self):
self.assertEquals(self.suite.name, "fake_testsuite")
self.assertEquals(self.suite.test_config, self.test_config)
self.assertEqual(self.suite.name, "fake_testsuite")
self.assertEqual(self.suite.test_config, self.test_config)
# Verify that the components of the TestSuite aren't loaded yet.
self.assertIsNone(self.suite.tests)
......@@ -56,7 +53,7 @@ class TestSuiteTest(unittest.TestCase):
return iterator == iter(iterator)
self.assertTrue(is_generator(tests))
self.assertEquals(tests.test_count_estimate, 2)
self.assertEqual(tests.test_count_estimate, 2)
slow_tests, fast_tests = list(tests.slow_tests), list(tests.fast_tests)
# Verify that the components of the TestSuite are loaded.
......@@ -71,14 +68,14 @@ class TestSuiteTest(unittest.TestCase):
# Merge the test generators
tests.merge(more_tests)
self.assertEquals(tests.test_count_estimate, 4)
self.assertEqual(tests.test_count_estimate, 4)
# Check the tests are sorted by speed
test_speeds = []
for test in tests:
test_speeds.append(test.is_slow)
self.assertEquals(test_speeds, [True, True, False, False])
self.assertEqual(test_speeds, [True, True, False, False])
if __name__ == '__main__':
......
......@@ -25,13 +25,11 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from os.path import exists
from os.path import isdir
from os.path import join
import os
import platform
import re
import urllib
### Exit codes and their meaning.
......
......@@ -13,13 +13,11 @@ from . import base_runner
from testrunner.local import utils
from testrunner.testproc import fuzzer
from testrunner.testproc.base import TestProcProducer
from testrunner.testproc.combiner import CombinerProc
from testrunner.testproc.execution import ExecutionProc
from testrunner.testproc.expectation import ExpectationProc
from testrunner.testproc.filter import StatusFileFilterProc, NameFilterProc
from testrunner.testproc.loader import LoadProc
from testrunner.testproc.progress import ResultsTracker
from testrunner.utils import random_utils
......
......@@ -2,10 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from ..local import statusfile
from ..outproc import base as outproc_base
from ..testproc import base as testproc_base
from ..testproc.result import Result
# Only check the exit code of the predictable_wrapper in
......
......@@ -2,8 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import random
from .utils import random_utils
......
......@@ -2,8 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from .result import SKIPPED
"""
Pipeline
......
......@@ -3,11 +3,8 @@
# found in the LICENSE file.
from collections import defaultdict
import time
from . import base
from ..objects import testcase
from ..outproc import base as outproc
class CombinerProc(base.TestProc):
def __init__(self, rng, min_group_size, max_group_size, count):
......
......@@ -3,7 +3,6 @@
# found in the LICENSE file.
import collections
import traceback
from . import base
from ..local import pool
......
......@@ -4,9 +4,6 @@
from . import base
from testrunner.local import statusfile
from testrunner.outproc import base as outproc
class ExpectationProc(base.TestProcProducer):
"""Test processor passing tests and results through and forgiving timeouts."""
def __init__(self):
......
......@@ -2,8 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from collections import namedtuple
import time
from . import base
......
......@@ -4,7 +4,6 @@
import datetime
import json
import os
import platform
import sys
import time
......
......@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import random
from collections import defaultdict
from . import base
......
......@@ -5,7 +5,6 @@
import os
import sys
import tempfile
import unittest
# Needed because the test runner contains relative imports.
......
......@@ -6,7 +6,6 @@
import heapq
import os
import platform
import random
import signal
import subprocess
......
......@@ -3,8 +3,6 @@
# found in the LICENSE file.
from . import base
from ..local.variants import ALL_VARIANTS, ALL_VARIANT_FLAGS
from .result import GroupedResult
STANDARD_VARIANT = set(["default"])
......
......@@ -5,7 +5,6 @@
import os
import sys
import tempfile
import unittest
# Needed because the test runner contains relative imports.
......
......@@ -12,7 +12,6 @@ the string "true".
"""
import json
import os
import sys
assert len(sys.argv) > 2
......
# Copyright 2017 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.
"""The same as dump_build_config.py but for gyp legacy.
Expected to be called like:
dump_build_config.py path/to/file.json [key1=value1 ...]
Raw gyp values are supported - they will be tranformed into valid json.
"""
# TODO(machenbach): Remove this when gyp is deprecated.
import json
import os
import sys
assert len(sys.argv) > 2
GYP_GN_CONVERSION = {
'is_component_build': {
'shared_library': 'true',
'static_library': 'false',
},
'is_debug': {
'Debug': 'true',
'Release': 'false',
},
}
DEFAULT_CONVERSION ={
'0': 'false',
'1': 'true',
'ia32': 'x86',
}
def gyp_to_gn(key, value):
value = GYP_GN_CONVERSION.get(key, DEFAULT_CONVERSION).get(value, value)
value = value if value in ['true', 'false'] else '"{0}"'.format(value)
return value
def as_json(kv):
assert '=' in kv
k, v = kv.split('=', 1)
v2 = gyp_to_gn(k, v)
try:
return k, json.loads(v2)
except ValueError as e:
print((k, v, v2))
raise e
with open(sys.argv[1], 'w') as f:
json.dump(dict(map(as_json, sys.argv[2:])), f)
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