]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Make the test OK on all hardware config
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 11 Oct 2021 13:01:09 +0000 (15:01 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 11 Oct 2021 13:01:09 +0000 (15:01 +0200)
src/Container/Test/CTestTestfileInstall.cmake
src/Container/Test/testcontainer.py

index 2cddc72c0427dfa0893f404a661703eee67f0f17..33360f1854347690415ffd272f8a3114faa00292 100644 (file)
@@ -19,7 +19,7 @@
 
 IF(NOT WIN32)
   SET(TEST_NAME ${COMPONENT_NAME}_testcontainer)
-  ADD_TEST(${TEST_NAME} ${SALOME_TEST_DRIVER} ${TIMEOUT} testcontainer.py)
+  ADD_TEST(${TEST_NAME} ${PYTHON_TEST_DRIVER} ${TIMEOUT} testcontainer.py)
   SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES
                                     LABELS "${COMPONENT_NAME}"
                                     ENVIRONMENT "LD_LIBRARY_PATH=${KERNEL_TEST_LIB}:$ENV{LD_LIBRARY_PATH}"
index 2f5d34fe72b0446912ae30554a93feb07e2b02b4..3789420ed7f91cb8ed7d8a04f52a6d2104467e0a 100644 (file)
@@ -65,22 +65,27 @@ class TestResourceManager(unittest.TestCase):
         loads2 = cont.loadOfCPUCores()
         self.checkLoads(cont, loads2)
         self.assertNotEqual(loads1, loads2)
+        cont.Shutdown()
 
     def test2(self):
         # Check custom script
         cont = self.getContainer("test_container_2")
-        cont.setPyScriptForCPULoad('cpu_loads = [0.1, 0.2, 0.3, 0.4]')
+        import multiprocessing as mp
+        ref_load = [max(0.1*(i+1),1.0) for i in range(mp.cpu_count())]
+        cont.setPyScriptForCPULoad('cpu_loads = {}'.format(ref_load))
         loads1 = cont.loadOfCPUCores()
-        self.assertEqual(loads1, [0.1, 0.2, 0.3, 0.4])
+        self.assertEqual(loads1, ref_load)
         cont.resetScriptForCPULoad()
         loads2 = cont.loadOfCPUCores()
         self.checkLoads(cont, loads2)
+        cont.Shutdown()
 
     def test3(self):
         # Check bad script
         cont = self.getContainer("test_container_3")
         cont.setPyScriptForCPULoad("bla-bla-bla")
         self.assertRaises(Exception, cont.loadOfCPUCores)
+        cont.Shutdown()
 
     def test4(self):
         # check memory sizes
@@ -90,6 +95,7 @@ class TestResourceManager(unittest.TestCase):
         memory_by_me = cont.getTotalPhysicalMemoryInUseByMe()
         self.assertGreater(memory_total, memory_in_use)
         self.assertGreater(memory_in_use, memory_by_me)
+        cont.Shutdown()
 
 
 if __name__ == '__main__':