[Libreoffice-commits] dev-tools.git: test-bugzilla-files/config test-bugzilla-files/new-control.py

Gülşah Köse (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 8 11:16:48 UTC 2021


 test-bugzilla-files/config         |    5 +++++
 test-bugzilla-files/new-control.py |   11 ++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit fefe99d83597e44f994c95aeaa36609cbda79400
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Fri Oct 8 10:29:17 2021 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Oct 8 13:16:30 2021 +0200

    Read limit values from config file.
    
    Remaining disk space, memory usage and CPU load limit values are moved
    to config file.
    
    Change-Id: Ia5a416d24dfa23a5c20f57eca6104f91f5388f64
    Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/123248
    Tested-by: Miklos Vajna <vmiklos at collabora.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/test-bugzilla-files/config b/test-bugzilla-files/config
index 3605bed..9622054 100644
--- a/test-bugzilla-files/config
+++ b/test-bugzilla-files/config
@@ -3,6 +3,11 @@ export SRCDIR=/home/$USER/source/libo-core
 export INSTDIR=/home/$USER/build/instdir
 export USERDIR=/home/$USER/.config
 
+# Warning limits
+export DISKSPACELIMIT=5      # Remaining disk space warning limit in GiB.
+export MEMORYLIMIT=90        # Memory usage warning limit in percent.
+export CPULOADAVGLIMIT=0.9   # CPU load average limit for per core in last minute. min 0, max 1.
+
 # For development purposes:
 # Don't touch the core.git source/build directory:
 # export CRASHTEST_READONLY_CORE=1
diff --git a/test-bugzilla-files/new-control.py b/test-bugzilla-files/new-control.py
index ab82a08..ee8befe 100644
--- a/test-bugzilla-files/new-control.py
+++ b/test-bugzilla-files/new-control.py
@@ -83,7 +83,8 @@ def get_list_of_files(directory_name):
 def checkDiskSpace():
     total, used, free = disk_usage(os.environ["CRASHTESTDATA"])
     freeGiB = free // (2**30)
-    if freeGiB <= 5:
+    disk_space_limit = int(os.environ["DISKSPACELIMIT"])
+    if freeGiB <= disk_space_limit:
         diskusagefile = open("/srv/crashtestdata/diskusageinfo.txt", "w")
         diskusagefile.write(str(freeGiB))
         diskusagefile.close()
@@ -91,9 +92,9 @@ def checkDiskSpace():
 def checkCPULoadAverage():
     cpuload, _, _ = os.getloadavg()
     cpuload /= float(os.cpu_count())
-    limit = 0.9
+    cpu_loadavg_limit = float(os.environ["CPULOADAVGLIMIT"])
 
-    if cpuload > limit:
+    if cpuload > cpu_loadavg_limit:
         cpuusagefile = open("/srv/crashtestdata/cpuusageinfo.txt", "w")
         cpuusagefile.write(str(cpuload))
         cpuusagefile.close()
@@ -106,9 +107,9 @@ def checkMemoryUsage():
 
     usage = used_memory / total_memory
     usage_in_percent = round(round(usage, 2)*100)
-    limit = 90
+    memory_limit = int(os.environ["MEMORYLIMIT"])
 
-    if usage_in_percent > limit:
+    if usage_in_percent > memory_limit:
         memoryusagefile = open(os.environ["CRASHTESTDATA"]+"/memoryusageinfo.txt", "w")
         memoryusagefile.write(str(usage_in_percent)+'%')
         memoryusagefile.close()


More information about the Libreoffice-commits mailing list