Opened 3 years ago

Closed 7 weeks ago

#4146 closed defect (rejected)

Fix failing UpdateCheckTest.testApplicationUpdateAvailable test in libadblockplus-android

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/29345737/

Description (last modified by asmirnov)

UpdateCheckTest.testApplicationUpdateAvailable is written similar to https://hg.adblockplus.org/libadblockplus/file/tip/test/UpdateCheck.cpp#l177.

For some reason it fails permanently for JsValue class not found. Other test in that test class succeed and the class is found. I've found changing response text (

webRequest.response.setResponse(
            "{\"1/4\": {\"version\":\"3.1\",\"url\":\"https://foo.bar/\"}}");

) or response code (

webRequest.response.setStatus(ServerResponse.NsStatus.OK);

) affects this and makes the class available.

ant run log:

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.UpdateCheckTest:.INSTRUMENTATION_RESULT: shortMsg=Process crashed.
     [exec] INSTRUMENTATION_CODE: 0

BUILD SUCCESSFUL

android log (with added jni output by me to investigate this):

06-10 06:22:59.999    4874-4874/? I/System.out﹕ EMMA: collecting runtime coverage data ...
06-10 06:22:59.999    4874-4874/? D/dalvikvm﹕ Trying to load lib /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so 0xb104acd0
06-10 06:23:00.009    4874-4874/? D/dalvikvm﹕ Added shared lib /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so 0xb104acd0
06-10 06:23:00.009    4874-4874/? D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so 0xb104acd0, skipping init
06-10 06:23:00.019    4874-4874/? D/dalvikvm﹕ Trying to load lib /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so 0xb104acd0
06-10 06:23:00.019    4874-4874/? D/dalvikvm﹕ Shared lib '/data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so' already loaded in same CL 0xb104acd0
06-10 06:23:00.019    4874-4889/? I/TestRunner﹕ started: testAndroidTestCaseSetupProperly(org.adblockplus.libadblockplus.tests.UpdateCheckTest)
06-10 06:23:00.019    4874-4889/? D/org.adblockplus.libadblockplus.tests.UpdateCheckTest﹕ setUp
06-10 06:23:00.019    4874-4889/? D/dalvikvm﹕ Trying to load lib /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so 0xb104acd0
06-10 06:23:00.029    4874-4889/? D/dalvikvm﹕ Shared lib '/data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so' already loaded in same CL 0xb104acd0
06-10 06:23:00.029    4874-4889/? D/dalvikvm﹕ Trying to load lib /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so 0xb104acd0
06-10 06:23:00.029    4874-4889/? D/dalvikvm﹕ Shared lib '/data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so' already loaded in same CL 0xb104acd0
06-10 06:23:00.029    4874-4889/? D/dalvikvm﹕ Trying to load lib /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so 0xb104acd0
06-10 06:23:00.029    4874-4889/? D/dalvikvm﹕ Shared lib '/data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so' already loaded in same CL 0xb104acd0
06-10 06:23:00.029    4874-4889/? D/org.adblockplus.libadblockplus.tests.UpdateCheckTest﹕ Try load JsValue
06-10 06:23:00.039    4874-4889/? D/dalvikvm﹕ Trying to load lib /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so 0xb104acd0
06-10 06:23:00.039    4874-4889/? D/dalvikvm﹕ Shared lib '/data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so' already loaded in same CL 0xb104acd0
06-10 06:23:00.119    4874-4889/? D/org.adblockplus.libadblockplus.tests.UpdateCheckTest﹕ tearDown()
06-10 06:23:00.119    4874-4889/? I/TestRunner﹕ finished: testAndroidTestCaseSetupProperly(org.adblockplus.libadblockplus.tests.UpdateCheckTest)
06-10 06:23:00.119    4874-4889/? I/TestRunner﹕ passed: testAndroidTestCaseSetupProperly(org.adblockplus.libadblockplus.tests.UpdateCheckTest)
06-10 06:23:00.119    4874-4889/? I/TestRunner﹕ started: testApplicationUpdateAvailable(org.adblockplus.libadblockplus.tests.UpdateCheckTest)
06-10 06:23:00.119    4874-4889/? D/org.adblockplus.libadblockplus.tests.UpdateCheckTest﹕ setUp
06-10 06:23:00.119    4874-4889/? D/org.adblockplus.libadblockplus.tests.UpdateCheckTest﹕ Try load JsValue
06-10 06:23:00.179    4874-4909/? D/libadblockplus-jni-log﹕ searching for org/adblockplus/libadblockplus/JsValue
06-10 06:23:00.179    4874-4909/? D/libadblockplus-jni-log﹕ class found: 0x0
06-10 06:23:00.189    4874-4909/? W/dalvikvm﹕ JNI WARNING: JNI function GetMethodID called with exception pending
06-10 06:23:00.189    4874-4909/? W/dalvikvm﹕ in Ldalvik/system/NativeStart;.run:()V (GetMethodID)
06-10 06:23:00.189    4874-4909/? W/dalvikvm﹕ Pending exception is:
06-10 06:23:00.189    4874-4909/? I/dalvikvm﹕ java.lang.NoClassDefFoundError: org/adblockplus/libadblockplus/JsValue
06-10 06:23:00.189    4874-4909/? I/dalvikvm﹕ at dalvik.system.NativeStart.run(Native Method)
06-10 06:23:00.189    4874-4909/? I/dalvikvm﹕ Caused by:
06-10 06:23:00.189    4874-4909/? I/dalvikvm﹕ java.lang.ClassNotFoundException: Didn't find class "org.adblockplus.libadblockplus.JsValue" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib]]
06-10 06:23:00.189    4874-4909/? I/dalvikvm﹕ at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
06-10 06:23:00.189    4874-4909/? I/dalvikvm﹕ at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
06-10 06:23:00.189    4874-4909/? I/dalvikvm﹕ at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
06-10 06:23:00.189    4874-4909/? I/dalvikvm﹕ at dalvik.system.NativeStart.run(Native Method)
06-10 06:23:00.189    4874-4909/? I/dalvikvm﹕ "Thread-208" prio=5 tid=13 NATIVE
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ | group="main" sCount=0 dsCount=0 obj=0xb1041488 self=0xb8a58600
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ | sysTid=4909 nice=-8 sched=0/0 cgrp=[fopen-error:2] handle=-1197122384
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ | state=R schedstat=( 0 0 0 ) utm=0 stm=0 core=0
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #00  pc 000bd4c6  /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const*, int)+86)
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #01  pc 000980a3  /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const*, Thread*, bool)+1155)
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #02  pc 00098396  /system/lib/libdvm.so (dvmDumpThread(Thread*, bool)+86)
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #03  pc 0004ce27  /system/lib/libdvm.so (ScopedCheck::checkThread(int)+455)
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #04  pc 0005ebb5  /system/lib/libdvm.so
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #05  pc 001a7117  /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so (NewJniJsValue(_JNIEnv*, std::__1::shared_ptr<AdblockPlus::JsValue> const&, _jclass*)+103)
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #06  pc 001a7ae3  /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so (JniJsValueListToArrayList(_JNIEnv*, std::__1::vector<std::__1::shared_ptr<AdblockPlus::JsValue>, std::__1::allocator<std::__1::shared_ptr<AdblockPlus::JsValue> > >&)+83)
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #07  pc 001a8b47  /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so (JniEventCallback::Callback(std::__1::vector<std::__1::shared_ptr<AdblockPlus::JsValue>, std::__1::allocator<std::__1::shared_ptr<AdblockPlus::JsValue> > >&)+151)
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #08  pc 001a262a  /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so (std::__1::__function::__func<std::__1::__bind<void (JniEventCallback::*)(std::__1::vector<std::__1::shared_ptr<AdblockPlus::JsValue>, std::__1::allocator<std::__1::shared_ptr<AdblockPlus::JsValue> > >&), JniEventCallback*&, std::__1::placeholders::__ph<1>&>, std::__1::allocator<std::__1::__bind<void (JniEventCallback::*)(std::__1::vector<std::__1::shared_ptr+42)
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #09  pc 001b9d0a  /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so (AdblockPlus::JsEngine::TriggerEvent(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<std::__1::shared_ptr<AdblockPlus::JsValue>, std::__1::allocator<std::__1::shared_ptr<AdblockPlus::JsValue> > >&)+90)
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #10  pc 001c201b  /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #11  pc 001f46c8  /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so (v8::internal::FunctionCallbackArguments::Call(v8::Handle<v8::Value> (*)(v8::Arguments const&))+296)
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #12  pc 002053bd  /data/app-lib/org.adblockplus.libadblockplus.tests-2/libadblockplus-jni.so
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ #13  pc 00000895  <unknown>
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ at dalvik.system.NativeStart.run(Native Method)
06-10 06:23:00.199    4874-4909/? I/dalvikvm﹕ [ 06-10 06:23:00.199  4874: 4909 E/dalvikvm ]
    VM aborting
06-10 06:23:00.199    4874-4909/? A/libc﹕ Fatal signal 6 (SIGABRT) at 0x0000130a (code=-6), thread 4909 (ationTestRunner)
06-10 06:23:00.319      934-934/? I/DEBUG﹕ *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-10 06:23:00.319      934-934/? I/DEBUG﹕ Build fingerprint: 'generic_x86/sdk_x86/generic_x86:4.4.2/KK/999428:eng/test-keys'
06-10 06:23:00.319      934-934/? I/DEBUG﹕ Revision: '0'
06-10 06:23:00.319      934-934/? I/DEBUG﹕ pid: 4874, tid: 4909, name: ationTestRunner  >>> org.adblockplus.libadblockplus.tests <<<
06-10 06:23:00.319      934-934/? I/DEBUG﹕ signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
06-10 06:23:00.579      934-934/? I/DEBUG﹕ eax 00000000  ebx 0000130a  ecx 0000132d  edx 00000006
06-10 06:23:00.579      934-934/? I/DEBUG﹕ esi 0000132d  edi 00000002
06-10 06:23:00.579      934-934/? I/DEBUG﹕ xcs 00000073  xds 0000007b  xes 0000007b  xfs 00000000  xss 0000007b
06-10 06:23:00.579      934-934/? I/DEBUG﹕ eip b76e6c96  ebp b774bce0  esp a68b8e80  flags 00200207
06-10 06:23:00.579      934-934/? I/DEBUG﹕ backtrace:
06-10 06:23:00.579      934-934/? I/DEBUG﹕ #00  pc 0003bc96  /system/lib/libc.so (tgkill+22)
06-10 06:23:00.579      934-934/? I/DEBUG﹕ #01  pc 00000005  <unknown>
06-10 06:23:00.579      934-934/? I/DEBUG﹕ stack:
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e40  00000000
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e44  b7747268  /system/lib/libc.so
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e48  00000000
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e4c  b76b8ef9  /system/lib/libc.so (pthread_mutex_unlock+25)
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e50  b774718c  /system/lib/libc.so
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e54  b8910760  [heap]
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e58  00000015
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e5c  b76b8ef9  /system/lib/libc.so (pthread_mutex_unlock+25)
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e60  00000000
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e64  b7705656  /system/lib/libc.so (funlockfile+6)
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e68  b7746fcc  /system/lib/libc.so
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e6c  b76f0c76  /system/lib/libc.so (__sflush_locked+150)
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e70  00000000
06-10 06:23:00.579      934-934/? I/DEBUG﹕ a68b8e74  00000000
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8e78  b76b8d29  /system/lib/libc.so (pthread_mutex_lock+9)
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8e7c  b7746fcc  /system/lib/libc.so
06-10 06:23:00.589      934-934/? I/DEBUG﹕ #00  a68b8e80  00000006
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8e84  0000132d
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8e88  b7746fcc  /system/lib/libc.so
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8e8c  b76c3436  /system/lib/libc.so (pthread_kill+102)
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8e90  0000130a
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8e94  0000132d
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8e98  00000006
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8e9c  00000000
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8ea0  b7747268  /system/lib/libc.so
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8ea4  b4e92e41  /system/lib/libdvm.so
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8ea8  b76c33d9  /system/lib/libc.so (pthread_kill+9)
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8eac  b7746fcc  /system/lib/libc.so
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8eb0  a68b8efc  [stack:4909]
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8eb4  a68b913c  [stack:4909]
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8eb8  00000000
06-10 06:23:00.589      934-934/? I/DEBUG﹕ a68b8ebc  b76c37fc  /system/lib/libc.so (raise+44)
06-10 06:23:00.589      934-934/? E/Corkscrew﹕ unrecognized dwarf lower part encoding: 0x66
06-10 06:23:00.589      934-934/? E/Corkscrew﹕ unrecognized dwarf lower part encoding: 0x66
06-10 06:23:00.589      934-934/? E/Corkscrew﹕ unrecognized dwarf lower part encoding: 0x66
06-10 06:23:00.589      934-934/? E/Corkscrew﹕ unrecognized dwarf lower part encoding: 0x66
06-10 06:23:00.589      934-934/? E/Corkscrew﹕ unrecognized dwarf lower part encoding: 0x66
06-10 06:23:00.589      934-934/? E/Corkscrew﹕ unrecognized dwarf lower part encoding: 0x66
06-10 06:23:00.589      934-934/? E/Corkscrew﹕ unrecognized dwarf lower part encoding: 0x66
06-10 06:23:00.589      934-934/? E/Corkscrew﹕ unrecognized dwarf lower part encoding: 0x66
06-10 06:23:00.589      934-934/? E/Corkscrew﹕ unrecognized dwarf lower part encoding: 0x66
06-10 06:23:00.659    1273-1295/system_process I/BootReceiver﹕ Copying /data/tombstones/tombstone_06 to DropBox (SYSTEM_TOMBSTONE)
06-10 06:23:00.679      937-937/? D/Zygote﹕ Process 4874 terminated by signal (6)
06-10 06:23:00.679    1273-1407/system_process I/ActivityManager﹕ Process org.adblockplus.libadblockplus.tests (pid 4874) has died.
06-10 06:23:00.679    1273-1407/system_process W/ActivityManager﹕ Crash of app org.adblockplus.libadblockplus.tests running instrumentation ComponentInfo{org.adblockplus.libadblockplus.tests/android.test.InstrumentationTestRunner}
06-10 06:23:00.689    4859-4859/? D/AndroidRuntime﹕ Shutting down VM
06-10 06:23:00.689    4859-4866/? D/jdwp﹕ Got wake-up signal, bailing out of select
06-10 06:23:00.689    4859-4866/? D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
06-10 06:23:00.899    1273-1407/system_process I/ActivityManager﹕ Force stopping org.adblockplus.libadblockplus.tests appid=10052 user=0: finished inst

the reason is that actually JsValue can't be found by https://hg.adblockplus.org/adblockplusandroid/file/tip/jni/JniJsValue.cpp#l153:

06-10 06:23:00.179    4874-4909/? D/libadblockplus-jni-log﹕ searching for org/adblockplus/libadblockplus/JsValue
06-10 06:23:00.179    4874-4909/? D/libadblockplus-jni-log﹕ class found: 0x0

that's completely strange because in other tests (test methods in that test class) it can be found,f.e.:

ant run

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.UpdateCheckTest:..
     [exec] Test results for InstrumentationTestRunner=..
     [exec] Time: 0.229
     [exec] 
     [exec] OK (2 tests)
     [exec] 
     [exec] 

BUILD SUCCESSFUL
Total time: 16 seconds

android log:

...
06-10 06:36:13.471    5219-5234/? D/org.adblockplus.libadblockplus.tests.UpdateCheckTest﹕ Try load JsValue
06-10 06:36:13.641    5219-5234/? D/libadblockplus-jni-log﹕ searching for org/adblockplus/libadblockplus/JsValue
06-10 06:36:13.641    5219-5234/? D/libadblockplus-jni-log﹕ class found: 0x1fa00009
...

Change History (12)

comment:1 Changed 3 years ago by asmirnov

  • Summary changed from Fix failing UpdateCheckTest.testApplicationUpdateAvailable test in libadblock to Fix failing UpdateCheckTest.testApplicationUpdateAvailable test in libadblockplus-android

comment:2 Changed 3 years ago by asmirnov

  • Description modified (diff)

comment:3 Changed 3 years ago by asmirnov

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

comment:4 Changed 2 years ago by asmirnov

.

Last edited 2 years ago by asmirnov (previous) (diff)

comment:7 Changed 2 years ago by rjeschke

Just a question, is removing the old method to cache classes in JNI also part of this issue? Otherwise we'll end up having two different methods to achieve the same result.

comment:8 Changed 2 years ago by asmirnov

Rene, what do you mean by "old method"? I expect only i method to be used for caching.

comment:10 Changed 2 years ago by rjeschke

Nevermind, I didn't recognize there's #4442. My fault.

comment:11 Changed 2 years ago by asmirnov

Yes, they don't contradict to each other (https://codereview.adblockplus.org/29354787/)

comment:12 Changed 7 weeks ago by asmirnov

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

The tests are rewritten, the issue is deprecated.

Note: See TracTickets for help on using tickets.