[Libreoffice-commits] dev-tools.git: test-bugzilla-files/new-control.py test-bugzilla-files/zip.sh
GülÅah Köse (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 21 07:27:04 UTC 2021
test-bugzilla-files/new-control.py | 16 ++++++++++++++++
test-bugzilla-files/zip.sh | 7 +++++++
2 files changed, 23 insertions(+)
New commits:
commit d26dac1442083ce330c17546d468f042cd90eee8
Author: Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Fri Sep 17 14:31:55 2021 +0300
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Sep 21 09:26:46 2021 +0200
Show a warning if memory usage is higher than limit.
If memory usage is higher than limit, we will add a
warning line to mail body.
Change-Id: Id18b391aad825f61dff0ba2c86f6cab6e4faf8f7
Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/122243
Tested-by: Miklos Vajna <vmiklos at collabora.com>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/test-bugzilla-files/new-control.py b/test-bugzilla-files/new-control.py
index a83c65a..ab82a08 100644
--- a/test-bugzilla-files/new-control.py
+++ b/test-bugzilla-files/new-control.py
@@ -98,6 +98,21 @@ def checkCPULoadAverage():
cpuusagefile.write(str(cpuload))
cpuusagefile.close()
+def checkMemoryUsage():
+ memory_info = dict((i.split()[0].rstrip(':'),int(i.split()[1])) for i in open('/proc/meminfo').readlines())
+ total_memory = memory_info['MemTotal']
+ # Not Total - Free, as that would include caches as well, which is not interesting for us.
+ used_memory = total_memory - memory_info['MemAvailable']
+
+ usage = used_memory / total_memory
+ usage_in_percent = round(round(usage, 2)*100)
+ limit = 90
+
+ if usage_in_percent > limit:
+ memoryusagefile = open(os.environ["CRASHTESTDATA"]+"/memoryusageinfo.txt", "w")
+ memoryusagefile.write(str(usage_in_percent)+'%')
+ memoryusagefile.close()
+
def usage():
message = """usage: {program} [option] dir"
- h | --help: print usage information
@@ -134,6 +149,7 @@ if __name__ == "__main__":
checkCPULoadAverage()
checkDiskSpace()
+ checkMemoryUsage()
with concurrent.futures.ThreadPoolExecutor(max_workers=workers) as executor:
future_to_task = {executor.submit(execute_task, task_file, asan): task_file for task_file in get_tasks(directory, task_size)}
for future in concurrent.futures.as_completed(future_to_task):
diff --git a/test-bugzilla-files/zip.sh b/test-bugzilla-files/zip.sh
index a0c2202..1e5026e 100755
--- a/test-bugzilla-files/zip.sh
+++ b/test-bugzilla-files/zip.sh
@@ -46,6 +46,12 @@ if [ -e $cpuusagefile ]; then
rm $cpuusagefile
fi
+memoryusagefile=$CRASHTESTDATA/memoryusageinfo.txt
+if [ -e $memoryusagefile ]; then
+ memory_usage="$(cat $memoryusagefile)"
+ rm $memoryusagefile
+fi
+
cat << EOF > mail.txt
Hi,
@@ -61,6 +67,7 @@ EOF
[ ! -z "${free_disk_space}" ] && echo "Warning! Remaining disk space is ${free_disk_space} GiB." >> mail.txt && echo "" >> mail.txt
[ ! -z "${cpu_usage}" ] && echo "Warning! CPU load average is ${cpu_usage}." >> mail.txt && echo "" >> mail.txt
+[ ! -z "${memory_usage}" ] && echo "Warning! Memory usage is ${memory_usage}." >> mail.txt && echo "" >> mail.txt
cat << EOF >> mail.txt
- Your friendly crashtest bot
More information about the Libreoffice-commits
mailing list