[PATCH v4 1/8] mf/tests: Move and split some helper code around.