-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
96 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...rc/main/kotlin/cmu/pasta/fray/junit/OutcomeDelayingEngineExecutionListenerInstrumenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package cmu.pasta.fray.junit | ||
|
||
import cmu.pasta.fray.instrumentation.visitors.ClassVisitorBase | ||
import cmu.pasta.fray.instrumentation.visitors.Utils | ||
import org.objectweb.asm.ClassVisitor | ||
import org.objectweb.asm.MethodVisitor | ||
import org.objectweb.asm.Type | ||
import org.objectweb.asm.commons.AdviceAdapter | ||
|
||
class OutcomeDelayingEngineExecutionListenerInstrumenter(cv: ClassVisitor) : | ||
ClassVisitorBase( | ||
cv, "org.junit.platform.launcher.core.OutcomeDelayingEngineExecutionListener") { | ||
override fun instrumentMethod( | ||
mv: MethodVisitor, | ||
access: Int, | ||
name: String, | ||
descriptor: String, | ||
signature: String?, | ||
exceptions: Array<out String>? | ||
): MethodVisitor { | ||
if (name == "executionStarted") { | ||
return object : AdviceAdapter(ASM9, mv, access, name, descriptor) { | ||
override fun onMethodEnter() { | ||
loadArgs() | ||
invokeStatic( | ||
Type.getObjectType(Recorder::class.java.name.replace(".", "/")), | ||
Utils.kFunctionToASMMethod(Recorder::executionStarted), | ||
) | ||
} | ||
} | ||
} | ||
if (name == "executionFinished") { | ||
return object : AdviceAdapter(ASM9, mv, access, name, descriptor) { | ||
override fun onMethodEnter() { | ||
loadArgs() | ||
invokeStatic( | ||
Type.getObjectType(Recorder::class.java.name.replace(".", "/")), | ||
Utils.kFunctionToASMMethod(Recorder::executionFinished), | ||
) | ||
} | ||
} | ||
} | ||
return mv | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters