Cherry picked the changes for CTest for unit tests from the master