title: unit testing for CTRL-C sent to an application
body: <p>I am developing an application handling <kbd>CTRL</kbd>-<kbd>C</kbd>. I am producing a signal handler to shut-down gracefully threads and other resources.</p>
  
  <p>I want to test <kbd>CTRL</kbd>-<kbd>C</kbd> in different scenarios where my application might be. I know how to setup those for the process under test, but I need a way (in the code of the running test suite) to check whether that condition is reached or not to call exactly <kbd>CTRL</kbd>-<kbd>C</kbd>.</p>
  
  <p>I work in Linux and I want to run my tests automatically with the help of <code>CPPUNIT</code>. In each of my <kbd>CTRL</kbd>-<kbd>C</kbd> tests I start the process and then I send <kbd>CTRL</kbd>-<kbd>C</kbd> using <code>kill</code> function having the PID of the process.</p>
  
  <p>I am using shared memory; once the tested application reaches a condition of my interest or a point when I would like to send <kbd>CTRL</kbd>-<kbd>C</kbd>, I write a tag or a state into the shared memory. Aat the same time the test suite code running in a different process is continuosly polling the shared memory and once it reads the desired state it send <kbd>CTRL</kbd>-<kbd>C</kbd>/kill.</p>
  
  <p>Do you think is a good approach or it is usually done in better/effective ways? </p>
  
  <p>Kind Regards</p>
  
  <p>AFG</p>