From e561951d8484a5735768592dd8d2d6cd0f83fd72 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Sat, 7 Sep 2013 15:22:18 -0600 Subject: [PATCH] tests: check remaining .x files We have been adding new .x files without keeping the list of *-structs files up-to-date. This adds the support for the recent additions. In the process of testing this, I also noticed that Fedora 19's use of dwarves-1.10 (providing pdwtags version 1.9) was producing a single line on stderr but still giving enough useful info on stdout that we could check structs; the real goal of checking stderr separately from stdout was to avoid the bug in dwarves-1.9 where stdout was empty (see bug http://bugzilla.redhat.com/772358). * src/Makefile.am (struct_prefix, PROTOCOL_STRUCTS): Add missing struct tests. (PDWTAGS): Work with Fedora 19 pdwtags. (lxc_monitor_protocol-struct, lock_protocol-struct): New rules. * src/lxc_monitor_protocol-structs: New file. * src/lock_protocol-structs): Likewise. * cfg.mk (generated_files): Enlarge list. Signed-off-by: Eric Blake --- cfg.mk | 3 +- src/Makefile.am | 21 +++++++++--- src/lock_protocol-structs | 55 ++++++++++++++++++++++++++++++++ src/lxc_monitor_protocol-structs | 16 ++++++++++ 4 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 src/lock_protocol-structs create mode 100644 src/lxc_monitor_protocol-structs diff --git a/cfg.mk b/cfg.mk index b8396673f4..e6584e8a91 100644 --- a/cfg.mk +++ b/cfg.mk @@ -33,8 +33,9 @@ gnulib_dir = $(srcdir)/.gnulib # This is all gnulib files, as well as generated files for RPC code. generated_files = \ $(srcdir)/daemon/*_dispatch.h \ + $(srcdir)/src/*/*_dispatch.h \ $(srcdir)/src/remote/*_client_bodies.h \ - $(srcdir)/src/remote/*_protocol.[ch] \ + $(srcdir)/src/*/*_protocol.[ch] \ $(srcdir)/gnulib/lib/*.[ch] # We haven't converted all scripts to using gnulib's init.sh yet. diff --git a/src/Makefile.am b/src/Makefile.am index 7f76af7f51..90b75543a4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -364,10 +364,10 @@ EXTRA_DIST += $(REMOTE_DRIVER_PROTOCOL) \ # The alternation of the following regexps matches both cases. r1 = /\* \d+ \*/ r2 = /\* <[[:xdigit:]]+> \S+:\d+ \*/ -struct_prefix = (remote_|qemu_|lxc_|virNet|keepalive_) +struct_prefix = (remote_|qemu_|lxc_|keepalive|vir(Net|LockSpace|LXCMonitor)) # Depending on configure options, libtool creates one or both of -# {,.libs/}libvirt_remote_driver_la-remote_protocol.o. We want the +# {,.libs/}libvirt_driver_remote_la-remote_protocol.o. We want the # newest of the two, in case configure options changed and a stale # file is left around from an earlier build. PDWTAGS = \ @@ -376,7 +376,7 @@ PDWTAGS = \ 2>/dev/null | sed -n 1p`; \ test -f "$$o" || { echo ".o for $< not found" >&2; exit 1; }; \ pdwtags --verbose $$o > $(@F)-t1 2> $(@F)-t2; \ - if test -s $(@F)-t2; then \ + if test ! -s $(@F)-t1 && test -s $(@F)-t2; then \ rm -rf $(@F)-t?; \ echo 'WARNING: pdwtags appears broken; skipping the $@ test' >&2;\ else \ @@ -426,12 +426,17 @@ check-symsorting: $(srcdir) $(SYM_FILES) EXTRA_DIST += check-symfile.pl check-symsorting.pl +# Keep this list synced with RPC_PROBE_FILES PROTOCOL_STRUCTS = \ $(srcdir)/remote_protocol-structs \ $(srcdir)/lxc_protocol-structs \ $(srcdir)/qemu_protocol-structs \ $(srcdir)/virnetprotocol-structs \ - $(srcdir)/virkeepaliveprotocol-structs + $(srcdir)/virkeepaliveprotocol-structs \ + $(srcdir)/lxc_monitor_protocol-structs \ + $(srcdir)/lock_protocol-structs \ + $(NULL) + if WITH_REMOTE check-protocol: $(PROTOCOL_STRUCTS) $(PROTOCOL_STRUCTS:structs=struct) @@ -445,6 +450,13 @@ $(srcdir)/remote_protocol-struct \ $(srcdir)/virnetprotocol-struct $(srcdir)/virkeepaliveprotocol-struct: \ $(srcdir)/%-struct: libvirt_net_rpc_la-%.lo $(PDWTAGS) +$(srcdir)/lxc_monitor_protocol-struct: \ + $(srcdir)/%-struct: libvirt_driver_lxc_impl_la-%.lo + $(PDWTAGS) +$(srcdir)/lock_protocol-struct: \ + $(srcdir)/%-struct: lockd_la-%.lo + $(PDWTAGS) + else !WITH_REMOTE # The $(PROTOCOL_STRUCTS) files must live in git, because they cannot be # re-generated when configured --without-remote. @@ -1886,6 +1898,7 @@ tapset_DATA = libvirt_probes.stp libvirt_qemu_probes.stp libvirt_functions.stp "non_pic_object='$<'" \ > $@ +# Keep this list synced with PROTOCOL_STRUCTS RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \ $(srcdir)/rpc/virkeepaliveprotocol.x \ $(srcdir)/remote/remote_protocol.x \ diff --git a/src/lock_protocol-structs b/src/lock_protocol-structs new file mode 100644 index 0000000000..8e8b84fb3b --- /dev/null +++ b/src/lock_protocol-structs @@ -0,0 +1,55 @@ +/* -*- c -*- */ +struct virLockSpaceProtocolOwner { + virLockSpaceProtocolUUID uuid; + virLockSpaceProtocolNonNullString name; + u_int id; + u_int pid; +}; +struct virLockSpaceProtocolRegisterArgs { + virLockSpaceProtocolOwner owner; + u_int flags; +}; +struct virLockSpaceProtocolRestrictArgs { + u_int flags; +}; +struct virLockSpaceProtocolNewArgs { + virLockSpaceProtocolNonNullString path; + u_int flags; +}; +struct virLockSpaceProtocolCreateResourceArgs { + virLockSpaceProtocolNonNullString path; + virLockSpaceProtocolNonNullString name; + u_int flags; +}; +struct virLockSpaceProtocolDeleteResourceArgs { + virLockSpaceProtocolNonNullString path; + virLockSpaceProtocolNonNullString name; + u_int flags; +}; +enum virLockSpaceProtocolAcquireResourceFlags { + VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = 1, + VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = 2, +}; +struct virLockSpaceProtocolAcquireResourceArgs { + virLockSpaceProtocolNonNullString path; + virLockSpaceProtocolNonNullString name; + u_int flags; +}; +struct virLockSpaceProtocolReleaseResourceArgs { + virLockSpaceProtocolNonNullString path; + virLockSpaceProtocolNonNullString name; + u_int flags; +}; +struct virLockSpaceProtocolCreateLockSpaceArgs { + virLockSpaceProtocolNonNullString path; +}; +enum virLockSpaceProtocolProcedure { + VIR_LOCK_SPACE_PROTOCOL_PROC_REGISTER = 1, + VIR_LOCK_SPACE_PROTOCOL_PROC_RESTRICT = 2, + VIR_LOCK_SPACE_PROTOCOL_PROC_NEW = 3, + VIR_LOCK_SPACE_PROTOCOL_PROC_CREATE_RESOURCE = 4, + VIR_LOCK_SPACE_PROTOCOL_PROC_DELETE_RESOURCE = 5, + VIR_LOCK_SPACE_PROTOCOL_PROC_ACQUIRE_RESOURCE = 6, + VIR_LOCK_SPACE_PROTOCOL_PROC_RELEASE_RESOURCE = 7, + VIR_LOCK_SPACE_PROTOCOL_PROC_CREATE_LOCKSPACE = 8, +}; diff --git a/src/lxc_monitor_protocol-structs b/src/lxc_monitor_protocol-structs new file mode 100644 index 0000000000..da72ec0493 --- /dev/null +++ b/src/lxc_monitor_protocol-structs @@ -0,0 +1,16 @@ +/* -*- c -*- */ +enum virLXCMonitorExitStatus { + VIR_LXC_MONITOR_EXIT_STATUS_ERROR = 0, + VIR_LXC_MONITOR_EXIT_STATUS_SHUTDOWN = 1, + VIR_LXC_MONITOR_EXIT_STATUS_REBOOT = 2, +}; +struct virLXCMonitorExitEventMsg { + enum virLXCMonitorExitStatus status; +}; +struct virLXCMonitorInitEventMsg { + uint64_t initpid; +}; +enum virLXCMonitorProcedure { + VIR_LXC_MONITOR_PROC_EXIT_EVENT = 1, + VIR_LXC_MONITOR_PROC_INIT_EVENT = 2, +}; -- GitLab