instrumentation

Intercepting calls to Java 8 lambda-expressions using Byte Buddy

时光总嘲笑我的痴心妄想 提交于 2019-12-03 13:31:15
问题 I try to intercept calls to methods and calls to Java 8 lambda expressions using a Byte Buddy AgentBuilder as follows: static { final Instrumentation inst = ByteBuddyAgent.install(); new AgentBuilder.Default() .type(ElementMatchers.nameContainsIgnoreCase("foo")) .transform((builder, typeDescription) -> builder.method(ElementMatchers.any()) .intercept(MethodDelegation.to(LogInterceptor.class))) .installOn(inst); } public static class LogInterceptor { @RuntimeType public static Object log(

Android NullPointerException in Instrumentation.execStartActivity

天大地大妈咪最大 提交于 2019-12-03 10:48:29
问题 I keep getting the bellow exception from some users: java.lang.NullPointerException at android.app.Instrumentation.execStartActivity(Instrumentation.java:1414) at android.app.Activity.startActivityForResult(Activity.java:2880) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817) at android.app.Activity.startActivity(Activity.java:2986) at com.google.android.gms.internal.bb$5.onClick(Unknown Source) at android.view.View.performClick(View.java:2535) at

Intercepting calls to Java 8 lambda-expressions using Byte Buddy

隐身守侯 提交于 2019-12-03 08:18:54
I try to intercept calls to methods and calls to Java 8 lambda expressions using a Byte Buddy AgentBuilder as follows: static { final Instrumentation inst = ByteBuddyAgent.install(); new AgentBuilder.Default() .type(ElementMatchers.nameContainsIgnoreCase("foo")) .transform((builder, typeDescription) -> builder.method(ElementMatchers.any()) .intercept(MethodDelegation.to(LogInterceptor.class))) .installOn(inst); } public static class LogInterceptor { @RuntimeType public static Object log(@SuperCall Callable<?> superCall) throws Exception { System.out.println("yeah..."); return superCall.call();

How to instrument a statement just before another statement using clang

狂风中的少年 提交于 2019-12-03 07:47:06
I have to instrument certain statements in clang by adding a statement just before it. I have a pointer to an Expr object using which I need to insert another statement just before the statement containing it. Right now I am using a hacky approach which just moves back the SourceLocation pointer till I see a ; or } or {. But this does not work for all cases. eg when I try to instrument a for statement, it fails. Is there any class in clang which provides a method to do this in a more cleaner way? EDIT: Here is snippet of my code. I need to insert an assert just before the statement containing

How to send key events to a headless emulator in an instrumentation test?

一世执手 提交于 2019-12-03 06:55:09
We are currently working on an instrumentation test suite which runs on our build server, but while the tests pass on a dev machine using a normal Android emulator, the builds fail on the build server since there we only run a headless emulator with the -no-window flag. The failure occurs when trying to invoke the InstrumentationTestCase.sendKeys() method to programmatically open the options menu. The error is: Permission denied: injecting key event from pid 646 uid 10026 to window Window{43d55100 paused=false} owned by uid 1000 We then found out that there's a INJECT_EVENTS permission, but

Examples for Robotium

限于喜欢 提交于 2019-12-03 06:15:35
问题 I found a tool for Instrumentation Testing called Robotium.It is easy and simple for black box testing of android applications. We can use it as follows: solo.clickOnText("Other"); solo.clickOnButton("Edit"); assertTrue(solo.searchText("Edit Window")); solo.enterText(1, "Some text for testing purposes") solo.clickOnButton("Save"); assertTrue(solo.searchText("Changes have been made successfully")); solo.clickOnButton("Ok"); assertTrue(solo.searchText("Some text for testing purposes")); Can any

Tools to analyze core dump from Node.js

萝らか妹 提交于 2019-12-03 03:47:29
问题 If I use gcore to make a code dump of a Node.js process, what are the best tools to analyze it? Inspired by: Tool for analyzing java core dump In my specific case, I'm interested in investigating some memory leaks, so I'm really curious to get some heap analysis. General tools and even instrumentation packages and techniques are also welcome. I'm finding Node.js to be very interesting, but the runtime analysis tools are just not there yet. 回答1: For investigating crashes, I've found node

android.util.AndroidException: INSTRUMENTATION_FAILED:

血红的双手。 提交于 2019-12-03 03:45:28
问题 I have a simple android app and I am testing it using my phone. So, there are two ways to do that : Using eclipse Using CLI Problem: When I run unit test case using Eclipse, it installs app on my phone at runtime and run junit test and after that if I use command on CLI: adb -d shell am instrument -w com.abc.xyz.test/android.test.InstrumentationTestRunner, it runs fine. However, if I directly run the above command in CLI without first running the unit test cases in Eclipse, I am getting error

Error while instrumenting class files (asm.ClassWriter.getCommonSuperClass)

╄→гoц情女王★ 提交于 2019-12-03 03:31:48
Getting error on instrumentation java.lang.RuntimeException: java.lang.ClassNotFoundException: Deposit at org.objectweb.asm.ClassWriter.getCommonSuperClass(Unknown Source) at org.objectweb.asm.ClassWriter.a(Unknown Source) at org.objectweb.asm.Frame.a(Unknown Source) at org.objectweb.asm.Frame.a(Unknown Source) at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source) at com.jConSequence.instrumentor.methodProber.AdddataBaseDetailsInstructions$AdddataBaseDetailsMethodInstructions.visitMaxs(AdddataBaseDetailsInstructions.java:131) at org.objectweb.asm.ClassReader.accept(Unknown Source) at org

How to create a Python class decorator that is able to wrap instance, class and static methods?

随声附和 提交于 2019-12-02 21:16:01
I'd like to create a Python class decorator (*) that would be able to seamlessly wrap all method types the class might have: instance, class and static. This is the code I have for now, with the parts that break it commented: def wrapItUp(method): def wrapped(*args, **kwargs): print "This method call was wrapped!" return method(*args, **kwargs) return wrapped dundersICareAbout = ["__init__", "__str__", "__repr__"]#, "__new__"] def doICareAboutThisOne(cls, methodName): return (callable(getattr(cls, methodName)) and (not (methodName.startswith("__") and methodName.endswith("__")) or methodName