selftests: Introduce minimal shared logic for running tests