| 57 | #endif |
| 58 | |
| 59 | cbm_proc_outcome_t cbm_proc_classify(bool exited_normally, int exit_code, int term_signal, |
| 60 | bool timed_out) { |
| 61 | if (timed_out) { |
| 62 | return CBM_PROC_HANG; |
| 63 | } |
| 64 | if (!exited_normally) { |
| 65 | /* POSIX signal death. */ |
| 66 | #ifndef _WIN32 |
| 67 | if (cbm_is_fault_signal(term_signal)) { |
| 68 | return CBM_PROC_CRASH; |
| 69 | } |
| 70 | #else |
| 71 | (void)term_signal; |
| 72 | #endif |
| 73 | return CBM_PROC_KILLED; |
| 74 | } |
| 75 | /* Exited with a code. A Windows NTSTATUS exception code is a crash; on POSIX |
| 76 | * exit codes are 0..255 so this branch never misfires there. */ |
| 77 | if ((unsigned)exit_code == CBM_WIN_CONTROL_C_EXIT) { |
| 78 | return CBM_PROC_KILLED; |
| 79 | } |
| 80 | if ((unsigned)exit_code >= CBM_WIN_CRASH_CODE_MIN) { |
| 81 | return CBM_PROC_CRASH; |
| 82 | } |
| 83 | return (exit_code == 0) ? CBM_PROC_CLEAN : CBM_PROC_EXIT_NONZERO; |
| 84 | } |
| 85 | |
| 86 | const char *cbm_proc_outcome_str(cbm_proc_outcome_t o) { |
| 87 | switch (o) { |
no test coverage detected