Factorize test on cmake file