ubuntu_calculator_app.tests.test_simple_page.TestSimplePage.test_divide_with_infinity_length_result_number failed on mako #91

Bug #1332567 reported by Brendan Donegan
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Ubuntu Calculator App
Fix Released
Critical
Riccardo Padovani

Bug Description

This test failed on mako image #91 with the following error:

Traceback (most recent call last):
  File "/home/phablet/autopilot/ubuntu_calculator_app/tests/test_simple_page.py", line 93, in test_divide_with_infinity_length_result_number
    self._assert_result("0.33333333")
  File "/home/phablet/autopilot/ubuntu_calculator_app/tests/test_simple_page.py", line 63, in _assert_result
    self.main_view.get_result, Eventually(Equals(expected_result)))
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 406, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: After 10.0 seconds test failed: '0.33333333' != '0.3'

It's pretty clear there that the number of decimal points in the displayed text has changed.

Related branches

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

Yes this has clearly changed. 1/3 = 0.3 now on the display. Which is not technically wrong but it's a lot less than useful. There also seem to be some calculations that it gets completely wrong. Like 0.45/2 = 0.25!

Changed in ubuntu-calculator-app:
status: New → Triaged
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Thanks for your report, we'll investigate on this.

Just for track, revision 279 of the app on image #76 works well

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Ok, I'm not able to reproduce it on desktop, but I can reproduce without problem on the device.

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

On image #97 this is not reproducible anymore, luckly. I mark it as invalid

Changed in ubuntu-calculator-app:
status: Triaged → Invalid
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

It's fixed, not Invalid. We just don't know how it was fixed :)

Changed in ubuntu-calculator-app:
status: Invalid → Fix Released
Changed in ubuntu-calculator-app:
importance: Undecided → Medium
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :
Changed in ubuntu-calculator-app:
status: Fix Released → New
status: New → Confirmed
Changed in ubuntu-calculator-app:
importance: Medium → High
importance: High → Critical
Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Ok, an update: in image #97 isn't fixed, but the bug has a very strange behavior:
- connect the device to computer,
- open the calculator,
- do 1/3: results is 0.3,
- close the app,
- disconnect the cable from the computer,
- reopen the calculator,
- do a calc,
- close the app,
- reopen the calculator
- do again 1/3
- result is 0.33333333, as expected

Seems that the calc is wrong if the device is connected to the pc

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

I'm pretty sure I have identified the origin of the bug: in bignumber.js there is function named "division", which has a do/while cycle inside.

Before the do/while cycle all vars are equal on desktop and on device, but after the cycle the array named qc is different.

So, I started to debug the do/while cycle, but everytime I add a console.log() in the do/while cycle, the bug disappears. I think is an Heisenbug[1].

I suppose the bug is in the QT 5.3 Javascript Interpreter, and I'm working to reproduce the bug with a simplier code.

Changed in ubuntu-calculator-app:
assignee: nobody → Riccardo Padovani (rpadovani)
Revision history for this message
Victor Thompson (vthompson) wrote :

I believe this is more likely to be a timing issue with setting and reading the rem[] array.

Revision history for this message
Victor Thompson (vthompson) wrote :

This appears to fix the timing constraint: lp:~vthompson/ubuntu-calculator-app/test-fix-1332567

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Nice catch Victor, I should think to it before.
I totally don't understand why it happens only with QT5.3 and only when device is connected to the PC, but your solution is totally better than my one.

I'll open a bug upstream to inform the developer.

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Opened a bug upsream to inform the developer: https://github.com/MikeMcl/bignumber.js/issues/39

Changed in ubuntu-calculator-app:
status: Confirmed → In Progress
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:ubuntu-calculator-app at revision 288, scheduled for release in ubuntu-calculator-app, milestone 1.6

Changed in ubuntu-calculator-app:
status: In Progress → Fix Committed
Changed in ubuntu-calculator-app:
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.