Run yaml and unit test for unified coverage (#22892)
* Include yaml test into test coverage result
* Address review comments
diff --git a/BUILD.gn b/BUILD.gn
index e5b64a2..e21616f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -43,6 +43,9 @@
(current_os == "mac" || current_os == "linux") &&
(host_cpu == "x64" || host_cpu == "arm64" || host_cpu == "arm")
enable_pylib = false
+
+ # Build the Linux all clusters app example with default group
+ chip_build_all_clusters_app = false
}
if (enable_fuzz_test_targets) {
@@ -218,6 +221,16 @@
if (build_tv_casting_common_a) {
deps += [ "${chip_root}/examples/tv-casting-app/tv-casting-common:tvCastingCommon" ]
}
+
+ if (chip_build_all_clusters_app) {
+ if (is_libfuzzer) {
+ deps += [ "${chip_root}/examples/all-clusters-app/linux:chip-all-clusters-app-fuzzing" ]
+ } else {
+ deps += [
+ "${chip_root}/examples/all-clusters-app/linux:chip-all-clusters-app",
+ ]
+ }
+ }
}
if (chip_build_tools) {
diff --git a/scripts/build_coverage.sh b/scripts/build_coverage.sh
index 91f5e7f..d89967f 100755
--- a/scripts/build_coverage.sh
+++ b/scripts/build_coverage.sh
@@ -46,6 +46,7 @@
OUTPUT_ROOT="$CHIP_ROOT/out/coverage"
COVERAGE_ROOT="$OUTPUT_ROOT/coverage"
skip_gn=false
+run_yaml=false
help() {
@@ -53,6 +54,7 @@
echo "General Options:
-h, --help Display this information.
+ -f, --full Run both yaml and unit tests for unified coverage.
Input Options:
-o, --output_root Set the build output directory. When set manually, performs only lcov stage
on provided build output. Assumes output_root has been built with 'use_coverage=true'
@@ -68,6 +70,9 @@
help
exit 1
;;
+ --full | -f)
+ run_yaml=true
+ ;;
--output_root | -o)
OUTPUT_ROOT=$2
COVERAGE_ROOT="$OUTPUT_ROOT/coverage"
@@ -88,10 +93,27 @@
# Generates ninja files
if [ "$skip_gn" == false ]; then
- gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args='use_coverage=true'
+ gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args='use_coverage=true chip_build_all_clusters_app=true'
+ ninja -C "$OUTPUT_ROOT"
+fi
+
+# Run unit tests
+if [ "$skip_gn" == false ]; then
ninja -C "$OUTPUT_ROOT" check
fi
+# Run yaml tests
+if [ "$run_yaml" == true ]; then
+ scripts/run_in_build_env.sh \
+ "./scripts/tests/run_test_suite.py \
+ --chip-tool ""$OUTPUT_ROOT/chip-tool \
+ run \
+ --iterations 1 \
+ --test-timeout-seconds 120 \
+ --all-clusters-app ""$OUTPUT_ROOT/chip-all-clusters-app
+ "
+fi
+
# Remove unit test itself from coverage statistics
find "$OUTPUT_ROOT/obj/src/" -depth -name 'tests' -exec rm -rf {} \;