Fix the tests script to only run the requested build modes.