blob: 4e4a96c5dbcb11933e5b189537ae960f57f4237b [file] [log] [blame]
# Copyright 2017 The Cobalt Authors. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# See the License for the specific language governing permissions and
# limitations under the License.
"""Starboard Linux shared platform configuration."""
import os
from import clang
from import platform_configuration
from import build
from import paths
from import test_filter
class LinuxConfiguration(platform_configuration.PlatformConfiguration):
"""Starboard Linux platform configuration."""
def __init__(self,
super(LinuxConfiguration, self).__init__(platform, asan_enabled_by_default)
self.sabi_json_path = sabi_json_path
def GetBuildFormat(self):
"""Returns the desired build format."""
# The comma means that ninja and qtcreator_ninja will be chained and use the
# same input information so that .gyp files will only have to be parsed
# once.
return 'ninja,qtcreator_ninja'
def GetVariables(self, config_name):
variables = super(LinuxConfiguration, self).GetVariables(
config_name, use_clang=1)
return variables
def GetLauncherPath(self):
"""Gets the path to the launcher module for this platform."""
return os.path.dirname(__file__)
def GetGeneratorVariables(self, config_name):
del config_name
generator_variables = {
'qtcreator_session_name_prefix': 'cobalt',
return generator_variables
def GetEnvironmentVariables(self):
if not hasattr(self, '_host_compiler_environment'):
self._host_compiler_environment = build.GetHostCompilerEnvironment(
clang.GetClangSpecification(), self.build_accelerator)
env_variables = self._host_compiler_environment
'CC': self._host_compiler_environment['CC_host'],
'CXX': self._host_compiler_environment['CXX_host'],
return env_variables
def GetTestEnvVariables(self):
# Due to fragile nature of dynamic TLS tracking, in particular LSAN reliance
# on GLIBC private APIs, tracking TLS leaks is unstable and can trigger
# sporadic false positives and/or crashes, depending on the used compiler,
# direct library dependencies and runtime-loaded dynamic libraries. Hence,
# TLS leak tracing in LSAN is turned off.
# For reference,
# When failing, 'LeakSanitizer has encountered a fatal error' message would
# be printed at test shutdown, and env var LSAN_OPTIONS=verbosity=2 would
# further point to 'Scanning DTLS range ..' prior to crash.
return {'ASAN_OPTIONS': 'intercept_tls_get_addr=0'}
def GetTestFilters(self):
filters = super(LinuxConfiguration, self).GetTestFilters()
has_cdm = os.path.isfile(
os.path.join(paths.REPOSITORY_ROOT, 'third_party', 'ce_cdm', 'cdm',
'include', 'cdm.h'))
for target, tests in self.__FILTERED_TESTS.iteritems():
filters.extend(test_filter.TestFilter(target, test) for test in tests)
if has_cdm:
return filters
# Filter the drm related tests, as ce_cdm is not present.
for target, tests in self.__DRM_RELATED_TESTS.iteritems():
filters.extend(test_filter.TestFilter(target, test) for test in tests)
return filters
def GetPathToSabiJsonFile(self):
return self.sabi_json_path
__DRM_RELATED_TESTS = { # pylint: disable=invalid-name
'nplb': [
__FILTERED_TESTS = { # pylint: disable=invalid-name
'player_filter_tests': [
# libdav1d crashes when fed invalid data
# Conditionally disables tests that require ipv6
if os.getenv('IPV6_AVAILABLE', 1) == '0':
__FILTERED_TESTS['nplb'] = [