32 lines
1.2 KiB
C
32 lines
1.2 KiB
C
|
|
#include "akerror.h"
|
||
|
|
#include "err_capture.h"
|
||
|
|
|
||
|
|
/*
|
||
|
|
* The library naming one of its own codes is not allowed to fail quietly.
|
||
|
|
* __akerr_name_library_status() runs from akerr_init() and from the generated
|
||
|
|
* errno table, neither of which has a caller to raise into, so a refusal there
|
||
|
|
* goes through FINISH_NORETURN: stack trace, then akerr_handler_unhandled_error,
|
||
|
|
* which terminates the process.
|
||
|
|
*
|
||
|
|
* In a correct build that can only happen with a name table too small to hold
|
||
|
|
* the library's own entries, which no test can configure (the slot count is
|
||
|
|
* PRIVATE to the library target). Calling the helper for a status the library
|
||
|
|
* does not own reaches the same refusal, so this test covers the terminal path
|
||
|
|
* itself.
|
||
|
|
*
|
||
|
|
* Registered in AKERR_WILL_FAIL_TESTS: reaching the end of main() means the
|
||
|
|
* failure was swallowed, and that is the bug this test exists to catch.
|
||
|
|
*/
|
||
|
|
|
||
|
|
int main(void)
|
||
|
|
{
|
||
|
|
akerr_init();
|
||
|
|
|
||
|
|
/* Nobody has reserved 9999, so this registration is refused. */
|
||
|
|
__akerr_name_library_status(9999, "Not The Library's To Name");
|
||
|
|
|
||
|
|
fprintf(stderr, "err_library_status_fatal: a refused library-status "
|
||
|
|
"registration did NOT terminate\n");
|
||
|
|
return 0;
|
||
|
|
}
|