Fix several test failures on Linux/FreeBSD caused by compiler configuration and invalid environment.

http://reviews.llvm.org/D6392