Opened on 06/22/2016 at 08:03:23 AM

Closed on 10/23/2018 at 10:26:54 AM

#4181 closed defect (rejected)

Fix FilterEngineTest tests

Reported by: asmirnov Assignee: asmirnov
Priority: P3 Milestone:
Module: Libadblockplus-Android Keywords:
Cc: rjeschke Blocked By: #4031
Blocking: Platform: Android
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29347192/
https://codereview.adblockplus.org/29435584/

Description (last modified by asmirnov)

It's about core functionality of filtering.

The tests are unstable and can succeed or fail randomly.
If i run the tests few times in a row without any changes they can succeed or fail:

successfull

est:
     [echo] Running tests ...
     [exec] WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
     [exec] 
     [exec] org.adblockplus.libadblockplus.tests.FilterEngineTest:...............
     [exec] Test results for InstrumentationTestRunner=...............
     [exec] Time: 0.764
     [exec] 
     [exec] OK (15 tests)
     [exec] 
     [exec] 

BUILD SUCCESSFUL

06-20 14:29:01.256    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:29:01.256    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:29:01.256    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 2
06-20 14:29:01.256    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 3
06-20 14:29:01.376    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:29:01.376    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:29:01.376    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:29:01.386    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:29:01.386    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:29:01.386    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:29:01.386    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:29:01.456    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:29:01.456    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:29:01.456    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ checking filter type ...
06-20 14:29:01.456    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:29:01.456    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:29:01.456    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:29:01.506    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:29:01.506    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:29:01.506    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:29:01.546    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:29:01.546    3855-3868/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1

failing:

test:
     [echo] Running tests ...
     [exec] WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
     [exec] 
     [exec] org.adblockplus.libadblockplus.tests.FilterEngineTest:........
     [exec] Failure in testMatches:
     [exec] junit.framework.AssertionFailedError: Expected: <null> but was: @@||example.org^$document
     [exec] 	at org.adblockplus.libadblockplus.tests.FilterEngineTest.testMatches(FilterEngineTest.java:166)
     [exec] 	at java.lang.reflect.Method.invokeNative(Native Method)
     [exec] 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
     [exec] 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
     [exec] 	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
     [exec] 	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
     [exec] 
     [exec] Failure in testMatchesNestedFrameOnWhitelistedDomain:
     [exec] junit.framework.AssertionFailedError: expected:<BLOCKING> but was:<EXCEPTION>
     [exec] 	at org.adblockplus.libadblockplus.tests.FilterEngineTest.testMatchesNestedFrameOnWhitelistedDomain(FilterEngineTest.java:304)
     [exec] 	at java.lang.reflect.Method.invokeNative(Native Method)
     [exec] 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
     [exec] 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
     [exec] 	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
     [exec] 	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
     [exec] 
     [exec] Failure in testMatchesNestedFrameRequest:
     [exec] junit.framework.AssertionFailedError: expected:<BLOCKING> but was:<EXCEPTION>
     [exec] 	at org.adblockplus.libadblockplus.tests.FilterEngineTest.testMatchesNestedFrameRequest(FilterEngineTest.java:268)
     [exec] 	at java.lang.reflect.Method.invokeNative(Native Method)
     [exec] 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
     [exec] 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
     [exec] 	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
     [exec] 	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
     [exec] ....
     [exec] Test results for InstrumentationTestRunner=.........F.F.F....
     [exec] Time: 0.771
     [exec] 
     [exec] FAILURES!!!
     [exec] Tests run: 15,  Failures: 3,  Errors: 0
     [exec] 
     [exec] 

BUILD SUCCESSFUL


06-20 14:40:02.896    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:40:02.896    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:40:02.896    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 2
06-20 14:40:02.896    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 3
06-20 14:40:03.016    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:40:03.016    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:40:03.016    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:40:03.066    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:40:03.066    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:40:03.066    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ checking filter type ...
06-20 14:40:03.066    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:40:03.106    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:40:03.106    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:40:03.106    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1
06-20 14:40:03.156    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 0
06-20 14:40:03.156    4835-4848/org.adblockplus.libadblockplus.tests D/abp﹕ type filter is 1

"type filter is x" is c++ output from JniGetType - just printing type enum.

According c++ tests succeed:

[----------] 15 tests from FilterEngineTest
[ RUN      ] FilterEngineTest.FilterCreation
[       OK ] FilterEngineTest.FilterCreation (469 ms)
[ RUN      ] FilterEngineTest.FilterProperties
[       OK ] FilterEngineTest.FilterProperties (301 ms)
[ RUN      ] FilterEngineTest.AddRemoveFilters
[       OK ] FilterEngineTest.AddRemoveFilters (398 ms)
[ RUN      ] FilterEngineTest.SubscriptionProperties
[       OK ] FilterEngineTest.SubscriptionProperties (393 ms)
[ RUN      ] FilterEngineTest.AddRemoveSubscriptions
[       OK ] FilterEngineTest.AddRemoveSubscriptions (315 ms)
[ RUN      ] FilterEngineTest.SubscriptionUpdates
[       OK ] FilterEngineTest.SubscriptionUpdates (266 ms)
[ RUN      ] FilterEngineTest.Matches
[       OK ] FilterEngineTest.Matches (392 ms)
[ RUN      ] FilterEngineTest.MatchesOnWhitelistedDomain
[       OK ] FilterEngineTest.MatchesOnWhitelistedDomain (301 ms)
[ RUN      ] FilterEngineTest.MatchesWithContentTypeMask
[       OK ] FilterEngineTest.MatchesWithContentTypeMask (421 ms)
[ RUN      ] FilterEngineTest.MatchesNestedFrameRequest
[       OK ] FilterEngineTest.MatchesNestedFrameRequest (352 ms)
[ RUN      ] FilterEngineTest.MatchesNestedFrameOnWhitelistedDomain
[       OK ] FilterEngineTest.MatchesNestedFrameOnWhitelistedDomain (342 ms)
[ RUN      ] FilterEngineTest.FirstRunFlag
[       OK ] FilterEngineTest.FirstRunFlag (381 ms)
[ RUN      ] FilterEngineTest.SetRemoveFilterChangeCallback
[       OK ] FilterEngineTest.SetRemoveFilterChangeCallback (332 ms)
[ RUN      ] FilterEngineTest.DocumentWhitelisting
[       OK ] FilterEngineTest.DocumentWhitelisting (525 ms)
[ RUN      ] FilterEngineTest.ElemhideWhitelisting
[       OK ] FilterEngineTest.ElemhideWhitelisting (326 ms)
[----------] 15 tests from FilterEngineTest (5514 ms total)

Attachments (0)

Change History (4)

comment:1 Changed on 06/22/2016 at 08:11:34 AM by asmirnov

  • Description modified (diff)

comment:2 Changed on 07/01/2016 at 02:08:12 PM by asmirnov

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:3 Changed on 05/10/2017 at 10:58:19 AM by asmirnov

  • Review URL(s) modified (diff)

comment:4 Changed on 10/23/2018 at 10:26:54 AM by asmirnov

  • Resolution set to rejected
  • Status changed from reviewing to closed

The tests are rewritten, the issue is deprecated.

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from asmirnov.
 
Note: See TracTickets for help on using tickets.