]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
meson: add test for gtkdoc coverage
authorEmil Velikov <emil.l.velikov@gmail.com>
Wed, 4 Sep 2024 18:25:44 +0000 (19:25 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 6 Sep 2024 19:38:27 +0000 (14:38 -0500)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/94
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Makefile.am
libkmod/docs/meson.build
meson.build
scripts/check-gtkdoc.sh [new file with mode: 0755]

index 16c5ae609a82d0027d44a50d239f6085ec8c0f53..6c4b00ebb354480bd8c557e587857a779b4d1505 100644 (file)
@@ -23,6 +23,7 @@ EXTRA_DIST += \
        meson_options.txt \
        testsuite/meson.build \
        scripts/build-scdoc.sh \
+       scripts/check-gtkdoc.sh \
        scripts/kmod-symlink.sh
 
 AM_CPPFLAGS = \
index ff0132c62b8c2be47592678cda1912e9f01966f9..a6d64ebf26edf16f353193ac9b8ac6d795b734fd 100644 (file)
@@ -6,7 +6,7 @@ version_file = configure_file(
   configuration: cdata,
 )
 
-gnome.gtkdoc(
+built_docs = gnome.gtkdoc(
   'libkmod',
   content_files : version_file,
   ignore_headers : [
@@ -20,3 +20,10 @@ gnome.gtkdoc(
   module_version : '3',
   main_xml : 'libkmod-docs.xml',
 )
+
+test(
+  'test-gtkdoc',
+  check_gtkdoc,
+  args : meson.current_build_dir(),
+  depends : built_docs,
+)
index c41a2bbe4e81eca35b7119edd9e21fdf5559a8de..db07e9c56e8f89b750b93f8979abf620453b5b98 100644 (file)
@@ -423,6 +423,7 @@ if get_option('manpages')
 endif
 
 if get_option('docs')
+  check_gtkdoc = find_program('scripts/check-gtkdoc.sh')
   subdir('libkmod/docs')
 endif
 
diff --git a/scripts/check-gtkdoc.sh b/scripts/check-gtkdoc.sh
new file mode 100755 (executable)
index 0000000..624837e
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -euo pipefail
+
+err=0
+
+warn() {
+    (( ++err ))
+    echo
+    echo "WARNING: $1."
+    echo "See file below for more details."
+    echo
+    echo "$2:"
+    cat "$2"
+    echo
+}
+
+cd "$1"
+
+grep -q '100%' 'libkmod-undocumented.txt' || warn 'Some APIs are missing documentation' 'libkmod-undocumented.txt'
+
+(( $(wc -l < 'libkmod-unused.txt') == 0)) || warn 'APIs are missing from the libkmod-section.txt index' 'libkmod-unused.txt'
+
+exit "$err"