11PYTHON_VERSION_COMPATIBILITY =
"PY3"
16 'recipe_engine/context',
19 'recipe_engine/platform',
20 'recipe_engine/properties',
21 'recipe_engine/raw_io',
31 """Run the DM test."""
32 do_upload = api.properties.get(
'do_upload') ==
'true'
33 images = api.properties.get(
'images') ==
'true'
34 lotties = api.properties.get(
'lotties') ==
'true'
35 resources = api.properties.get(
'resources') ==
'true'
36 skps = api.properties.get(
'skps') ==
'true'
37 svgs = api.properties.get(
'svgs') ==
'true'
49 host_dm_dir = str(api.flavor.host_dirs.dm_dir)
50 api.flavor.create_clean_host_dir(api.path.start_dir.join(
'test'))
51 device_dm_dir = str(api.flavor.device_dirs.dm_dir)
52 if host_dm_dir != device_dm_dir:
53 api.flavor.create_clean_device_dir(device_dm_dir)
56 hash_filename =
'uninteresting_hashes.txt'
58 host_hashes_file = api.vars.tmp_dir.join(hash_filename)
59 hashes_file = api.flavor.device_path_join(
60 api.flavor.device_dirs.tmp_dir, hash_filename)
61 script = api.gold_upload.resource(
'get_uninteresting_hashes.py')
64 'get uninteresting hashes',
65 cmd=[
'python3', script, api.properties[
'gold_hashes_url'],
69 abort_on_failure=
True,
70 fail_build_on_failure=
True,
73 if api.path.exists(host_hashes_file):
74 api.flavor.copy_file_to_device(host_hashes_file, hashes_file)
78 args = json.loads(api.properties[
'dm_flags'])
79 props = json.loads(api.properties[
'dm_properties'])
80 args.append(
'--properties')
83 for k
in sorted(props.keys()):
85 if v ==
'${SWARMING_BOT_ID}':
86 v = api.vars.swarming_bot_id
87 elif v ==
'${SWARMING_TASK_ID}':
88 v = api.vars.swarming_task_id
94 args.extend([
'--resourcePath', api.flavor.device_dirs.resource_dir])
96 args.extend([
'--skps', api.flavor.device_dirs.skp_dir])
99 '--images', api.flavor.device_path_join(
100 api.flavor.device_dirs.images_dir,
'dm'),
101 '--colorImages', api.flavor.device_path_join(
102 api.flavor.device_dirs.images_dir,
'colorspace'),
107 args.extend([
'--svgs', api.flavor.device_path_join(
108 api.flavor.device_dirs.svg_dir,
"svg")])
112 api.flavor.device_path_join(
113 api.flavor.device_dirs.resource_dir,
'skottie'),
114 api.flavor.device_dirs.lotties_dir,
116 if 'Fontations' in api.vars.builder_cfg.get(
'extra_config', []):
117 args.extend([
'--fontTestDataPath', api.flavor.device_dirs.fonts_dir])
120 args.extend([
'--uninterestingHashesFile', hashes_file])
122 args.extend([
'--writePath', api.flavor.device_dirs.dm_dir])
125 api.run(api.flavor.step,
'dm', cmd=args, abort_on_failure=
False)
129 api.flavor.copy_directory_contents_to_host(
130 api.flavor.device_dirs.dm_dir, api.flavor.host_dirs.dm_dir)
132 if 'Win' not in api.vars.builder_cfg.get(
'os',
''):
133 api.gold_upload.upload()
138 api.file.ensure_directory(
'makedirs tmp_dir', api.vars.tmp_dir)
139 api.flavor.setup(
'dm')
144 api.flavor.cleanup_steps()
145 api.run.check_failure()
149 'Test-Android-Clang-Pixel2XL-GPU-Adreno540-arm-Debug-All-Android_ASAN',
150 'Test-Android-Clang-Pixel2XL-GPU-Adreno540-arm64-Debug-All-Android',
151 'Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Release-All-Lottie',
152 'Test-Win10-Clang-ShuttleC-GPU-GTX960-x86_64-Debug-All-ANGLE',
153 'Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All-Fontations',
158 for builder
in TEST_BUILDERS:
161 buildbucket_build_id=
'123454321',
162 dm_flags=
'["dm","--example","--flags"]',
163 dm_properties=(
'{"key1":"value1","key2":"",'
164 '"bot":"${SWARMING_BOT_ID}",'
165 '"task":"${SWARMING_TASK_ID}"}'),
167 gs_bucket=
'skia-infra-gm',
168 patch_ref=
'89/456789/12',
171 path_config=
'kitchen',
172 gold_hashes_url=
'https://example.com/hashes.txt',
173 swarm_out_dir=
'[SWARM_OUT_DIR]',
174 task_id=
'task_12345',
177 if 'ASAN' not in builder:
178 props[
'do_upload'] =
'true'
179 if 'Lottie' in builder:
180 props[
'lotties'] =
'true'
182 props[
'images'] =
'true'
183 props[
'skps'] =
'true'
184 props[
'svgs'] =
'true'
187 api.properties(**props) +
189 api.path.start_dir.join(
'skia'),
190 api.path.start_dir.join(
'skia',
'infra',
'bots',
'assets',
191 'skimage',
'VERSION'),
192 api.path.start_dir.join(
'skia',
'infra',
'bots',
'assets',
194 api.path.start_dir.join(
'skia',
'infra',
'bots',
'assets',
196 api.path.start_dir.join(
'tmp',
'uninteresting_hashes.txt')
198 api.step_data(
'get swarming bot id',
199 stdout=api.raw_io.output(
'skia-bot-123')) +
200 api.step_data(
'get swarming task id',
201 stdout=api.raw_io.output(
'123456'))
204 test += api.platform(
'win', 64)