Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle Integrate QEMU testing to CI #709

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .circleci/config.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 7 additions & 12 deletions examples/chip-tests/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,15 @@ follow these steps:

#### Using QEMU

- In the root of the example directory, source `idf.sh` and use the
`defconfig` make target to configure the application with defaults.

$ source idf.sh
$ SDKCONFIG_DEFAULTS=sdkconfig_qemu.defaults idf make defconfig

- Run make to build the application

$ idf make
- Run `qemu_run.sh` located in the root of the example directory. The script
builds the application for QEMU target, executes it, and checks the test
results. The script exit status is `0` on success, and non zero on errors.
It also outputs the final test results on console.

- Build the flash image for QEMU and run the application.
$ qemu_run.sh

$ ../../../scripts/tools/build_esp32_flash_image.sh ./build/chip-crypto-tests.bin test.bin
$ ../../../scripts/tools/esp32_qemu_run.sh ./test.bin
> If you previously built the example for DevKitC or M5Stack, you should
> delete the build folder and sdkconfig prior to running `qemu_run.sh`.

#### Using DevKitC or M5Stack

Expand Down
56 changes: 56 additions & 0 deletions examples/chip-tests/esp32/qemu_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env bash
#
#
# 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.
#
#
# Description:
# This is a utility script that runs CHIP tests using ESP32 QEMU.
#

here=$(cd "$(dirname "$0")" && pwd)
chip_dir="$here/../../.."

set -e

die() {
echo "$me: *** ERROR: " "${*}"
exit 1
}

# move to the example folder, I don't work anywhere else
cd "$here" || die 'ack!, where am I?!?'

source idf.sh
SDKCONFIG_DEFAULTS=sdkconfig_qemu.defaults idf make defconfig
idf make

flash_image_file=$(mktemp)
trap "{ rm -f $flash_image_file; }" EXIT

"$chip_dir"/scripts/tools/build_esp32_flash_image.sh ./build/chip-crypto-tests.bin "$flash_image_file"
"$chip_dir"/scripts/tools/esp32_qemu_run.sh "$flash_image_file" | tee results.log

# If the logs contain failure message
if grep -F "] : FAILED" results.log; then
die 'Some tests failed. Check results.log'
fi

# If the logs do not contain final success status
if grep -F "CHIP-tests: CHIP test status: 0" results.log; then
echo "$me: All tests passed"
else
die 'Tests did not run to completion. Check results.log'
fi