Skip to content

Commit

Permalink
Run crypto tests (only) under BoringSSL from unified build
Browse files Browse the repository at this point in the history
Add a new default option enable_host_clang_boringssl_crypto_tests
to the unified build that runs the tests from src/crypto and
src/credentials only.

Also add an option enable_host_clang_boringssl_build that runs all of
the tests (and builds any tools), which is not enabled by default.

This gives some coverage to BoringSSL without costing a full build
(it would be even cheaper if we could swap out the CryptoPAL via
the command line..)
  • Loading branch information
mspang committed Jul 25, 2022
1 parent 35e13a9 commit 675f634
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
24 changes: 24 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
enable_host_gcc_mbedtls_crypto_tests =
enable_default_builds && host_os != "win"

# Enable building chip with clang & boringssl
enable_host_clang_boringssl_build = false

# Enable limited testing with clang & boringssl
enable_host_clang_boringssl_crypto_tests =
enable_default_builds && host_os != "win"

# Build the chip-cert tool.
enable_standalone_chip_cert_build =
enable_default_builds && host_os != "win" && chip_crypto == "openssl"
Expand Down Expand Up @@ -362,6 +369,23 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
builds += [ ":host_gcc_mbedtls_crypto_tests" ]
}

if (enable_host_clang_boringssl_build) {
chip_build("host_clang_boringssl") {
toolchain = "${chip_root}/config/boringssl/toolchain:${host_os}_${host_cpu}_clang_boringssl"
}

builds += [ ":host_clang_boringssl" ]
}

if (enable_host_clang_boringssl_crypto_tests) {
chip_build("host_clang_boringssl_crypto_tests") {
test_group = "//src:crypto_tests"
toolchain = "${chip_root}/config/boringssl/toolchain:${host_os}_${host_cpu}_clang_boringssl"
}

builds += [ ":host_clang_boringssl_crypto_tests" ]
}

if (enable_android_builds) {
chip_build("android_arm") {
toolchain = "${build_root}/toolchain/android:android_arm"
Expand Down
26 changes: 26 additions & 0 deletions config/boringssl/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) 2020 Project CHIP Authors
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

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

import("${build_root}/toolchain/gcc_toolchain.gni")

gcc_toolchain("${host_os}_${host_cpu}_clang_boringssl") {
toolchain_args = {
current_os = host_os
current_cpu = host_cpu
is_clang = true
chip_crypto = "boringssl"
}
}
5 changes: 4 additions & 1 deletion third_party/boringssl/repo/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ all_sources = crypto_sources
all_headers = crypto_headers

static_library("boringssl") {
cflags = [ "-O2" ]
cflags = [
"-O2",
"-Wno-unused-variable",
]

public = all_headers

Expand Down

0 comments on commit 675f634

Please sign in to comment.