[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
Fri Sep 17 06:41:47 UTC 2021


 test-bugzilla-files/new-control.py |   13 ++++++++++++-
 test-bugzilla-files/zip.sh         |   11 +++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 4f337cfd71a0047e134f4f80476efe3db16a96f5
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Wed Sep 15 17:31:32 2021 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Sep 17 08:41:24 2021 +0200

    Show a warning if remaining disk space less than 5 GiB
    
    We show a warning at the output of the command.sh. Then we added that
    warning to mail body.
    
    Change-Id: I87efd38dc7e370ed497c0f56ebb8e09a1dc26aa3
    Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/122111
    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 f5faa0a..10479a4 100644
--- a/test-bugzilla-files/new-control.py
+++ b/test-bugzilla-files/new-control.py
@@ -23,7 +23,7 @@ import time
 import subprocess
 import getopt
 import sys
-from shutil import copyfile, rmtree
+from shutil import copyfile, rmtree, disk_usage
 
 def partition(l, n):
     for i in range(0, len(l), n):
@@ -80,6 +80,14 @@ def get_list_of_files(directory_name):
             all_files.append(full_path)
     return all_files
 
+def checkDiskSpace():
+    total, used, free = disk_usage(os.environ["CRASHTESTDATA"])
+    freeGiB = free // (2**30)
+    if freeGiB <= 5:
+        diskusagefile = open("/srv/crashtestdata/diskusageinfo.txt", "w")
+        diskusagefile.write(str(freeGiB))
+        diskusagefile.close()
+
 def usage():
     message = """usage: {program} [option] dir"
  - h | --help: print usage information
@@ -114,6 +122,7 @@ if __name__ == "__main__":
     if asan == 1:
         workers = 64
 
+    checkDiskSpace()
     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):
@@ -126,4 +135,6 @@ if __name__ == "__main__":
                 print('%r successfully passed' % (task))
 
     exported_files = get_list_of_files("/srv/crashtestdata/current/srv/crashtestdata/files/")
+    checkDiskSpace()
     saveAsPreviousState(exported_files)
+    checkDiskSpace()
diff --git a/test-bugzilla-files/zip.sh b/test-bugzilla-files/zip.sh
index b9bb808..92b9801 100755
--- a/test-bugzilla-files/zip.sh
+++ b/test-bugzilla-files/zip.sh
@@ -34,6 +34,11 @@ if [ -z "$CRASHTEST_NO_UPLOAD" ]; then
     ssh upload at gimli.documentfoundation.org unzip -n /srv/www/dev-builds.libreoffice.org/crashtest/current.zip -d /srv/www/dev-builds.libreoffice.org/crashtest
 fi
 cd /srv/crashtestdata/
+diskusagefile=/srv/crashtestdata/diskusageinfo.txt
+if [ -e $diskusagefile ]; then
+    free_disk_space="$(cat $diskusagefile)"
+    rm $diskusagefile
+fi
 cat << EOF > mail.txt
 Hi,
 
@@ -45,8 +50,14 @@ $num_of_import_crashes files have crashed during import.
 
 $num_of_export_crashes files have crashed during export.
 
+EOF
+
+[ ! -z "${free_disk_space}" ] && echo "Warning! Remaining disk space is ${free_disk_space} GiB." >> mail.txt && echo "" >> mail.txt
+
+cat << EOF >> mail.txt
 - Your friendly crashtest bot
 EOF
+
 if [ -z "$CRASHTEST_NO_EMAIL" ]; then
     /srv/crashtestdata/sendEmail -t libreoffice at lists.freedesktop.org -u "Crash test update" -m "$(cat /srv/crashtestdata/mail.txt)" -a logs/*.csv
 fi


More information about the Libreoffice-commits mailing list