summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-12-13 20:06:11 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-12-14 10:41:52 +0000
commitff73b7b3c312b9da1e7fa929b32200859061edac (patch)
tree84eefb56a14bc08360f89c5169bc534c22f05471
parenta8cdd8fb5c53f2661cc62618e5c4192011c25517 (diff)
remove exported files immediately after no longer need them
to avoid Gigs of files eating up space during a run Change-Id: I91b7babd25131691f38258221ee4918cc943d445 Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/144107 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--test-bugzilla-files/test-bugzilla-files.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py
index 16d337e0..22216137 100644
--- a/test-bugzilla-files/test-bugzilla-files.py
+++ b/test-bugzilla-files/test-bugzilla-files.py
@@ -375,7 +375,8 @@ def exportDoc(xDoc, filterName, validationCommand, filename, connection, timer):
props = [ ("FilterName", filterName) ]
saveProps = tuple([mkPropertyValue(name, value) for (name, value) in props])
# note: avoid empty path segments in the url!
- fileURL = "file://" + os.path.normpath(os.environ["CRASHTESTDATA"] + "/current/" + filename)
+ filePath = os.path.normpath(os.environ["CRASHTESTDATA"] + "/current/" + filename)
+ fileURL = "file://" + filePath
t = None
try:
args = [connection]
@@ -404,19 +405,24 @@ def exportDoc(xDoc, filterName, validationCommand, filename, connection, timer):
print("xDoc.storeToURL " + fileURL + " " + filterName + "\n")
if validationCommand:
- validationCommandWithURL = validationCommand + " " + fileURL[7:]
+ validationCommandWithURL = validationCommand + " " + filePath
print(validationCommandWithURL)
try:
output = str(subprocess.check_output(validationCommandWithURL, shell=True, timeout=600), encoding='utf-8')
print(output)
if ("Error" in output) or ("error" in output):
print("Error validating file")
- validLog = open(fileURL[7:]+".log", "w")
+ validLog = open(filePath+".log", "w")
validLog.write(output)
validLog.close()
except subprocess.CalledProcessError:
pass # ignore that exception
+ try:
+ os.remove(filePath)
+ except:
+ pass
+
def getODFunDiffCommand():
return os.environ["HOME"] + "/source/bin/odfundiff-exe"