test: move generate_message, add_message into test-lib-common.sh