Merge ~sylvain-pineau/checkbox-ng:system_info_html into checkbox-ng:master

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 29eafa7ed4be2a9bb65a2de11e785fdda57aec60
Merged at revision: 3570e10cfb9abb4cc3b9d0f7cfb8b11adb01f706
Proposed branch: ~sylvain-pineau/checkbox-ng:system_info_html
Merge into: checkbox-ng:master
Diff against target: 174 lines (+69/-14)
7 files modified
plainbox/impl/exporter/jinja2.py (+15/-0)
plainbox/impl/providers/exporters/data/checkbox.html (+27/-3)
plainbox/impl/providers/exporters/data/multi-page.html (+27/-3)
plainbox/test-data/html-exporter/with_both_certification_status.html (+0/-2)
plainbox/test-data/html-exporter/with_certification_blocker.html (+0/-2)
plainbox/test-data/html-exporter/with_certification_non_blocker.html (+0/-2)
plainbox/test-data/html-exporter/without_certification_status.html (+0/-2)
Reviewer Review Type Date Requested Status
Devices Certification Bot Needs Fixing
Jonathan Cave (community) Approve
Review via email: mp+359508@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jonathan Cave (jocave) wrote :

IMO, very nice!

review: Approve
Revision history for this message
Devices Certification Bot (ce-certification-qa) wrote :
Download full text (6.3 KiB)

The merge was fine but running tests failed.

[trusty] starting container
[trusty] (timing) 0.00user 0.01system 0:00.25elapsed 4%CPU (0avgtext+0avgdata 4952maxresident)k
[trusty] (timing) 0inputs+72outputs (0major+1080minor)pagefaults 0swaps
[trusty] provisioning container
[trusty] (timing) 35.39user 20.46system 3:56.46elapsed 23%CPU (0avgtext+0avgdata 69216maxresident)k
[trusty] (timing) 13056inputs+1672984outputs (43major+1423735minor)pagefaults 0swaps
[trusty-testing] Starting tests...
Found a test script: ./requirements/001-container-tests-plainbox-egg-info
[trusty-testing] 001-container-tests-plainbox-egg-info: PASS
[trusty-testing] (timing) 0.19user 0.02system 0:00.23elapsed 90%CPU (0avgtext+0avgdata 24092maxresident)k
[trusty-testing] (timing) 0inputs+88outputs (0major+9386minor)pagefaults 0swaps
Found a test script: ./requirements/container-tests-checkbox-documentation
[trusty-testing] container-tests-checkbox-documentation: PASS
[trusty-testing] (timing) 0.03user 0.00system 0:00.08elapsed 48%CPU (0avgtext+0avgdata 10292maxresident)k
[trusty-testing] (timing) 0inputs+0outputs (0major+2620minor)pagefaults 0swaps
Found a test script: ./requirements/container-tests-checkbox-ng-unit
[trusty-testing] container-tests-checkbox-ng-unit: FAIL
[trusty-testing] stdout: https://paste.ubuntu.com/p/nvZbPcw7p7/
[trusty-testing] stderr: https://paste.ubuntu.com/p/6v75Z3VW4q/
[trusty-testing] (timing) Command exited with non-zero status 1
[trusty-testing] (timing) 13.28user 0.95system 0:17.50elapsed 81%CPU (0avgtext+0avgdata 71120maxresident)k
[trusty-testing] (timing) 448inputs+53856outputs (6major+470562minor)pagefaults 0swaps
Found a test script: ./requirements/container-tests-providers-internal
[trusty-testing] container-tests-providers-internal: PASS
[trusty-testing] (timing) 11.31user 0.62system 0:13.86elapsed 86%CPU (0avgtext+0avgdata 61592maxresident)k
[trusty-testing] (timing) 8inputs+48032outputs (1major+464538minor)pagefaults 0swaps
[trusty-testing] Fixing file permissions in source directory
[trusty-testing] Destroying container
Name: trusty-testing
State: STOPPED
[xenial] starting container
[xenial] (timing) 0.00user 0.00system 0:00.25elapsed 1%CPU (0avgtext+0avgdata 4988maxresident)k
[xenial] (timing) 0inputs+72outputs (0major+1085minor)pagefaults 0swaps
[xenial] provisioning container
[xenial] (timing) 38.13user 13.71system 3:58.99elapsed 21%CPU (0avgtext+0avgdata 83848maxresident)k
[xenial] (timing) 14048inputs+2067280outputs (29major+1611628minor)pagefaults 0swaps
[xenial-testing] Starting tests...
Found a test script: ./requirements/001-container-tests-plainbox-egg-info
[xenial-testing] 001-container-tests-plainbox-egg-info: PASS
[xenial-testing] (timing) 0.20user 0.05system 0:00.31elapsed 82%CPU (0avgtext+0avgdata 25388maxresident)k
[xenial-testing] (timing) 0inputs+88outputs (0major+9687minor)pagefaults 0swaps
Found a test script: ./requirements/container-tests-checkbox-documentation
[xenial-testing] container-tests-checkbox-documentation: PASS
[xenial-testing] (timing) 1.73user 0.06system 0:02.31elapsed 77%CPU (0avgtext+0avgdata ...

Read more...

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/plainbox/impl/exporter/jinja2.py b/plainbox/impl/exporter/jinja2.py
2index b02af57..59d7b3b 100644
3--- a/plainbox/impl/exporter/jinja2.py
4+++ b/plainbox/impl/exporter/jinja2.py
5@@ -26,6 +26,8 @@
6 """
7
8 import json
9+import re
10+from collections import OrderedDict
11 from datetime import datetime
12
13 from jinja2 import Environment
14@@ -62,6 +64,17 @@ def do_is_name(text):
15 return text == 'name'
16
17
18+def json_load_ordered_dict(text):
19+ """Render json dict in Jinja templates but keep keys ordering."""
20+ return json.loads(
21+ text, object_pairs_hook=OrderedDict)
22+
23+
24+def highlight_keys(text):
25+ """A filter for rendering keys as bold html text."""
26+ return re.sub('(\w+:\s)', r'<b>\1</b>', text)
27+
28+
29 class Jinja2SessionStateExporter(ISessionStateExporter):
30
31 """Session state exporter that renders output using jinja2 template."""
32@@ -123,6 +136,8 @@ class Jinja2SessionStateExporter(ISessionStateExporter):
33 env.autoescape = True
34 env.filters['jsonify'] = json.dumps
35 env.filters['strip_ns'] = do_strip_ns
36+ env.filters['json_load_ordered_dict'] = json_load_ordered_dict
37+ env.filters['highlight_keys'] = highlight_keys
38 env.tests['is_name'] = do_is_name
39
40 def dump(self, data, stream):
41diff --git a/plainbox/impl/providers/exporters/data/checkbox.html b/plainbox/impl/providers/exporters/data/checkbox.html
42index 97318fd..37d625f 100644
43--- a/plainbox/impl/providers/exporters/data/checkbox.html
44+++ b/plainbox/impl/providers/exporters/data/checkbox.html
45@@ -41,9 +41,33 @@
46 <h1>System Testing Report</h1>
47 </div><!-- /header -->
48 <div role="main" class="ui-content jqm-content">
49- {%- if ns ~ "lsb" in resource_map %}
50- <h2>Software Information</h2>
51- <p>{{ resource_map[ns ~ "lsb"][0]["description"] }}</p>
52+ {%- if ns ~ 'system_info_json' in state.job_state_map and state.job_state_map[ns ~ 'system_info_json'].result.outcome == 'pass' %}
53+ <h2>System Information</h2>
54+ {%- set system_info_json = state.job_state_map[ns ~ 'system_info_json'].result.io_log_as_text_attachment.rstrip() %}
55+ {%- set system_info = system_info_json|json_load_ordered_dict %}
56+ <table data-role="table" id="system-info" data-mode="reflow" class="ui-body-d ui-responsive table-stroke">
57+ <thead><tr class="ui-bar-d"></tr></thead>
58+ </tbody>
59+ {%- for section, section_data in system_info.items() %}
60+ <tr style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px;">
61+ <th style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; vertical-align:top; font-size: 0.85em;">{{ section }}</th>
62+ <td style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; line-height: 1em;">
63+ {%- for info in section_data %}
64+ <p style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; font-size: 0.85em">
65+ {% autoescape false %}
66+ {%- if section in ('System', 'Machine', 'CPU') %}
67+ {{ info|highlight_keys }}
68+ {%- else %}
69+ {{ info }}
70+ {%- endif %}
71+ {% endautoescape %}</p>
72+ {%- endfor %}
73+ </td>
74+ </tr>
75+ {%- endfor %}
76+ </tbody>
77+ </table>
78+ <br>
79 {%- endif %}
80 <h2>Tests Results</h2>
81 {%- if manager.test_plans %}
82diff --git a/plainbox/impl/providers/exporters/data/multi-page.html b/plainbox/impl/providers/exporters/data/multi-page.html
83index 6f8beb2..6e511b4 100644
84--- a/plainbox/impl/providers/exporters/data/multi-page.html
85+++ b/plainbox/impl/providers/exporters/data/multi-page.html
86@@ -92,9 +92,33 @@
87 </div><!-- /header -->
88
89 <div role="main" class="ui-content jqm-content">
90- {%- if ns ~ "lsb" in resource_map %}
91- <h2>Software Information</h2>
92- <p>{{ resource_map[ns ~ "lsb"][0]["description"] }}</p>
93+ {%- if ns ~ 'system_info_json' in state.job_state_map and state.job_state_map[ns ~ 'system_info_json'].result.outcome == 'pass' %}
94+ <h2>System Information</h2>
95+ {%- set system_info_json = state.job_state_map[ns ~ 'system_info_json'].result.io_log_as_text_attachment.rstrip() %}
96+ {%- set system_info = system_info_json|json_load_ordered_dict %}
97+ <table data-role="table" id="system-info" data-mode="reflow" class="ui-body-d ui-responsive table-stroke">
98+ <thead><tr class="ui-bar-d"></tr></thead>
99+ </tbody>
100+ {%- for section, section_data in system_info.items() %}
101+ <tr style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px;">
102+ <th style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; vertical-align:top; font-size: 0.85em;">{{ section }}</th>
103+ <td style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; line-height: 1em;">
104+ {%- for info in section_data %}
105+ <p style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; font-size: 0.85em">
106+ {% autoescape false %}
107+ {%- if section in ('System', 'Machine', 'CPU') %}
108+ {{ info|highlight_keys }}
109+ {%- else %}
110+ {{ info }}
111+ {%- endif %}
112+ {% endautoescape %}</p>
113+ {%- endfor %}
114+ </td>
115+ </tr>
116+ {%- endfor %}
117+ </tbody>
118+ </table>
119+ <br>
120 {%- endif %}
121 <h2>Tests Results</h2>
122 {%- if manager.test_plans %}
123diff --git a/plainbox/test-data/html-exporter/with_both_certification_status.html b/plainbox/test-data/html-exporter/with_both_certification_status.html
124index 2643dcc..9ba67b9 100644
125--- a/plainbox/test-data/html-exporter/with_both_certification_status.html
126+++ b/plainbox/test-data/html-exporter/with_both_certification_status.html
127@@ -502,8 +502,6 @@ b.matchMedia=b.matchMedia||(function(k,l){var i,g=k.documentElement,h=g.firstEle
128 <h1>System Testing Report</h1>
129 </div><!-- /header -->
130 <div role="main" class="ui-content jqm-content">
131- <h2>Software Information</h2>
132- <p>Ubuntu 14.04 LTS</p>
133 <h2>Tests Results</h2>
134 <div id="canvas-holder" style="width:300px">
135 <canvas id="chart-area"></canvas>
136diff --git a/plainbox/test-data/html-exporter/with_certification_blocker.html b/plainbox/test-data/html-exporter/with_certification_blocker.html
137index a3927cb..47d2e01 100644
138--- a/plainbox/test-data/html-exporter/with_certification_blocker.html
139+++ b/plainbox/test-data/html-exporter/with_certification_blocker.html
140@@ -502,8 +502,6 @@ b.matchMedia=b.matchMedia||(function(k,l){var i,g=k.documentElement,h=g.firstEle
141 <h1>System Testing Report</h1>
142 </div><!-- /header -->
143 <div role="main" class="ui-content jqm-content">
144- <h2>Software Information</h2>
145- <p>Ubuntu 14.04 LTS</p>
146 <h2>Tests Results</h2>
147 <div id="canvas-holder" style="width:300px">
148 <canvas id="chart-area"></canvas>
149diff --git a/plainbox/test-data/html-exporter/with_certification_non_blocker.html b/plainbox/test-data/html-exporter/with_certification_non_blocker.html
150index b73f027..d44047b 100644
151--- a/plainbox/test-data/html-exporter/with_certification_non_blocker.html
152+++ b/plainbox/test-data/html-exporter/with_certification_non_blocker.html
153@@ -502,8 +502,6 @@ b.matchMedia=b.matchMedia||(function(k,l){var i,g=k.documentElement,h=g.firstEle
154 <h1>System Testing Report</h1>
155 </div><!-- /header -->
156 <div role="main" class="ui-content jqm-content">
157- <h2>Software Information</h2>
158- <p>Ubuntu 14.04 LTS</p>
159 <h2>Tests Results</h2>
160 <div id="canvas-holder" style="width:300px">
161 <canvas id="chart-area"></canvas>
162diff --git a/plainbox/test-data/html-exporter/without_certification_status.html b/plainbox/test-data/html-exporter/without_certification_status.html
163index 8903bbd..53fbbec 100644
164--- a/plainbox/test-data/html-exporter/without_certification_status.html
165+++ b/plainbox/test-data/html-exporter/without_certification_status.html
166@@ -502,8 +502,6 @@ b.matchMedia=b.matchMedia||(function(k,l){var i,g=k.documentElement,h=g.firstEle
167 <h1>System Testing Report</h1>
168 </div><!-- /header -->
169 <div role="main" class="ui-content jqm-content">
170- <h2>Software Information</h2>
171- <p>Ubuntu 14.04 LTS</p>
172 <h2>Tests Results</h2>
173 <div id="canvas-holder" style="width:300px">
174 <canvas id="chart-area"></canvas>

Subscribers

People subscribed via source and target branches