Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: mojo/tools/mopy/paths.py

Issue 1384243002: Adds the ability to run pure Go unit tests in the Mojo test suite. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebasing Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/tools/mopy/invoke_go.py ('k') | mojo/tools/run_pure_go_tests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os 5 import os
6 6
7 from .config import Config 7 from .config import Config
8 from .gn import BuildDirectoryForConfig 8 from .gn import BuildDirectoryForConfig
9 9
10 class Paths(object): 10 class Paths(object):
11 """Provides commonly used paths""" 11 """Provides commonly used paths"""
12 12
13 def __init__(self, config=None, build_dir=None): 13 def __init__(self, config=None, build_dir=None):
14 """Specify either a config or a build_dir to generate paths to binary 14 """Specify either a config or a build_dir to generate paths to binary
15 artifacts.""" 15 artifacts."""
16 self.src_root = os.path.abspath(os.path.join(__file__, 16 self.src_root = os.path.abspath(os.path.join(__file__,
17 os.pardir, os.pardir, os.pardir, os.pardir)) 17 os.pardir, os.pardir, os.pardir, os.pardir))
18 self.mojo_dir = os.path.join(self.src_root, "mojo") 18 self.mojo_dir = os.path.join(self.src_root, "mojo")
19 self.adb_path = os.path.join(self.src_root, 'third_party', 'android_tools', 19 self.adb_path = os.path.join(self.src_root, 'third_party', 'android_tools',
20 'sdk', 'platform-tools', 'adb') 20 'sdk', 'platform-tools', 'adb')
21 21
22 self.go_tool_path = None
23 if config:
24 if (config.target_os == Config.OS_LINUX and
25 config.target_cpu == Config.ARCH_X64):
26 self.go_tool_path = os.path.join(self.src_root, "third_party",
27 "go", "tool", "linux_amd64", "bin", "go")
28 elif config.target_os == Config.OS_ANDROID:
29 self.go_tool_path = os.path.join(self.src_root, "third_party",
30 "go", "tool", "android_arm", "bin", "go")
31
22 if config: 32 if config:
23 self.build_dir = BuildDirectoryForConfig(config, self.src_root) 33 self.build_dir = BuildDirectoryForConfig(config, self.src_root)
24 elif build_dir is not None: 34 elif build_dir is not None:
25 self.build_dir = os.path.abspath(build_dir) 35 self.build_dir = os.path.abspath(build_dir)
26 else: 36 else:
27 self.build_dir = None 37 self.build_dir = None
28 38
29 if self.build_dir is not None: 39 if self.build_dir is not None:
30 self.mojo_shell_path = os.path.join(self.build_dir, "mojo_shell") 40 self.mojo_shell_path = os.path.join(self.build_dir, "mojo_shell")
31 self.dart_snapshotter_path = os.path.join( 41 self.dart_snapshotter_path = os.path.join(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return os.path.join(self.build_dir, name + '.mojo') 87 return os.path.join(self.build_dir, name + '.mojo')
78 return name + '.mojo' 88 return name + '.mojo'
79 89
80 @staticmethod 90 @staticmethod
81 def IsValidAppUrl(url): 91 def IsValidAppUrl(url):
82 """Returns False if url is malformed, True otherwise.""" 92 """Returns False if url is malformed, True otherwise."""
83 try: 93 try:
84 return len(url.split(':')) == 2 94 return len(url.split(':')) == 2
85 except ValueError: 95 except ValueError:
86 return False 96 return False
OLDNEW
« no previous file with comments | « mojo/tools/mopy/invoke_go.py ('k') | mojo/tools/run_pure_go_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698