[Libvir] PATCH: Use macros to remove duplicate test code