This is an archive of the discontinued LLVM Phabricator instance.

[LNT] Missing "Produced by" field on Run causes UI to crash
ClosedPublic

Authored by leandron on Jul 5 2017, 2:10 AM.

Details

Summary

When a given run contains a "producer" value (usually an URL pointing to build systems), the run details page can crash when displaying this run in cases when the previous or baseline runs do not contain a valid value for the "producer" field.

It is possible to see the following error message:

...
File "/sandbox/lnt/server/ui/filters.py", line 47, in filter_producerAsHTML
  if not producer:
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'producer'

This change prevents the UI to crash when "producer" is not found. It also adds a test change to capture this situation.

Diff Detail

Repository
rL LLVM

Event Timeline

leandron created this revision.Jul 5 2017, 2:10 AM
kristof.beyls added inline comments.Jul 5 2017, 8:48 AM
tests/server/ui/V4Pages.py
291–292 ↗(On Diff #105229)

Ideally, the test would also check that the outputted producer information is as expected, not just that the HTML return code is as expected.
You can find examples of how that's done in this file; just look for how check_nr_machines_reported is used & defined. check_table_content is another example.

Do you think it would be possible to improve the test case like this without too much effort?

cmatthews requested changes to this revision.Jul 5 2017, 12:04 PM

LGTM, besides Kristof's point about checking the output in the test.

This revision now requires changes to proceed.Jul 5 2017, 12:04 PM
leandron updated this revision to Diff 106162.Jul 12 2017, 2:47 AM
leandron edited edge metadata.
  • Improve testing output to check the generated labels
  • Small change to escape a bare & that crashes xml.etree.ElementTree
  • sync with current SVN rev.
leandron updated this revision to Diff 106188.Jul 12 2017, 5:44 AM

Adding context.

kristof.beyls edited edge metadata.Jul 12 2017, 7:22 AM

Mostly looks good, just 2 minor remarks.

tests/server/ui/V4Pages.py
143 ↗(On Diff #106188)

I was confused by the name "check_table_row_content", not sure what this function was doing based on the name.
After reading the implementation, I guess "check_row_is_in_table" is a better name?

168 ↗(On Diff #106188)

Isn't table_header always "Produced by" for check_producer_label?
If so, wouldn't it be better to make the signature of check_producer_label(client, url, label)?

I'll submit a new version including these fixes.

tests/server/ui/V4Pages.py
143 ↗(On Diff #106188)

Yes. I'll rename.

168 ↗(On Diff #106188)

Makes sense. I'll change.

leandron updated this revision to Diff 106217.Jul 12 2017, 8:10 AM

Applying code review suggestions.

This revision was automatically updated to reflect the committed changes.