diff options
Diffstat (limited to 'test-bugzilla-files/new-control.py')
-rw-r--r-- | test-bugzilla-files/new-control.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/test-bugzilla-files/new-control.py b/test-bugzilla-files/new-control.py index e8cc89f3..2a95970a 100644 --- a/test-bugzilla-files/new-control.py +++ b/test-bugzilla-files/new-control.py @@ -52,26 +52,27 @@ def execute_task(task_file, asan): elif asan == 0: subprocess.call("./execute.sh " + task_file, shell=True) time.sleep(1) + os.remove(task_file) 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 ~/source/libo-core/ && git rev-parse HEAD" + 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 +92,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 +102,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() @@ -149,8 +150,8 @@ if __name__ == "__main__": print("no valid directory") sys.exit(1) - task_size = 100 - workers = 30 + task_size = int(os.environ["FILESNR"]) + workers = int(os.environ["WORKERS"]) if asan == 1: workers = 64 @@ -168,7 +169,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/" + os.environ["CRASHTESTDATA"] + "/files/") checkDiskSpace() if os.getenv('SAVEPREVIOUSSTATE'): |