Open Bug 899605 Opened 6 years ago Updated 4 years ago

Robocop testBrowserProvider fails on Jellybean

Categories

(Firefox for Android :: General, defect)

x86
Android
defect
Not set

Tracking

()

People

(Reporter: gbrown, Unassigned)

References

Details

(Whiteboard: [reit-x86] [leave open])

Attachments

(1 file)

Robocop's testBrowserProvider fails consistently when run on the x86 emulator setup (see bug 891959). It also fails locally when run on a Motorola Razr i (XT890).

This may be a fails-on-Jellybean rather than a fails-on-x86 problem, but it is the effort to get tests running on x86 that is bringing about this bug.


0 INFO SimpleTest START
1 INFO TEST-START | testBrowserProvider
2 INFO TEST-PASS | testBrowserProvider | Mobile bookmarks folder is present - true should equal true
3 INFO TEST-START | testBrowserProvider - TestSpecialFolders
4 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | All non-special bookmarks and folders were deleted - 7 should equal 7
5 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | All history entries were deleted - 0 should equal 0
6 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | All favicons were deleted - 0 should equal 0
7 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | All thumbnails were deleted - 0 should equal 0
8 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | Right number of special folders - 7 should equal 7
9 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | The id of places folder is correct - 0 should equal 0
10 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | The PARENT of the places special folder is correct - 0 should equal 0
11 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | The PARENT of the mobile special folder is correct - 0 should equal 0
12 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | The PARENT of the toolbar special folder is correct - 0 should equal 0
13 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | The PARENT of the menu special folder is correct - 0 should equal 0
14 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | The PARENT of the tags special folder is correct - 0 should equal 0
15 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | The PARENT of the unfiled special folder is correct - 0 should equal 0
16 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | The id of reading list folder is correct - -2 should equal -2
17 INFO TEST-PASS | testBrowserProvider - TestSpecialFolders | The PARENT of the readinglist special folder is correct - 0 should equal 0
18 INFO TEST-START | testBrowserProvider - TestInsertBookmarks
19 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | All non-special bookmarks and folders were deleted - 7 should equal 7
20 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | All history entries were deleted - 0 should equal 0
21 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | All favicons were deleted - 0 should equal 0
22 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | All thumbnails were deleted - 0 should equal 0
23 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Inserted bookmark found - true should equal true
24 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Inserted bookmark has correct title - Example should equal Example
25 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Inserted bookmark has correct URL - http://example.com should equal http://example.com
26 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Inserted bookmark has correct tags - tags should equal tags
27 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Inserted bookmark has correct keyword - keyword should equal keyword
28 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Inserted bookmark has correct description - description should equal description
29 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Inserted bookmark has correct position - 0 should equal 0
30 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Inserted bookmark has correct type - 1 should equal 1
31 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Inserted bookmark has correct parent ID - 1 should equal 1
32 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Inserted bookmark has correct is-deleted state - 0 should equal 0
33 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Should not be able to insert bookmark with null position - -1 should equal -1
34 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Should not be able to insert bookmark with null type - -1 should equal -1
35 INFO TEST-UNEXPECTED-FAIL | testBrowserProvider - TestInsertBookmarks | Should not be able to insert bookmark with invalid parent - got 11, expected -1
Exception caught during test!
junit.framework.AssertionFailedError: 35 INFO TEST-UNEXPECTED-FAIL | testBrowserProvider - TestInsertBookmarks | Should not be able to insert bookmark with invalid parent - got 11, expected -1
        at junit.framework.Assert.fail(Assert.java:50)
        at org.mozilla.fennec_mozdev.FennecMochitestAssert._logMochitestResult(FennecMochitestAssert.java:107)
        at org.mozilla.fennec_mozdev.FennecMochitestAssert.ok(FennecMochitestAssert.java:136)
        at org.mozilla.fennec_mozdev.FennecMochitestAssert.is(FennecMochitestAssert.java:142)
        at org.mozilla.fennec_mozdev.tests.testBrowserProvider$TestInsertBookmarks.test(testBrowserProvider.java:661)
        at org.mozilla.fennec_mozdev.tests.testBrowserProvider$Test.run(testBrowserProvider.java:378)
        at org.mozilla.fennec_mozdev.tests.testBrowserProvider.testBrowserProvider(testBrowserProvider.java:370)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
        at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
        at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
        at org.mozilla.fennec_mozdev.tests.BaseTest.runTest(BaseTest.java:133)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:115)
        at junit.framework.TestResult.runProtected(TestResult.java:133)
        at junit.framework.TestResult.run(TestResult.java:118)
        at junit.framework.TestCase.run(TestCase.java:124)
        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
        at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
        at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)
36 INFO TEST-UNEXPECTED-FAIL | testBrowserProvider - TestInsertBookmarks | Exception caught - junit.framework.AssertionFailedError: 35 INFO TEST-UNEXPECTED-FAIL | testBrowserProvider - TestInsertBookmarks | Should not be able to insert bookmark with invalid parent - got 11, expected -1
37 INFO TEST-END | testBrowserProvider - TestInsertBookmarks | finished in 113ms
38 INFO TEST-START | Shutdown
39 INFO Passed: 31
40 INFO Failed: 2
41 INFO Todo: 0
42 INFO SimpleTest FINISHED
Blocks: 892688
No longer blocks: 891959
The part of the test that is failing is:

            if (Build.VERSION.SDK_INT >= 8) {
                b = createOneBookmark();
                b.put(mBookmarksParentCol, -1);
                id = -1;

                try {
                    id = ContentUris.parseId(mProvider.insert(mBookmarksUri, b));
                } catch (Exception e) {}

                mAsserter.is(new Long(id), new Long(-1),
                             "Should not be able to insert bookmark with invalid parent");
            }

We get id == 11 here.

:lucasr -- Can you think of what might be going wrong? Where should I look?
Flags: needinfo?(lucasr.at.mozilla)
I'd check if this code is running the test device:

http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/db/BrowserProvider.java#415

If we set a foreign key on the table, it should fail to update a bookmark with an invalid foreign key.
Flags: needinfo?(lucasr.at.mozilla)
That code does execute -- twice in fact. 

foreignKeyOnParent == ", FOREIGN KEY (parent) REFERENCES bookmarks(_id)"
I also see the same failure on a Nexus 4 running Android 4.2.2.
Summary: Robocop testBrowserProvider fails on x86 emulator / RAZR → Robocop testBrowserProvider fails on x86 emulator / RAZR / Jellybean
Does it work at all in any device running Android >= 4.0?
It works fine on the Pandas, running 4.0.4.

pandaboard-eng 4.0.4 IMM76I 5 test-keys

https://tbpl.mozilla.org/php/getParsedLog.php?id=26257864&tree=Mozilla-Inbound&full=1
(In reply to Geoff Brown [:gbrown] from comment #6)
> It works fine on the Pandas, running 4.0.4.
> 
> pandaboard-eng 4.0.4 IMM76I 5 test-keys
> 
> https://tbpl.mozilla.org/php/getParsedLog.php?id=26257864&tree=Mozilla-
> Inbound&full=1

And I assume the code I mentioned in comment #2 actually runs on this device?
(In reply to Lucas Rocha (:lucasr) from comment #7)
> And I assume the code I mentioned in comment #2 actually runs on this device?

I verified that the code in comment #2 runs on the emulator/4.2 (Comment 3) and on the pandaboard/4.0.4. 

For the panda, consider https://tbpl.mozilla.org/?tree=Try&rev=027dfe31250d:

15:00:59     INFO -  08-13 15:00:54.609 I/Robocop ( 2130): 1 INFO TEST-START | testBrowserProvider
15:00:59     INFO -  08-13 15:00:54.656 D/GeckoBrowserProvider( 2130): Creating browser.db: /mnt/sdcard/tests/profile/browser.db
15:00:59     INFO -  08-13 15:00:54.656 D/GeckoBrowserProvider( 2130): Creating bookmarks table on /mnt/sdcard/tests/profile/browser.db
15:00:59     INFO -  08-13 15:00:54.656 D/GeckoBrowserProvider( 2130):  ---- Build.VERSION == 15; foreignKeyOnParent == , FOREIGN KEY (parent) REFERENCES bookmarks(_id)
15:00:59     INFO -  08-13 15:00:54.656 D/GeckoBrowserProvider( 2130): Creating BrowserProvider
15:00:59     INFO -  08-13 15:00:54.656 D/GeckoBrowserProvider( 2130): Creating BrowserProvider
15:00:59     INFO -  08-13 15:00:54.664 V/GeckoBrowserProvider( 2130): Getting readable database for URI: content://org.mozilla.fennec.db.browser/bookmarks?test=1
15:00:59     INFO -  08-13 15:00:54.664 W/GeckoProfile( 2130): requested profile directory missing: null
15:00:59     INFO -  08-13 15:00:54.664 V/GeckoBrowserProvider( 2130): Getting database path for profile: default
15:00:59     INFO -  08-13 15:00:54.671 D/GeckoBrowserProvider( 2130): Creating history table
15:00:59     INFO -  08-13 15:00:54.679 D/GeckoBrowserProvider( 2130): Creating favicons table
15:00:59     INFO -  08-13 15:00:54.679 D/GeckoBrowserProvider( 2130): Creating thumbnails table
15:00:59     INFO -  08-13 15:00:54.679 D/GeckoBrowserProvider( 2130): Creating bookmarks_with_favicons view
15:00:59     INFO -  08-13 15:00:54.687 D/GeckoBrowserProvider( 2130): Creating history_with_favicons view
15:00:59     INFO -  08-13 15:00:54.687 D/GeckoBrowserProvider( 2130): Creating combined view
15:00:59     INFO -  08-13 15:00:54.687 D/GeckoBrowserProvider( 2130): Creating combined_with_favicons view
15:00:59     INFO -  08-13 15:00:54.695 D/GeckoBrowserProvider( 2130): Inserted special folder: places
15:00:59     INFO -  08-13 15:00:54.695 D/GeckoBrowserProvider( 2130): Inserted special folder: mobile
15:00:59     INFO -  08-13 15:00:54.695 D/GeckoBrowserProvider( 2130): Inserted special folder: toolbar
15:00:59     INFO -  08-13 15:00:54.695 D/GeckoBrowserProvider( 2130): Inserted special folder: menu
15:00:59     INFO -  08-13 15:00:54.703 D/GeckoBrowserProvider( 2130): Inserted special folder: tags
15:00:59     INFO -  08-13 15:00:54.703 D/GeckoBrowserProvider( 2130): Inserted special folder: unfiled
15:00:59     INFO -  08-13 15:00:54.703 D/GeckoBrowserProvider( 2130): Inserted special folder: readinglist
15:00:59     INFO -  08-13 15:00:54.710 D/GeckoBrowserProvider( 2130): Inserted special folder: pinned
15:00:59     INFO -  08-13 15:00:54.734 D/GeckoBrowserProvider( 2130): Creating browser.db: /data/data/org.mozilla.fennec/databases/testBrowserProvider.browser.db
15:00:59     INFO -  08-13 15:00:54.734 D/GeckoBrowserProvider( 2130): Creating bookmarks table on /data/data/org.mozilla.fennec/databases/testBrowserProvider.browser.db
15:00:59     INFO -  08-13 15:00:54.734 D/GeckoBrowserProvider( 2130):  ---- Build.VERSION == 15; foreignKeyOnParent == , FOREIGN KEY (parent) REFERENCES bookmarks(_id)
15:00:59     INFO -  08-13 15:00:54.742 D/GeckoBrowserProvider( 2130): Creating history table
15:00:59     INFO -  08-13 15:00:54.742 D/GeckoBrowserProvider( 2130): Creating favicons table
15:00:59     INFO -  08-13 15:00:54.742 D/GeckoBrowserProvider( 2130): Creating thumbnails table
15:00:59     INFO -  08-13 15:00:54.750 D/GeckoBrowserProvider( 2130): Creating bookmarks_with_favicons view
15:00:59     INFO -  08-13 15:00:54.750 D/GeckoBrowserProvider( 2130): Creating history_with_favicons view
15:00:59     INFO -  08-13 15:00:54.750 D/GeckoBrowserProvider( 2130): Creating combined view
15:00:59     INFO -  08-13 15:00:54.750 D/GeckoBrowserProvider( 2130): Creating combined_with_favicons view
15:00:59     INFO -  08-13 15:00:54.757 D/GeckoBrowserProvider( 2130): Inserted special folder: places
15:00:59     INFO -  08-13 15:00:54.757 D/GeckoBrowserProvider( 2130): Inserted special folder: mobile
15:00:59     INFO -  08-13 15:00:54.757 D/GeckoBrowserProvider( 2130): Inserted special folder: toolbar
15:00:59     INFO -  08-13 15:00:54.757 D/GeckoBrowserProvider( 2130): Inserted special folder: menu
15:00:59     INFO -  08-13 15:00:54.765 D/GeckoBrowserProvider( 2130): Inserted special folder: tags
15:00:59     INFO -  08-13 15:00:54.765 D/GeckoBrowserProvider( 2130): Inserted special folder: unfiled
15:00:59     INFO -  08-13 15:00:54.765 D/GeckoBrowserProvider( 2130): Inserted special folder: readinglist
15:00:59     INFO -  08-13 15:00:54.765 D/GeckoBrowserProvider( 2130): Inserted special folder: pinned
15:00:59     INFO -  08-13 15:00:54.828 E/GeckoLibLoad( 2130): Loaded libs in 537ms total, 265ms(719ms) user, 93ms(148ms) system, 0(0) faults
15:00:59     INFO -  08-13 15:00:54.828 W/GeckoThread( 2130): zerdatime 428059 - runGecko
15:00:59     INFO -  08-13 15:00:54.828 I/GeckoThread( 2130): RunGecko - args = -no-remote -profile /mnt/sdcard/tests/profile -P default
15:00:59     INFO -  08-13 15:00:54.835 D/GeckoBrowserProvider( 2130): Opening browser.db: /data/data/org.mozilla.fennec/databases/testBrowserProvider.browser.db
...
5:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): exception in DB operation
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at android.database.sqlite.SQLiteStatement.native_executeInsert(Native Method)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:113)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1718)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at android.database.sqlite.SQLiteDatabase.insertOrThrow(SQLiteDatabase.java:1617)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at org.mozilla.gecko.db.BrowserProvider.insertBookmark(BrowserProvider.java:2841)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at org.mozilla.gecko.db.BrowserProvider.insertInTransaction(BrowserProvider.java:2365)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at org.mozilla.gecko.db.BrowserProvider.insert(BrowserProvider.java:2335)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at org.mozilla.fennec.tests.ContentProviderTest$DelegatingTestContentProvider.insert(ContentProviderTest.java:128)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at org.mozilla.fennec.tests.testBrowserProvider$TestInsertBookmarks.test(testBrowserProvider.java:660)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at org.mozilla.fennec.tests.testBrowserProvider$Test.run(testBrowserProvider.java:380)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at org.mozilla.fennec.tests.testBrowserProvider.testBrowserProvider(testBrowserProvider.java:372)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at java.lang.reflect.Method.invokeNative(Native Method)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at java.lang.reflect.Method.invoke(Method.java:511)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at org.mozilla.fennec.tests.BaseTest.runTest(BaseTest.java:133)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at junit.framework.TestCase.runBare(TestCase.java:127)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at junit.framework.TestResult$1.protect(TestResult.java:106)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at junit.framework.TestResult.runProtected(TestResult.java:124)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at junit.framework.TestResult.run(TestResult.java:109)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at junit.framework.TestCase.run(TestCase.java:118)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:545)
15:00:59     INFO -  08-13 15:00:55.203 E/GeckoBrowserProvider( 2130): 	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)
15:00:59     INFO -  08-13 15:00:55.203 I/Robocop ( 2130): 35 INFO TEST-PASS | testBrowserProvider - TestInsertBookmarks | Should not be able to insert bookmark with invalid parent - -1 should equal -1
Whiteboard: [reit-x86]
Assignee: nobody → lucasr.at.mozilla
Blocks: 833984
Blocks: 846364
Blocks: 847315
I want to get this test running clean on the x86 emulator as more people are starting to look at x86 test results now. This patch avoids the troublesome assertions on api level 16 and higher, as we already do for api level < 8. 

We can leave the bug open for further investigation if needed.
Attachment #797376 - Flags: review?(lucasr.at.mozilla)
Attachment #797376 - Flags: review?(lucasr.at.mozilla) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/c456e82b5e07
No longer blocks: 892688
Whiteboard: [reit-x86] → [reit-x86] [leave open]
Assignee: lucasr.at.mozilla → nobody
Summary: Robocop testBrowserProvider fails on x86 emulator / RAZR / Jellybean → Robocop testBrowserProvider fails on Jellybean
You need to log in before you can comment on or make changes to this bug.