Merge ~stanley31/bugit/+git/bugit:add-failed-tests into bugit:master

Proposed by StanleyHuang
Status: Merged
Approved by: StanleyHuang
Approved revision: 63a4a85236c184dca147d82bb86e181584f7c1bc
Merged at revision: 8492f321a87e84b9cd205fb931b6c55af5310754
Proposed branch: ~stanley31/bugit/+git/bugit:add-failed-tests
Merge into: bugit:master
Diff against target: 291 lines (+81/-40)
1 file modified
bugit/ui.py (+81/-40)
Reviewer Review Type Date Requested Status
HanhsuanLee Approve
Yujin.Wu Pending
Vincent Liao Pending
Gabriel Zhi Chen Pending
Vic Liu Pending
Scott Hu Pending
Clair Lin Pending
YANG, ZHI-HAO Pending
Rick Wu Pending
Weichen Wu Pending
PeiYao Chang Pending
Review via email: mp+466204@code.launchpad.net

Commit message

Add 'affected test cases' section in bug report

To post a comment you must log in.
Revision history for this message
HanhsuanLee (hanhsuan) wrote :

Does this change not be included in ReopenReportScreen ?

Revision history for this message
StanleyHuang (stanley31) wrote :

> Does this change not be included in ReopenReportScreen ?

The ReopenReportScreen will not modify the bug description, but add a comment. So user need to add the failed test cases in the description fields manually in current implementation.

Revision history for this message
HanhsuanLee (hanhsuan) wrote :

LGTM

Revision history for this message
HanhsuanLee (hanhsuan) wrote :

LGTM to approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/bugit/ui.py b/bugit/ui.py
index 986621d..f6a1e08 100644
--- a/bugit/ui.py
+++ b/bugit/ui.py
@@ -40,7 +40,9 @@ class SelectionScreen:
40 self.build_ui()40 self.build_ui()
4141
42 def build_ui(self):42 def build_ui(self):
43 button = urwid.Button(label="None", on_press=self.item_chosen, user_data="None")43 button = urwid.Button(
44 label="None", on_press=self.item_chosen, user_data="None"
45 )
44 _ui_items = [button]46 _ui_items = [button]
45 self.header = urwid.AttrMap(urwid.Text(self._header_text), "header")47 self.header = urwid.AttrMap(urwid.Text(self._header_text), "header")
46 self.footer = urwid.AttrMap(urwid.Text(self.footer_text), "foot")48 self.footer = urwid.AttrMap(urwid.Text(self.footer_text), "foot")
@@ -55,7 +57,10 @@ class SelectionScreen:
55 self.main_view = urwid.Frame(57 self.main_view = urwid.Frame(
56 urwid.Filler(58 urwid.Filler(
57 urwid.Padding(59 urwid.Padding(
58 self.pile, align="center", width=("relative", 5), min_width=5060 self.pile,
61 align="center",
62 width=("relative", 5),
63 min_width=50,
59 ),64 ),
60 "top",65 "top",
61 ),66 ),
@@ -92,8 +97,10 @@ class SessionsScreen(SelectionScreen):
9297
93 header_text = (98 header_text = (
94 "The following Checkbox sessions are available on this device.\n\n"99 "The following Checkbox sessions are available on this device.\n\n"
95 "You can select a failed job from one of these, and bugit will automatically get the output from this job.\n"100 "You can select a failed job from one of these,"
96 "Please select the Checkbox session to use (or 'None' if you want to fill the description yourself):\n\n"101 " and bugit will automatically get the output from this job.\n"
102 "Please select the Checkbox session to use"
103 " (or 'None' if you want to fill the description yourself):\n\n"
97 "(Note: the sessions are sorted with the most recent on top.)"104 "(Note: the sessions are sorted with the most recent on top.)"
98 )105 )
99 super().__init__(items=items, header_text=header_text)106 super().__init__(items=items, header_text=header_text)
@@ -104,7 +111,8 @@ class JobsScreen(SelectionScreen):
104111
105 header_text = (112 header_text = (
106 "The following jobs are available in this session.\n\n"113 "The following jobs are available in this session.\n\n"
107 "You can select a failed job from one of these, and bugit will automatically get the output from this job.\n"114 "You can select a failed job from one of these,"
115 " and bugit will automatically get the output from this job.\n"
108 "Please select the job to use:\n\n"116 "Please select the job to use:\n\n"
109 )117 )
110 super().__init__(items=items, header_text=header_text)118 super().__init__(items=items, header_text=header_text)
@@ -128,10 +136,19 @@ class ReportScreen:
128136
129 statuses = ("New", "Confirmed")137 statuses = ("New", "Confirmed")
130 importances = {138 importances = {
131 'launchpad': ("Undecided", "Wishlist", "Low", "Medium", "High", "Critical"),139 "launchpad": (
132 'jira': ("Lowest", "Low", "Medium", "High", "Highest")140 "Undecided",
141 "Wishlist",
142 "Low",
143 "Medium",
144 "High",
145 "Critical",
146 ),
147 "jira": ("Lowest", "Low", "Medium", "High", "Highest"),
133 }148 }
134 STAGE_IMMEDIATE = "Issue reported and logs collected right after it happened"149 STAGE_IMMEDIATE = (
150 "Issue reported and logs collected right after it happened"
151 )
135 STAGE_FROZEN_DEVICE = (152 STAGE_FROZEN_DEVICE = (
136 "Device froze, issue reported and logs collected right after a reboot"153 "Device froze, issue reported and logs collected right after a reboot"
137 )154 )
@@ -167,10 +184,12 @@ class ReportScreen:
167 template="Launchpad",184 template="Launchpad",
168 ):185 ):
169 if job_id and job_output:186 if job_id and job_output:
187 self.default_description += f"[Affected test cases]\n{job_id}\n\n"
170 self.default_description += f"[Checkbox job `{job_id}` output]\n\n"188 self.default_description += f"[Checkbox job `{job_id}` output]\n\n"
171 if job_output["comments"]:189 if job_output["comments"]:
172 self.default_description += (190 self.default_description += (
173 "Tester comments\n---------------\n" f"{job_output['comments']}\n\n"191 "Tester comments\n---------------\n"
192 f"{job_output['comments']}\n\n"
174 )193 )
175 if not job_output["stdout"] and not job_output["stderr"]:194 if not job_output["stdout"] and not job_output["stderr"]:
176 self.default_description += "No output found for this job.\n\n"195 self.default_description += "No output found for this job.\n\n"
@@ -182,17 +201,17 @@ class ReportScreen:
182 self.default_description += (201 self.default_description += (
183 "stderr\n------\n" f"{job_output['stderr']}\n"202 "stderr\n------\n" f"{job_output['stderr']}\n"
184 )203 )
204 else:
205 self.default_description += "[Affected test cases]\n\n"
185206
186 # Adding standard info (CPU, BIOS, GPU, etc.) to the description207 # Adding standard info (CPU, BIOS, GPU, etc.) to the description
187 std_info = AttachmentAssistant.get_standard_info()208 std_info = AttachmentAssistant.get_standard_info()
188 std_info_str = "\n".join(209 std_info_str = "\n".join(
189 ["{}: {}".format(elt, std_info[elt]) for elt in std_info]210 ["{}: {}".format(elt, std_info[elt]) for elt in std_info]
190 )211 )
191 cid_str = "\nCID: {}".format(cid)
192 sku_str = "\nSKU: {}".format(sku)
193 self.default_description += (212 self.default_description += (
194 "[Additional information]" + cid_str + sku_str + "\n" + std_info_str213 "[Additional information]\nCID: {}\nSKU: {}\n{}"
195 )214 ).format(cid, sku, std_info_str)
196215
197 self._title = urwid.LineBox(urwid.Edit(), "Bug Title")216 self._title = urwid.LineBox(urwid.Edit(), "Bug Title")
198 self._description = urwid.LineBox(217 self._description = urwid.LineBox(
@@ -233,7 +252,9 @@ class ReportScreen:
233 )252 )
234 self._tags = urwid.LineBox(urwid.Edit(edit_text=tags), "Tags")253 self._tags = urwid.LineBox(urwid.Edit(edit_text=tags), "Tags")
235 status_list = urwid.LineBox(urwid.Pile(self._status), "Status")254 status_list = urwid.LineBox(urwid.Pile(self._status), "Status")
236 importance_list = urwid.LineBox(urwid.Pile(self._importance), "Importance")255 importance_list = urwid.LineBox(
256 urwid.Pile(self._importance), "Importance"
257 )
237 stage_bug_filed_list = urwid.LineBox(258 stage_bug_filed_list = urwid.LineBox(
238 urwid.Pile(self._stage_bug_filed), "When was the issue filed?"259 urwid.Pile(self._stage_bug_filed), "When was the issue filed?"
239 )260 )
@@ -261,13 +282,19 @@ class ReportScreen:
261 self.bug_tags_lists,282 self.bug_tags_lists,
262 ]283 ]
263 )284 )
264 self.main_view = urwid.Frame(urwid.Filler(self.pile, "top"), footer=self.footer)285 self.main_view = urwid.Frame(
286 urwid.Filler(self.pile, "top"), footer=self.footer
287 )
265 self.error_text = urwid.Text("")288 self.error_text = urwid.Text("")
266 self.ok_button = urwid.Padding(289 self.ok_button = urwid.Padding(
267 urwid.Button("OK", on_press=self.close_dialog), align="center", width=6290 urwid.Button("OK", on_press=self.close_dialog),
291 align="center",
292 width=6,
268 )293 )
269 self.error_dialog = urwid.AttrMap(294 self.error_dialog = urwid.AttrMap(
270 urwid.LineBox(urwid.Pile([self.error_text, self.ok_button]), "Error"),295 urwid.LineBox(
296 urwid.Pile([self.error_text, self.ok_button]), "Error"
297 ),
271 "error",298 "error",
272 )299 )
273 self.error_view = urwid.Overlay(300 self.error_view = urwid.Overlay(
@@ -287,8 +314,8 @@ class ReportScreen:
287 else:314 else:
288 # if checkbox is unticked315 # if checkbox is unticked
289 for tag in tags:316 for tag in tags:
290 self._tags.base_widget.edit_text = self._tags.base_widget.edit_text.replace(317 self._tags.base_widget.edit_text = (
291 tag, ""318 self._tags.base_widget.edit_text.replace(tag, "")
292 )319 )
293 # clean up the list of tags to320 # clean up the list of tags to
294 # - remove unwanted white spaces321 # - remove unwanted white spaces
@@ -338,7 +365,9 @@ class ReportScreen:
338 if "ihv-nvidia" in tags and any([i in tags for i in check_tags]):365 if "ihv-nvidia" in tags and any([i in tags for i in check_tags]):
339 options.update({"include_nvidia-bug-report": True})366 options.update({"include_nvidia-bug-report": True})
340367
341 stage_bug_filed = [rb.label for rb in self._stage_bug_filed if rb.state]368 stage_bug_filed = [
369 rb.label for rb in self._stage_bug_filed if rb.state
370 ]
342 if stage_bug_filed:371 if stage_bug_filed:
343 # If the bug description already contains a "[Stage]" section,372 # If the bug description already contains a "[Stage]" section,
344 # remove it since it will be updated and re-filled below373 # remove it since it will be updated and re-filled below
@@ -348,10 +377,14 @@ class ReportScreen:
348 description_list.pop(i) # Remove the [Stage] line377 description_list.pop(i) # Remove the [Stage] line
349 description_list.pop(i) # Remove the line after [Stage]378 description_list.pop(i) # Remove the line after [Stage]
350 description = (379 description = (
351 "\n".join(description_list) + "\n\n[Stage]\n" + stage_bug_filed[0]380 "\n".join(description_list)
381 + "\n\n[Stage]\n"
382 + stage_bug_filed[0]
352 )383 )
353 self._description.base_widget.set_edit_text(description)384 self._description.base_widget.set_edit_text(description)
354 options["device_froze"] = self.STAGE_FROZEN_DEVICE in stage_bug_filed[0]385 options["device_froze"] = (
386 self.STAGE_FROZEN_DEVICE in stage_bug_filed[0]
387 )
355 options["collect_log"] = self.STAGE_LATER not in stage_bug_filed[0]388 options["collect_log"] = self.STAGE_LATER not in stage_bug_filed[0]
356389
357 return BugReport(390 return BugReport(
@@ -380,7 +413,7 @@ class ReopenReportScreen(ReportScreen):
380 importance="",413 importance="",
381 job_id="",414 job_id="",
382 job_output=None,415 job_output=None,
383 template="Launchpad"416 template="Launchpad",
384 ):417 ):
385 if job_id and job_output:418 if job_id and job_output:
386 job_pattern = ["comments", "stdout", "stderr"]419 job_pattern = ["comments", "stdout", "stderr"]
@@ -390,11 +423,10 @@ class ReopenReportScreen(ReportScreen):
390 prefix_str = "Job {}".format(key)423 prefix_str = "Job {}".format(key)
391 self.default_description += "{}\n{}\n{}\n\n".format(424 self.default_description += "{}\n{}\n{}\n\n".format(
392 prefix_str,425 prefix_str,
393 '-'*len(prefix_str),426 "-" * len(prefix_str),
394 job_output[key].strip()427 job_output[key].strip(),
395 )428 )
396 if not job_output["stdout"].strip() and \429 if not job_output["stdout"].strip() and not job_output["stderr"]:
397 not job_output["stderr"]:
398 self.default_description += "No output found for this job\n\n"430 self.default_description += "No output found for this job\n\n"
399431
400 # Adding standard info (CPU, BIOS, GPU, etc.) to the description432 # Adding standard info (CPU, BIOS, GPU, etc.) to the description
@@ -403,10 +435,7 @@ class ReopenReportScreen(ReportScreen):
403 ["{}: {}".format(elt, std_info[elt]) for elt in std_info]435 ["{}: {}".format(elt, std_info[elt]) for elt in std_info]
404 )436 )
405 self.default_description += (437 self.default_description += (
406 "[Additional information]\n"438 "[Additional information]\nCID: {}\nSKU: {}\n{}"
407 "CID: {}\n"
408 "SKU: {}\n"
409 "{}"
410 ).format(cid, sku, std_info_str)439 ).format(cid, sku, std_info_str)
411440
412 self._title = urwid.LineBox(urwid.Text(title), "Bug Title")441 self._title = urwid.LineBox(urwid.Text(title), "Bug Title")
@@ -423,8 +452,11 @@ class ReopenReportScreen(ReportScreen):
423 self._importance = []452 self._importance = []
424 for i in self.importances[template]:453 for i in self.importances[template]:
425 rb = urwid.RadioButton(self._importance, i, "first True", None)454 rb = urwid.RadioButton(self._importance, i, "first True", None)
426 [rb.set_state(True) for rb in self._importance455 [
427 if rb.label == importance]456 rb.set_state(True)
457 for rb in self._importance
458 if rb.label == importance
459 ]
428460
429 self._stage_bug_filed = []461 self._stage_bug_filed = []
430 for s in self.stage_bug_filed:462 for s in self.stage_bug_filed:
@@ -441,7 +473,7 @@ class ReopenReportScreen(ReportScreen):
441 bug_state_lists = urwid.Columns(473 bug_state_lists = urwid.Columns(
442 [474 [
443 urwid.LineBox(urwid.Pile(self._status), "Status"),475 urwid.LineBox(urwid.Pile(self._status), "Status"),
444 urwid.LineBox(urwid.Pile(self._importance), "Importance")476 urwid.LineBox(urwid.Pile(self._importance), "Importance"),
445 ]477 ]
446 )478 )
447479
@@ -457,15 +489,18 @@ class ReopenReportScreen(ReportScreen):
457 ]489 ]
458 )490 )
459 self.main_view = urwid.Frame(491 self.main_view = urwid.Frame(
460 urwid.Filler(self.pile, "top"), footer=self.footer)492 urwid.Filler(self.pile, "top"), footer=self.footer
493 )
461 self.error_text = urwid.Text("")494 self.error_text = urwid.Text("")
462 self.ok_button = urwid.Padding(495 self.ok_button = urwid.Padding(
463 urwid.Button("OK", on_press=self.close_dialog),496 urwid.Button("OK", on_press=self.close_dialog),
464 align="center", width=6497 align="center",
498 width=6,
465 )499 )
466 self.error_dialog = urwid.AttrMap(500 self.error_dialog = urwid.AttrMap(
467 urwid.LineBox(501 urwid.LineBox(
468 urwid.Pile([self.error_text, self.ok_button]), "Error"),502 urwid.Pile([self.error_text, self.ok_button]), "Error"
503 ),
469 "error",504 "error",
470 )505 )
471 self.error_view = urwid.Overlay(506 self.error_view = urwid.Overlay(
@@ -480,7 +515,9 @@ class ReopenReportScreen(ReportScreen):
480 def report(self):515 def report(self):
481 options = {}516 options = {}
482517
483 stage_bug_filed = [rb.label for rb in self._stage_bug_filed if rb.state]518 stage_bug_filed = [
519 rb.label for rb in self._stage_bug_filed if rb.state
520 ]
484 if stage_bug_filed:521 if stage_bug_filed:
485 # If the bug description already contains a "[Stage]" section,522 # If the bug description already contains a "[Stage]" section,
486 # remove it since it will be updated and re-filled below523 # remove it since it will be updated and re-filled below
@@ -490,10 +527,14 @@ class ReopenReportScreen(ReportScreen):
490 description_list.pop(i) # Remove the [Stage] line527 description_list.pop(i) # Remove the [Stage] line
491 description_list.pop(i) # Remove the line after [Stage]528 description_list.pop(i) # Remove the line after [Stage]
492 description = (529 description = (
493 "\n".join(description_list) + "\n\n[Stage]\n" + stage_bug_filed[0]530 "\n".join(description_list)
531 + "\n\n[Stage]\n"
532 + stage_bug_filed[0]
494 )533 )
495 self._description.base_widget.set_edit_text(description)534 self._description.base_widget.set_edit_text(description)
496 options["device_froze"] = self.STAGE_FROZEN_DEVICE in stage_bug_filed[0]535 options["device_froze"] = (
536 self.STAGE_FROZEN_DEVICE in stage_bug_filed[0]
537 )
497 options["collect_log"] = self.STAGE_LATER not in stage_bug_filed[0]538 options["collect_log"] = self.STAGE_LATER not in stage_bug_filed[0]
498539
499 return BugReport(540 return BugReport(

Subscribers

People subscribed via source and target branches

to all changes: