diff --git a/testing/run_tests.py b/testing/run_tests.py index 98509be2b153a..d03e7aa406d56 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -138,6 +138,16 @@ def is_mac(): return sys.platform == 'darwin' +def is_aarm64(): + assert is_mac() + output = subprocess.check_output(['sysctl', 'machdep.cpu']) + text = output.decode('utf-8') + aarm64 = text.find('Apple') >= 0 + if not aarm64: + assert text.find('GenuineIntel') >= 0 + return aarm64 + + def is_linux(): return sys.platform.startswith('linux') @@ -467,6 +477,22 @@ def make_test(name, flags=None, extra_env=None): shuffle_flags, coverage=coverage ) + extra_env = { + # pylint: disable=line-too-long + # See https://developer.apple.com/documentation/metal/diagnosing_metal_programming_issues_early?language=objc + 'MTL_SHADER_VALIDATION': '1', # Enables all shader validation tests. + 'MTL_SHADER_VALIDATION_GLOBAL_MEMORY': + '1', # Validates accesses to device and constant memory. + 'MTL_SHADER_VALIDATION_THREADGROUP_MEMORY': + '1', # Validates accesses to threadgroup memory. + 'MTL_SHADER_VALIDATION_TEXTURE_USAGE': + '1', # Validates that texture references are not nil. + } + if is_aarm64(): + extra_env.append({ + 'METAL_DEBUG_ERROR_MODE': '0', # Enables metal validation. + 'METAL_DEVICE_WRAPPER_TYPE': '1', # Enables metal validation. + }) # Impeller tests are only supported on macOS for now. run_engine_executable( build_dir, @@ -474,18 +500,7 @@ def make_test(name, flags=None, extra_env=None): executable_filter, shuffle_flags, coverage=coverage, - extra_env={ - # pylint: disable=line-too-long - # See https://developer.apple.com/documentation/metal/diagnosing_metal_programming_issues_early?language=objc - 'MTL_SHADER_VALIDATION': - '1', # Enables all shader validation tests. - 'MTL_SHADER_VALIDATION_GLOBAL_MEMORY': - '1', # Validates accesses to device and constant memory. - 'MTL_SHADER_VALIDATION_THREADGROUP_MEMORY': - '1', # Validates accesses to threadgroup memory. - 'MTL_SHADER_VALIDATION_TEXTURE_USAGE': - '1', # Validates that texture references are not nil. - }, + extra_env=extra_env, # TODO(117122): Remove this allowlist. # https://github.com/flutter/flutter/issues/114872 allowed_failure_output=[