tests: move some common functions into kdbus-util

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>