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

Bug #1079598 reported by James Hunt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libnih
New
Undecided
Unassigned

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:

(1) TEST_FAILURE_REGISTER_DESTRUCTOR()
      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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.