Merge lp:~brendan-donegan/checkbox/cdts-report into lp:checkbox

Proposed by Brendan Donegan
Status: Rejected
Rejected by: Zygmunt Krynicki
Proposed branch: lp:~brendan-donegan/checkbox/cdts-report
Merge into: lp:checkbox
Diff against target: 339 lines (+101/-28)
12 files modified
checkbox-gui/checkbox-gui/main.cpp (+4/-4)
checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml (+3/-2)
checkbox-gui/checkbox-gui/qml/checkbox-gui.qml (+1/-1)
checkbox-gui/gui-engine/gui-engine.cpp (+10/-6)
checkbox-gui/gui-engine/gui-engine.h (+7/-4)
checkbox-ng/checkbox_ng/service.py (+4/-3)
plainbox-provider-checkbox/provider_jobs/miscellanea.txt.in (+1/-0)
plainbox-provider-resource-generic/provider_jobs/resource.txt.in (+6/-0)
plainbox/plainbox/data/report/checkbox.xsl (+22/-4)
plainbox/plainbox/data/report/hardware-1_0.rng (+19/-0)
plainbox/plainbox/impl/exporter/xml.py (+16/-0)
plainbox/plainbox/impl/highlevel.py (+8/-4)
To merge this branch: bzr merge lp:~brendan-donegan/checkbox/cdts-report
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Needs Fixing
Chris Gregan (community) Approve
Brendan Donegan (community) Needs Resubmitting
Review via email: mp+213309@code.launchpad.net

Description of the change

This adds the following additional information to the test report

    - client name
    - date report created
    - links to requirements documents where a requirements_docs.txt file is
      provided in CHECKBOX_SHARE/data

It needs to be ported to checkbox-ihv-ng as well.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Please prefix commits with general area

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Why aren't we using option list for passing client name and instead we are inventing another argument?

review: Needs Information
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Please use PLAINBOX PROVIDER DATA Instead of CHECKBOX SHARE/data

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

> Why aren't we using option list for passing client name and instead we are
> inventing another argument?

Because the option_list is the option_list (a parameter to the exporter), whereas client name is a separate parameter to the export. Have a look at the constructor for the xml exporter.

review: Needs Resubmitting
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Maybe we could fix that. That is the intended goal of the option_list

2836. By Brendan Donegan

checkbox-gui: Add additional information to report

This adds the following additional information to the test report

- client name
- date report created
- links to requirements documents where a requirements_docs.txt file is
  provided in CHECKBOX_SHARE/data

Signed-off-by: Brendan Donegan <email address hidden>

Revision history for this message
Chris Gregan (cgregan) wrote :

Looks good...demo works as expected.

review: Approve
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

We need to fix the API to not add redundant arguments that make sense to one exporter so please don't merge this yet

review: Needs Fixing
Revision history for this message
Daniel Manrique (roadmr) wrote :

All this code made it into plainbox/checkbox-gui already (apologies for poaching it), would it make sense to decline this merge request now?

Unmerged revisions

2836. By Brendan Donegan

checkbox-gui: Add additional information to report

This adds the following additional information to the test report

- client name
- date report created
- links to requirements documents where a requirements_docs.txt file is
  provided in CHECKBOX_SHARE/data

Signed-off-by: Brendan Donegan <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-gui/checkbox-gui/main.cpp'
2--- checkbox-gui/checkbox-gui/main.cpp 2014-03-19 13:48:36 +0000
3+++ checkbox-gui/checkbox-gui/main.cpp 2014-03-28 17:48:41 +0000
4@@ -40,9 +40,9 @@
5 int main(int argc, char *argv[])
6 {
7 QApplication app(argc, argv);
8- QByteArray applicationName;
9- applicationName = QFileInfo(QCoreApplication::applicationFilePath()).fileName().toUtf8();
10- qputenv("APP_ID", applicationName);
11+ QByteArray clientName;
12+ clientName = QFileInfo(QCoreApplication::applicationFilePath()).fileName().toUtf8();
13+ qputenv("APP_ID", clientName);
14
15 qmlRegisterType<WhiteListItem>("Ubuntu.Checkbox", 0, 1, "WhiteListItem");
16 qmlRegisterType<TestItem>("Ubuntu.Checkbox", 0, 1, "TestItem");
17@@ -53,7 +53,7 @@
18 GuiEngine guiengine((QObject*)&app);
19
20 // Register the applicationName with the QML runtime
21- viewer.rootContext()->setContextProperty("applicationName", applicationName);
22+ viewer.rootContext()->setContextProperty("clientName", clientName);
23
24 // Register the GuiEngine with the QML runtime
25 viewer.rootContext()->setContextProperty("guiEngine", &guiengine);
26
27=== modified file 'checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml'
28--- checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml 2014-03-20 11:17:53 +0000
29+++ checkbox-gui/checkbox-gui/qml/SubmissionDialog.qml 2014-03-28 17:48:41 +0000
30@@ -94,7 +94,8 @@
31 if (!export_path) {
32 export_path = guiEngine.GetSaveFileName();
33 }
34- var success = guiEngine.GuiExportSessionToFileAsXML(export_path);
35+ var success = guiEngine.GuiExportSessionToFileAsXML(
36+ export_path, clientName);
37 if (submit_to == "certification") {
38 if (success) {
39 dialog.text = guiEngine.SendSubmissionViaCertificationTransport(export_path,
40@@ -117,7 +118,7 @@
41 onClicked: {
42 onClicked:{
43 var mysavepath = '/tmp/report.html';
44- runmanagerview.reportIsSaved = guiEngine.GuiExportSessionToFileAsHTML(mysavepath);
45+ runmanagerview.reportIsSaved = guiEngine.GuiExportSessionToFileAsHTML(mysavepath, clientName);
46 Qt.openUrlExternally(mysavepath)
47 }
48 }
49
50=== modified file 'checkbox-gui/checkbox-gui/qml/checkbox-gui.qml'
51--- checkbox-gui/checkbox-gui/qml/checkbox-gui.qml 2014-01-29 10:00:26 +0000
52+++ checkbox-gui/checkbox-gui/qml/checkbox-gui.qml 2014-03-28 17:48:41 +0000
53@@ -29,7 +29,7 @@
54 id: mainView
55 width: units.gu(100)
56 height: units.gu(90)
57- applicationName: applicationName
58+ applicationName: clientName
59
60 // TODO - For Resume dialog, when plainbox starts up, check if this is a 'Resume'
61 // if it is, set pageName = "ResumeView", state = "RESUME"
62
63=== modified file 'checkbox-gui/gui-engine/gui-engine.cpp'
64--- checkbox-gui/gui-engine/gui-engine.cpp 2014-03-20 10:35:19 +0000
65+++ checkbox-gui/gui-engine/gui-engine.cpp 2014-03-28 17:48:41 +0000
66@@ -2009,7 +2009,8 @@
67 return reply;
68 }
69
70-bool GuiEngine::GuiExportSessionToFileAsXML(const QString& output_file)
71+bool GuiEngine::GuiExportSessionToFileAsXML(const QString& output_file,
72+ const QString& clientName)
73 {
74 QString output_format = "xml";
75 QStringList options; // No options
76@@ -2020,12 +2021,13 @@
77 }
78
79 // FIXME - When we get a useful success/failure code here, return to caller
80- QString done = ExportSessionToFile(m_session,output_format,options,output_file);
81+ QString done = ExportSessionToFile(m_session,output_format,options,output_file, clientName);
82
83 return true;
84 }
85
86-bool GuiEngine::GuiExportSessionToFileAsHTML(const QString& output_file)
87+bool GuiEngine::GuiExportSessionToFileAsHTML(const QString& output_file,
88+ const QString& clientName)
89 {
90 QString output_format = "html";
91 QStringList options; // No options
92@@ -2036,7 +2038,7 @@
93 }
94
95 // FIXME - When we get a useful success/failure code here, return to caller
96- QString done = ExportSessionToFile(m_session,output_format,options,output_file);
97+ QString done = ExportSessionToFile(m_session,output_format,options,output_file,clientName);
98
99 return true;
100 }
101@@ -2044,7 +2046,8 @@
102 const QString GuiEngine::ExportSessionToFile(const QDBusObjectPath session, \
103 const QString &output_format, \
104 const QStringList &option_list, \
105- const QString &output_file)
106+ const QString &output_file, \
107+ const QString &applicationName)
108 {
109 QString empty;
110
111@@ -2071,7 +2074,8 @@
112 QVariant::fromValue<QString>(session.path()), \
113 QVariant::fromValue<QString>(output_format), \
114 varlist, \
115- QVariant::fromValue<QString>(output_file));
116+ QVariant::fromValue<QString>(output_file), \
117+ QVariant::fromValue<QString>(applicationName));
118
119 if (!reply.isValid()) {
120 qDebug() << "Error: " << reply.error();
121
122=== modified file 'checkbox-gui/gui-engine/gui-engine.h'
123--- checkbox-gui/gui-engine/gui-engine.h 2014-03-20 10:35:19 +0000
124+++ checkbox-gui/gui-engine/gui-engine.h 2014-03-28 17:48:41 +0000
125@@ -163,8 +163,10 @@
126 QString GuiExportSessionAsXML(void);
127 QString GuiExportSessionAsHTML(void);
128
129- bool GuiExportSessionToFileAsXML(const QString& output_file);
130- bool GuiExportSessionToFileAsHTML(const QString& output_file);
131+ bool GuiExportSessionToFileAsXML(const QString& output_file, \
132+ const QString& clientName);
133+ bool GuiExportSessionToFileAsHTML(const QString& output_file, \
134+ const QString& clientName);
135
136 const QString SendSubmissionViaCertificationTransport( \
137 const QString &submission_path,
138@@ -199,8 +201,9 @@
139
140 const QString ExportSessionToFile(const QDBusObjectPath session, \
141 const QString& output_format, \
142- const QStringList& option_list,
143- const QString& output_file);
144+ const QStringList& option_list, \
145+ const QString& output_file, \
146+ const QString& applicationName);
147
148 QString SendDataViaTransport(const QString &transport, \
149 const QString &url, \
150
151=== modified file 'checkbox-ng/checkbox_ng/service.py'
152--- checkbox-ng/checkbox_ng/service.py 2014-03-26 19:05:10 +0000
153+++ checkbox-ng/checkbox_ng/service.py 2014-03-28 17:48:41 +0000
154@@ -1201,12 +1201,13 @@
155 return self.native.export_session(session, output_format, option_list)
156
157 @dbus.service.method(
158- dbus_interface=SERVICE_IFACE, in_signature='osass', out_signature='s')
159+ dbus_interface=SERVICE_IFACE, in_signature='osasss', out_signature='s')
160 @PlainBoxObjectWrapper.translate
161 def ExportSessionToFile(self, session: 'o', output_format: 's',
162- option_list: 'as', output_file: 's'):
163+ option_list: 'as', output_file: 's',
164+ client_name: 's'):
165 return self.native.export_session_to_file(
166- session, output_format, option_list, output_file)
167+ session, output_format, option_list, output_file, None, client_name)
168
169 @dbus.service.method(
170 dbus_interface=SERVICE_IFACE, in_signature='', out_signature='as')
171
172=== modified file 'plainbox-provider-checkbox/provider_jobs/miscellanea.txt.in'
173--- plainbox-provider-checkbox/provider_jobs/miscellanea.txt.in 2014-03-20 14:07:18 +0000
174+++ plainbox-provider-checkbox/provider_jobs/miscellanea.txt.in 2014-03-28 17:48:41 +0000
175@@ -5,6 +5,7 @@
176 dpkg
177 lsb
178 package
179+ requirements
180 uname
181 dmi_attachment
182 sysfs_attachment
183
184=== modified file 'plainbox-provider-resource-generic/provider_jobs/resource.txt.in'
185--- plainbox-provider-resource-generic/provider_jobs/resource.txt.in 2014-03-25 01:18:06 +0000
186+++ plainbox-provider-resource-generic/provider_jobs/resource.txt.in 2014-03-28 17:48:41 +0000
187@@ -187,3 +187,9 @@
188 echo "state: unsupported"
189 fi
190 description: Creates resource info for RTC
191+
192+name: requirements
193+estimated_duration: 0.01
194+plugin: resource
195+command: cat $PLAINBOX_PROVIDER_DATA/requirements_docs.txt
196+description: Provide links to requirements documents
197
198=== modified file 'plainbox/plainbox/data/report/checkbox.xsl'
199--- plainbox/plainbox/data/report/checkbox.xsl 2013-09-03 15:16:51 +0000
200+++ plainbox/plainbox/data/report/checkbox.xsl 2014-03-28 17:48:41 +0000
201@@ -19,6 +19,9 @@
202 <h1>System Testing<span class="grey"> Report</span></h1>
203 </div>
204 <div id="content" class="clearfix">
205+ <xsl:apply-templates select=".//summary" />
206+ </div>
207+ <div id="content" class="clearfix">
208 <h2>Hardware Information</h2>
209 <xsl:apply-templates select=".//hardware/dmi" />
210 <xsl:apply-templates select=".//hardware/sysfs-attributes" />
211@@ -29,6 +32,7 @@
212 <h2>Software Information</h2>
213 <xsl:apply-templates select=".//software/packages" />
214 <xsl:apply-templates select=".//software/lsbrelease" />
215+ <xsl:apply-templates select=".//software/requirements"/>
216 </div>
217 <div id="content" class="clearfix">
218 <h2>Tests Performed</h2>
219@@ -45,9 +49,10 @@
220 </xsl:template>
221
222 <xsl:template match="summary">
223- <h3 id="summary">Summary</h3>
224- <p>This report was created using <xsl:value-of select="client/@name" /> <xsl:text> </xsl:text><xsl:value-of select="client/@version" /> on <xsl:value-of select="date_created/@value" />, on <xsl:value-of select="distribution/@value" /><xsl:text> </xsl:text><xsl:value-of select="distroseries/@value" /> (<xsl:value-of select="architecture/@value" />).</p>
225- <p>You can view other reports for this system <a href="https://launchpad.net/+hwdb/+fingerprint/{system_id/@value}">here</a>.</p>
226+ <p>
227+ This report was created using <xsl:value-of select="client/@name" /> <xsl:text> </xsl:text><xsl:value-of select="client/@version" /> on
228+ <xsl:value-of select="date_created/@value" />
229+ </p>
230 </xsl:template>
231
232 <xsl:template match="hardware/udev">
233@@ -123,7 +128,20 @@
234 </table>
235 </div>
236 </xsl:template>
237-
238+<xsl:template match="software/requirements">
239+ <span onClick="showHide('requirements');"><h3 id="requirements"><img class="disclosureimg" src="${PLAINBOX_ASSETS}/report/images/closed.png" />Requirements</h3></span>
240+ <div class="data" id="requirements-contents">
241+ <table>
242+ <xsl:for-each select="requirement">
243+ <tr>
244+ <td>
245+ <a href="{.}"><xsl:value-of select="@name" /></a>
246+ </td>
247+ </tr>
248+ </xsl:for-each>
249+ </table>
250+ </div>
251+</xsl:template>
252
253 <xsl:template match="questions">
254 <h3 id="questions">Tests</h3>
255
256=== modified file 'plainbox/plainbox/data/report/hardware-1_0.rng'
257--- plainbox/plainbox/data/report/hardware-1_0.rng 2013-03-15 15:50:24 +0000
258+++ plainbox/plainbox/data/report/hardware-1_0.rng 2014-03-28 17:48:41 +0000
259@@ -228,6 +228,25 @@
260 </element>
261 </optional>
262 <optional>
263+ <element name="requirements">
264+ <zeroOrMore>
265+ <element name="requirements">
266+ <attribute name="name"/>
267+ <attribute name="id">
268+ <data type="integer">
269+ <except>
270+ <value/>
271+ </except>
272+ </data>
273+ </attribute>
274+ <oneOrMore>
275+ <ref name="property"/>
276+ </oneOrMore>
277+ </element>
278+ </zeroOrMore>
279+ </element>
280+ </optional>
281+ <optional>
282 <element name="xorg">
283 <attribute name="version">
284 <text/>
285
286=== modified file 'plainbox/plainbox/impl/exporter/xml.py'
287--- plainbox/plainbox/impl/exporter/xml.py 2014-03-26 19:30:43 +0000
288+++ plainbox/plainbox/impl/exporter/xml.py 2014-03-28 17:48:41 +0000
289@@ -377,6 +377,22 @@
290 ("name", key),
291 ("type", "str"))))
292 package_property.text = value
293+ requirements_data = self.get_resource(data, "requirements")
294+ if requirements_data is not None:
295+ requirements = ET.SubElement(software, "requirements")
296+ for index, requirements_dict in enumerate(requirements_data):
297+ requirement = ET.SubElement(
298+ requirements, "requirement", attrib=OrderedDict((
299+ ("id", str(index)),
300+ ("name", requirements_dict["name"]))))
301+ for key, value in requirements_dict.items():
302+ if key == "name":
303+ continue
304+ requirements_property = ET.SubElement(
305+ requirement, "property", attrib=OrderedDict((
306+ ("name", key),
307+ ("type", "str"))))
308+ requirements_property.text = value
309
310 def _add_summary(self, element, data):
311 """
312
313=== modified file 'plainbox/plainbox/impl/highlevel.py'
314--- plainbox/plainbox/impl/highlevel.py 2014-03-28 12:35:30 +0000
315+++ plainbox/plainbox/impl/highlevel.py 2014-03-28 17:48:41 +0000
316@@ -301,16 +301,20 @@
317 return temp_stream.getvalue()
318
319 def export_session_to_file(self, session, output_format, option_list,
320- output_file):
321+ output_file, client_version=None,
322+ client_name=None):
323 with open(output_file, 'wb') as stream:
324 self._export_session_to_stream(
325- session, output_format, option_list, stream)
326+ session, output_format, option_list,
327+ stream, client_version, client_name)
328 return output_file
329
330 def _export_session_to_stream(self, session, output_format, option_list,
331- stream):
332+ stream, client_version, client_name):
333 exporter_cls = get_all_exporters()[output_format]
334- exporter = exporter_cls(option_list)
335+ exporter = exporter_cls(option_list,
336+ client_version=client_version,
337+ client_name=client_name)
338 data_subset = exporter.get_session_data_subset(session)
339 exporter.dump(data_subset, stream)
340

Subscribers

People subscribed via source and target branches