Program logic bugs vs input/environmental errors

eles via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 15 09:39:46 PDT 2014


On Wednesday, 15 October 2014 at 14:47:33 UTC, Ola Fosheim 
Grøstad wrote:
> On Wednesday, 15 October 2014 at 14:25:43 UTC, Dicebot wrote:
>> How can one continue without recovering? This will result in 
>> any kind of environment not being cleaned and false failures 
>> of other tests that share it.
>
> fork()?

http://check.sourceforge.net/doc/check_html/check_2.html

"Writing a framework for C requires solving some special problems 
that frameworks for Smalltalk, Java or Python don’t have to face. 
In all of those language, the worst that a unit test can do is 
fail miserably, throwing an exception of some sort. In C, a unit 
test is just as likely to trash its address space as it is to 
fail to meet its test requirements, and if the test framework 
sits in the same address space, goodbye test framework.

To solve this problem, Check uses the fork() system call to 
create a new address space in which to run each unit test, and 
then uses message queues to send information on the testing 
process back to the test framework. That way, your unit test can 
do all sorts of nasty things with pointers, and throw a 
segmentation fault, and the test framework will happily note a 
unit test error, and chug along. "


More information about the Digitalmars-d mailing list