diff options
author | Gülşah Köse <gulsah.kose@collabora.com> | 2021-09-15 17:31:32 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-09-17 08:41:24 +0200 |
commit | 4f337cfd71a0047e134f4f80476efe3db16a96f5 (patch) | |
tree | 9a5b5bc9ab706d109a5ef1280b8c349bfd90306c /test-bugzilla-files | |
parent | fdae1595ab45aac688e83e199328829a0e39bc49 (diff) |
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@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'test-bugzilla-files')
-rw-r--r-- | test-bugzilla-files/new-control.py | 13 | ||||
-rwxr-xr-x | test-bugzilla-files/zip.sh | 11 |
2 files changed, 23 insertions, 1 deletions
diff --git a/test-bugzilla-files/new-control.py b/test-bugzilla-files/new-control.py index f5faa0a6..10479a4d 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 b9bb808d..92b98015 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@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@lists.freedesktop.org -u "Crash test update" -m "$(cat /srv/crashtestdata/mail.txt)" -a logs/*.csv fi |