Skip to content

Commit 2987329

Browse files
authored
Run crypto tests (only) under BoringSSL from unified build (#21168)
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..)
1 parent 4f280ce commit 2987329

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

.github/workflows/build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ jobs:
391391
# use that on Darwin.
392392
# * the "host clang" build, which uses the pigweed
393393
# clang.
394-
"default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false';;
394+
"default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false enable_host_clang_boringssl_crypto_tests=false';;
395395
"python_lib") GN_ARGS='enable_rtti=true enable_pylib=true';;
396396
esac
397397
BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS" --export-compile-commands

BUILD.gn

+24
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,13 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
241241
enable_host_gcc_mbedtls_crypto_tests =
242242
enable_default_builds && host_os != "win"
243243

244+
# Enable building chip with clang & boringssl
245+
enable_host_clang_boringssl_build = false
246+
247+
# Enable limited testing with clang & boringssl
248+
enable_host_clang_boringssl_crypto_tests =
249+
enable_default_builds && host_os != "win"
250+
244251
# Build the chip-cert tool.
245252
enable_standalone_chip_cert_build =
246253
enable_default_builds && host_os != "win" && chip_crypto == "openssl"
@@ -362,6 +369,23 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
362369
builds += [ ":host_gcc_mbedtls_crypto_tests" ]
363370
}
364371

372+
if (enable_host_clang_boringssl_build) {
373+
chip_build("host_clang_boringssl") {
374+
toolchain = "${chip_root}/config/boringssl/toolchain:${host_os}_${host_cpu}_clang_boringssl"
375+
}
376+
377+
builds += [ ":host_clang_boringssl" ]
378+
}
379+
380+
if (enable_host_clang_boringssl_crypto_tests) {
381+
chip_build("host_clang_boringssl_crypto_tests") {
382+
test_group = "//src:crypto_tests"
383+
toolchain = "${chip_root}/config/boringssl/toolchain:${host_os}_${host_cpu}_clang_boringssl"
384+
}
385+
386+
builds += [ ":host_clang_boringssl_crypto_tests" ]
387+
}
388+
365389
if (enable_android_builds) {
366390
chip_build("android_arm") {
367391
toolchain = "${build_root}/toolchain/android:android_arm"

config/boringssl/toolchain/BUILD.gn

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
17+
import("${build_root}/toolchain/gcc_toolchain.gni")
18+
19+
gcc_toolchain("${host_os}_${host_cpu}_clang_boringssl") {
20+
toolchain_args = {
21+
current_os = host_os
22+
current_cpu = host_cpu
23+
is_clang = true
24+
chip_crypto = "boringssl"
25+
}
26+
}

0 commit comments

Comments
 (0)