dim_brightness test would return 1 even it works due to the potential rounding issue

Bug #1464163 reported by Po-Hsu Lin
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox Provider - Base
Fix Released
Medium
Po-Hsu Lin

Bug Description

Expected result:
dim_brightness script would return 0 to make the test pass, and brightness successfully dimmed.

Actual result:
It return 1, but brightness successfully dimmed.
Tested on 201306-13745

It looks like the script didn't pass the if statement in the brightness value checking algorithm:
    def was_brightness_applied(self, interface):
        '''See if the selected brightness was applied

        Note: this doesn't guarantee that screen brightness
              changed.
        '''
        if (self.get_actual_brightness(interface) !=
            self.get_last_set_brightness(interface)):
            return False
        else:
            return True

root@201306-13745:~$ apt-cache policy checkbox
checkbox:
  Installed: (none)
  Candidate: 0.18-0ubuntu2
  Version table:
     0.18-0ubuntu2 0
        500 http://archive.ubuntu.com/ubuntu/ vivid/universe amd64 Packages
root@201306-13745:~$ apt-cache policy plainbox
plainbox:
  Installed: 0.22+bzr3836+pkg29~ubuntu15.04.1
  Candidate: 0.22+bzr3836+pkg29~ubuntu15.04.1
  Version table:
 *** 0.22+bzr3836+pkg29~ubuntu15.04.1 0
        500 http://ppa.launchpad.net/checkbox-dev/ppa/ubuntu/ vivid/main amd64 Packages
        100 /var/lib/dpkg/status
     0.5.4-1 0
        500 http://archive.ubuntu.com/ubuntu/ vivid/universe amd64 Packages
root@201306-13745:~$ plainbox dev list provider
provider '2013.com.canonical.plainbox:manifest'
provider '2013.com.canonical.plainbox:categories'
provider '2013.com.canonical.certification:certification-client'
provider '2013.com.canonical.certification:checkbox'
provider '2013.com.canonical.certification:plainbox-resources'
provider '2013.com.canonical.certification:piglit'

Related branches

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

On a 14.04.3 I+A system (201404-14986), the dim_brightness script return 1 because of the brightness value checking algorithm mentioned above.
After running the script on this system, the brightness will be changed from 5273 to 2636, but the actual brightness is 2637. Therefore it's causing this issue.

We should double check this on other system to see how the rounding works.

Changed in plainbox-provider-checkbox:
status: New → Confirmed
importance: Undecided → Medium
summary: - On vivid, dim brightness test would return 1 even it works
+ dim_brightness test would return 1 even it works due to the potential
+ rounding issue
Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

On 201407-15273, 14.04.3 + 4.2 kernel, I can reproduce this, and the same rounding issue can be found there.
The brightness will be changed from 937 to 468, but the actual brightness will is 469.

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

On 201401-14542, 14.04.1 (3.13.0-63), although the maximum brightness is 937, however both of the brightness and actual_brightness will be changed to 468. So it won't return FAIL on this system.

Looks like we can't just round it.

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

So for comment #2 and #3, we could obtain the same value from our script (937/2=468), it's the actual brightness that is causing the problem.

A quick and dirty fix is to add a tolerance value or percentage, e.g. make it pass with actual brightness = 468 +/- 1

Po-Hsu Lin (cypressyew)
Changed in plainbox-provider-checkbox:
assignee: nobody → Po-Hsu Lin (cypressyew)
status: Confirmed → In Progress
Po-Hsu Lin (cypressyew)
tags: added: scripts
Revision history for this message
Vanessa Chang (vanessa-chang) wrote :

this issue can also be reproduced during oem project testing. add tag accordingly.

tags: added: ce-qa-concern
Po-Hsu Lin (cypressyew)
Changed in plainbox-provider-checkbox:
status: In Progress → Fix Committed
milestone: none → 0.23
Pierre Equoy (pieq)
Changed in plainbox-provider-checkbox:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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