There are a number of issues with unit tests on Darwin. These patches address the following:
- Unit tests should be passed -arch (-m32/-m64 isn't sufficient)
- Unit tests should be passed ${DARWIN_osx_CFLAGS} because they're being built for OS X
- Test architectures should be filtered based on base system capabilities (i.e. don't try running x86_64h tests on pre-haswell hardware).
Since this function is Darwin-specific, maybe we want to add the darwin_ prefix, to avoid name clashes.