Closed Bug 935979 Opened 12 years ago Closed 12 years ago

[keyboard] Intermittent Travis unit test failure: jspinyin various issues

Categories

(Firefox OS Graveyard :: Gaia::Keyboard, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: julienw, Assigned: rudyl)

References

Details

Attachments

(2 files)

(see also bug 935577) 1) [keyboard] jspinyin activate: Error: timeout of 2000ms exceeded at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3680) 2) [keyboard] jspinyin click 'z': Error: procFunction is undefined (http://keyboard.gaiamobile.org:8080/js/imes/jspinyin/worker.js:15) at onerror (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4959) 3) [keyboard] jspinyin get more candidates: TypeError: list is null at (anonymous) (http://keyboard.gaiamobile.org:8080/test/unit/jspinyin_test.js:247) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/test/mocha_generators.js:40) at (anonymous) (http://keyboard.gaiamobile.org:8080/test/unit/jspinyin_test.js:246) at engine_getMore (http://keyboard.gaiamobile.org:8080/js/imes/jspinyin/jspinyin.js:765) at (anonymous) (http://keyboard.gaiamobile.org:8080/test/unit/jspinyin_test.js:245) at wrapper (http://test-agent.gaiamobile.org:8080/common/test/mocha_generators.js:60) at run (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3709) at runTest (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4081) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4127) at next (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4007) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4016) at next (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3964) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3984) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4932) 4) [keyboard] jspinyin select first candidate and get predicts: TypeError: firstCandidate is undefined at (anonymous) (http://keyboard.gaiamobile.org:8080/test/unit/jspinyin_test.js:272) at wrapper (http://test-agent.gaiamobile.org:8080/common/test/mocha_generators.js:60) at run (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3709) at runTest (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4081) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4127) at next (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4007) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4016) at next (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3964) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3984) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4932) 5) [keyboard] jspinyin get more predicts: TypeError: list is null at (anonymous) (http://keyboard.gaiamobile.org:8080/test/unit/jspinyin_test.js:281) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/test/mocha_generators.js:40) at (anonymous) (http://keyboard.gaiamobile.org:8080/test/unit/jspinyin_test.js:280) at engine_getMore (http://keyboard.gaiamobile.org:8080/js/imes/jspinyin/jspinyin.js:765) at (anonymous) (http://keyboard.gaiamobile.org:8080/test/unit/jspinyin_test.js:279) at wrapper (http://test-agent.gaiamobile.org:8080/common/test/mocha_generators.js:60) at run (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3709) at runTest (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4081) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4127) at next (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4007) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4016) at next (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3964) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3984) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4932) 6) [keyboard] jspinyin select first predict: TypeError: firstPredict is undefined at (anonymous) (http://keyboard.gaiamobile.org:8080/test/unit/jspinyin_test.js:296) at wrapper (http://test-agent.gaiamobile.org:8080/common/test/mocha_generators.js:60) at run (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3709) at runTest (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4081) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4127) at next (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4007) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4016) at next (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3964) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3984) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4932) 7) [keyboard] jspinyin input the phrase in userdict from indexedDB: Error: timeout of 2000ms exceeded at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3680) 8) [keyboard] jspinyin create new phrase into userdict: Error: timeout of 2000ms exceeded at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3680) 9) [keyboard] jspinyin input the phrase in userdict that we just created: Error: timeout of 2000ms exceeded at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3680) 10) [keyboard] jspinyin click backspace to clear pendingSymbols: Error: timeout of 2000ms exceeded at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3680) 11) [keyboard] jspinyin deactivate: Error: expected [ 240, 222, 188, 10, 0, 2, 239, 0, 176, 1, 11, 140, 122, 102, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0 ] to equal [ 240, 222, 188, 10, 0, 2, 239, 0, 176, 1, 11, 140, 122, 102, 0, 2, 239, 0, 176, 1, 208, 103, 234, 83, 10, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 1, 0, 254, 0, 2, 0, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0 ] at chaiAssert (http://test-agent.gaiamobile.org:8080/common/test/helper.js:33) at eql (http://test-agent.gaiamobile.org:8080/common/vendor/chai/chai.js:530) at deepEqual (http://test-agent.gaiamobile.org:8080/common/vendor/chai/chai.js:1331) at (anonymous) (http://keyboard.gaiamobile.org:8080/test/unit/jspinyin_test.js:470) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/test/mocha_generators.js:40) at callback (http://keyboard.gaiamobile.org:8080/test/unit/jspinyin_test.js:468) at indexedDBActions (http://keyboard.gaiamobile.org:8080/test/unit/jspinyin_test.js:130) at (anonymous) (http://keyboard.gaiamobile.org:8080/test/unit/jspinyin_test.js:137)
Attached file keyboard_failures.txt
Current travis failures for jspinyin tests.
Hi Rudy, Arthur - Would you guys have any idea what's going on here?
Flags: needinfo?(rlu)
Flags: needinfo?(arthur.chen)
Flags: needinfo?(rlu)
Flags: needinfo?(lchang)
Sorry arthur for the unneeded ni? I suggested the wrong name from memory, so much work with you in settings lately :) - Removing my dupe ni? for rudy as well.
Flags: needinfo?(rlu)
Flags: needinfo?(arthur.chen)
Attached file Patch V1
Let's see if extending the timeout is all we need to get this passed.
Flags: needinfo?(rlu)
Assignee: nobody → rlu
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Really sorry for this issue caused. Rudy, thank you for help!!
Flags: needinfo?(lchang)
Why do we need to extend the timeout? if the underlying code is using setTimeout, a more reliable fix is to use sinon's fake timers to make the test determinist instead of relying on crappy timeouts triggering when we want. see http://sinonjs.org/docs/#clock for more information.
This issue seems to be caused because the jspinyin needs more than 2 seconds to activate its library in Travis system. So we extend the timeout to avoid cancelling the activate process.
Luke, is this because there is a setTimeout in jspinyin code? In that case, using sinon's fake timers is a better idea than increasing mocha's timeout. If you only increase the timeout, there is a chance that the bug will come back from time to time. Is this because the library is slow? In that case, we might want to make it faster anywya, because we're running on constrained devices.
Flags: needinfo?(lchang)
Hi Julien, There is no setTimeout in the jspinyin initialize stage so I guess we can't use fake timers to resolve this issue. And yes, this library needs more time to activate its database. We've put it into web workers so that it won't block users' input. However, we will keep improving its performance as much as possible.
Flags: needinfo?(lchang)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: