ya2 · news · projects · code · about

fixes for building
authorFlavio Calva <f.calva@gmail.com>
Wed, 20 Jul 2022 17:42:40 +0000 (18:42 +0100)
committerFlavio Calva <f.calva@gmail.com>
Wed, 20 Jul 2022 17:42:40 +0000 (18:42 +0100)
pmachines/app.py
prj.org
tests/test_functional.py

index 0b0234c59b46c73d76cfe070ea0373b3ed9b48b6..153ba718fc2cba436f7bbf09219f6cec6fe5f49d 100755 (executable)
@@ -8,6 +8,7 @@ from sys import platform, argv, exit
 from logging import info, debug
 from os.path import exists
 from os import makedirs
+from multiprocessing import cpu_count
 from panda3d.core import Filename, load_prc_file_data, AntialiasAttrib, \
     Texture, WindowProperties, LVector2i, TextNode
 from panda3d.bullet import BulletWorld, BulletDebugNode
@@ -304,5 +305,6 @@ class PmachinesApp:
             self.__fps_lst.pop(0)
         self.__fps_lst += [globalClock.average_frame_rate]
         if len(self.__fps_lst) == 4:
-            assert(any(fps > 55 for fps in self.__fps_lst))
+            fps_threshold = 55 if cpu_count() >= 4 else 25
+            assert(any(fps > fps_threshold for fps in self.__fps_lst), 'low fps %s' % self.__fps_lst)
         return task.again
diff --git a/prj.org b/prj.org
index 46e3f6c20db114dd6dfbc38ad0135606f8c19807..b0fab5885a014f2324eff7e5c6076058d0b3d90f 100644 (file)
--- a/prj.org
+++ b/prj.org
@@ -3,7 +3,8 @@
 #+CATEGORY: pmachines
 #+TAGS: bug(b) calendar(c) waiting(w)
 
-* CODE create builds, update website and itch.io
+* CODE asserts (also fps) only for dev or functional tests
+* READY create builds and update website/itch.io
 * READY refactoring (recurring task)
 * BACKLOG intro animation (from target item to start position)
 * BACKLOG buttons of the scenes enabled sequentially
index 994f557cacf1c35f79a0867b4d7381bb81104704..49ab3ffbd727d9d9480fd55b2ce9a1f2b9d9d31e 100644 (file)
@@ -61,7 +61,7 @@ class FunctionalTests(TestCase):
 
     def __similar_images(self, ref_img, tst_img):
         cmd = 'magick compare -metric NCC %s %s diff.png' % (ref_img, tst_img)
-        res = exec_cmd(cmd)
+        res = exec_cmd(cmd, False)
         if exists('diff.png'): remove('diff.png')
         print('compare %s %s: %s' % (ref_img, tst_img, res))
         return float(res) > .8