tests: cleanup common functions.