From d538d7a2219b970b9e844844c08e42dc1463acec Mon Sep 17 00:00:00 2001 From: aml Date: Thu, 25 Sep 2014 14:50:42 +0400 Subject: [PATCH] 0024589: Draw Harness - disable floating-point exceptions by default OSD::SetSignal() called with Standard_False argument to have FPEs disabled. Test cased modification: de step_4 G7 - fixed reference data. de iges_2 H9 - Fixed reference data. According to input file, there are big tolerance edge and surface, which leads to big tolerance in ref data, result and image has changed due to usage of these shapes instead of omitting them. de end - changed behavior in case of big isolines, now isolines not break fit command in certain places. Modeling algorithms: Fixed 0.0 / 0.0 uncertainty in circle to quasi-angular bspline conversion. Correction of test cases for issue CR24589 --- src/Convert/Convert_ConicToBSplineCurve.cxx | 21 +++++++--- src/Draw/Draw.cxx | 2 +- src/Draw/Draw_Window.cxx | 2 +- src/QABugs/QABugs_11.cxx | 45 ++++++++++++--------- tests/de/end | 12 ++++-- tests/de/iges_2/H9 | 15 +++---- tests/de/step_4/G7 | 8 +--- 7 files changed, 60 insertions(+), 45 deletions(-) diff --git a/src/Convert/Convert_ConicToBSplineCurve.cxx b/src/Convert/Convert_ConicToBSplineCurve.cxx index bfc7f3fcfe..62f428d339 100644 --- a/src/Convert/Convert_ConicToBSplineCurve.cxx +++ b/src/Convert/Convert_ConicToBSplineCurve.cxx @@ -503,11 +503,22 @@ void Convert_ConicToBSplineCurve::BuildCosAndSin( alpha_2 = alpha * 0.5e0 ; p_param = - 1.0e0 / (alpha_2 * alpha_2) ; - if (alpha_2 < M_PI * 0.5e0) { - tan_alpha_2 = Tan(alpha_2) ; - value1 = 3.0e0 * (tan_alpha_2 - alpha_2) ; - value1 = alpha_2 / value1 ; - p_param += value1 ; + if (alpha_2 < M_PI * 0.5e0) + { + if (alpha_2 < 1.0e-7) + { + // Fixed degenerate case, when obtain 0 / 0 uncertainty. + // According to Taylor aprroximation: + // b (gamma) = -6.0 / 15.0 + o(gamma^2) + p_param = -6.0 / 15.0; + } + else + { + tan_alpha_2 = Tan(alpha_2) ; + value1 = 3.0e0 * (tan_alpha_2 - alpha_2) ; + value1 = alpha_2 / value1 ; + p_param += value1 ; + } } q_param = (1.0e0 / 3.0e0) + p_param ; diff --git a/src/Draw/Draw.cxx b/src/Draw/Draw.cxx index ed04b5f8fc..30e6a626d1 100644 --- a/src/Draw/Draw.cxx +++ b/src/Draw/Draw.cxx @@ -248,7 +248,7 @@ void Draw_Appli(Standard_Integer argc, char** argv,const FDraw_InitAppli Draw_In // ***************************************************************** // set signals // ***************************************************************** - OSD::SetSignal(); + OSD::SetSignal(Standard_False); #ifdef _WIN32 // in interactive mode, force Windows to report dll loading problems interactively diff --git a/src/Draw/Draw_Window.cxx b/src/Draw/Draw_Window.cxx index 7b9208e3e4..7378ca4b30 100644 --- a/src/Draw/Draw_Window.cxx +++ b/src/Draw/Draw_Window.cxx @@ -2079,7 +2079,7 @@ static DWORD WINAPI tkLoop(VOID) #endif //#ifdef _TK // set signal handler in the new thread - OSD::SetSignal(); + OSD::SetSignal(Standard_False); // inform the others that we have started isTkLoopStarted = true; diff --git a/src/QABugs/QABugs_11.cxx b/src/QABugs/QABugs_11.cxx index a7099d5681..43766d5fe9 100644 --- a/src/QABugs/QABugs_11.cxx +++ b/src/QABugs/QABugs_11.cxx @@ -88,7 +88,7 @@ #include #include -#if ! defined(WNT) +#if ! defined(_WIN32) extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS(); #else Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS(); @@ -2357,7 +2357,8 @@ static Standard_Integer OCC5698 (Draw_Interpretor& di, Standard_Integer argc, co return 0; } -#ifdef WNT +// stack overflow can be successfully handled only on 32-bit Windows +#if defined(_WIN32) && !defined(_WIN64) static int StackOverflow (int i = -1) { char arr[2000]; @@ -2366,8 +2367,10 @@ static int StackOverflow (int i = -1) StackOverflow(i-1); return i; } +#endif // this code does not work with optimize mode on Windows +#ifdef _WIN32 #pragma optimize( "", off ) #endif static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) @@ -2394,7 +2397,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co di << " 4 / 0 = " << res << " Does not Caught... KO"<< "\n"; Succes = Standard_False; } -#if defined(SOLARIS) || defined(WNT) +#if defined(SOLARIS) || defined(_WIN32) catch(Standard_DivideByZero) #else catch(Standard_NumericError) @@ -2427,16 +2430,17 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co di << "\n"; Standard_Real res, a= 4.0, b=0.0; res = a / b; - di << " 4.0 / 0.0 = " << res << " Does not Caught... KO"<< "\n"; - Succes = Standard_False; + di << " 4.0 / 0.0 = " << res << " Does not Caught... OK"<< "\n"; } catch(Standard_DivideByZero) // Solaris, Windows w/o SSE2 { - di << " Ok" << "\n"; + di << " KO" << "\n"; + Succes = Standard_False; } catch(Standard_NumericError) // Linux, Windows with SSE2 { - di << " Ok" << "\n"; + di << " KO" << "\n"; + Succes = Standard_False; } catch(Standard_Failure) { //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl; @@ -2484,16 +2488,17 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co (void)sin(1.); //this function tests FPU flags and raises signal (tested on LINUX). - di << "-- "<