[PATCH] D35001: [LNT] Missing "Produced by" field on Run causes UI to crash
Leandro Nunes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 5 02:10:18 PDT 2017
leandron created this revision.
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.
https://reviews.llvm.org/D35001
Files:
lnt/server/ui/templates/reporting/runs.html
tests/server/ui/Inputs/V4Pages_extra_records.sql
tests/server/ui/V4Pages.py
Index: tests/server/ui/V4Pages.py
===================================================================
--- tests/server/ui/V4Pages.py
+++ tests/server/ui/V4Pages.py
@@ -288,6 +288,9 @@
check_redirect(client, '/v4/nts/1/graph?test.3=2',
'v4/nts/graph\?plot\.0=1\.3\.2&highlight_run=1$')
+ # Get a run that contains producer information
+ check_code(client, '/v4/nts/7')
+
# Get the new graph page.
check_code(client, '/v4/nts/graph?plot.0=1.3.2')
# Don't crash when requesting non-existing data
Index: tests/server/ui/Inputs/V4Pages_extra_records.sql
===================================================================
--- tests/server/ui/Inputs/V4Pages_extra_records.sql
+++ tests/server/ui/Inputs/V4Pages_extra_records.sql
@@ -76,7 +76,8 @@
INSERT INTO "NT_Run" ("MachineID", "OrderID", "ImportedFrom", "StartTime",
"EndTime", "SimpleRunID", "Parameters")
VALUES(2,6,'run7.json','2012-05-10 16:28:23.000000',
- '2012-05-10 16:28:58.000000',NULL,'[]'); -- ID 7
+ '2012-05-10 16:28:58.000000',NULL,
+ '[["producer", "http://my.build.server/buildResult"]]'); -- ID 7
INSERT INTO "NT_Run" ("MachineID", "OrderID", "ImportedFrom", "StartTime",
"EndTime", "SimpleRunID", "Parameters")
VALUES(2,7,'run8.json','2012-05-11 16:28:23.000000',
Index: lnt/server/ui/templates/reporting/runs.html
===================================================================
--- lnt/server/ui/templates/reporting/runs.html
+++ lnt/server/ui/templates/reporting/runs.html
@@ -94,7 +94,9 @@
<td style="{{ styles['td'] }}"><span class="utctime">{{ r.start_time.isoformat() }}</span></td>
<td style="{{ styles['td'] }}">{{ r.end_time - r.start_time }}</td>
{% if show_producers %}
- <td style="{{ styles['td'] }}">{{ r.parameters.producer|producerAsHTML }}</td>
+ <td style="{{ styles['td'] }}">
+ {{ r.parameters.producer|producerAsHTML|safe if 'producer' in r.parameters else "" }}
+ </td>
{% endif %}
</tr>
{% else %}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35001.105229.patch
Type: text/x-patch
Size: 2082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170705/889589a6/attachment-0001.bin>
More information about the llvm-commits
mailing list