@@ -52,19 +52,27 @@ def is_asan(build_dir):
52
52
53
53
54
54
def run_cmd (
55
- cmd , forbidden_output = None , expect_failure = False , env = None , ** kwargs
55
+ cmd ,
56
+ forbidden_output = None ,
57
+ expect_failure = False ,
58
+ env = None ,
59
+ allowed_failure_output = None ,
60
+ ** kwargs
56
61
):
57
62
if forbidden_output is None :
58
63
forbidden_output = []
64
+ if allowed_failure_output is None :
65
+ allowed_failure_output = []
59
66
60
67
command_string = ' ' .join (cmd )
61
68
62
69
print_divider ('>' )
63
70
print ('Running command "%s"' % command_string )
64
71
65
72
start_time = time .time ()
66
- stdout_pipe = sys .stdout if not forbidden_output else subprocess .PIPE
67
- stderr_pipe = sys .stderr if not forbidden_output else subprocess .PIPE
73
+ collect_output = forbidden_output or allowed_failure_output
74
+ stdout_pipe = sys .stdout if not collect_output else subprocess .PIPE
75
+ stderr_pipe = sys .stderr if not collect_output else subprocess .PIPE
68
76
process = subprocess .Popen (
69
77
cmd ,
70
78
stdout = stdout_pipe ,
@@ -92,10 +100,17 @@ def run_cmd(
92
100
93
101
print_divider ('!' )
94
102
95
- raise Exception (
96
- 'Command "%s" exited with code %d.' %
97
- (command_string , process .returncode )
98
- )
103
+ allowed_failure = False
104
+ for allowed_string in allowed_failure_output :
105
+ if (stdout and allowed_string in stdout ) or (stderr and
106
+ allowed_string in stderr ):
107
+ allowed_failure = True
108
+
109
+ if not allowed_failure :
110
+ raise Exception (
111
+ 'Command "%s" exited with code %d.' %
112
+ (command_string , process .returncode )
113
+ )
99
114
100
115
if stdout or stderr :
101
116
print (stdout )
@@ -192,6 +207,7 @@ def run_engine_executable( # pylint: disable=too-many-arguments
192
207
flags = None ,
193
208
cwd = BUILDROOT_DIR ,
194
209
forbidden_output = None ,
210
+ allowed_failure_output = None ,
195
211
expect_failure = False ,
196
212
coverage = False ,
197
213
extra_env = None ,
@@ -205,6 +221,8 @@ def run_engine_executable( # pylint: disable=too-many-arguments
205
221
flags = []
206
222
if forbidden_output is None :
207
223
forbidden_output = []
224
+ if allowed_failure_output is None :
225
+ allowed_failure_output = []
208
226
if extra_env is None :
209
227
extra_env = {}
210
228
@@ -249,7 +267,8 @@ def run_engine_executable( # pylint: disable=too-many-arguments
249
267
cwd = cwd ,
250
268
forbidden_output = forbidden_output ,
251
269
expect_failure = expect_failure ,
252
- env = env
270
+ env = env ,
271
+ allowed_failure_output = allowed_failure_output
253
272
)
254
273
except :
255
274
# The LUCI environment may provide a variable containing a directory path
@@ -287,6 +306,7 @@ def __init__( # pylint: disable=too-many-arguments
287
306
flags = None ,
288
307
cwd = BUILDROOT_DIR ,
289
308
forbidden_output = None ,
309
+ allowed_failure_output = None ,
290
310
expect_failure = False ,
291
311
coverage = False ,
292
312
extra_env = None ,
@@ -297,6 +317,7 @@ def __init__( # pylint: disable=too-many-arguments
297
317
self .flags = flags
298
318
self .cwd = cwd
299
319
self .forbidden_output = forbidden_output
320
+ self .allowed_failure_output = allowed_failure_output
300
321
self .expect_failure = expect_failure
301
322
self .coverage = coverage
302
323
self .extra_env = extra_env
@@ -309,6 +330,7 @@ def __call__(self, *args):
309
330
flags = self .flags ,
310
331
cwd = self .cwd ,
311
332
forbidden_output = self .forbidden_output ,
333
+ allowed_failure_output = self .allowed_failure_output ,
312
334
expect_failure = self .expect_failure ,
313
335
coverage = self .coverage ,
314
336
extra_env = self .extra_env ,
@@ -442,28 +464,32 @@ def make_test(name, flags=None, extra_env=None):
442
464
shuffle_flags ,
443
465
coverage = coverage
444
466
)
445
- # TODO(117122): Re-enable impeller_unittests after shader compiler errors
446
- # are addressed.
447
467
# Impeller tests are only supported on macOS for now.
448
- # run_engine_executable(
449
- # build_dir,
450
- # 'impeller_unittests',
451
- # executable_filter,
452
- # shuffle_flags,
453
- # coverage=coverage,
454
- # extra_env={
455
- # # pylint: disable=line-too-long
456
- # # See https://developer.apple.com/documentation/metal/diagnosing_metal_programming_issues_early?language=objc
457
- # 'MTL_SHADER_VALIDATION':
458
- # '1', # Enables all shader validation tests.
459
- # 'MTL_SHADER_VALIDATION_GLOBAL_MEMORY':
460
- # '1', # Validates accesses to device and constant memory.
461
- # 'MTL_SHADER_VALIDATION_THREADGROUP_MEMORY':
462
- # '1', # Validates accesses to threadgroup memory.
463
- # 'MTL_SHADER_VALIDATION_TEXTURE_USAGE':
464
- # '1', # Validates that texture references are not nil.
465
- # }
466
- # )
468
+ run_engine_executable (
469
+ build_dir ,
470
+ 'impeller_unittests' ,
471
+ executable_filter ,
472
+ shuffle_flags ,
473
+ coverage = coverage ,
474
+ extra_env = {
475
+ # pylint: disable=line-too-long
476
+ # See https://developer.apple.com/documentation/metal/diagnosing_metal_programming_issues_early?language=objc
477
+ 'MTL_SHADER_VALIDATION' :
478
+ '1' , # Enables all shader validation tests.
479
+ 'MTL_SHADER_VALIDATION_GLOBAL_MEMORY' :
480
+ '1' , # Validates accesses to device and constant memory.
481
+ 'MTL_SHADER_VALIDATION_THREADGROUP_MEMORY' :
482
+ '1' , # Validates accesses to threadgroup memory.
483
+ 'MTL_SHADER_VALIDATION_TEXTURE_USAGE' :
484
+ '1' , # Validates that texture references are not nil.
485
+ },
486
+ # TODO(117122): Remove this allowlist.
487
+ # https://github.com/flutter/flutter/issues/114872
488
+ allowed_failure_output = [
489
+ '[MTLCompiler createVertexStageAndLinkPipelineWithFragment:' ,
490
+ '[MTLCompiler pipelineStateWithVariant:' ,
491
+ ]
492
+ )
467
493
468
494
469
495
def parse_impeller_vulkan_filter ():
@@ -566,6 +592,7 @@ def gather_dart_test(
566
592
None ,
567
593
command_args ,
568
594
forbidden_output = forbidden_output ,
595
+ allowed_failure_output = allowed_failure_output ,
569
596
expect_failure = expect_failure ,
570
597
)
571
598
0 commit comments