test-bugzilla-files/analyze_logs.py | 5 ++-- test-bugzilla-files/test-bugzilla-files.py | 32 ++++++++++++++++++++++------- test-bugzilla-files/zip.sh | 8 ++++--- 3 files changed, 33 insertions(+), 12 deletions(-)
New commits: commit aebf2c80c3a6e70e5423c4b8209819873a22c97b Author: Miklos Vajna <[email protected]> AuthorDate: Wed Oct 13 09:08:19 2021 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Wed Oct 13 09:09:25 2021 +0200 crashtest: improve the per-run odfundifflog.csv Don't load/save it similar to other .csv files, which track the longer-term trend. That would mean the new version gets overwritten by the old state. Also make sure no duplicated headers are written to the merged .csv file. Change-Id: I6e78925611d8c6272fbfabea6b4c05881be3764e diff --git a/test-bugzilla-files/analyze_logs.py b/test-bugzilla-files/analyze_logs.py index d273da5..760b806 100644 --- a/test-bugzilla-files/analyze_logs.py +++ b/test-bugzilla-files/analyze_logs.py @@ -83,13 +83,14 @@ def import_csv(filename): infile.close() return reader -def export_csv(filename, data, reader): +def export_csv(filename, data, reader, header=True): fieldnames = set(data.keys()) if not reader is None: fieldnames.update(reader.fieldnames) writer = csv.DictWriter(open(filename, "w"), sorted(fieldnames), restval=0) - writer.writeheader() + if header: + writer.writeheader() if not reader is None: for row in reader: writer.writerow(row) diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py index b3dd53c..45b1613 100644 --- a/test-bugzilla-files/test-bugzilla-files.py +++ b/test-bugzilla-files/test-bugzilla-files.py @@ -341,7 +341,7 @@ def handleODFunDiff(file, odfundifflog): result["attr-diff-count"] = getDifferencesByType("Attribute" , odfundifflog) result["node-diff-count"] = getDifferencesByType("Node", odfundifflog) reader = import_csv("odfundifflog.csv") - export_csv("odfundifflog.csv", result, reader) + export_csv("odfundifflog.csv", result, reader, header=False) def getDifferencesByType(type, odfundifflog): difflist = odfundifflog.splitlines() diff --git a/test-bugzilla-files/zip.sh b/test-bugzilla-files/zip.sh index e169a99..4b52fb1 100755 --- a/test-bugzilla-files/zip.sh +++ b/test-bugzilla-files/zip.sh @@ -9,7 +9,8 @@ mkdir -p /srv/crashtestdata/logs/$SHA/backtraces for a in */core*; do gdb ~/build/instdir/program/soffice.bin $a -ex "thread apply all backtrace full" --batch > /srv/crashtestdata/logs/$SHA/backtraces/`dirname "$a"`-`basename "$a"`.backtrace.txt; done cat */crashlog.txt > /srv/crashtestdata/logs/$SHA/crashlog.txt cat */exportCrash.txt > /srv/crashtestdata/logs/$SHA/exportCrash.txt -cat */odfundifflog.csv > /srv/crashtestdata/logs/$SHA/odfundifflog.csv +echo "attr-diff-count,filename,node-diff-count,total-diff-count" > /srv/crashtestdata/logs/$SHA/odfundifflog.csv +cat */odfundifflog.csv >> /srv/crashtestdata/logs/$SHA/odfundifflog.csv num_of_odf_diffs=$(< "/srv/crashtestdata/logs/$SHA/odfundifflog.txt" wc -l) num_of_import_crashes=$(< "/srv/crashtestdata/logs/$SHA/crashlog.txt" wc -l) num_of_export_crashes=$(< "/srv/crashtestdata/logs/$SHA/exportCrash.txt" wc -l) @@ -26,9 +27,10 @@ unzip validation.zip -d validation unzip odfundiff.zip -d odfundiff rm *.zip cp ~/source/dev-tools/test-bugzilla-files/analyze_logs.py . -cp ../*.csv . +# No odfundifflog.csv, which is specific to a single run. +cp ../exportCrashes.csv ../importCrash.csv ../odfundiff.csv ../validationErrors.csv . python analyze_logs.py -cp *.csv ../. +cp exportCrashes.csv importCrash.csv odfundiff.csv validationErrors.csv ../. cd .. zip -r current.zip $SHA/* if [ -z "$CRASHTEST_NO_UPLOAD" ]; then commit 5b27d5915bbc0431859805a2215153577059da9c Author: Gülşah Köse <[email protected]> AuthorDate: Tue Oct 12 17:40:01 2021 +0300 Commit: Miklos Vajna <[email protected]> CommitDate: Wed Oct 13 09:09:17 2021 +0200 Analyze attr and node diffs in odfundiff logs. We create a csv file that includes filename, node diff count, attr diff count and total diff count. That will give better info which file includes what type of diffs. Change-Id: I3335b808b8b4708c09116438f8f2cbb890f063bd Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/123436 Tested-by: Miklos Vajna <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py index de6bb26..b3dd53c 100644 --- a/test-bugzilla-files/test-bugzilla-files.py +++ b/test-bugzilla-files/test-bugzilla-files.py @@ -33,6 +33,8 @@ import sys import time import uuid import datetime +import re +from analyze_logs import import_csv, export_csv import signal import threading @@ -332,12 +334,28 @@ def handleCrash(file, disposed): # crashed_files.append(file) # add here the remaining handling code for crashed files -def handleODFunDiff(file): - print("File: " + file + " has differences") - diffLog = open("odfundifflog.txt", "a") - diffLog.write('Difference in :' + file) - diffLog.write('\n') - diffLog.close() +def handleODFunDiff(file, odfundifflog): + result = dict() + result["filename"] = file + result["total-diff-count"] = len(odfundifflog.splitlines()) - 1 # Last line of log is not a real difference + result["attr-diff-count"] = getDifferencesByType("Attribute" , odfundifflog) + result["node-diff-count"] = getDifferencesByType("Node", odfundifflog) + reader = import_csv("odfundifflog.csv") + export_csv("odfundifflog.csv", result, reader) + +def getDifferencesByType(type, odfundifflog): + difflist = odfundifflog.splitlines() + result_difflist = [] + + if type == "Attribute": + pattern = '^Difference:.*Attribute' + elif type == "Node": + pattern = '^Difference:.*Node' + + for diff in difflist: + if re.match(pattern, diff): + result_difflist.append(diff) + return len(result_difflist) def alarm_handler(args): args.kill() @@ -680,7 +698,7 @@ if __name__ == "__main__": validLog = open("/srv/crashtestdata/current" + filename + ".log.odfundiff", "w") validLog.write(output) validLog.close() - handleODFunDiff(filename) + handleODFunDiff(filename, output) except subprocess.CalledProcessError: pass else: diff --git a/test-bugzilla-files/zip.sh b/test-bugzilla-files/zip.sh index c6e5586..e169a99 100755 --- a/test-bugzilla-files/zip.sh +++ b/test-bugzilla-files/zip.sh @@ -9,7 +9,7 @@ mkdir -p /srv/crashtestdata/logs/$SHA/backtraces for a in */core*; do gdb ~/build/instdir/program/soffice.bin $a -ex "thread apply all backtrace full" --batch > /srv/crashtestdata/logs/$SHA/backtraces/`dirname "$a"`-`basename "$a"`.backtrace.txt; done cat */crashlog.txt > /srv/crashtestdata/logs/$SHA/crashlog.txt cat */exportCrash.txt > /srv/crashtestdata/logs/$SHA/exportCrash.txt -cat */odfundifflog.txt > /srv/crashtestdata/logs/$SHA/odfundifflog.txt +cat */odfundifflog.csv > /srv/crashtestdata/logs/$SHA/odfundifflog.csv num_of_odf_diffs=$(< "/srv/crashtestdata/logs/$SHA/odfundifflog.txt" wc -l) num_of_import_crashes=$(< "/srv/crashtestdata/logs/$SHA/crashlog.txt" wc -l) num_of_export_crashes=$(< "/srv/crashtestdata/logs/$SHA/exportCrash.txt" wc -l)
