Run yaml and unit test for unified coverage (#22892)
* Include yaml test into test coverage result
* Address review comments
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 {} \;