| 46 | #endif |
| 47 | |
| 48 | cbm_proc_outcome_t cbm_proc_classify(bool exited_normally, int exit_code, int term_signal, |
| 49 | bool timed_out) { |
| 50 | if (timed_out) { |
| 51 | return CBM_PROC_HANG; |
| 52 | } |
| 53 | if (!exited_normally) { |
| 54 | /* POSIX signal death. */ |
| 55 | #ifndef _WIN32 |
| 56 | if (cbm_is_fault_signal(term_signal)) { |
| 57 | return CBM_PROC_CRASH; |
| 58 | } |
| 59 | #else |
| 60 | (void)term_signal; |
| 61 | #endif |
| 62 | return CBM_PROC_KILLED; |
| 63 | } |
| 64 | /* Exited with a code. A Windows NTSTATUS exception code is a crash; on POSIX |
| 65 | * exit codes are 0..255 so this branch never misfires there. */ |
| 66 | if ((unsigned)exit_code >= CBM_WIN_CRASH_CODE_MIN) { |
| 67 | return CBM_PROC_CRASH; |
| 68 | } |
| 69 | return (exit_code == 0) ? CBM_PROC_CLEAN : CBM_PROC_EXIT_NONZERO; |
| 70 | } |
| 71 | |
| 72 | const char *cbm_proc_outcome_str(cbm_proc_outcome_t o) { |
| 73 | switch (o) { |
no test coverage detected