Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
flavor.default.DefaultFlavor Class Reference
Inheritance diagram for flavor.default.DefaultFlavor:
flavor.android.AndroidFlavor flavor.ios.iOSFlavor flavor.ssh.SSHFlavor flavor.valgrind.ValgrindFlavor flavor.chromebook.ChromebookFlavor

Public Member Functions

 __init__ (self, module, app_name)
 
 device_path_join (self, *args)
 
 copy_directory_contents_to_device (self, host_dir, device_dir)
 
 copy_directory_contents_to_host (self, device_dir, host_dir)
 
 copy_file_to_device (self, host_path, device_path)
 
 create_clean_device_dir (self, path)
 
 create_clean_host_dir (self, path)
 
 read_file_on_device (self, path, **kwargs)
 
 remove_file_on_device (self, path)
 
 install (self)
 
 cleanup_steps (self)
 
 step (self, name, cmd, **unused_kwargs)
 

Public Attributes

 app_name
 
 module
 
 m
 
 device_dirs
 
 host_dirs
 

Protected Member Functions

 _run (self, title, cmd, infra_step=False, **kwargs)
 
 _py (self, title, script, infra_step=True, args=())
 

Protected Attributes

 _chrome_path
 

Detailed Description

Definition at line 26 of file default.py.

Constructor & Destructor Documentation

◆ __init__()

flavor.default.DefaultFlavor.__init__ (   self,
  module,
  app_name 
)

Reimplemented in flavor.android.AndroidFlavor, flavor.chromebook.ChromebookFlavor, flavor.ios.iOSFlavor, flavor.ssh.SSHFlavor, and flavor.valgrind.ValgrindFlavor.

Definition at line 27 of file default.py.

27 def __init__(self, module, app_name):
28 # Name of the app we're going to run. May be used in various ways by
29 # different flavors.
30 self.app_name = app_name
31
32 # Store a pointer to the parent recipe module (SkiaFlavorApi) so that
33 # FlavorUtils objects can do recipe module-like things, like run steps or
34 # access module-level resources.
35 self.module = module
36
37 # self.m is just a shortcut so that Flavor objects can use the same
38 # syntax as regular recipe modules to run steps, eg: self.m.step(...)
39 self.m = module.m
40 self._chrome_path = None
41 self.device_dirs = DeviceDirs(
42 bin_dir=self.m.vars.build_dir,
43 dm_dir=self.m.vars.swarming_out_dir,
44 perf_data_dir=self.m.vars.swarming_out_dir,
45 resource_dir=self.m.path['start_dir'].join('skia', 'resources'),
46 images_dir=self.m.path['start_dir'].join('skimage'),
47 fonts_dir=self.m.path['start_dir'].join('googlefonts_testdata', 'data'),
48 lotties_dir=self.m.path['start_dir'].join('lottie-samples'),
49 skp_dir=self.m.path['start_dir'].join('skp'),
50 svg_dir=self.m.path['start_dir'].join('svg'),
51 mskp_dir=self.m.path['start_dir'].join('mskp'),
52 tmp_dir=self.m.vars.tmp_dir,
53 texttraces_dir=self.m.path['start_dir'].join('text_blob_traces'))
54 self.host_dirs = self.device_dirs
55

Member Function Documentation

◆ _py()

flavor.default.DefaultFlavor._py (   self,
  title,
  script,
  infra_step = True,
  args = () 
)
protected

Definition at line 120 of file default.py.

120 def _py(self, title, script, infra_step=True, args=()):
121 return self.m.run(self.m.step, title, cmd=['python3', script]+args,
122 infra_step=infra_step)
123
Definition run.py:1

◆ _run()

flavor.default.DefaultFlavor._run (   self,
  title,
  cmd,
  infra_step = False,
**  kwargs 
)
protected

Reimplemented in flavor.ios.iOSFlavor.

Definition at line 116 of file default.py.

116 def _run(self, title, cmd, infra_step=False, **kwargs):
117 return self.m.run(self.m.step, title, cmd=cmd,
118 infra_step=infra_step, **kwargs)
119

◆ cleanup_steps()

flavor.default.DefaultFlavor.cleanup_steps (   self)
Run any device-specific cleanup steps.

Reimplemented in flavor.android.AndroidFlavor.

Definition at line 112 of file default.py.

112 def cleanup_steps(self):
113 """Run any device-specific cleanup steps."""
114 pass
115

◆ copy_directory_contents_to_device()

flavor.default.DefaultFlavor.copy_directory_contents_to_device (   self,
  host_dir,
  device_dir 
)
Like shutil.copytree(), but for copying to a connected device.

Reimplemented in flavor.android.AndroidFlavor, flavor.ios.iOSFlavor, and flavor.chromebook.ChromebookFlavor.

Definition at line 60 of file default.py.

60 def copy_directory_contents_to_device(self, host_dir, device_dir):
61 """Like shutil.copytree(), but for copying to a connected device."""
62 # For "normal" builders who don't have an attached device, we expect
63 # host_dir and device_dir to be the same.
64 if str(host_dir) != str(device_dir):
65 raise ValueError('For builders who do not have attached devices, copying '
66 'from host to device is undefined and only allowed if '
67 'host_path and device_path are the same (%s vs %s).' % (
68 str(host_dir), str(device_dir)))
69

◆ copy_directory_contents_to_host()

flavor.default.DefaultFlavor.copy_directory_contents_to_host (   self,
  device_dir,
  host_dir 
)
Like shutil.copytree(), but for copying from a connected device.

Reimplemented in flavor.android.AndroidFlavor, flavor.ios.iOSFlavor, and flavor.chromebook.ChromebookFlavor.

Definition at line 70 of file default.py.

70 def copy_directory_contents_to_host(self, device_dir, host_dir):
71 """Like shutil.copytree(), but for copying from a connected device."""
72 # For "normal" builders who don't have an attached device, we expect
73 # host_dir and device_dir to be the same.
74 if str(host_dir) != str(device_dir):
75 raise ValueError('For builders who do not have attached devices, copying '
76 'from device to host is undefined and only allowed if '
77 'host_path and device_path are the same (%s vs %s).' % (
78 str(host_dir), str(device_dir)))
79

◆ copy_file_to_device()

flavor.default.DefaultFlavor.copy_file_to_device (   self,
  host_path,
  device_path 
)
Like shutil.copyfile, but for copying to a connected device.

Reimplemented in flavor.android.AndroidFlavor, flavor.ios.iOSFlavor, and flavor.ssh.SSHFlavor.

Definition at line 80 of file default.py.

80 def copy_file_to_device(self, host_path, device_path):
81 """Like shutil.copyfile, but for copying to a connected device."""
82 # For "normal" builders who don't have an attached device, we expect
83 # host_dir and device_dir to be the same.
84 if str(host_path) != str(device_path):
85 raise ValueError('For builders who do not have attached devices, copying '
86 'from host to device is undefined and only allowed if '
87 'host_path and device_path are the same (%s vs %s).' % (
88 str(host_path), str(device_path)))
89

◆ create_clean_device_dir()

flavor.default.DefaultFlavor.create_clean_device_dir (   self,
  path 
)
Like shutil.rmtree() + os.makedirs(), but on a connected device.

Reimplemented in flavor.android.AndroidFlavor, flavor.ios.iOSFlavor, and flavor.ssh.SSHFlavor.

Definition at line 90 of file default.py.

90 def create_clean_device_dir(self, path):
91 """Like shutil.rmtree() + os.makedirs(), but on a connected device."""
92 self.create_clean_host_dir(path)
93

◆ create_clean_host_dir()

flavor.default.DefaultFlavor.create_clean_host_dir (   self,
  path 
)
Convenience function for creating a clean directory.

Definition at line 94 of file default.py.

94 def create_clean_host_dir(self, path):
95 """Convenience function for creating a clean directory."""
96 self.m.run.rmtree(path)
97 self.m.file.ensure_directory(
98 'makedirs %s' % self.m.path.basename(path), path)
99

◆ device_path_join()

flavor.default.DefaultFlavor.device_path_join (   self,
args 
)
Like os.path.join(), but for paths on a connected device.

Definition at line 56 of file default.py.

56 def device_path_join(self, *args):
57 """Like os.path.join(), but for paths on a connected device."""
58 return self.m.path.join(*args)
59

◆ install()

flavor.default.DefaultFlavor.install (   self)
Run device-specific installation steps.

Reimplemented in flavor.android.AndroidFlavor, flavor.chromebook.ChromebookFlavor, flavor.ios.iOSFlavor, and flavor.ssh.SSHFlavor.

Definition at line 108 of file default.py.

108 def install(self):
109 """Run device-specific installation steps."""
110 pass
111
static bool install(SkBitmap *bm, const SkImageInfo &info, const SkRasterHandleAllocator::Rec &rec)

◆ read_file_on_device()

flavor.default.DefaultFlavor.read_file_on_device (   self,
  path,
**  kwargs 
)
Reads the specified file.

Reimplemented in flavor.android.AndroidFlavor, flavor.ios.iOSFlavor, and flavor.ssh.SSHFlavor.

Definition at line 100 of file default.py.

100 def read_file_on_device(self, path, **kwargs):
101 """Reads the specified file."""
102 return self.m.file.read_text('read %s' % path, path)
103

◆ remove_file_on_device()

flavor.default.DefaultFlavor.remove_file_on_device (   self,
  path 
)
Removes the specified file.

Reimplemented in flavor.android.AndroidFlavor, flavor.ios.iOSFlavor, and flavor.ssh.SSHFlavor.

Definition at line 104 of file default.py.

104 def remove_file_on_device(self, path):
105 """Removes the specified file."""
106 return self.m.file.remove('remove %s' % path, path)
107

◆ step()

flavor.default.DefaultFlavor.step (   self,
  name,
  cmd,
**  unused_kwargs 
)

Reimplemented in flavor.android.AndroidFlavor, flavor.ios.iOSFlavor, flavor.ssh.SSHFlavor, and flavor.valgrind.ValgrindFlavor.

Definition at line 124 of file default.py.

124 def step(self, name, cmd, **unused_kwargs):
125 app = self.device_dirs.bin_dir.join(cmd[0])
126 cmd = [app] + cmd[1:]
127 env = self.m.context.env
128 path = []
129 ld_library_path = []
130
131 workdir = self.m.vars.workdir
132 clang_linux = workdir.join('clang_linux')
133 extra_tokens = self.m.vars.extra_tokens
134
135 if self.m.vars.is_linux:
136 if (self.m.vars.builder_cfg.get('cpu_or_gpu', '') == 'GPU'
137 and 'Intel' in self.m.vars.builder_cfg.get('cpu_or_gpu_value', '')):
138 dri_path = workdir.join('mesa_intel_driver_linux')
139 if ('IntelIrisXe' in self.m.vars.builder_cfg.get('cpu_or_gpu_value', '')):
140 dri_path = workdir.join('mesa_intel_driver_linux_22')
141 ld_library_path.append(dri_path)
142 env['LIBGL_DRIVERS_PATH'] = str(dri_path)
143 env['VK_ICD_FILENAMES'] = str(dri_path.join('intel_icd.x86_64.json'))
144
145 if 'Vulkan' in extra_tokens:
146 env['VULKAN_SDK'] = str(workdir.join('linux_vulkan_sdk'))
147 path.append(workdir.join('linux_vulkan_sdk', 'bin'))
148 ld_library_path.append(workdir.join('linux_vulkan_sdk', 'lib'))
149 # Enable layers for Debug only to avoid affecting perf results on
150 # Release.
151 # ASAN reports leaks in the Vulkan SDK when the debug layer is enabled.
152 # TSAN runs out of memory.
153 if (self.m.vars.builder_cfg.get('configuration', '') != 'Release' and
154 'ASAN' not in extra_tokens and
155 'TSAN' not in extra_tokens):
156 env['VK_LAYER_PATH'] = str(workdir.join(
157 'linux_vulkan_sdk', 'etc', 'vulkan', 'explicit_layer.d'))
158
159 if 'SwiftShader' in extra_tokens:
160 ld_library_path.append(self.host_dirs.bin_dir.join('swiftshader_out'))
161
162 # Find the MSAN/TSAN-built libc++.
163 if 'MSAN' in extra_tokens:
164 ld_library_path.append(clang_linux.join('msan'))
165 elif 'TSAN' in extra_tokens:
166 ld_library_path.append(clang_linux.join('tsan'))
167
168 if any('SAN' in t for t in extra_tokens):
169 # Sanitized binaries may want to run clang_linux/bin/llvm-symbolizer.
170 path.append(clang_linux.join('bin'))
171 # We find that testing sanitizer builds with libc++ uncovers more issues
172 # than with the system-provided C++ standard library, which is usually
173 # libstdc++. libc++ proactively hooks into sanitizers to help their
174 # analyses. We ship a copy of libc++ with our Linux toolchain in /lib.
175 ld_library_path.append(clang_linux.join('lib', 'x86_64-unknown-linux-gnu'))
176
177 if 'ASAN' in extra_tokens:
178 os = self.m.vars.builder_cfg.get('os', '')
179 if 'Mac' in os or 'Win' in os:
180 # Mac and Win don't support detect_leaks.
181 env['ASAN_OPTIONS'] = 'symbolize=1'
182 else:
183 env['ASAN_OPTIONS'] = 'symbolize=1 detect_leaks=1'
184 env['ASAN_SYMBOLIZER_PATH'] = clang_linux.join('bin', 'llvm-symbolizer')
185 env[ 'LSAN_OPTIONS'] = 'symbolize=1 print_suppressions=1'
186 env['UBSAN_OPTIONS'] = 'symbolize=1 print_stacktrace=1'
187
188 # If you see <unknown module> in stacktraces, try fast_unwind_on_malloc=0.
189 # This may cause a 2-25x slowdown, so use it only when you really need it.
190 if name == 'dm' and 'Vulkan' in extra_tokens:
191 env['ASAN_OPTIONS'] += ' fast_unwind_on_malloc=0'
192 env['LSAN_OPTIONS'] += ' fast_unwind_on_malloc=0'
193
194 if 'TSAN' in extra_tokens:
195 # We don't care about malloc(), fprintf, etc. used in signal handlers.
196 # If we're in a signal handler, we're already crashing...
197 env['TSAN_OPTIONS'] = 'report_signal_unsafe=0'
198
199 if 'Coverage' in extra_tokens:
200 # This is the output file for the coverage data. Just running the binary
201 # will produce the output. The output_file is in the swarming_out_dir and
202 # thus will be an isolated output of the Test step.
203 profname = '%s.profraw' % self.m.vars.builder_cfg.get('test_filter','o')
204 env['LLVM_PROFILE_FILE'] = self.m.path.join(self.m.vars.swarming_out_dir,
205 profname)
206
207 if 'DWriteCore' in extra_tokens:
208 path.append(workdir.join('dwritecore', 'bin'))
209
210 if path:
211 env['PATH'] = self.m.path.pathsep.join(
212 ['%(PATH)s'] + ['%s' % p for p in path])
213 if ld_library_path:
214 env['LD_LIBRARY_PATH'] = self.m.path.pathsep.join(
215 '%s' % p for p in ld_library_path)
216
217 to_symbolize = ['dm', 'nanobench']
218 if name in to_symbolize and self.m.vars.is_linux:
219 # Convert path objects or placeholders into strings such that they can
220 # be passed to symbolize_stack_trace.py
221 args = [workdir] + [str(x) for x in cmd]
222 with self.m.context(cwd=self.m.path['start_dir'].join('skia'), env=env):
223 self._py('symbolized %s' % name,
224 self.module.resource('symbolize_stack_trace.py'),
225 args=args,
226 infra_step=False)
227 elif 'Win' in self.m.vars.builder_cfg.get('os', ''):
228 with self.m.context(env=env):
229 wrapped_cmd = ['powershell', '-ExecutionPolicy', 'Unrestricted',
230 '-File',
231 self.module.resource('win_run_and_check_log.ps1')] + cmd
232 self._run(name, wrapped_cmd)
233 else:
234 with self.m.context(env=env):
235 self._run(name, cmd)
static int step(int x, SkScalar min, SkScalar max)
Definition BlurTest.cpp:215

Member Data Documentation

◆ _chrome_path

flavor.default.DefaultFlavor._chrome_path
protected

Definition at line 40 of file default.py.

◆ app_name

flavor.default.DefaultFlavor.app_name

Definition at line 30 of file default.py.

◆ device_dirs

flavor.default.DefaultFlavor.device_dirs

Definition at line 41 of file default.py.

◆ host_dirs

flavor.default.DefaultFlavor.host_dirs

Definition at line 54 of file default.py.

◆ m

flavor.default.DefaultFlavor.m

Definition at line 39 of file default.py.

◆ module

flavor.default.DefaultFlavor.module

Definition at line 35 of file default.py.


The documentation for this class was generated from the following file: