diff options
author | Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> | 2023-09-07 16:48:40 +0300 |
---|---|---|
committer | Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> | 2023-09-14 18:00:59 +0200 |
commit | 5dae4ad45be14ea5ab29308f024b8ea1dc1a02e9 (patch) | |
tree | 026ee6bfa7ab80939bf36a5e39b7161e200ac89e /bin | |
parent | 046cee10e62993238534c68e33d97ed63067b290 (diff) |
check-missing-unittests: change to dump JSON
Change-Id: I697db0cb18e0a5119be74486a2258dfb35161c04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156667
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/check-missing-unittests.py | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/bin/check-missing-unittests.py b/bin/check-missing-unittests.py index 5ea891396d6a..0ee36ef76aaf 100755 --- a/bin/check-missing-unittests.py +++ b/bin/check-missing-unittests.py @@ -21,6 +21,19 @@ def splitList(lst, n): for i in range(0, len(lst), n): yield lst[i:i + n] +def whiteboardNotes(whiteboard): + if not whiteboard: + return '' + if ' ' in whiteboard: + whiteboardList = reversed(whiteboard.split(' ')) + for w in whiteboardList: + if w.startswith("unitTestNotes"): + return w.split(':')[1] + elif whiteboard.startswith("unitTestNotes"): + return whiteboard.split(':')[1] + + return '' + def main(ignoredBugs): results = { 'export': { @@ -154,7 +167,10 @@ def main(ignoredBugs): if bugId not in hasTestSet: listOfBugIdsWithoutTest.append(bugId) + bugzillaJson = [] + resultList = [] + fixList = [] #Split the list into different chunks for the requests, otherwise it fails for chunk in splitList(listOfBugIdsWithoutTest, 50): urlGet = 'https://bugs.documentfoundation.org/rest/bug?id=' + ','.join(chunk) @@ -163,49 +179,45 @@ def main(ignoredBugs): rGet.close() bugzillaJson.extend(rawData['bugs']) - print() - print('{{TopMenu}}') - print('{{Menu}}') - print('{{Menu.Development}}') - print() - print('This report is generated by ' + os.path.basename(sys.argv[0])) - print() - print('Date: ' + str(datetime.datetime.now())) - print() - print('Commits: ' + str(len(commits))) - print() - print('Branch: ' + branch.decode().strip()) - print() - print('Hash: ' + str(last_hash.decode().strip())) - for k,v in results.items(): - print('\n== ' + k + ' ==') for k1, v1 in v.items(): - print('\n=== ' + k1 + ' ===') for bugId, info in v1.items(): resolution = '' keywords = [] priority = '' + notes = '' for bug in bugzillaJson: if str(bug['id']) == str(bugId): resolution = bug['resolution'] keywords = bug['keywords'] priority = bug['priority'] + notes = whiteboardNotes(bug['whiteboard']) break # Only care about FIXED bugs # Ignore performance bugs and accessibility bugs if resolution and resolution == 'FIXED' and 'perf' not in keywords \ and 'accessibility' not in keywords: - print( - "# {} - [{}] {} - [https://bugs.documentfoundation.org/show_bug.cgi?id={} tdf#{}]".format( - info[0], priority.upper(), info[1], bugId, bugId)) - - print('\n== ignored bugs ==') - print(' '.join(ignoredBugs)) - print() - print('[[Category:QA]][[Category:Development]]') + fixList.append({ + "id": bugId, + "date": info[0], + "priority": priority.upper(), + "summary": info[1], + "maintopic":k, + "subtopic":k1, + "notes": notes + }) + + resultList.append([{ + "Generator": os.path.basename(sys.argv[0]), + "Date": str(datetime.datetime.now()), + "Commits": str(len(commits)), + "Branch": branch.decode().strip(), + "Hash": str(last_hash.decode().strip()), + }]) + resultList.append(fixList) + print(json.dumps(resultList)) def usage(): message = """usage: {program} [bugs to ignore (each one is one argument)] |