| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | |||
| 2 | /*************************************** | ||
| 3 | Auteur : Pierre Aubert | ||
| 4 | Mail : pierre.aubert@lapp.in2p3.fr | ||
| 5 | Licence : CeCILL-C | ||
| 6 | ****************************************/ | ||
| 7 | |||
| 8 | #include <unistd.h> | ||
| 9 | #include <iostream> | ||
| 10 | #include <fstream> | ||
| 11 | |||
| 12 | #include "SignalCatcher.h" | ||
| 13 | |||
| 14 | ///Check Signal Catcher | ||
| 15 | /** @return true on success, false otherwise | ||
| 16 | */ | ||
| 17 | 1 | bool testSignalCatch(){ | |
| 18 | 1 | phoenix_addSignalCatcher(SIGQUIT); | |
| 19 | |||
| 20 | 1 | bool isSignalRecived(false); | |
| 21 | 1 | size_t delay(10lu); | |
| 22 |
3/4✓ Branch 0 (10→11) taken 3 times.
✗ Branch 1 (10→12) not taken.
✓ Branch 2 (11→4) taken 2 times.
✓ Branch 3 (11→12) taken 1 times.
|
3 | for(size_t i(0lu); i < delay && !isSignalRecived; ++i){ |
| 23 | 2 | std::cout << "Waiting for signal : i = " << i << std::endl; | |
| 24 | 2 | isSignalRecived = phoenix_isSignalRecived(SIGQUIT); | |
| 25 | 2 | usleep(10000000); | |
| 26 | } | ||
| 27 | |||
| 28 | 1 | std::cout << "testSignalCatch : isSignalRecived = " << isSignalRecived << std::endl; | |
| 29 | 1 | return isSignalRecived; | |
| 30 | } | ||
| 31 | |||
| 32 | 1 | int main(int argc, char **argv){ | |
| 33 | 1 | bool b(true); | |
| 34 |
1/1✓ Branch 0 (2→3) taken 1 times.
|
1 | b &= testSignalCatch(); |
| 35 |
3/3✓ Branch 0 (3→4) taken 1 times.
✓ Branch 2 (4→5) taken 1 times.
✓ Branch 4 (5→6) taken 1 times.
|
1 | std::cout << "final : b = " << b << std::endl; |
| 36 |
1/1✓ Branch 0 (6→7) taken 1 times.
|
1 | std::ofstream fs; |
| 37 |
1/1✓ Branch 0 (7→8) taken 1 times.
|
1 | fs.open("test_phoenix_thread_signal_catcher.log"); |
| 38 |
2/2✓ Branch 0 (8→9) taken 1 times.
✓ Branch 2 (9→10) taken 1 times.
|
1 | fs << b << std::endl; |
| 39 |
1/1✓ Branch 0 (10→11) taken 1 times.
|
1 | fs.close(); |
| 40 | 1 | return b - 1; | |
| 41 | 1 | } | |
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 |