title: Unit-testing MPI Programs with gtest
body: <p>I'm parallelizing an already existent application that uses gTest with MPI. In MPI programs, the first thing to do is to initialize the environment with a call to </p>
  
  <pre><code>MPI_Init( int *argc, char ***argv )
  </code></pre>
  
  <p>At the end of an MPI program the root process should also call MPI_Finalize. How can I write unit-tests for such an application using Google Test?</p>
  
  <p>In particular, how do I access argc, and argv from the tests <em>before</em> gTest modifies them. </p>
  
  <p>Right now I'm doing:</p>
  
  <pre><code>int argc = 0;
  char** argv = NULL;
  boost::mpi::environment env(argc,argv);
  
  TEST(component_test, test_name) {
    // stuff using mpi
  }
  </code></pre>
  
  <p>and feels wrong.</p>