Optimized the test target
Merge pull request #5905 from LaurentGoderre/optimize-build

Optimize the test target