build: add test for checking consistency of "nm-autoptr.h"
This commit is contained in:
10
Makefile.am
10
Makefile.am
@@ -1861,6 +1861,11 @@ nodist_libnminclude_HEADERS += \
|
||||
|
||||
EXTRA_DIST += src/libnm-client-public/meson.build
|
||||
|
||||
check-local-nm-autoptr:
|
||||
$(srcdir)/tools/check-nm-autoptr.sh
|
||||
|
||||
check_local += check-local-nm-autoptr
|
||||
|
||||
###############################################################################
|
||||
|
||||
noinst_PROGRAMS += src/libnm-core-impl/gen-metadata-nm-settings-libnm-core
|
||||
@@ -5792,20 +5797,21 @@ EXTRA_DIST += \
|
||||
\
|
||||
src/contrib/nm-vpn-editor-plugin-call.h \
|
||||
\
|
||||
tools/check-compare-generated.sh \
|
||||
tools/check-config-options.sh \
|
||||
tools/check-docs.sh \
|
||||
tools/check-exports.sh \
|
||||
tools/check-compare-generated.sh \
|
||||
tools/check-gitlab-ci.sh \
|
||||
tools/check-nm-autoptr.sh \
|
||||
tools/check-tree.sh \
|
||||
tools/check-vapi.sh \
|
||||
tools/create-exports-NetworkManager.sh \
|
||||
tools/debug-helper.py \
|
||||
tools/enums-to-docbook.pl \
|
||||
tools/meson-post-install.sh \
|
||||
tools/run-nm-test.sh \
|
||||
tools/test-networkmanager-service.py \
|
||||
tools/test-sudo-wrapper.sh \
|
||||
tools/enums-to-docbook.pl \
|
||||
\
|
||||
src/core/settings/plugins/meson.build \
|
||||
\
|
||||
|
@@ -946,6 +946,11 @@ test(
|
||||
find_program(join_paths(source_root, 'tools', 'check-vapi.sh')),
|
||||
)
|
||||
|
||||
test(
|
||||
'check-nm-autoptr',
|
||||
find_program(join_paths(source_root, 'tools', 'check-nm-autoptr.sh')),
|
||||
)
|
||||
|
||||
subdir('examples/C/glib')
|
||||
|
||||
enable_qt = get_option('qt')
|
||||
|
26
tools/check-nm-autoptr.sh
Executable file
26
tools/check-nm-autoptr.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
die() {
|
||||
printf "%s\n" "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")/.." || die "cannot change to srcdir"
|
||||
|
||||
AUTOPTR_H=./src/libnm-client-public/nm-autoptr.h
|
||||
|
||||
for s in $( sed -n 's/^ *typedef \+struct \+.*[A-Za-z0-9_]\+ \+\(NMSetting[A-Za-z0-9_]\+\)\> *;$/\1/p' ./src/libnm-core-public/nm-core-types.h ) ; do
|
||||
grep -q "^ *G_DEFINE_AUTOPTR_CLEANUP_FUNC *( *\\<$s\\> *, *g_object_unref *)" -- "$AUTOPTR_H" || die "didn't see setting '$s' in \"$AUTOPTR_H\""
|
||||
done
|
||||
|
||||
for s in $( grep -h -o '\<NMDevice[A-Za-z0-9_]\+\>' ./src/libnm-client-public/nm-device-*.h | sort -u | grep -v 'Class$') ; do
|
||||
case "$s" in
|
||||
NMDeviceModemCapabilities| \
|
||||
NMDeviceWifiCapabilities)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
grep -q "^ *G_DEFINE_AUTOPTR_CLEANUP_FUNC *( *\\<$s\\> *, *g_object_unref *)" -- "$AUTOPTR_H" || die "didn't see device '$s' in \"$AUTOPTR_H\""
|
||||
done
|
Reference in New Issue
Block a user