]> OCCT Git - occt-copy.git/commitdiff
0030775: Foundation Classes - Preserve application-defined top-level exception filter
authorkgv <kgv@opencascade.com>
Mon, 17 Jun 2019 15:42:36 +0000 (18:42 +0300)
committermgn <mgn@opencascade.com>
Tue, 2 Jul 2019 14:10:40 +0000 (17:10 +0300)
OSD::SetSignal() method now accepts argument resetting handler to default.
Added new method OSD::SetThreadLocalSignal() intended to setup
thread-specific handlers (e.g. _set_se_translator() on Windows) and FPE settings.

OSD_ThreadPool now uses new method instead of OSD::SetSignal().

dsetsignal syntax has been changed so that the first argument now defines
of signals should be catched by OCCT or not;
new parameter -fpe defines if FPE signals should be catched.

21 files changed:
src/Draw/Draw_BasicCommands.cxx
src/OSD/OSD.hxx
src/OSD/OSD_ThreadPool.cxx
src/OSD/OSD_signal.cxx
src/QABugs/QABugs_11.cxx
tests/bugs/fclasses/bug28829
tests/bugs/fclasses/bug30775 [new file with mode: 0644]
tests/bugs/fclasses/bug6143
tests/bugs/modalg_6/bug28054_1
tests/bugs/modalg_6/bug28054_2
tests/bugs/modalg_6/bug28706
tests/bugs/modalg_7/bug28085_1
tests/bugs/modalg_7/bug29698
tests/bugs/moddata_3/bug28175_1
tests/bugs/vis/bug29127
tests/lowalgos/intss/bug27842
tests/lowalgos/intss/bug28085_2
tests/lowalgos/intss/bug28222_1
tests/lowalgos/intss/bug28222_2
tests/lowalgos/intss/bug28222_3
tests/perf/fclasses/strtod

index 638fcfdd9d01879b95ec5e8552b0bce609339564..b640f1449d00dcf23383c63f80ac41ff028bdd86 100644 (file)
@@ -908,21 +908,71 @@ static int dperf (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char
 
 static int dsetsignal (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
 {
-  // arm FPE handler if argument is provided and its first symbol is not '0'
-  // or if environment variable CSF_FPE is set and its first symbol is not '0'
-  bool setFPE = false;
-  if (theArgNb > 1)
+  if (theArgNb < 2)
   {
-    setFPE = (theArgVec[1][0] == '1' || theArgVec[1][0] == 't');
+    theDI << "Catch signals: " << (OSD::ToCatchSignals() ? "1" : "0") << "\n"
+          << "Catch FPE:     " << (OSD::ToCatchFloatingSignals() ? "1" : "0") << "\n";
+    return 0;
   }
-  else
+
+  Standard_Integer toSetSig = -1, toSetFpe = -1;
+  for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
+  {
+    TCollection_AsciiString anArg (theArgVec[anArgIter]);
+    anArg.LowerCase();
+    if (anArg == "-fpe"
+     && toSetFpe == -1
+     && anArgIter + 1 < theArgNb)
+    {
+      TCollection_AsciiString anArgNext (theArgVec[++anArgIter]);
+      if (anArgNext == "1")
+      {
+        toSetFpe = 1;
+      }
+      else if (anArgNext == "0")
+      {
+        toSetFpe = 0;
+      }
+      else
+      {
+        std::cout << "Syntax error at '" << anArg << "'\n";
+        return 1;
+      }
+    }
+    else if (toSetSig == -1
+          && (anArg == "0" || anArg == "1"))
+    {
+      toSetSig = anArg == "1" ? 1 : 0;
+    }
+    else
+    {
+      std::cout << "Syntax error at '" << anArg << "'\n";
+      return 1;
+    }
+  }
+  if (toSetSig == -1)
+  {
+    std::cout << "Syntax error: wrong number of arguments\n";
+    return 1;
+  }
+
+  if (toSetSig == 1
+   && toSetFpe == -1)
   {
     OSD_Environment aEnv ("CSF_FPE");
     TCollection_AsciiString aEnvStr = aEnv.Value();
-    setFPE = (! aEnvStr.IsEmpty() && aEnvStr.Value(1) != '0');
+    toSetFpe = (!aEnvStr.IsEmpty() && aEnvStr.Value(1) != '0') ? 1 : 0;
+  }
+
+  OSD::SetSignal (toSetSig == 1, toSetFpe == 1);
+  if (toSetSig == 1)
+  {
+    theDI << "Signal handlers are set, with FPE " << (toSetFpe == 1 ? "armed" : "disarmed");
+  }
+  else
+  {
+    theDI << "Signal handlers are reset to defaults, with FPE " << (toSetFpe == 1 ? "armed" : "disarmed");
   }
-  OSD::SetSignal (setFPE);
-  theDI << "Signal handlers are set, with FPE " << (setFPE ? "armed" : "disarmed"); 
   return 0;
 }
 
@@ -1052,7 +1102,7 @@ void Draw::BasicCommands(Draw_Interpretor& theCommands)
          __FILE__, dmeminfo, g);
   theCommands.Add("dperf","dperf [reset] -- show performance counters, reset if argument is provided",
                  __FILE__,dperf,g);
-  theCommands.Add("dsetsignal","dsetsignal [fpe=0] -- set OSD signal handler, with FPE option if argument is given",
+  theCommands.Add("dsetsignal","dsetsignal {0|1} [-fpe {0|1}] -- set OSD signal handler, with FPE option if argument is given",
                  __FILE__,dsetsignal,g);
 
   theCommands.Add("dparallel",
index dd80e028b0833e9f735c19d0e58a3da3a5d81f9e..586998b257e5839dcb8c233602c4a2e53aa05200 100644 (file)
@@ -50,7 +50,9 @@ public:
 
   DEFINE_STANDARD_ALLOC
 
-  
+  //! Return signal catching value previously set by SetSignal().
+  Standard_EXPORT static Standard_Boolean ToCatchSignals();
+
   //! Sets signal and exception handlers.
   //!
   //! ### Windows-specific notes
@@ -102,12 +104,31 @@ public:
   //! ::throw() will be called) is regulated by the
   //! OCC_CONVERT_SIGNALS macro used during compilation of Open CASCADE and
   //! user's code. Refer to Foundation Classes User's Guide for further details.
-  //!
-  Standard_EXPORT static void SetSignal (const Standard_Boolean theFloatingSignal = Standard_True);
+  Standard_EXPORT static void SetSignal (Standard_Boolean theToCatch,
+                                         Standard_Boolean theFloatingSignal);
+
+  //! Sets signal and exception handlers.
+  static void SetSignal (const Standard_Boolean theFloatingSignal = Standard_True)
+  {
+    SetSignal (Standard_True, theFloatingSignal);
+  }
+
+  //! Initializes thread-local signal handlers.
+  //! This method sets up extra handlers which are not inherited on creation of new thread.
+  //! This includes _set_se_translator() on Windows platform and SetFloatingSignals().
+  //! The main purpose of this method is initializing handlers for newly created threads
+  //! without overriding global handlers (set by application or by OSD::SetSignal()).
+  //! In most cases OSD::SetSignal() should be called instead.
+  Standard_EXPORT static void SetThreadLocalSignal (Standard_Boolean theToCatch,
+                                                    Standard_Boolean theFloatingSignal);
 
   //! Return floating signal catching value previously set by SetSignal().
   Standard_EXPORT static Standard_Boolean ToCatchFloatingSignals();
 
+  //! Enables/disables floating signal (FPE) catching for current thread.
+  //! This call does NOT actually register any exception handler - SetSignal() should be called beforehand for complete setup.
+  Standard_EXPORT static void SetFloatingSignals (Standard_Boolean theFloatingSignal);
+
   //! Commands the process to sleep for a number of seconds.
   Standard_EXPORT static void SecSleep (const Standard_Integer aDelay);
   
index 17c5370cf12a8eb7ac927c1bc0e321b1c7b60703..83be9b7df8d71b203c06ec1656947be41fa8a172 100644 (file)
@@ -310,7 +310,7 @@ void OSD_ThreadPool::performJob (Handle(Standard_Failure)& theFailure,
 // =======================================================================
 void OSD_ThreadPool::EnumeratedThread::performThread()
 {
-  OSD::SetSignal (false);
+  OSD::SetThreadLocalSignal (OSD::ToCatchSignals(), false);
   for (;;)
   {
     myWakeEvent.Wait();
@@ -323,7 +323,7 @@ void OSD_ThreadPool::EnumeratedThread::performThread()
     myFailure.Nullify();
     if (myJob != NULL)
     {
-      OSD::SetSignal (myToCatchFpe);
+      OSD::SetThreadLocalSignal (OSD::ToCatchSignals(), myToCatchFpe);
       OSD_ThreadPool::performJob (myFailure, myJob, myThreadIndex);
       myJob = NULL;
     }
index 79031e62877eef3a4776efb47cb8e4b36f703afb..39532f4560f94fb42ac379cbc688af9f25c68d65 100644 (file)
 #include <Standard_DivideByZero.hxx>
 #include <Standard_Overflow.hxx>
 
+static Standard_Boolean OSD_WasSetSignal = Standard_False;
 static Standard_THREADLOCAL Standard_Boolean fFltExceptions = Standard_False;
 
+//=======================================================================
+//function : ToCatchSignals
+//purpose  :
+//=======================================================================
+Standard_Boolean OSD::ToCatchSignals()
+{
+  return OSD_WasSetSignal;
+}
+
 //=======================================================================
 //function : ToCatchFloatingSignals
 //purpose  :
@@ -367,13 +377,40 @@ static LONG WINAPI WntHandler (EXCEPTION_POINTERS *lpXP)
                       lpXP->ExceptionRecord->ExceptionInformation[0]);
 }
 
+//=======================================================================
+//function : SetFloatingSignals
+//purpose  :
+//=======================================================================
+void OSD::SetFloatingSignals (Standard_Boolean theFloatingSignal)
+{
+  fFltExceptions = theFloatingSignal;
+  _controlfp (theFloatingSignal ? 0 : _OSD_FPX, _OSD_FPX);
+}
+
+//=======================================================================
+//function : SetThreadLocalSignal
+//purpose  :
+//=======================================================================
+void OSD::SetThreadLocalSignal (Standard_Boolean theToCatch,
+                                Standard_Boolean theFloatingSignal)
+{
+#ifdef _MSC_VER
+  _set_se_translator (theToCatch ? TranslateSE : NULL);
+#else
+  (void )theToCatch;
+#endif
+  SetFloatingSignals (theFloatingSignal);
+}
+
 //=======================================================================
 //function : SetSignal
 //purpose  :
 //=======================================================================
-void OSD::SetSignal (const Standard_Boolean theFloatingSignal)
+void OSD::SetSignal (Standard_Boolean theToCatch,
+                     Standard_Boolean theFloatingSignal)
 {
   Standard_Mutex::Sentry aSentry (THE_SIGNAL_MUTEX); // lock the mutex to prevent simultaneous handling
+  OSD_WasSetSignal = theToCatch;
 #if !defined(OCCT_UWP) || defined(NTDDI_WIN10_TH2)
   OSD_Environment env ("CSF_DEBUG_MODE");
   TCollection_AsciiString val = env.Value();
@@ -391,37 +428,34 @@ void OSD::SetSignal (const Standard_Boolean theFloatingSignal)
   // when user's code is compiled with /EHs
   // Replaces the existing top-level exception filter for all existing and all future threads
   // in the calling process
-  ::SetUnhandledExceptionFilter (/*(LPTOP_LEVEL_EXCEPTION_FILTER)*/ WntHandler);
+  ::SetUnhandledExceptionFilter (theToCatch ? WntHandler : NULL);
 #endif // NTDDI_WIN10_TH2
 
   // Signal handlers will only be used when the method ::raise() will be used
   // Handlers must be set for every thread
-  if (signal (SIGSEGV, (void(*)(int))SIGWntHandler) == SIG_ERR)
+  void(*aHandler)(int) = theToCatch ? (void(*)(int))SIGWntHandler : (void(*)(int))SIG_DFL;
+  if (signal (SIGSEGV, aHandler) == SIG_ERR)
     cout << "signal(OSD::SetSignal) error\n";
-  if (signal (SIGFPE,  (void(*)(int))SIGWntHandler) == SIG_ERR)
+  if (signal (SIGFPE,  aHandler) == SIG_ERR)
     cout << "signal(OSD::SetSignal) error\n";
-  if (signal (SIGILL,  (void(*)(int))SIGWntHandler) == SIG_ERR)
+  if (signal (SIGILL,  aHandler) == SIG_ERR)
     cout << "signal(OSD::SetSignal) error\n";
 
   // Set Ctrl-C and Ctrl-Break handler
   fCtrlBrk = Standard_False;
 #ifndef OCCT_UWP
-  SetConsoleCtrlHandler (&_osd_ctrl_break_handler, TRUE);
-#endif
-#ifdef _MSC_VER
-//  _se_translator_function pOldSeFunc =
-  _set_se_translator (TranslateSE);
-#endif
-
-  fFltExceptions = theFloatingSignal;
-  if (theFloatingSignal)
+  if (theToCatch)
   {
-    _controlfp (0, _OSD_FPX);        // JR add :
+    SetConsoleCtrlHandler (&_osd_ctrl_break_handler, TRUE);
   }
-  else {
-    _controlfp (_OSD_FPX, _OSD_FPX); // JR add :
+  else
+  {
+    SetConsoleCtrlHandler (NULL, FALSE);
   }
-}  // end OSD :: SetSignal
+#endif
+
+  SetThreadLocalSignal (theToCatch, theFloatingSignal);
+}
 
 //============================================================================
 //==== ControlBreak
@@ -874,55 +908,73 @@ static void SegvHandler(const int theSignal,
 
 #endif
 
+//=======================================================================
+//function : SetFloatingSignals
+//purpose  :
+//=======================================================================
+void OSD::SetFloatingSignals (Standard_Boolean theFloatingSignal)
+{
+  fFltExceptions = theFloatingSignal;
+#if defined (__linux__)
+  if (theFloatingSignal)
+  {
+    feenableexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
+  }
+  else
+  {
+    fedisableexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
+  }
+#elif defined (sgi) || defined (IRIX)
+  char* aTrapFpeEnv = getenv ("TRAP_FPE");
+  if (aTrapFpeEnv == NULL)
+  {
+  #ifdef OCCT_DEBUG
+    std::cout << "On SGI you must set TRAP_FPE environment variable :\n"
+                 "set env(TRAP_FPE) \"UNDERFL=FLUSH_ZERO;OVERFL=DEFAULT;DIVZERO=DEFAULT;INT_OVERFL=DEFAULT\" or\n"
+                 "setenv TRAP_FPE \"UNDERFL=FLUSH_ZERO;OVERFL=DEFAULT;DIVZERO=DEFAULT;INT_OVERFL=DEFAULT\"\n";
+  #endif
+  }
+#endif
+}
+
+//=======================================================================
+//function : SetThreadLocalSignal
+//purpose  :
+//=======================================================================
+void OSD::SetThreadLocalSignal (Standard_Boolean theToCatch,
+                                Standard_Boolean theFloatingSignal)
+{
+  (void )theToCatch;
+  SetFloatingSignals (theFloatingSignal);
+}
+
 //============================================================================
 //==== SetSignal
 //====     Set the differents signals:
 //============================================================================
 
-void OSD::SetSignal(const Standard_Boolean aFloatingSignal)
+void OSD::SetSignal (Standard_Boolean theToCatch,
+                     Standard_Boolean theFloatingSignal)
 {
-  struct sigaction act, oact;
-  int              stat = 0;
-
-  if( aFloatingSignal ) {
-    //==== Enable the floating point exceptions ===============
+  OSD_WasSetSignal = theToCatch;
+  SetFloatingSignals (theFloatingSignal);
 #if defined (__sun) || defined (SOLARIS)
-    sigfpe_handler_type PHandler = (sigfpe_handler_type) Handler ;
-    stat = ieee_handler("set", "invalid",  PHandler);
-    stat = ieee_handler("set", "division", PHandler) || stat;
-    stat = ieee_handler("set", "overflow", PHandler) || stat;
-
-    //stat = ieee_handler("set", "underflow", PHandler) || stat;
-    //stat = ieee_handler("set", "inexact", PHandler) || stat;
-
-    if (stat) {
+  int aSunStat = 0;
+  sigfpe_handler_type anFpeHandler = (theToCatch && theFloatingSignal) ? (sigfpe_handler_type )Handler : NULL;
+  aSunStat = ieee_handler ("set", "invalid",  anFpeHandler);
+  aSunStat = ieee_handler ("set", "division", anFpeHandler) || aSunStat;
+  aSunStat = ieee_handler ("set", "overflow", anFpeHandler) || aSunStat;
+  //aSunStat = ieee_handler ("set", "underflow", anFpeHandler) || aSunStat;
+  //aSunStat = ieee_handler ("set", "inexact",   anFpeHandler) || aSunStat;
+  if (aSunStat)
+  {
 #ifdef OCCT_DEBUG
-      cerr << "ieee_handler does not work !!! KO " << endl;
-#endif
-    }
-#elif defined (__linux__)
-    feenableexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
-    fFltExceptions = Standard_True;
+    std::cerr << "ieee_handler does not work !!! KO\n";
 #endif
   }
-  else
-  {
-#if defined (__linux__)
-    fedisableexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
-    fFltExceptions = Standard_False;
 #endif
-  }
 
-#if defined (sgi) || defined (IRIX )
- char *TRAP_FPE = getenv("TRAP_FPE") ;
- if ( TRAP_FPE == NULL ) {
-#ifdef OCCT_DEBUG
-   cout << "On SGI you must set TRAP_FPE environment variable : " << endl ;
-   cout << "set env(TRAP_FPE) \"UNDERFL=FLUSH_ZERO;OVERFL=DEFAULT;DIVZERO=DEFAULT;INT_OVERFL=DEFAULT\" or" << endl ;
-   cout << "setenv TRAP_FPE \"UNDERFL=FLUSH_ZERO;OVERFL=DEFAULT;DIVZERO=DEFAULT;INT_OVERFL=DEFAULT\"" << endl ;
-#endif
- }
-#endif
+  struct sigaction act, oact;
 
   //==== Save the old Signal Handler, and set the new one ===================
 
@@ -934,14 +986,21 @@ void OSD::SetSignal(const Standard_Boolean aFloatingSignal)
   act.sa_flags   = 0 ;
 #endif
 #ifdef SA_SIGINFO
-  act.sa_flags = act.sa_flags | SA_SIGINFO ;
-  act.sa_sigaction = /*(void(*)(int, siginfo_t *, void*))*/ Handler;
+  if (theToCatch)
+  {
+    act.sa_flags = act.sa_flags | SA_SIGINFO;
+    act.sa_sigaction = Handler;
+  }
+  else
+  {
+    act.sa_handler = SIG_DFL;
+  }
 #else
-  act.sa_handler = /*(SIG_PFV)*/ Handler;
+  act.sa_handler = theToCatch ? Handler : SIG_DFL;
 #endif
 
   //==== Always detected the signal "SIGFPE" =================================
-  stat = sigaction(SIGFPE,&act,&oact);   // ...... floating point exception
+  int stat = sigaction(SIGFPE,&act,&oact);   // ...... floating point exception
   if (stat) {
 #ifdef OCCT_DEBUG
      cerr << "sigaction does not work !!! KO " << endl;
@@ -1003,11 +1062,14 @@ void OSD::SetSignal(const Standard_Boolean aFloatingSignal)
 # endif
 #endif
 
-#ifdef SA_SIGINFO
-  act.sa_sigaction = /*(void(*)(int, siginfo_t *, void*))*/ SegvHandler;
-#else
-  act.sa_handler = /*(SIG_PFV)*/ SegvHandler;
-#endif
+  if (theToCatch)
+  {
+  #ifdef SA_SIGINFO
+    act.sa_sigaction = /*(void(*)(int, siginfo_t *, void*))*/ SegvHandler;
+  #else
+    act.sa_handler = /*(SIG_PFV)*/ SegvHandler;
+  #endif
+  }
 
   if ( sigaction( SIGSEGV , &act , &oact ) )  // ...... segmentation violation
     perror("OSD::SetSignal sigaction( SIGSEGV , &act , &oact ) ") ;
@@ -1027,7 +1089,6 @@ void OSD::SetSignal(const Standard_Boolean aFloatingSignal)
      exit (1);
    }
 #endif
-
 }
 
 //============================================================================
index 3b44114f09a06f2161294a05386026911eff9caa..238374e3f1ecbd4a42d3285783ba61256139a672 100644 (file)
@@ -55,6 +55,7 @@
 #include <OSD_Exception_ACCESS_VIOLATION.hxx>
 #include <OSD_Exception_STACK_OVERFLOW.hxx>
 #include <OSD.hxx>
+#include <OSD_ThreadPool.hxx>
 #include <STEPCAFControl_Writer.hxx>
 #include <STEPControl_StepModelType.hxx>
 #include <Interface_Static.hxx>
@@ -2458,6 +2459,68 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
 
   return 0;
 }
+
+//! Auxiliary functor.
+struct TestParallelFunctor
+{
+  TestParallelFunctor() : myNbNotRaised (0), myNbSigSegv (0), myNbUnknown (0) {}
+
+  Standard_Integer NbNotRaised() const { return myNbNotRaised; }
+  Standard_Integer NbSigSegv()   const { return myNbSigSegv; }
+  Standard_Integer NbUnknown()   const { return myNbUnknown; }
+
+  void operator() (int theThreadId, int theTaskId) const
+  {
+    (void )theThreadId;
+    (void )theTaskId;
+
+    // Test Access Violation
+    {
+      try {
+        OCC_CATCH_SIGNALS
+        int* pint = NULL;
+        *pint = 4;
+        Standard_Atomic_Increment (&myNbNotRaised);
+      }
+    #ifdef _WIN32
+      catch (OSD_Exception_ACCESS_VIOLATION const&)
+    #else
+      catch (OSD_SIGSEGV const&)
+    #endif
+      {
+        Standard_Atomic_Increment (&myNbSigSegv);
+      }
+      catch (Standard_Failure const& )
+      {
+        Standard_Atomic_Increment (&myNbUnknown);
+      }
+    }
+  }
+private:
+  mutable volatile Standard_Integer myNbNotRaised;
+  mutable volatile Standard_Integer myNbSigSegv;
+  mutable volatile Standard_Integer myNbUnknown;
+};
+
+static Standard_Integer OCC30775 (Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** )
+{
+  if (theNbArgs != 1)
+  {
+    std::cout << "Syntax error: wrong number of arguments\n";
+    return 1;
+  }
+
+  Handle(OSD_ThreadPool) aPool = new OSD_ThreadPool (4);
+  OSD_ThreadPool::Launcher aLauncher (*aPool, 4);
+  TestParallelFunctor aFunctor;
+  aLauncher.Perform (0, 100, aFunctor);
+  theDI << "NbRaised: "    << (aFunctor.NbSigSegv() + aFunctor.NbUnknown()) << "\n"
+        << "NbNotRaised: " << aFunctor.NbNotRaised() << "\n"
+        << "NbSigSeg: "    << aFunctor.NbSigSegv() << "\n"
+        << "NbUnknown: "   << aFunctor.NbUnknown() << "\n";
+  return 0;
+}
+
 #if defined(_MSC_VER)
 #pragma optimize( "", on )
 #endif
@@ -4816,7 +4879,8 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands) {
   theCommands.Add("OCC5739", "OCC5739 name shape step", __FILE__, OCC5739_UniAbs, group);
   theCommands.Add("OCC6046", "OCC6046 nb_of_vectors size", __FILE__, OCC6046, group);
   theCommands.Add("OCC5698", "OCC5698 wire", __FILE__, OCC5698, group);
-  theCommands.Add("OCC6143", "OCC6143", __FILE__, OCC6143, group);
+  theCommands.Add("OCC6143", "OCC6143 catching signals", __FILE__, OCC6143, group);
+  theCommands.Add("OCC30775", "OCC30775 catching signals in threads", __FILE__, OCC30775, group);
   theCommands.Add("OCC7141", "OCC7141 [nCount] aPath", __FILE__, OCC7141, group);
   theCommands.Add("OCC7372", "OCC7372", __FILE__, OCC7372, group);
   theCommands.Add("OCC8169", "OCC8169 edge1 edge2 plane", __FILE__, OCC8169, group);
index 74b2a60d5a0a92c85e4ed22e548509204725ef40..6ffa1e5460f529fb0b06b1edfbbef361562f638b 100644 (file)
@@ -3,13 +3,13 @@
 pload QAcommands
 
 # start with enabled signals
-dsetsignal 1
+dsetsignal 1 -fpe 1
 
 # first, disable
-dsetsignal 0
+dsetsignal 1 -fpe 0
 OCC28829
 
 # then, enable
 puts "REQUIRED OCC28829 All: Standard_NumericError"
-dsetsignal 1
+dsetsignal 1 -fpe 1
 catch {OCC28829}
diff --git a/tests/bugs/fclasses/bug30775 b/tests/bugs/fclasses/bug30775
new file mode 100644 (file)
index 0000000..e5027ce
--- /dev/null
@@ -0,0 +1,23 @@
+puts "================"
+puts "0030775: OSD::SetSignal() within OSD_ThreadPool should not override global handlers"
+puts "================"
+puts ""
+
+pload QAcommands
+
+dsetsignal 1 -fpe 1
+set IsDone [catch {set aResult [OCC30775]} result]
+
+if { ${IsDone} != 0 } {
+  puts "result = ${result}"
+  puts "Faulty test case"
+} else {
+  if { [string first "NbRaised: 100" $aResult] != -1 } {
+    puts "OK test case"
+  } else {
+    puts "Faulty test case"
+  }
+}
+
+#dsetsignal 0 -fpe 0
+#set IsDone [catch {set aResult [OCC30775]} result]
index 0fa01f923de6381b222db368540495286020042f..91aac0c760bc64be2ba00010ecb48b8f67f69798 100644 (file)
@@ -15,9 +15,9 @@ pload QAcommands
 
 set BugNumber OCC6143
 
-dsetsignal 1
+dsetsignal 1 -fpe 1
 set IsDone [catch {set aResult [OCC6143]} result]
-dsetsignal
+dsetsignal 1 -fpe 0
 
 if { ${IsDone} != 0 } {
     puts "result = ${result}"
index e024183e83e4cd5e74d2e30abebc79a45fa3ca88..73febd734d9bee790e9378979799464e9034bad6 100644 (file)
@@ -8,7 +8,7 @@ puts ""
 
 set Tol 1.0e-7
 
-dsetsignal 1
+dsetsignal 1 -fpe 1
 
 restore [locate_data_file bug28054_FaceProj.brep] f1
 restore [locate_data_file bug28054_EdgeProj.brep] e1
index 89958f9bb9cd8d49358c2c585b4cf54020b58116..f7b016fc03e8bf52f3da8130bb6b714cf05b2b88 100644 (file)
@@ -9,7 +9,7 @@ puts ""
 
 set Tol 1.0e-7
 
-dsetsignal 1
+dsetsignal 1 -fpe 1
 
 cone c 0 0 0 45 0
 trimv c1 c 5 10
index 6c8fdf10087fb9fcd6b323a89fd12b82a2ca3390..50b145ed4f5514670db4038b50c1018624c297e1 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 #  Incomplete result of section operation between attached shapes
 #######################################################################
 
-dsetsignal 1
+dsetsignal 1 -fpe 1
 
 # Before the fix, section curve was incomplete
 
index 40eb2a8fa2c1f32aeaeb3a6aad4392f4b4403950..16bac220d45ff967e46b8bb49fe60355e41ac50c 100644 (file)
@@ -4,7 +4,7 @@ puts "============"
 puts ""
 
 # enable FPE signals
-dsetsignal 1
+dsetsignal 1 -fpe 1
 
 restore [locate_data_file bug28085_object.brep] b1
 restore [locate_data_file bug28085_tool.brep] b2
index 04deaadc2c77e7688adadd70850a19354aca8d88..6e4b9d03f9e8caa50833c22971934a07bb51984d 100644 (file)
@@ -15,7 +15,7 @@ restore [locate_data_file bug26952_B41.brep] b1
 restore [locate_data_file bug26952_Tank41_1.brep] b2
 
 # enable FPE signals
-dsetsignal 1
+dsetsignal 1 -fpe 1
 
 bclearobjects
 bcleartools
@@ -25,7 +25,7 @@ bfillds
 bbop result 0
 
 # disable FPE signals
-dsetsignal 0
+dsetsignal 1 -fpe 0
 
 checkprops result -s 424.666
 checknbshapes result -wire 2 -face 1
index 48ffa1b23d5908a6357ab4eec339736ad185ca2c..73ff9c1032806646ee5fbddcd41d163e8937329f 100644 (file)
@@ -8,7 +8,7 @@ puts ""
 
 # Set signals on.
 pload MODELING
-dsetsignal 1
+dsetsignal 1 -fpe 1
 
 # Prepare input data.
 restore [locate_data_file bug28175_2.brep] c
index ebb94b043fb69bafd2fd737bf84ece63c550350c..29a4bc06740c7a69efa4494d0986b37f2e0fa370 100644 (file)
@@ -11,7 +11,7 @@ box b 1 2 3
 vcaps -softMode 1
 
 # disable FPE signals -- these often occur in software OpenGL drivers
-dsetsignal 0
+dsetsignal 1 -fpe 0
 
 vclear
 vinit View1
index e55c77dcff453d621a8ca30a0bf0af954161a34e..b586fab983c3b896b8eda55da458047389d9c53d 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 # Exception in intersection algorithm if FPE is switched on
 ######################################################
 
-dsetsignal 1
+dsetsignal 1 -fpe 1
 
 restore [locate_data_file bug27842_shape1_fix.brep] b1 
 restore [locate_data_file bug27842_shape2_fix.brep] b2
index a4ef28b2db0ae0ada3cb30c2af5d8fc6aa64a7b4..606f604e2abe86abc811d9dcd4cf1cc90b4464ec 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 foreach a [directory c_*] {unset $a}
 
 # enable FPE signals
-dsetsignal 1
+dsetsignal 1 -fpe 1
 
 restore [locate_data_file bug28883_Prism.brep] b1
 restore [locate_data_file bug28883_LES_2d_shell.brep] b2
index d6bf565cb73daf4122a4f19b076642cef84fd580..104ce8968fc78b4c6010c89eec458e563dddd9e0 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 #  Intersection of two cylinders fails
 #######################################################################
 
-dsetsignal 1
+dsetsignal 1 -fpe 1
 
 set GoodNbCurv 4
 
index 3fd838d95865927d817e20d62e87e6474da6ab61..c8e536dfe6c006d6f65d5c70e1c994b2321cf5a5 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 #  Intersection of two cylinders fails
 #######################################################################
 
-dsetsignal 1
+dsetsignal 1 -fpe 1
 
 set GoodNbCurv 4
 
index 3e1f0ac0f4855681f7d779d971b3d1fa907e90d3..054147975365fd6d74ad5129f7cffd1e3e187237 100644 (file)
@@ -6,7 +6,7 @@ puts ""
 #  Intersection of two cylinders fails
 #######################################################################
 
-dsetsignal 1
+dsetsignal 1 -fpe 1
 
 set GoodNbCurv 2
 
index 50a7369a71f27714b3fd30dc9a3d1a64f3d5e82e..9722a0ae74c7fe301da4b92b91d5c1aa0e122122 100644 (file)
@@ -39,7 +39,7 @@ puts "1M random values, 18 significant digits, in range (-1e305, 1e305)"
 CheckAtof 1000000 16 -1e305 1e305
 
 # Disarm FPE signals - otherwise they will be raised if signaling NAN appears
-dsetsignal 0
+dsetsignal 1 -fpe 0
 
 puts "Special values + 1M values defined by random binary data, 10 digits"
 CheckAtof 1000000 10 0 0