Skip to content

Commit

Permalink
Add chip-cert to build_examples.py (#15147)
Browse files Browse the repository at this point in the history
* Add chip cert tool to build_examples

* Add chip-cert to the example build CI

* Fix build tests unittest

* Restyle
  • Loading branch information
andy31415 authored and pull[bot] committed Aug 8, 2023
1 parent 3d49ce0 commit 1231160
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/examples-linux-standalone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 2 additions & 0 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
15 changes: 15 additions & 0 deletions scripts/build/builders/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class HostApp(Enum):
LOCK = auto()
TESTS = auto()
SHELL = auto()
CERT_TOOL = auto()

def ExamplePath(self):
if self == HostApp.ALL_CLUSTERS:
Expand All @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions scripts/build/testdata/build_linux_on_x64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 1231160

Please sign in to comment.