summary refs log tree commit diff
path: root/tools/check-vapi.sh
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2023-08-09 21:55:35 +0200
committerMichael Biebl <biebl@debian.org>2023-08-09 21:55:35 +0200
commit05e4a733f2141995181a551854d5df929f084adf (patch)
tree83bb937740a6667525ba0df046748ecaa829c269 /tools/check-vapi.sh
parent14b0f3a9dc9ea90d60a3b057350fd4d637dc021a (diff)
New upstream version 1.44.0 upstream/1.44.0
Diffstat (limited to 'tools/check-vapi.sh')
-rwxr-xr-xtools/check-vapi.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/check-vapi.sh b/tools/check-vapi.sh
new file mode 100755
index 00000000..da640cfd
--- /dev/null
+++ b/tools/check-vapi.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -e
+
+die() {
+    printf "%s\n" "$*" >&2
+    exit 1
+}
+
+cd "$(dirname "$(readlink -f "$0")")/.." || die "cannot change to srcdir"
+
+VAPI=./vapi/NM-1.0.metadata
+
+for s in $(grep -r -h '#define \+\<NM_SETTING_.*SETTING_NAME\>' -- ./src/libnm-core-public/ \
+           | sed -n 's/^#define \+NM_\(SETTING_[A-Z0-9_]\+\)_SETTING_NAME\> \+.*/\1/p') ; do
+    grep -q "^$s" -- "$VAPI" || die "didn't see '$s' in \"$VAPI\""
+done
+
+for f in ./src/libnm-client-public/nm-device-*.h ; do
+    D=( $(sed -n 's/^#define \+NM_IS_DEVICE_\([A-Z0-9_]\+\)_CLASS\>(.*/\1/p' "$f") )
+    test ${#D[@]} = 1 || die "did not detect device in \"$f\""
+    s="${D[0]}"
+    c="$(grep -c "^DEVICE_${s}_\* *parent=" -- "$VAPI")"
+    test "$c" = 1 || die "didn't see device '$s' in \"$VAPI\""
+done