checkbox resource evaluator has non-obvious behavior for the membership test operator

Bug #1176189 reported by Jeff Lane 
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox
Won't Fix
Medium
Unassigned

Bug Description

In theory, Checkbox should happily parse the python statements contained in job descriptions when setting up requirements like this:

package.name == 'Foo'

or

dmi.product not in ['Laptop', 'Notebook', 'Portable']

However, that second one does not work. The opposite form of that statement:

dmi.product in ['Laptop', 'Notebook', 'Portable']

Does work fine, but for some reason, when checkbox parses the 'not in' version, it fails to properly work.

This was observed as the root cause of bug #1116681

Where I had use the 'not in' syntax for a requirement. To fix that bug, I changed the requires to a format known to work. For the root cause, Ive opened this bug to address the actual requirements parsing in checkbox

Revision history for this message
Jeff Lane  (bladernr) wrote :

For convenience, here's the text of the other bug:
For the actual result:
https://certification.canonical.com/hardware/201302-12676/submission/i0ryyDGuuBim19Y/result/test:monitor%252Fmulti-head:__monitor__

This test has the constraint: dmi.product not in ['Notebook','Laptop','Portable']

It appears that this is not working correctly. DMI clearly shows the system to be a "Desktop" chassis type:
Handle 0x0003, DMI type 3, 22 bytes
Chassis Information
 Manufacturer: Gigabyte Technology Co., Ltd.
 Type: Desktop
 Lock: Not Present
 Version: To Be Filled By O.E.M.
 Serial Number: To Be Filled By O.E.M.
 Asset Tag: To Be Filled By O.E.M.
 Boot-up State: Safe
 Power Supply State: Safe
 Thermal State: Safe
 Security Status: None
 OEM Information: 0x00000000
 Height: Unspecified
 Number Of Power Cords: 1
 Contained Elements: 0
 SKU Number: To be filled by O.E.M.

so perhaps something is broken with the dmi interpreter (dmi.py) or the bits that interpret the requires are not honoring the python statement.

Revision history for this message
Jeff Lane  (bladernr) wrote :

Daniel:
OK, I was able to reproduce this problem on my sole desktop system. One interesting thing I notice is that the requires: for this job are unique: it's the ONLY instance in all checkbox jobs where a requirement is expressed as "<something> not in [list]". So there may be some weirdness in the requirements evaluator that causes this particular scenario to fail. Now, to put a few wires in resource_info to measure what happens in this case...

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

http://bazaar.launchpad.net/~checkbox-dev/checkbox/trunk/view/head:/checkbox/test_resource.py#L264 for information on how set membership operator is implemented in checkbox

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

I don't see a way to fix this. Keep in mind that 'not in' and 'in' are implemented by one method, __contains__. I suspect what may be missing is an appropriate __not__ method on the return value but may be impossible.

summary: - checkbox fails to parse python statements in requires lines
+ checkbox resource evaluator has non-obvious behavior for the membership
+ test operator
Changed in checkbox:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.