test-bugzilla-files/new-control.py |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 5a9fa894bb0e546fc0d825ee3458b89ffce7fd27
Author:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
AuthorDate: Fri Aug 19 15:31:48 2022 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Sep 14 11:46:05 2022 +0200

    Use more CRASHTESTDATA in new-control.py
    
    Change-Id: Iddc214708a1c040d9ab974450ad5093b0ef209ef
    Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/138719
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/test-bugzilla-files/new-control.py 
b/test-bugzilla-files/new-control.py
index e50f01f..cda4cb7 100644
--- a/test-bugzilla-files/new-control.py
+++ b/test-bugzilla-files/new-control.py
@@ -55,23 +55,23 @@ def execute_task(task_file, asan):
 
 def saveAsPreviousState(exported_files):
     odf_file_ext = ['odt', 'odp', 'odb', 'ods', 'odg']
-    previous_path = "/srv/crashtestdata/previous"
+    previous_path = os.environ["CRASHTESTDATA"] + "/previous"
     if os.path.exists(previous_path):
         rmtree(previous_path)
 
     for ext in odf_file_ext:
-        os.makedirs(previous_path + "/srv/crashtestdata/files/"+ ext)
+        os.makedirs(previous_path + os.environ["CRASHTESTDATA"] + "/files/"+ 
ext)
 
-    prefix = "/srv/crashtestdata/current"
+    prefix = os.environ["CRASHTESTDATA"] + "/current"
     for file in exported_files:
         ext = file[-3:]
         if ext in odf_file_ext and os.path.exists(file):
-            
os.makedirs(os.path.dirname("/srv/crashtestdata/previous"+file[len(prefix):]), 
exist_ok=True)
-            copyfile(file, "/srv/crashtestdata/previous"+file[len(prefix):])
+            os.makedirs(os.path.dirname(os.environ["CRASHTESTDATA"] + 
"/previous"+file[len(prefix):]), exist_ok=True)
+            copyfile(file, os.environ["CRASHTESTDATA"] + 
"/previous"+file[len(prefix):])
 
     SHAcmd = "cd $SRCDIR && git rev-parse HEAD"
     previous_SHA = str(subprocess.check_output(SHAcmd, shell=True), 
encoding='utf-8')
-    previous_SHA_file = open("/srv/crashtestdata/previous/hash.txt", "w")
+    previous_SHA_file = open(os.environ["CRASHTESTDATA"] + 
"/previous/hash.txt", "w")
     previous_SHA_file.write(previous_SHA)
     previous_SHA_file.close()
 
@@ -91,7 +91,7 @@ def checkDiskSpace():
     freeGiB = free // (2**30)
     disk_space_limit = int(os.environ["DISKSPACELIMIT"])
     if freeGiB <= disk_space_limit:
-        diskusagefile = open("/srv/crashtestdata/diskusageinfo.txt", "w")
+        diskusagefile = open(os.environ["CRASHTESTDATA"] + 
"/diskusageinfo.txt", "w")
         diskusagefile.write(str(freeGiB))
         diskusagefile.close()
 
@@ -101,7 +101,7 @@ def checkCPULoadAverage():
     cpu_loadavg_limit = float(os.environ["CPULOADAVGLIMIT"])
 
     if cpuload > cpu_loadavg_limit:
-        cpuusagefile = open("/srv/crashtestdata/cpuusageinfo.txt", "w")
+        cpuusagefile = open(os.environ["CRASHTESTDATA"] + "/cpuusageinfo.txt", 
"w")
         cpuusagefile.write(str(cpuload))
         cpuusagefile.close()
 
@@ -168,7 +168,7 @@ if __name__ == "__main__":
             else:
                 print('%r successfully passed' % (task))
 
-    exported_files = 
get_list_of_files("/srv/crashtestdata/current/srv/crashtestdata/files/")
+    exported_files = get_list_of_files(os.environ["CRASHTESTDATA"] + 
"/current/srv/crashtestdata/files/")
     checkDiskSpace()
 
     if os.getenv('SAVEPREVIOUSSTATE'):

Reply via email to