def configuration_options(): return [ optparse.make_option( "-t", "--target", default=config.Config( executive.Executive(), filesystem.FileSystem()).default_configuration(), dest="configuration", help="(DEPRECATED) (default: %default)"), optparse.make_option('--debug', action='store_const', const='Debug', dest="configuration", help='Set the configuration to Debug'), optparse.make_option('--release', action='store_const', const='Release', dest="configuration", help='Set the configuration to Release'), optparse.make_option( '--64-bit', action='store_const', const='x86_64', default=None, dest="architecture", help='use 64-bit binaries by default (x86_64 instead of x86)'), optparse.make_option( '--32-bit', action='store_const', const='x86', default=None, dest="architecture", help='use 32-bit binaries by default (x86 instead of x86_64)'), ]
def __init__(self): self.executive = executive.Executive() self.filesystem = filesystem.FileSystem() self.user = user.User() self.platform = platforminfo.PlatformInfo(sys, platform, self.executive) self.workspace = workspace.Workspace(self.filesystem, self.executive)
def mock_run_command(arg_list): # Set this to True to test actual output (where possible). integration_test = False if integration_test: return executive.Executive().run_command(arg_list) if 'webkit-build-directory' in arg_list[1]: return mock_webkit_build_directory(arg_list[2:]) return 'Error'
def test_webkit_base_dir(self): # FIXME: We use a real filesystem here. Should this move to a # mocked one? c = config.Config(executive.Executive(), filesystem.FileSystem()) base_dir = c.webkit_base_dir() self.assertTrue(base_dir) self.assertNotEqual(base_dir[-1], '/') orig_cwd = os.getcwd() if sys.platform == 'win32': os.chdir(os.environ['USERPROFILE']) else: os.chdir(os.environ['HOME']) c = config.Config(executive.Executive(), filesystem.FileSystem()) try: base_dir_2 = c.webkit_base_dir() self.assertEqual(base_dir, base_dir_2) finally: os.chdir(orig_cwd)
def __init__(self): self.executable = sys.executable self.executive = executive.Executive() self.filesystem = filesystem.FileSystem() self.user = user.User() self.platform = platforminfo.PlatformInfo(sys, platform, self.executive) self.workspace = workspace.Workspace(self.filesystem, self.executive) self.stdin = sys.stdin self.stdout = sys.stdout self.stderr = sys.stderr
def configuration_options(): return [ optparse.make_option( "-t", "--target", default=config.Config( executive.Executive(), filesystem.FileSystem()).default_configuration(), dest="configuration", help="(DEPRECATED) (default: %default)"), optparse.make_option('--debug', action='store_const', const='Debug', dest="configuration", help='Set the configuration to Debug'), optparse.make_option('--release', action='store_const', const='Release', dest="configuration", help='Set the configuration to Release'), optparse.make_option( '--64-bit', action='store_const', const='x86_64', default=None, dest="architecture", help='use 64-bit binaries by default (x86_64 instead of x86)'), optparse.make_option( '--32-bit', action='store_const', const='x86', default=None, dest="architecture", help='use 32-bit binaries by default (x86 instead of x86_64)'), optparse.make_option('--arm', action='store_const', const='arm64e', default=None, dest="architecture", help='Use arm64e binaries by default'), optparse.make_option( '--architecture', action='store', default=None, dest="architecture", help='Use binaries of the specified architecture by default.'), # FIXME https://bugs.webkit.org/213677: This should effect the models used by simulator ports optparse.make_option('--model', action='store', default=None, dest="model", help='Override the model details on upload.'), ]
def main(argv=None): if not argv: argv = sys.argv if len(argv) == 3 and argv[1] == '--mock': e = executive_mock.MockExecutive2(output='foo\nfoo/%s' % argv[2]) fs = filesystem_mock.MockFileSystem({'foo/Configuration': argv[2]}) else: e = executive.Executive() fs = filesystem.FileSystem() c = config.Config(e, fs) print(c.default_configuration())
def __init__(self, reset_results, verbose, provider): self.reset_results = reset_results self.verbose = verbose self.executive = executive.Executive() self.provider = provider self.idl_compiler = None _, self.interfaces_info_filename = provider.new_temp_file() # Generate output into the reference directory if resetting results, or # a temp directory if not. if reset_results: self.output_directory = reference_directory else: self.output_directory = provider.new_temp_dir()
def __init__(self): self.bugs = bugzilla.Bugzilla() self.buildbot = buildbot.BuildBot() self.executive = executive.Executive() self._irc = None self.filesystem = filesystem.FileSystem() self.workspace = workspace.Workspace(self.filesystem, self.executive) self._port = None self.user = user.User() self._scm = None self._checkout = None self.status_server = statusserver.StatusServer() self.port_factory = port.factory self.platform = platforminfo.PlatformInfo()
def __init__(self): self.bugs = bugzilla.Bugzilla() self.buildbot = buildbot.BuildBot() self.executive = executive.Executive() self.web = web.Web() self._irc = None self.filesystem = filesystem.FileSystem() self.workspace = workspace.Workspace(self.filesystem, self.executive) self._port = None self.user = user.User() self._scm = None self._checkout = None self.status_server = statusserver.StatusServer() # FIXME: Unfortunately Port objects are currently the central-dispatch objects of the NRWT world. # In order to instantiate a port correctly, we have to pass it at least an executive, user, scm, and filesystem # so for now we just pass along the whole Host object. self.port_factory = PortFactory(self) self.platform = platforminfo.PlatformInfo()
def test_default_configuration__standalone(self): # FIXME: This test runs a standalone python script to test # reading the default configuration to work around any possible # caching / reset bugs. See https://bugs.webkit.org/show_bug?id=49360 # for the motivation. We can remove this test when we remove the # global configuration cache in config.py. e = executive.Executive() fs = filesystem.FileSystem() c = config.Config(e, fs) script = c.path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'layout_tests', 'port', 'config_standalone.py') # Note: don't use 'Release' here, since that's the normal default. expected = 'Debug' args = [sys.executable, script, '--mock', expected] actual = e.run_command(args).rstrip() self.assertEqual(actual, expected)
def cluster_file_hashes(glob_pattern): """Get the hashes of all the test expectations in the tree. We cheat and use git's hashes. Args: glob_pattern: a pattern to filter the files. Returns: A dictionary mapping (test name, hash of content) => [paths] """ # A map of file hash => set of all files with that hash. hashes = collections.defaultdict(set) # Fill in the map. cmd = ('git', 'ls-tree', '-r', 'HEAD', 'LayoutTests') try: git_output = executive.Executive().run_command(cmd) except OSError, e: if e.errno == 2: # No such file or directory. _log.error("Error: 'No such file' when running git.") _log.error("This script requires git.") sys.exit(1) raise e
def test_as_command(self): output = executive.Executive().run_command( echo.command_arguments('foo', 'bar', 'baz')) self.assertEqual(output, 'foo bar baz\n')
def __init__(self): self._executive = executive.Executive() self._filesystem = filesystem.FileSystem()
def test_as_command(self): input = 'foo bar baz\n' output = executive.Executive().run_command(cat.command_arguments(), input=input) self.assertEqual(input, output)
def test_path_from_webkit_base(self): # FIXME: We use a real filesystem here. Should this move to a # mocked one? c = config.Config(executive.Executive(), filesystem.FileSystem()) self.assertTrue(c.path_from_webkit_base('foo'))