Function
audit_main
Audition entry point.
Parameters 🔗
argc | in | The number of program arguments. |
argv | in | Pointer to an array of program argument strings. |
Return Value 🔗
Exit status.
Discussion 🔗
If your test runner implements its own custom main
function, then it must invoke audit_main to transfer control to the Audition library. A minimal implementation of a custom main
function might look like this:
#include <audition.h>
int main(int argc, char *argv[]) {
return audit_main(argc, argv);
}
Implementing a custom main function is discouraged. If you need to perform initialization and and clean up logic before any test or suite you should use the RUNNER_SETUP and RUNNER_TEARDOWN fixtures. You should also never print or write to stdout
or stderr
from your custom main
function because the output will intermix with test reporter output which may render it invalid. For example, if you print from your custom main
function and use the JUnit XML reporter, then your printed text will appear alongside the JUnit XML which means the output will be malformed XML.
The argc
and argv
parameters must conform to the standard format expected by the main
function according to the C standard. Specifically, argc
should represent the number of command-line arguments, and argv
should be an array of strings where argv
[0] is the program name and the subsequent elements are the command-line arguments. The last element of argv
must be NULL
, indicating the end of the argument list, to comply with the C standard.