mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0031038: Draw - adaptations for running tests with CLang address sanitizer
New optional environment variable CSF_CPULIMIT_FACTOR is introduced, allowing scaling the argument given to DRAW command cpulimit by specified factor. Command testgrid is extended by two new options: - -skipped: to re-run tests skipped in specified log - -skip: to skip specified number of tests in the beginning of test sequence Temporary Tcl scripts generated by test system are now removed from the test log directories immediately after the test execution, to save disk space. Advises on use of CLang sanitizers are added in guide "Debugging hints and tips".
This commit is contained in:
@@ -537,13 +537,24 @@ static void *CpuFunc(void* /*threadarg*/)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
static Standard_Integer cpulimit(Draw_Interpretor&, Standard_Integer n, const char** a)
|
||||
// Returns time in seconds defined by the argument string,
|
||||
// multiplied by factor defined in environment variable
|
||||
// CSF_CPULIMIT_FACTOR (if it exists, 1 otherwise)
|
||||
static clock_t GetCpuLimit (const Standard_CString theParam)
|
||||
{
|
||||
#else
|
||||
clock_t aValue = Draw::Atoi (theParam);
|
||||
|
||||
OSD_Environment aEnv("CSF_CPULIMIT_FACTOR");
|
||||
TCollection_AsciiString aEnvStr = aEnv.Value();
|
||||
if (!aEnvStr.IsEmpty())
|
||||
{
|
||||
aValue *= Draw::Atoi (aEnvStr.ToCString());
|
||||
}
|
||||
return aValue;
|
||||
}
|
||||
|
||||
static Standard_Integer cpulimit(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
#endif
|
||||
static int aFirst = 1;
|
||||
#ifdef _WIN32
|
||||
// Windows specific code
|
||||
@@ -553,7 +564,7 @@ static Standard_Integer cpulimit(Draw_Interpretor& di, Standard_Integer n, const
|
||||
if (n <= 1){
|
||||
CPU_LIMIT = RLIM_INFINITY;
|
||||
} else {
|
||||
CPU_LIMIT = Draw::Atoi (a[1]);
|
||||
CPU_LIMIT = GetCpuLimit (a[1]);
|
||||
Standard_Real anUserSeconds, aSystemSeconds;
|
||||
OSD_Chronometer::GetProcessCPU (anUserSeconds, aSystemSeconds);
|
||||
CPU_CURRENT = clock_t(anUserSeconds + aSystemSeconds);
|
||||
@@ -573,7 +584,7 @@ static Standard_Integer cpulimit(Draw_Interpretor& di, Standard_Integer n, const
|
||||
if (n <= 1)
|
||||
rlp.rlim_cur = RLIM_INFINITY;
|
||||
else
|
||||
rlp.rlim_cur = Draw::Atoi(a[1]);
|
||||
rlp.rlim_cur = GetCpuLimit (a[1]);
|
||||
CPU_LIMIT = rlp.rlim_cur;
|
||||
|
||||
int status;
|
||||
@@ -597,10 +608,10 @@ static Standard_Integer cpulimit(Draw_Interpretor& di, Standard_Integer n, const
|
||||
pthread_create(&cpulimitThread, NULL, CpuFunc, NULL);
|
||||
}
|
||||
#endif
|
||||
di << "CPU and elapsed time limit set to " << (double)CPU_LIMIT << " seconds";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : mallochook
|
||||
//purpose :
|
||||
|
Reference in New Issue
Block a user