Skip to content

Commit

Permalink
Updating //build for cobalt.
Browse files Browse the repository at this point in the history
Change-Id: I3ead4d9a1c5f4af2444ab9199b04774ab18e100c
  • Loading branch information
aee-google committed Jan 11, 2024
1 parent 423a1d3 commit ccd55f0
Show file tree
Hide file tree
Showing 40 changed files with 756 additions and 58 deletions.
1 change: 1 addition & 0 deletions build/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ buildflag_header("chromecast_buildflags") {
header = "chromecast_buildflags.h"

flags = [
"IS_CHROMECAST=$is_chromecast",
"IS_CASTOS=$is_castos",
"IS_CAST_ANDROID=$is_cast_android",
"ENABLE_CAST_RECEIVER=$enable_cast_receiver",
Expand Down
4 changes: 4 additions & 0 deletions build/android/docs/coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class files and runtime **.exec** files. Then we need to process them using the
3. The coverage results of JUnit and instrumentation tests will be merged
automatically if they are in the same directory.

4. If generating coverage and there are duplicate class files, as can happen
when generating coverage for downstream targets, use the
--include-substr-filter option to choose jars in the desired directory.

## How to generate coverage report

1. Now we have generated .exec files already. We can create a JaCoCo HTML/XML/CSV
Expand Down
31 changes: 31 additions & 0 deletions build/android/pylib/gtest/gtest_test_instance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,37 @@ def testParseGTestJSON_skippedTest_example(self):
actual[0].GetName())
self.assertEqual(base_test_result.ResultType.SKIP, actual[0].GetType())

def testParseGTestJSON_skippedTest_example(self):
raw_json = """
{
"tests": {
"mojom_tests": {
"parse": {
"ast_unittest": {
"ASTTest": {
"testNodeBase": {
"expected": "SKIP",
"actual": "SKIP",
}
}
}
}
}
},
"interrupted": false,
"path_delimiter": ".",
"version": 3,
"seconds_since_epoch": 1406662283.764424,
"num_failures_by_type": {
"SKIP": 1
},
}"""
actual = gtest_test_instance.ParseGTestJSON(raw_json)
self.assertEquals(1, len(actual))
self.assertEquals('mojom_tests.parse.ast_unittest.ASTTest.testNodeBase',
actual[0].GetName())
self.assertEquals(base_test_result.ResultType.SKIP, actual[0].GetType())

def testTestNameWithoutDisabledPrefix_disabled(self):
test_name_list = [
'A.DISABLED_B',
Expand Down
7 changes: 7 additions & 0 deletions build/android/pylib/local/device/local_device_test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ def run_tests_on_device(dev, tests, results):
# of bad device detection.
consecutive_device_errors = 0

# TODO(crbug.com/1181389): Remove this workaround once the deadlocks
# in ArCore are resolved
def GetResultTypeForTest(t):
if 'WebXrAr' in self._GetUniqueTestName(t):
return base_test_result.ResultType.PASS
return base_test_result.ResultType.TIMEOUT

if isinstance(test, list):
results.AddResults(
base_test_result.BaseTestResult(
Expand Down
28 changes: 28 additions & 0 deletions build/android/pylib/results/json_results_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,34 @@ def testGenerateJsonTestResultFormatDict_skippedResult(self):
self.assertIn('SKIP', results_dict['num_failures_by_type'])
self.assertEqual(1, results_dict['num_failures_by_type']['SKIP'])

def testGenerateJsonTestResultFormatDict_skippedResult(self):
result = base_test_result.BaseTestResult('test.package.TestName',
base_test_result.ResultType.SKIP)

all_results = base_test_result.TestRunResults()
all_results.AddResult(result)

results_dict = json_results.GenerateJsonTestResultFormatDict([all_results],
False)
self.assertEquals(1, len(results_dict['tests']))
self.assertEquals(1, len(results_dict['tests']['test']))
self.assertEquals(1, len(results_dict['tests']['test']['package']))
self.assertEquals(
'PASS',
results_dict['tests']['test']['package']['TestName']['expected'])
self.assertEquals(
'FAIL', results_dict['tests']['test']['package']['TestName']['actual'])
self.assertEquals(
True,
results_dict['tests']['test']['package']['TestName']['is_unexpected'])

self.assertTrue('FAIL' not in results_dict['num_failures_by_type']
or results_dict['num_failures_by_type']['FAIL'] == 0)
self.assertTrue('PASS' not in results_dict['num_failures_by_type']
or results_dict['num_failures_by_type']['PASS'] == 0)
self.assertIn('SKIP', results_dict['num_failures_by_type'])
self.assertEquals(1, results_dict['num_failures_by_type']['SKIP'])

def testGenerateJsonTestResultFormatDict_failedResultWithRetry(self):
result_1 = base_test_result.BaseTestResult('test.package.TestName',
base_test_result.ResultType.FAIL)
Expand Down
40 changes: 37 additions & 3 deletions build/build_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
#include "build/buildflag.h" // IWYU pragma: export

// A set of macros to use for platform detection.
#if defined(__native_client__)
#if defined(STARBOARD)
// noop
#elif defined(__native_client__)
// __native_client__ must be first, so that other OS_ defines are not set.
#define OS_NACL 1
#elif defined(ANDROID)
Expand Down Expand Up @@ -268,7 +270,33 @@
// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
// http://www.agner.org/optimize/calling_conventions.pdf
// or with gcc, run: "echo | gcc -E -dM -"
#if defined(_M_X64) || defined(__x86_64__)
#if defined(STARBOARD)
#include "starboard/configuration.h"
#if SB_IS(32_BIT)
#define ARCH_CPU_32_BITS 1
#elif SB_IS(64_BIT)
#define ARCH_CPU_64_BITS 1
#endif // SB_IS(32_BIT)
#if SB_IS(BIG_ENDIAN)
#define ARCH_CPU_BIG_ENDIAN 1
#else // SB_IS(BIG_ENDIAN)
#define ARCH_CPU_LITTLE_ENDIAN 1
#endif // SB_IS(BIG_ENDIAN)
#if SB_IS(ARCH_X86)
#define ARCH_CPU_X86_FAMILY 1
#define ARCH_CPU_X86 1
#elif SB_IS(ARCH_X64)
#define ARCH_CPU_X86_FAMILY 1
#define ARCH_CPU_X86_64 1
#elif SB_IS(ARCH_ARM) || SB_IS(ARCH_ARM64)
#define ARCH_CPU_ARM_FAMILY 1
#if SB_IS(BIG_ENDIAN)
#define ARCH_CPU_ARM 1
#else // SB_IS(BIG_ENDIAN)
#define ARCH_CPU_ARMEL 1
#endif // SB_IS(BIG_ENDIAN)
#endif
#elif defined(_M_X64) || defined(__x86_64__)
#define ARCH_CPU_X86_FAMILY 1
#define ARCH_CPU_X86_64 1
#define ARCH_CPU_64_BITS 1
Expand Down Expand Up @@ -355,7 +383,13 @@
#endif

// Type detection for wchar_t.
#if defined(OS_WIN)
#if defined(STARBOARD)
#if SB_IS(WCHAR_T_UTF16)
#define WCHAR_T_IS_UTF16
#elif SB_IS(WCHAR_T_UTF32)
#define WCHAR_T_IS_UTF32
#endif
#elif defined(OS_WIN)
#define WCHAR_T_IS_UTF16
#elif defined(OS_FUCHSIA)
#define WCHAR_T_IS_UTF32
Expand Down
2 changes: 1 addition & 1 deletion build/config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ group("common_deps") {
public_deps += [ "//build/config/sanitizers:deps" ]
}

if (use_custom_libcxx) {
if (!is_starboard && use_custom_libcxx) {
public_deps += [ "//buildtools/third_party/libc++" ]
}

Expand Down
2 changes: 1 addition & 1 deletion build/config/android/internal_rules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import("//build/toolchain/goma.gni")
import("//build/toolchain/kythe.gni")
import("//build/util/generate_wrapper.gni")
import("//build_overrides/build.gni")
if (current_toolchain == default_toolchain) {
if (is_starboardized_toolchain || current_toolchain == default_toolchain) {
import("//build/toolchain/concurrent_links.gni")
}
assert(is_android)
Expand Down
3 changes: 2 additions & 1 deletion build/config/apple/sdk_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def main():
default='.',
help='Value of gn $root_build_dir')
parser.add_argument('platform',
choices=['iphoneos', 'iphonesimulator', 'macosx'])
choices=['iphoneos', 'iphonesimulator', 'macosx',
'appletvos'])
args = parser.parse_args()
if args.developer_dir:
os.environ['DEVELOPER_DIR'] = args.developer_dir
Expand Down
23 changes: 16 additions & 7 deletions build/config/arm.gni
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/v8_target_cpu.gni")

if (is_starboard) {
import("//starboard/sabi/sabi.gni")
}

# These are primarily relevant in current_cpu == "arm" contexts, where
# ARM code is being compiled. But they can also be relevant in the
# other contexts when the code will change its behavior based on the
Expand Down Expand Up @@ -45,14 +49,19 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
arm_arch = "armv8-a+crc"
}

if (current_os == "android" || target_os == "android") {
arm_float_abi = "softfp"
if (is_starboard) {
arm_float_abi = sabi_variables.floating_point_abi
arm_fpu = sabi_variables.floating_point_fpu
} else {
declare_args() {
# The ARM floating point mode. This is either the string "hard", "soft",
# or "softfp". An empty string means to use the default one for the
# arm_version.
arm_float_abi = ""
if (current_os == "android" || target_os == "android") {
arm_float_abi = "softfp"
} else {
declare_args() {
# The ARM floating point mode. This is either the string "hard", "soft",
# or "softfp". An empty string means to use the default one for the
# arm_version.
arm_float_abi = ""
}
}
}
assert(arm_float_abi == "" || arm_float_abi == "hard" ||
Expand Down
8 changes: 6 additions & 2 deletions build/config/clang/clang.gni
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

import("//build/toolchain/toolchain.gni")

default_clang_base_path = "//third_party/llvm-build/Release+Asserts"
if (!use_cobalt_customizations) {
default_clang_base_path = "//third_party/llvm-build/Release+Asserts"
}

declare_args() {
# Indicates if the build should use the Chrome-specific plugins for enforcing
Expand All @@ -18,5 +20,7 @@ declare_args() {
build_with_chromium && !is_official_build &&
((is_linux && !is_castos) || (is_android && !is_cast_android))

clang_base_path = default_clang_base_path
if (!use_cobalt_customizations) {
clang_base_path = default_clang_base_path
}
}
Loading

0 comments on commit ccd55f0

Please sign in to comment.