Commit 49d89bd7 authored by phajdan.jr's avatar phajdan.jr Committed by Commit bot

Remove unused code from infra/scripts/legacy

BUG=506498

Review URL: https://codereview.chromium.org/1276233002

Cr-Commit-Position: refs/heads/master@{#342354}
parent b483c2b4
......@@ -33,20 +33,6 @@ def AreNinjaFilesNewerThanXcodeFiles(src_dir=None):
return IsFileNewerThanFile(ninja_path, xcode_path)
def AreNinjaFilesNewerThanMSVSFiles(src_dir=None):
"""Returns True if the generated ninja files are newer than the generated
msvs files.
Parameters:
src_dir: The path to the src directory. If None, it's assumed to be
at src/ relative to the current working directory.
"""
src_dir = src_dir or 'src'
ninja_path = os.path.join(src_dir, 'out', 'Release', 'build.ninja')
msvs_path = os.path.join(src_dir, 'build', 'all.sln')
return IsFileNewerThanFile(ninja_path, msvs_path)
def GetBuildOutputDirectory(src_dir=None, cros_board=None):
"""Returns the path to the build directory, relative to the checkout root.
......@@ -71,41 +57,6 @@ def GetBuildOutputDirectory(src_dir=None, cros_board=None):
return os.path.join(src_dir, 'xcodebuild')
if sys.platform == 'cygwin' or sys.platform.startswith('win'):
if AreNinjaFilesNewerThanMSVSFiles(src_dir):
return os.path.join(src_dir, 'out')
return os.path.join(src_dir, 'build')
raise NotImplementedError('Unexpected platform %s' % sys.platform)
def RmtreeExceptNinjaOrGomaFiles(build_output_dir):
"""Recursively removes everything but ninja files from a build directory."""
for root, _, files in os.walk(build_output_dir, topdown=False):
for f in files:
# For .manifest in particular, gyp windows ninja generates manifest
# files at generation time but clobber nukes at the beginning of
# compile, so make sure not to delete those generated files, otherwise
# compile will fail.
if (f.endswith('.ninja') or f.endswith('.manifest') or
f == 'args.gn' or
f.startswith('msvc') or # VS runtime DLLs.
f.startswith('pgort') or # VS PGO runtime DLL.
f in ('gyp-mac-tool', 'gyp-win-tool',
'environment.x86', 'environment.x64')):
continue
# Keep goma related files.
if f == '.goma_deps':
continue
os.unlink(os.path.join(root, f))
# Delete the directory if empty; this works because the walk is bottom-up.
try:
os.rmdir(root)
except OSError, e:
if e.errno in (39, 41, 66):
# If the directory isn't empty, ignore it.
# On Windows, os.rmdir will raise WindowsError with winerror 145,
# which e.errno is 41.
# On Linux, e.errno is 39.
pass
else:
raise
......@@ -4,13 +4,9 @@
# found in the LICENSE file.
import logging
import optparse
import os
import re
import sys
from common import gtest_utils
from xml.dom import minidom
from slave.gtest.json_results_generator import JSONResultsGenerator
from slave.gtest.test_result import canonical_name
from slave.gtest.test_result import TestResult
......@@ -44,38 +40,6 @@ def GetResultsMap(observer):
return test_results_map
def GetResultsMapFromXML(results_xml):
"""Parse the given results XML file and returns a map of TestResults."""
results_xml_file = None
try:
results_xml_file = open(results_xml)
except IOError:
logging.error('Cannot open file %s', results_xml)
return dict()
node = minidom.parse(results_xml_file).documentElement
results_xml_file.close()
test_results_map = dict()
testcases = node.getElementsByTagName('testcase')
for testcase in testcases:
name = testcase.getAttribute('name')
classname = testcase.getAttribute('classname')
test_name = '%s.%s' % (classname, name)
failures = testcase.getElementsByTagName('failure')
not_run = testcase.getAttribute('status') == 'notrun'
elapsed = float(testcase.getAttribute('time'))
result = TestResult(test_name,
failed=bool(failures),
not_run=not_run,
elapsed_time=elapsed)
test_results_map[canonical_name(test_name)] = [result]
return test_results_map
def GenerateJSONResults(test_results_map, options):
"""Generates a JSON results file from the given test_results_map,
returning the associated generator for use with UploadJSONResults, below.
......@@ -137,72 +101,3 @@ def UploadJSONResults(generator):
if generator:
generator.upload_json_files([FULL_RESULTS_FILENAME,
TIMES_MS_FILENAME])
# For command-line testing.
def main():
# Builder base URL where we have the archived test results.
# (Note: to be deprecated)
BUILDER_BASE_URL = 'http://build.chromium.org/buildbot/gtest_results/'
option_parser = optparse.OptionParser()
option_parser.add_option('', '--test-type', default='',
help='Test type that generated the results XML,'
' e.g. unit-tests.')
option_parser.add_option('', '--results-directory', default='./',
help='Output results directory source dir.')
option_parser.add_option('', '--input-results-xml', default='',
help='Test results xml file (input for us).'
' default is TEST_TYPE.xml')
option_parser.add_option('', '--builder-base-url', default='',
help=('A URL where we have the archived test '
'results. (default=%sTEST_TYPE_results/)'
% BUILDER_BASE_URL))
option_parser.add_option('', '--builder-name',
default='DUMMY_BUILDER_NAME',
help='The name of the builder shown on the '
'waterfall running this script e.g. WebKit.')
option_parser.add_option('', '--build-name',
default='DUMMY_BUILD_NAME',
help='The name of the builder used in its path, '
'e.g. webkit-rel.')
option_parser.add_option('', '--build-number', default='',
help='The build number of the builder running'
'this script.')
option_parser.add_option('', '--test-results-server',
default='',
help='The test results server to upload the '
'results.')
option_parser.add_option('--master-name', default='',
help='The name of the buildbot master. '
'Both test-results-server and master-name '
'need to be specified to upload the results '
'to the server.')
option_parser.add_option('--webkit-revision', default='0',
help='The WebKit revision being tested. If not '
'given, defaults to 0.')
option_parser.add_option('--chrome-revision', default='0',
help='The Chromium revision being tested. If not '
'given, defaults to 0.')
options = option_parser.parse_args()[0]
if not options.test_type:
logging.error('--test-type needs to be specified.')
sys.exit(1)
if not options.input_results_xml:
logging.error('--input-results-xml needs to be specified.')
sys.exit(1)
if options.test_results_server and not options.master_name:
logging.warn('--test-results-server is given but '
'--master-name is not specified; the results won\'t be '
'uploaded to the server.')
results_map = GetResultsMapFromXML(options.input_results_xml)
generator = GenerateJSONResults(results_map, options)
UploadJSONResults(generator)
if '__main__' == __name__:
main()
......@@ -11,22 +11,14 @@ build directory, e.g. chrome-release/build/.
For a list of command-line options, call this script with '--help'.
"""
import ast
import copy
import datetime
import exceptions
import gzip
import hashlib
import json
import logging
import optparse
import os
import platform
import re
import stat
import subprocess
import sys
import tempfile
from common import chromium_utils
from common import gtest_utils
......
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