Boost logo

Boost Testing :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-04-04 05:35:16


Rene Rivera wrote:

> Aleksey Gurtovoy wrote:
>> Rene Rivera writes:
>>
>>>Martin Slater wrote:
>>>
>>>>What scope are you looking for in this, just window or cross platform?
>>>>I've not developed under *nix for a while but I assume this is mainly a
>>>>windows problem.
>>>
>>>It's a Windows only problem.
>>
>> Strictly speaking, it's not. Compilers and tests can still hang forever,
>> which happens with gcc and Serialization library on OS X. IOW, the set of
>> problems might vary from platform to platform, but _some_ build
>> monitoring tool is needed regardless of the OS you are running on.
>
> Hmm.. good point! I was only thinking of the GUI intrusive problems.
> Forgot about the non-GUI problems like infinite loops in the compiler,
> and unbounded slow memory use.
>
> So for those types of problems having a monitor that puts bounds on
> memory and time would be awesome.

Hmm... "ulimit" might do the trick. Except that it can control max cpu time
of a process, but not max real time. So, a process stuck in I/O operation
might not be killed. For memory, the following works:

#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include <stdio.h>

int main(int ac, char* av[])
{
    rlimit r = {100000, 100000};
    if (setrlimit(RLIMIT_AS, &r))
    {
        perror("setrlmit");
    }
    int* u = new int[100000];
}

The only drawback is that process is simply refused more memory, so operator
new[] fails, throws and everything aborts. Not very useful diagnostic.

- Volodya


Boost-testing list run by mbergal at meta-comm.com