mirror of
https://github.com/systemd/systemd.git
synced 2025-01-09 01:18:19 +03:00
build-sys: add a link test for exported symbols
I know that this is a pretty big net to catch some small fish, but we *do* regularly forget to properly export symbols that were supposed to be exported. This time sd_bus_get_current and some renamed symbols are caught.
This commit is contained in:
parent
2b70d172a7
commit
f1e0c18340
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
/Makefile
|
/Makefile
|
||||||
/defined
|
/defined
|
||||||
/undefined
|
/undefined
|
||||||
|
/exported
|
||||||
/TAGS
|
/TAGS
|
||||||
/accelerometer
|
/accelerometer
|
||||||
/ata_id
|
/ata_id
|
||||||
@ -156,6 +157,8 @@
|
|||||||
/test-utf8
|
/test-utf8
|
||||||
/test-util
|
/test-util
|
||||||
/test-watchdog
|
/test-watchdog
|
||||||
|
/test-libsystemd-*-sym*
|
||||||
|
/test-libudev-sym*
|
||||||
/timedatectl
|
/timedatectl
|
||||||
/udevadm
|
/udevadm
|
||||||
/v4l_id
|
/v4l_id
|
||||||
|
112
Makefile.am
112
Makefile.am
@ -4662,23 +4662,24 @@ install-tree: all
|
|||||||
# Let's run all tests of the test suite, but under valgrind. Let's
|
# Let's run all tests of the test suite, but under valgrind. Let's
|
||||||
# exclude the one perl script we have in there
|
# exclude the one perl script we have in there
|
||||||
valgrind-tests: $(TESTS)
|
valgrind-tests: $(TESTS)
|
||||||
for f in $(TESTS) ; do \
|
$(AM_V_GEN)for f in $(filter-out %.pl, $^); do \
|
||||||
[ "$$f" == "$${f/.pl/}" ] && libtool --mode=execute valgrind --leak-check=full --error-exitcode=55 $(builddir)/$$f ; \
|
echo "Running $$f"; \
|
||||||
|
libtool --mode=execute valgrind -q --leak-check=full --max-stackframe=4194400 --error-exitcode=55 $(builddir)/$$f ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
exported: $(lib_LTLIBRARIES)
|
exported: $(lib_LTLIBRARIES)
|
||||||
$(AM_V_GEN)for f in $(lib_LTLIBRARIES) ; do \
|
$(AM_V_GEN)for f in $(lib_LTLIBRARIES:.la=.so) ; do \
|
||||||
nm -g --defined-only $(builddir)/.libs/"$${f/.la/.so}" 2>&1 /dev/null | grep " T " | cut -d" " -f3 ; \
|
nm -g --defined-only $(builddir)/.libs/"$$f" 2>&1 /dev/null | grep " T " | cut -d" " -f3 ; \
|
||||||
done > $@
|
done > $@
|
||||||
|
|
||||||
check-api-docs: exported man
|
check-api-docs: exported man
|
||||||
for symbol in `cat exported` ; do \
|
$(AM_V_GEN)for symbol in `cat exported` ; do \
|
||||||
if test -f $(builddir)/man/$$symbol.html ; then \
|
if test -f $(builddir)/man/$$symbol.html ; then \
|
||||||
echo " Symbol $$symbol() is documented." ; \
|
echo " Symbol $$symbol() is documented." ; \
|
||||||
else \
|
else \
|
||||||
echo "‣ Symbol $$symbol() lacks documentation." ; \
|
echo "‣ Symbol $$symbol() lacks documentation." ; \
|
||||||
fi ; \
|
fi ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
OBJECT_VARIABLES:=$(filter %_OBJECTS,$(.VARIABLES))
|
OBJECT_VARIABLES:=$(filter %_OBJECTS,$(.VARIABLES))
|
||||||
ALL_OBJECTS:=$(foreach v,$(OBJECT_VARIABLES),$($(v)))
|
ALL_OBJECTS:=$(foreach v,$(OBJECT_VARIABLES),$($(v)))
|
||||||
@ -4694,3 +4695,102 @@ CLEANFILES += \
|
|||||||
|
|
||||||
check-api-unused: defined undefined exported
|
check-api-unused: defined undefined exported
|
||||||
( cat exported undefined ) | sort -u | diff -u - defined | grep ^+ | grep -v ^+++ | cut -c2-
|
( cat exported undefined ) | sort -u | diff -u - defined | grep ^+ | grep -v ^+++ | cut -c2-
|
||||||
|
|
||||||
|
# Stupid test that everything purported to be exported really is
|
||||||
|
|
||||||
|
define generate-sym-test
|
||||||
|
$(AM_V_at)$(MKDIR_P) $(dir $@)
|
||||||
|
$(AM_V_at)echo '#include <stdio.h>' > $@
|
||||||
|
$(AM_V_at)for file in $(notdir $(filter %.h, $^)); do \
|
||||||
|
echo "#include \"$$file\""; \
|
||||||
|
done >> $@
|
||||||
|
$(AM_V_at)echo 'void* functions[] = {' >> $@
|
||||||
|
$(AM_V_GEN)sed -r -n 's/^( +[a-zA-Z0-9_]+);/\1,/p' $< >> $@
|
||||||
|
$(AM_V_at)echo '};' >> $@
|
||||||
|
$(AM_V_at)echo 'int main(void) {' >> $@
|
||||||
|
$(AM_V_at)echo ' unsigned i; for (i=0;i<sizeof(functions)/sizeof(void*);i++) printf("%p\n", functions[i]);' >> $@
|
||||||
|
$(AM_V_at)echo 'return 0; }' >> $@
|
||||||
|
endef
|
||||||
|
|
||||||
|
test-libsystemd-bus-sym.c: \
|
||||||
|
src/libsystemd-bus/libsystemd-bus.sym \
|
||||||
|
src/systemd/sd-bus.h \
|
||||||
|
src/systemd/sd-utf8.h \
|
||||||
|
Makefile
|
||||||
|
$(generate-sym-test)
|
||||||
|
|
||||||
|
test-libsystemd-daemon-sym.c: \
|
||||||
|
src/libsystemd-daemon/libsystemd-daemon.sym \
|
||||||
|
src/systemd/sd-daemon.h \
|
||||||
|
Makefile
|
||||||
|
$(generate-sym-test)
|
||||||
|
|
||||||
|
test-libsystemd-id128-sym.c: \
|
||||||
|
src/libsystemd-id128/libsystemd-id128.sym \
|
||||||
|
src/systemd/sd-id128.h \
|
||||||
|
Makefile
|
||||||
|
$(generate-sym-test)
|
||||||
|
|
||||||
|
test-libsystemd-journal-sym.c: \
|
||||||
|
src/journal/libsystemd-journal.sym \
|
||||||
|
src/systemd/sd-journal.h \
|
||||||
|
Makefile
|
||||||
|
$(generate-sym-test)
|
||||||
|
|
||||||
|
test-libsystemd-login-sym.c: \
|
||||||
|
src/login/libsystemd-login.sym \
|
||||||
|
src/systemd/sd-login.h \
|
||||||
|
Makefile
|
||||||
|
$(generate-sym-test)
|
||||||
|
|
||||||
|
test-libudev-sym.c: \
|
||||||
|
src/libudev/libudev.sym \
|
||||||
|
src/udev/udev.h \
|
||||||
|
Makefile
|
||||||
|
$(generate-sym-test)
|
||||||
|
|
||||||
|
test_libsystemd_bus_sym_SOURCES = \
|
||||||
|
test-libsystemd-bus-sym.c
|
||||||
|
test_libsystemd_bus_sym_LDADD = \
|
||||||
|
libsystemd-bus.la
|
||||||
|
|
||||||
|
test_libsystemd_daemon_sym_SOURCES = \
|
||||||
|
test-libsystemd-daemon-sym.c
|
||||||
|
test_libsystemd_daemon_sym_LDADD = \
|
||||||
|
libsystemd-daemon.la
|
||||||
|
|
||||||
|
test_libsystemd_id128_sym_SOURCES = \
|
||||||
|
test-libsystemd-id128-sym.c
|
||||||
|
test_libsystemd_id128_sym_LDADD = \
|
||||||
|
libsystemd-id128.la
|
||||||
|
|
||||||
|
test_libsystemd_journal_sym_SOURCES = \
|
||||||
|
test-libsystemd-journal-sym.c
|
||||||
|
test_libsystemd_journal_sym_LDADD = \
|
||||||
|
libsystemd-journal.la
|
||||||
|
|
||||||
|
test_libsystemd_login_sym_SOURCES = \
|
||||||
|
test-libsystemd-login-sym.c
|
||||||
|
test_libsystemd_login_sym_LDADD = \
|
||||||
|
libsystemd-login.la
|
||||||
|
|
||||||
|
test_libudev_sym_SOURCES = \
|
||||||
|
test-libudev-sym.c
|
||||||
|
test_libudev_sym_LDADD = \
|
||||||
|
libudev.la
|
||||||
|
|
||||||
|
BUILT_SOURCES += \
|
||||||
|
$(test_libsystemd_bus_sym_SOURCES) \
|
||||||
|
$(test_libsystemd_daemon_sym_SOURCES) \
|
||||||
|
$(test_libsystemd_id128_sym_SOURCES) \
|
||||||
|
$(test_libsystemd_journal_sym_SOURCES) \
|
||||||
|
$(test_libsystemd_login_sym_SOURCES) \
|
||||||
|
$(test_libudev_sym_SOURCES)
|
||||||
|
|
||||||
|
tests += \
|
||||||
|
test-libsystemd-bus-sym \
|
||||||
|
test-libsystemd-daemon-sym \
|
||||||
|
test-libsystemd-id128-sym \
|
||||||
|
test-libsystemd-journal-sym \
|
||||||
|
test-libsystemd-login-sym \
|
||||||
|
test-libudev-sym
|
||||||
|
@ -41,9 +41,9 @@ global:
|
|||||||
sd_bus_can_send;
|
sd_bus_can_send;
|
||||||
sd_bus_get_server_id;
|
sd_bus_get_server_id;
|
||||||
sd_bus_send;
|
sd_bus_send;
|
||||||
sd_bus_send_with_reply;
|
sd_bus_call;
|
||||||
sd_bus_send_with_reply_cancel;
|
sd_bus_call_async;
|
||||||
sd_bus_send_with_reply_and_block;
|
sd_bus_call_async_cancel;
|
||||||
sd_bus_get_fd;
|
sd_bus_get_fd;
|
||||||
sd_bus_get_events;
|
sd_bus_get_events;
|
||||||
sd_bus_get_timeout;
|
sd_bus_get_timeout;
|
||||||
|
Loading…
Reference in New Issue
Block a user