TEST_FAILED should allow a custom destructor / command to be called prior to aborting

Bug #1079598 reported by James Hunt on 2012-11-16
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Currently, if a test that uses NIH fails, TEST_FAILED() is called, which displays a message then calls abort(3).

As a convenience to the user, particularly to handle those scenarios where the tests are being run in an automated fashion on a system they have no access to (for example a buildd), it would be useful to provide potentially 2 facilities:

      A facility to register a void (*)(void) function that is called prior to abort(3).

(2) Have TEST_FAILED() check the value of the environment variable "NIH_TEST_FAILED_COMMAND" and if set, call:

      system (getenv ("NIH_TEST_FAILED_COMMAND")).

There are potential security implications of (2), but surely nobody builds as 'root' or grants the test user full sudo access right? :-)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers