]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
Prevent multithread test failing if only one CPU core is available
authormnt <mnt@opencascade.com>
Thu, 7 Sep 2017 08:40:06 +0000 (11:40 +0300)
committermnt <mnt@opencascade.com>
Thu, 7 Sep 2017 08:40:06 +0000 (11:40 +0300)
tests/multithread.py

index 62e8f0a13049e1e6ba1ad7e7ca956b4caae2e941..3d75848e9d02435bdcd24c326f6d1162eddb4e0a 100644 (file)
@@ -4,10 +4,13 @@ import os
 import sys
 import salome
 import time
+import multiprocessing
 
 salome.salome_init()
 theStudy = salome.myStudy
 
+cpu_count = multiprocessing.cpu_count()
+
 ###
 ### GEOM component
 ###
@@ -77,7 +80,10 @@ time3 = time.time()
 time_singlethread = time3-time2
 print "Time in 1 proc: %.3s"%(time_singlethread)
 
-assert time_multithread < time_singlethread/2.
+if cpu_count == 1:
+    print "Warning: cannot validate test - only 1 cpu core is available"
+else:
+    assert time_multithread < time_singlethread/2.
 
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(True)