From 1231160896e93eadc2c731368883b9f824aec2c2 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 15 Feb 2022 01:28:32 -0500 Subject: [PATCH] Add chip-cert to build_examples.py (#15147) * Add chip cert tool to build_examples * Add chip-cert to the example build CI * Fix build tests unittest * Restyle --- .github/workflows/examples-linux-standalone.yaml | 5 +++++ scripts/build/build/targets.py | 2 ++ scripts/build/builders/host.py | 15 +++++++++++++++ scripts/build/testdata/build_linux_on_x64.txt | 12 ++++++++++++ 4 files changed, 34 insertions(+) diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index 0386dcbb4f5104..620e68d41a7205 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -61,6 +61,11 @@ jobs: path: | .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log + - name: Build Standalone cert tool + timeout-minutes: 5 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --no-log-timestamps --target-glob '*-chip-cert' build" - name: Build example Standalone Echo Client timeout-minutes: 5 run: | diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 49a794d6c8df3e..1f179e0a8b34f5 100644 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -145,6 +145,8 @@ def HostTargets(): targets[0].Extend('rpc-console', app=HostApp.RPC_CONSOLE)) app_targets.append( targets[0].Extend('tv-app', app=HostApp.TV_APP)) + app_targets.append( + targets[0].Extend('chip-cert', app=HostApp.CERT_TOOL)) for target in targets: app_targets.append(target.Extend( diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py index 58685b62092f5a..6e7e9b0015df40 100644 --- a/scripts/build/builders/host.py +++ b/scripts/build/builders/host.py @@ -30,6 +30,7 @@ class HostApp(Enum): LOCK = auto() TESTS = auto() SHELL = auto() + CERT_TOOL = auto() def ExamplePath(self): if self == HostApp.ALL_CLUSTERS: @@ -50,6 +51,8 @@ def ExamplePath(self): return '../' elif self == HostApp.SHELL: return 'shell/standalone' + elif self == HostApp.CERT_TOOL: + return '..' else: raise Exception('Unknown app type: %r' % self) @@ -83,6 +86,9 @@ def OutputNames(self): elif self == HostApp.SHELL: yield 'chip-shell' yield 'chip-shell.map' + elif self == HostApp.CERT_TOOL: + yield 'cert-tool' + yield 'cert-tool.map' else: raise Exception('Unknown app type: %r' % self) @@ -169,6 +175,15 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ip self.extra_gn_options.append('chip_build_tests=true') self.build_command = 'check' + if app == HostApp.CERT_TOOL: + # Certification only built for openssl + if self.board == HostBoard.ARM64: + # OpenSSL and MBEDTLS conflict. We only cross compile with mbedtls + raise Exception( + "Cannot cross compile CERT TOOL: ssl library conflict") + self.extra_gn_options.append('chip_crypto="openssl"') + self.build_command = 'src/tools/chip-cert' + def GnBuildArgs(self): if self.board == HostBoard.NATIVE: return self.extra_gn_options diff --git a/scripts/build/testdata/build_linux_on_x64.txt b/scripts/build/testdata/build_linux_on_x64.txt index 3b2b4c3f4b49e4..539458954df38e 100644 --- a/scripts/build/testdata/build_linux_on_x64.txt +++ b/scripts/build/testdata/build_linux_on_x64.txt @@ -70,6 +70,12 @@ gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/exa # Generating linux-x64-all-clusters-ipv6only gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/all-clusters-app/linux --args=chip_inet_config_enable_ipv4=false {out}/linux-x64-all-clusters-ipv6only +# Generating linux-x64-chip-cert +gn gen --check --fail-on-unused-args --export-compile-commands --root={root} '--args=chip_crypto="openssl"' {out}/linux-x64-chip-cert + +# Generating linux-x64-chip-cert-ipv6only +gn gen --check --fail-on-unused-args --export-compile-commands --root={root} '--args=chip_inet_config_enable_ipv4=false chip_crypto="openssl"' {out}/linux-x64-chip-cert-ipv6only + # Generating linux-x64-chip-tool gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/chip-tool {out}/linux-x64-chip-tool @@ -157,6 +163,12 @@ ninja -C {out}/linux-x64-all-clusters # Building linux-x64-all-clusters-ipv6only ninja -C {out}/linux-x64-all-clusters-ipv6only +# Building linux-x64-chip-cert +ninja -C {out}/linux-x64-chip-cert src/tools/chip-cert + +# Building linux-x64-chip-cert-ipv6only +ninja -C {out}/linux-x64-chip-cert-ipv6only src/tools/chip-cert + # Building linux-x64-chip-tool ninja -C {out}/linux-x64-chip-tool