Merge lp:~sylvain-pineau/checkbox/fix-1561821 into lp:checkbox

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 4290
Merged at revision: 4290
Proposed branch: lp:~sylvain-pineau/checkbox/fix-1561821
Merge into: lp:checkbox
Diff against target: 68 lines (+11/-4)
3 files modified
plainbox/plainbox/impl/unit/template.py (+11/-0)
providers/plainbox-provider-checkbox/jobs/input.txt.in (+0/-2)
providers/plainbox-provider-checkbox/jobs/suspend.txt.in (+0/-2)
To merge this branch: bzr merge lp:~sylvain-pineau/checkbox/fix-1561821
Reviewer Review Type Date Requested Status
Pierre Equoy Approve
Sylvain Pineau (community) Needs Resubmitting
Review via email: mp+290320@code.launchpad.net

Description of the change

Fixes the linked bug, but without modifying the udev parser to add an extra input-id field.

To post a comment you must log in.
Revision history for this message
Pierre Equoy (pieq) wrote :

It's very smart!

When I was testing it and checking how it worked, I realized there are other jobs where we need to remove the {path} parameter in the description or else it will fail the same way:

  - suspend/pointing-after-suspend_{product_slug}_{category}_{__index__}
  - suspend/clicking-after-suspend_{product_slug}_{category}_{__index__}

Other than that, it looks great. Thanks!

review: Needs Fixing
4290. By Sylvain Pineau

providers:checkbox: Remove {path} requirement in input jobs

As those may change if the same device is unplugged/re-plugged
(even on the same port).

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

I've fixed the suspend jobs

review: Needs Resubmitting
Revision history for this message
Pierre Equoy (pieq) wrote :

+1

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plainbox/plainbox/impl/unit/template.py'
2--- plainbox/plainbox/impl/unit/template.py 2016-03-03 16:04:58 +0000
3+++ plainbox/plainbox/impl/unit/template.py 2016-03-30 08:11:28 +0000
4@@ -32,6 +32,7 @@
5 from plainbox.impl.secure.origin import Origin
6 from plainbox.impl.symbol import SymbolDef
7 from plainbox.impl.unit import all_units
8+from plainbox.impl.unit import get_accessed_parameters
9 from plainbox.impl.unit._legacy import TemplateUnitLegacyAPI
10 from plainbox.impl.unit._legacy import TemplateUnitValidatorLegacyAPI
11 from plainbox.impl.unit.unit import Unit
12@@ -366,6 +367,16 @@
13 # XXX: extract raw dictionary from the resource object, there is no
14 # normal API for that due to the way resource objects work.
15 parameters = dict(object.__getattribute__(resource, '_data'))
16+ accessed_parameters = set(itertools.chain(*{
17+ get_accessed_parameters(value) for value in data.values()}))
18+ # Recreate the parameters with only the subset that will actually be
19+ # used by the template. Doing this filter can prevent exceptions like
20+ # DependencyDuplicateError where an unused resource property can differ
21+ # when resuming and bootstrapping sessions, causing job checksums
22+ # mismatches.
23+ # See https://bugs.launchpad.net/bugs/1561821
24+ parameters = {
25+ k: v for k, v in parameters.items() if k in accessed_parameters}
26 # Add the special __index__ to the resource namespace variables
27 parameters['__index__'] = index
28 # Instantiate the class using the instantiation API
29
30=== modified file 'providers/plainbox-provider-checkbox/jobs/input.txt.in'
31--- providers/plainbox-provider-checkbox/jobs/input.txt.in 2016-03-02 14:01:49 +0000
32+++ providers/plainbox-provider-checkbox/jobs/input.txt.in 2016-03-30 08:11:28 +0000
33@@ -5,7 +5,6 @@
34 category_id: 2013.com.canonical.plainbox::input
35 id: input/pointing_{product_slug}_{category}_{__index__}
36 estimated_duration: 30.0
37-requires: device.path == '{path}'
38 _summary: Check pointing functionality for {product}
39 _purpose:
40 This will test your {product} device
41@@ -78,7 +77,6 @@
42 category_id: 2013.com.canonical.plainbox::input
43 id: input/clicking_{product_slug}_{category}_{__index__}
44 estimated_duration: 30.0
45-requires: device.path == '{path}'
46 _summary: Check button functionality for {product}
47 _purpose:
48 This will test the buttons of your {product} device
49
50=== modified file 'providers/plainbox-provider-checkbox/jobs/suspend.txt.in'
51--- providers/plainbox-provider-checkbox/jobs/suspend.txt.in 2016-03-11 14:36:34 +0000
52+++ providers/plainbox-provider-checkbox/jobs/suspend.txt.in 2016-03-30 08:11:28 +0000
53@@ -2673,7 +2673,6 @@
54 category_id: 2013.com.canonical.plainbox::suspend
55 id: suspend/pointing-after-suspend_{product_slug}_{category}_{__index__}
56 depends: suspend/suspend_advanced
57-requires: device.path == "{path}"
58 _description:
59 PURPOSE:
60 This will test your {product} device after suspend.
61@@ -2690,7 +2689,6 @@
62 estimated_duration: 30.0
63 id: suspend/clicking-after-suspend_{product_slug}_{category}_{__index__}
64 depends: suspend/suspend_advanced
65-requires: device.path == "{path}"
66 _summary: Check post suspend button functionality for {product}
67 _description:
68 PURPOSE:

Subscribers

People subscribed via source and target branches