summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-08-06 16:39:23 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-08-06 16:50:09 +0100
commitb5c383a16ab10e0e950281bcfb50c73d239063ce (patch)
tree0d6631140206d608bc9e3daffac13eff76d3ee58
parenta7ef7e54fa927bab5b649a8aac6111f02d6ba34f (diff)
ci: unit-tests: Generate coverage reports
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rwxr-xr-x50-build-unit-tests.sh1
-rwxr-xr-x53-generate-coverage-reports.sh20
2 files changed, 21 insertions, 0 deletions
diff --git a/50-build-unit-tests.sh b/50-build-unit-tests.sh
index 3776fee..cfda0b9 100755
--- a/50-build-unit-tests.sh
+++ b/50-build-unit-tests.sh
@@ -19,6 +19,7 @@ function build() {
if [ ! -d "$BUILDDIR/build.ninja" ]; then
meson "$BUILDDIR" "$LIBCAMERA" \
-Db_sanitize=address,undefined \
+ -Db_coverage=true \
-Dv4l2=true \
-Dandroid=enabled \
-Ddocumentation=disabled \
diff --git a/53-generate-coverage-reports.sh b/53-generate-coverage-reports.sh
new file mode 100755
index 0000000..a8b279a
--- /dev/null
+++ b/53-generate-coverage-reports.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+
+source ./common.sh
+
+ID=$0
+logfile=$(log_filename $ID)
+
+LIBCAMERA=${1:-$(srcdir libcamera)}
+BUILDDIR=${2:-$(builddir unit-tests)}
+
+check_version "$LIBCAMERA" "$ID"
+
+# Run the unit-tests
+ninja -C $BUILDDIR coverage-html > $logfile
+pass_fail $? "Generate test coverage report"
+
+completed $ID