malsyned / pfstest

Professional Firmware Services Unit Test Framework
Other
1 stars 0 forks source link

Consider not using failure count as return value #4

Closed malsyned closed 7 years ago

malsyned commented 7 years ago

Is the number of failures a poor choice for the return value? Aren't return values > 128 reserved, and > 255 not necessarily supported? What do Unity, jUnit, Python unittest, etc. return on failure?

malsyned commented 7 years ago

Unity actually returns the failure count as its exit status. However: in POSIX systems, exit statuses are truncated at 255. Furthermore, exit statuses 127 or above are used in Linux to indicate abnormal termination or program not found. Glibc's manual explicitly advises against returning error counts:

https://www.gnu.org/software/libc/manual/html_node/Exit-Status.html

Most interesting bit from that: "For greater portability, you can use the macros EXIT_SUCCESS and EXIT_FAILURE for the conventional status value for success and failure, respectively. They are declared in the file stdlib.h."