Fix and simplify version matching for running tests