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
...@@ -13,7 +13,6 @@ import time ...@@ -13,7 +13,6 @@ import time
from ..local.android import ( from ..local.android import (
android_driver, CommandFailedException, TimeoutException) android_driver, CommandFailedException, TimeoutException)
from ..local import utils
from ..objects import output from ..objects import output
BASE_DIR = os.path.normpath( BASE_DIR = os.path.normpath(
......
...@@ -3,10 +3,8 @@ ...@@ -3,10 +3,8 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import sys
from testrunner.local import testsuite, statusfile from testrunner.local import testsuite, statusfile
from testrunner.objects.testcase import TestCase
class TestLoader(testsuite.TestLoader): class TestLoader(testsuite.TestLoader):
def _list_test_filenames(self): def _list_test_filenames(self):
...@@ -27,7 +25,7 @@ class TestSuite(testsuite.TestSuite): ...@@ -27,7 +25,7 @@ class TestSuite(testsuite.TestSuite):
return TestLoader return TestLoader
def _test_class(self): def _test_class(self):
return testsuite.TestCase return TestCase
def GetSuite(*args, **kwargs): def GetSuite(*args, **kwargs):
return TestSuite(*args, **kwargs) return TestSuite(*args, **kwargs)
...@@ -7,14 +7,9 @@ from contextlib import contextmanager ...@@ -7,14 +7,9 @@ from contextlib import contextmanager
from multiprocessing import Process, Queue from multiprocessing import Process, Queue
import os import os
import signal import signal
import time
import traceback import traceback
try: from queue import Empty
from queue import Empty # Python 3
except ImportError:
from Queue import Empty # Python 2
from . import command from . import command
from . import utils from . import utils
...@@ -27,11 +22,7 @@ def setup_testing(): ...@@ -27,11 +22,7 @@ def setup_testing():
global Process global Process
del Queue del Queue
del Process del Process
try: from queue import Queue
from queue import Queue # Python 3
except ImportError:
from Queue import Queue # Python 2
from threading import Thread as Process from threading import Thread as Process
# Monkeypatch threading Queue to look like multiprocessing Queue. # Monkeypatch threading Queue to look like multiprocessing Queue.
Queue.cancel_join_thread = lambda self: None Queue.cancel_join_thread = lambda self: None
......
...@@ -83,7 +83,7 @@ class StatusFileTest(unittest.TestCase): ...@@ -83,7 +83,7 @@ class StatusFileTest(unittest.TestCase):
self.assertRaises( self.assertRaises(
SyntaxError, lambda: statusfile._EvalExpression( SyntaxError, lambda: statusfile._EvalExpression(
'system==linux and mode=release', variables)) 'system==linux and mode=release', variables))
self.assertEquals( self.assertEqual(
statusfile.VARIANT_EXPRESSION, statusfile.VARIANT_EXPRESSION,
statusfile._EvalExpression('system==linux and variant==default', statusfile._EvalExpression('system==linux and variant==default',
variables)) variables))
...@@ -92,41 +92,41 @@ class StatusFileTest(unittest.TestCase): ...@@ -92,41 +92,41 @@ class StatusFileTest(unittest.TestCase):
rules, prefix_rules = statusfile.ReadStatusFile( rules, prefix_rules = statusfile.ReadStatusFile(
TEST_STATUS_FILE % 'system==linux', make_variables()) TEST_STATUS_FILE % 'system==linux', make_variables())
self.assertEquals( self.assertEqual(
{ {
'foo/bar': set(['PASS', 'SKIP']), 'foo/bar': set(['PASS', 'SKIP']),
'baz/bar': set(['PASS', 'FAIL', 'SLOW']), 'baz/bar': set(['PASS', 'FAIL', 'SLOW']),
}, },
rules[''], rules[''],
) )
self.assertEquals( self.assertEqual(
{ {
'foo/': set(['SLOW', 'FAIL']), 'foo/': set(['SLOW', 'FAIL']),
}, },
prefix_rules[''], prefix_rules[''],
) )
self.assertEquals({}, rules['default']) self.assertEqual({}, rules['default'])
self.assertEquals({}, prefix_rules['default']) self.assertEqual({}, prefix_rules['default'])
def test_read_statusfile_section_false(self): def test_read_statusfile_section_false(self):
rules, prefix_rules = statusfile.ReadStatusFile( rules, prefix_rules = statusfile.ReadStatusFile(
TEST_STATUS_FILE % 'system==windows', make_variables()) TEST_STATUS_FILE % 'system==windows', make_variables())
self.assertEquals( self.assertEqual(
{ {
'foo/bar': set(['PASS', 'SKIP']), 'foo/bar': set(['PASS', 'SKIP']),
'baz/bar': set(['PASS', 'FAIL']), 'baz/bar': set(['PASS', 'FAIL']),
}, },
rules[''], rules[''],
) )
self.assertEquals( self.assertEqual(
{ {
'foo/': set(['PASS', 'SLOW']), 'foo/': set(['PASS', 'SLOW']),
}, },
prefix_rules[''], prefix_rules[''],
) )
self.assertEquals({}, rules['default']) self.assertEqual({}, rules['default'])
self.assertEquals({}, prefix_rules['default']) self.assertEqual({}, prefix_rules['default'])
def test_read_statusfile_section_variant(self): def test_read_statusfile_section_variant(self):
rules, prefix_rules = statusfile.ReadStatusFile( rules, prefix_rules = statusfile.ReadStatusFile(
...@@ -134,26 +134,26 @@ class StatusFileTest(unittest.TestCase): ...@@ -134,26 +134,26 @@ class StatusFileTest(unittest.TestCase):
make_variables(), make_variables(),
) )
self.assertEquals( self.assertEqual(
{ {
'foo/bar': set(['PASS', 'SKIP']), 'foo/bar': set(['PASS', 'SKIP']),
'baz/bar': set(['PASS', 'FAIL']), 'baz/bar': set(['PASS', 'FAIL']),
}, },
rules[''], rules[''],
) )
self.assertEquals( self.assertEqual(
{ {
'foo/': set(['PASS', 'SLOW']), 'foo/': set(['PASS', 'SLOW']),
}, },
prefix_rules[''], prefix_rules[''],
) )
self.assertEquals( self.assertEqual(
{ {
'baz/bar': set(['PASS', 'SLOW']), 'baz/bar': set(['PASS', 'SLOW']),
}, },
rules['default'], rules['default'],
) )
self.assertEquals( self.assertEqual(
{ {
'foo/': set(['FAIL']), 'foo/': set(['FAIL']),
}, },
......
...@@ -26,16 +26,13 @@ ...@@ -26,16 +26,13 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import fnmatch
import imp import imp
import itertools import itertools
import os import os
from contextlib import contextmanager from contextlib import contextmanager
from . import command
from . import statusfile from . import statusfile
from . import utils from . import utils
from ..objects.testcase import TestCase
from .variants import ALL_VARIANTS, ALL_VARIANT_FLAGS from .variants import ALL_VARIANTS, ALL_VARIANT_FLAGS
......
...@@ -3,10 +3,8 @@ ...@@ -3,10 +3,8 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import itertools
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,8 +12,7 @@ TOOLS_PATH = os.path.dirname( ...@@ -14,8 +12,7 @@ TOOLS_PATH = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(TOOLS_PATH) sys.path.append(TOOLS_PATH)
from testrunner.local.testsuite import TestSuite, TestGenerator from testrunner.local.testsuite import TestSuite
from testrunner.objects.testcase import TestCase
from testrunner.test_config import TestConfig from testrunner.test_config import TestConfig
...@@ -42,8 +39,8 @@ class TestSuiteTest(unittest.TestCase): ...@@ -42,8 +39,8 @@ class TestSuiteTest(unittest.TestCase):
"standard_runner") "standard_runner")
def testLoadingTestSuites(self): def testLoadingTestSuites(self):
self.assertEquals(self.suite.name, "fake_testsuite") self.assertEqual(self.suite.name, "fake_testsuite")
self.assertEquals(self.suite.test_config, self.test_config) self.assertEqual(self.suite.test_config, self.test_config)
# Verify that the components of the TestSuite aren't loaded yet. # Verify that the components of the TestSuite aren't loaded yet.
self.assertIsNone(self.suite.tests) self.assertIsNone(self.suite.tests)
...@@ -56,7 +53,7 @@ class TestSuiteTest(unittest.TestCase): ...@@ -56,7 +53,7 @@ class TestSuiteTest(unittest.TestCase):
return iterator == iter(iterator) return iterator == iter(iterator)
self.assertTrue(is_generator(tests)) 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) slow_tests, fast_tests = list(tests.slow_tests), list(tests.fast_tests)
# Verify that the components of the TestSuite are loaded. # Verify that the components of the TestSuite are loaded.
...@@ -71,14 +68,14 @@ class TestSuiteTest(unittest.TestCase): ...@@ -71,14 +68,14 @@ class TestSuiteTest(unittest.TestCase):
# Merge the test generators # Merge the test generators
tests.merge(more_tests) 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 # Check the tests are sorted by speed
test_speeds = [] test_speeds = []
for test in tests: for test in tests:
test_speeds.append(test.is_slow) 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__': if __name__ == '__main__':
......
...@@ -25,13 +25,11 @@ ...@@ -25,13 +25,11 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # 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 isdir
from os.path import join from os.path import join
import os import os
import platform import platform
import re import re
import urllib
### Exit codes and their meaning. ### Exit codes and their meaning.
......
...@@ -13,13 +13,11 @@ from . import base_runner ...@@ -13,13 +13,11 @@ from . import base_runner
from testrunner.local import utils from testrunner.local import utils
from testrunner.testproc import fuzzer from testrunner.testproc import fuzzer
from testrunner.testproc.base import TestProcProducer
from testrunner.testproc.combiner import CombinerProc from testrunner.testproc.combiner import CombinerProc
from testrunner.testproc.execution import ExecutionProc from testrunner.testproc.execution import ExecutionProc
from testrunner.testproc.expectation import ExpectationProc from testrunner.testproc.expectation import ExpectationProc
from testrunner.testproc.filter import StatusFileFilterProc, NameFilterProc from testrunner.testproc.filter import StatusFileFilterProc, NameFilterProc
from testrunner.testproc.loader import LoadProc from testrunner.testproc.loader import LoadProc
from testrunner.testproc.progress import ResultsTracker
from testrunner.utils import random_utils from testrunner.utils import random_utils
......
...@@ -2,10 +2,8 @@ ...@@ -2,10 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from ..local import statusfile
from ..outproc import base as outproc_base from ..outproc import base as outproc_base
from ..testproc import base as testproc_base from ..testproc import base as testproc_base
from ..testproc.result import Result
# Only check the exit code of the predictable_wrapper in # Only check the exit code of the predictable_wrapper in
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import random
from .utils import random_utils from .utils import random_utils
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from .result import SKIPPED
""" """
Pipeline Pipeline
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
# found in the LICENSE file. # found in the LICENSE file.
from collections import defaultdict from collections import defaultdict
import time
from . import base from . import base
from ..objects import testcase
from ..outproc import base as outproc
class CombinerProc(base.TestProc): class CombinerProc(base.TestProc):
def __init__(self, rng, min_group_size, max_group_size, count): def __init__(self, rng, min_group_size, max_group_size, count):
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
# found in the LICENSE file. # found in the LICENSE file.
import collections import collections
import traceback
from . import base from . import base
from ..local import pool from ..local import pool
......
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
from . import base from . import base
from testrunner.local import statusfile
from testrunner.outproc import base as outproc
class ExpectationProc(base.TestProcProducer): class ExpectationProc(base.TestProcProducer):
"""Test processor passing tests and results through and forgiving timeouts.""" """Test processor passing tests and results through and forgiving timeouts."""
def __init__(self): def __init__(self):
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from collections import namedtuple
import time
from . import base from . import base
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import datetime import datetime
import json import json
import os
import platform import platform
import sys import sys
import time import time
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import random
from collections import defaultdict from collections import defaultdict
from . import base from . import base
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
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.
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
import heapq import heapq
import os import os
import platform import platform
import random
import signal import signal
import subprocess import subprocess
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
# found in the LICENSE file. # found in the LICENSE file.
from . import base from . import base
from ..local.variants import ALL_VARIANTS, ALL_VARIANT_FLAGS
from .result import GroupedResult
STANDARD_VARIANT = set(["default"]) STANDARD_VARIANT = set(["default"])
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
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.
......
...@@ -12,7 +12,6 @@ the string "true". ...@@ -12,7 +12,6 @@ the string "true".
""" """
import json import json
import os
import sys import sys
assert len(sys.argv) > 2 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