Disable multiple ranks for non-MPI unit tests
Make tests not explicitly declared in CMake as supporting MPI only run
on a single MPI rank. This is already the case for the 'test' and
'check' targets, but manually it is possible to run them with multiple
ranks. Now all other ranks except the master will exit, and only master
will run the tests. This avoids potential race conditions in tests not
designed for concurrent execution, e.g., related to file system access.
Some cleanup of the related CMake macros.
Closes #1795
Change-Id: I69e88ba3419cce96eb5b0c7e145643accc65533d