From 601a33f7724a54b61ba6d1ac5a52221bbd1b8bde Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Tue, 9 Dec 2014 17:25:01 +0300 Subject: [PATCH] Fix stepping test's testData --- .../debugger/tinyApp/outs/accessors.out | 4 ++ .../debugger/tinyApp/outs/onClassHeader.out | 1 - .../debugger/tinyApp/outs/onObjectHeader.out | 2 - .../tinyApp/outs/syntheticMethods.out | 2 + .../singleBreakpoint/onClassHeader.kt | 6 ++- .../singleBreakpoint/onObjectHeader.kt | 6 ++- .../src/stepInto/stepInto/accessors.kt | 3 +- .../src/stepInto/stepInto/syntheticMethods.kt | 3 +- .../debugger/AbstractKotlinSteppingTest.kt | 45 ----------------- .../idea/debugger/KotlinDebuggerTestBase.kt | 49 +++++++++++++++++++ .../AbstractKotlinEvaluateExpressionTest.kt | 1 + 11 files changed, 68 insertions(+), 54 deletions(-) diff --git a/idea/testData/debugger/tinyApp/outs/accessors.out b/idea/testData/debugger/tinyApp/outs/accessors.out index 0ea0df9a46f..bc2f4de713c 100644 --- a/idea/testData/debugger/tinyApp/outs/accessors.out +++ b/idea/testData/debugger/tinyApp/outs/accessors.out @@ -2,15 +2,19 @@ LineBreakpoint created at accessors.kt:10 !JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! accessors.AccessorsPackage Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' accessors.kt:10 +accessors.kt:15 accessors.kt:17 accessors.kt:18 accessors.kt:15 accessors.kt:11 +accessors.kt:15 accessors.kt:22 accessors.kt:15 accessors.kt:11 accessors.kt:12 +accessors.kt:15 accessors.kt:25 +accessors.kt:7 accessors.kt:26 accessors.kt:15 accessors.kt:13 diff --git a/idea/testData/debugger/tinyApp/outs/onClassHeader.out b/idea/testData/debugger/tinyApp/outs/onClassHeader.out index 391eeecbb42..594c77deb40 100644 --- a/idea/testData/debugger/tinyApp/outs/onClassHeader.out +++ b/idea/testData/debugger/tinyApp/outs/onClassHeader.out @@ -2,7 +2,6 @@ LineBreakpoint created at onClassHeader.kt:6 !JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! onClassHeader.OnClassHeaderPackage Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' onClassHeader.kt:6 -onClassHeader.kt:18 onClassHeader.kt:16 Compile bytecode for 1 + 1 Compile bytecode for this diff --git a/idea/testData/debugger/tinyApp/outs/onObjectHeader.out b/idea/testData/debugger/tinyApp/outs/onObjectHeader.out index 3d161482026..937a56ec228 100644 --- a/idea/testData/debugger/tinyApp/outs/onObjectHeader.out +++ b/idea/testData/debugger/tinyApp/outs/onObjectHeader.out @@ -6,8 +6,6 @@ onObjectHeader.kt:10 onObjectHeader.kt:16 onObjectHeader.kt:8 onObjectHeader.kt:11 -onObjectHeader.kt:20 -onObjectHeader.kt:21 onObjectHeader.kt:8 Compile bytecode for 1 + 1 Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' diff --git a/idea/testData/debugger/tinyApp/outs/syntheticMethods.out b/idea/testData/debugger/tinyApp/outs/syntheticMethods.out index b8de18f9594..df8fc0cc90e 100644 --- a/idea/testData/debugger/tinyApp/outs/syntheticMethods.out +++ b/idea/testData/debugger/tinyApp/outs/syntheticMethods.out @@ -2,10 +2,12 @@ LineBreakpoint created at syntheticMethods.kt:6 !JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! syntheticMethods.SyntheticMethodsPackage Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' syntheticMethods.kt:6 +syntheticMethods.kt:17 syntheticMethods.kt:19 syntheticMethods.kt:20 syntheticMethods.kt:17 syntheticMethods.kt:7 +syntheticMethods.kt:34 syntheticMethods.kt:0 syntheticMethods.kt:7 syntheticMethods.kt:25 diff --git a/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/onClassHeader.kt b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/onClassHeader.kt index 7a1a7adfa0b..e11a8dbc914 100644 --- a/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/onClassHeader.kt +++ b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/onClassHeader.kt @@ -19,7 +19,7 @@ class Derived: Base() { } } -// STEP_INTO: 2 +// STEP_INTO: 1 // EXPRESSION: 1 + 1 // RESULT: 2: I @@ -28,4 +28,6 @@ class Derived: Base() { // RESULT: instance of onClassHeader.Derived(id=ID): LonClassHeader/Derived; // EXPRESSION: this.foo("a") -// RESULT: 2: I \ No newline at end of file +// RESULT: 2: I + +// SKIP_SYNTHETIC_METHODS: false \ No newline at end of file diff --git a/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/onObjectHeader.kt b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/onObjectHeader.kt index e87ea39c953..5ec64147c24 100644 --- a/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/onObjectHeader.kt +++ b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/onObjectHeader.kt @@ -21,7 +21,9 @@ object A { } } -// STEP_INTO: 7 +// STEP_INTO: 5 // EXPRESSION: 1 + 1 -// RESULT: 2: I \ No newline at end of file +// RESULT: 2: I + +// SKIP_SYNTHETIC_METHODS: false \ No newline at end of file diff --git a/idea/testData/debugger/tinyApp/src/stepInto/stepInto/accessors.kt b/idea/testData/debugger/tinyApp/src/stepInto/stepInto/accessors.kt index 20fce8c2b94..83945ae90f7 100644 --- a/idea/testData/debugger/tinyApp/src/stepInto/stepInto/accessors.kt +++ b/idea/testData/debugger/tinyApp/src/stepInto/stepInto/accessors.kt @@ -27,4 +27,5 @@ class A { } } -// STEP_INTO: 13 \ No newline at end of file +// STEP_INTO: 17 +// SKIP_SYNTHETIC_METHODS: false \ No newline at end of file diff --git a/idea/testData/debugger/tinyApp/src/stepInto/stepInto/syntheticMethods.kt b/idea/testData/debugger/tinyApp/src/stepInto/stepInto/syntheticMethods.kt index ad5fee2cb28..929a06553f1 100644 --- a/idea/testData/debugger/tinyApp/src/stepInto/stepInto/syntheticMethods.kt +++ b/idea/testData/debugger/tinyApp/src/stepInto/stepInto/syntheticMethods.kt @@ -44,4 +44,5 @@ class A { } } -// STEP_INTO: 24 \ No newline at end of file +// STEP_INTO: 26 +// SKIP_SYNTHETIC_METHODS: false \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/AbstractKotlinSteppingTest.kt b/idea/tests/org/jetbrains/kotlin/idea/debugger/AbstractKotlinSteppingTest.kt index b1f6eab87cd..e42d2fdd8e7 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/AbstractKotlinSteppingTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/AbstractKotlinSteppingTest.kt @@ -31,20 +31,6 @@ import kotlin.properties.Delegates import com.intellij.debugger.settings.DebuggerSettings public abstract class AbstractKotlinSteppingTest : KotlinDebuggerTestBase() { - private var oldSettings: DebuggerSettings by Delegates.notNull() - private var oldIsFilterForStdlibAlreadyAdded: Boolean by Delegates.notNull() - private var oldDisableKotlinInternalClasses: Boolean by Delegates.notNull() - - override fun initApplication() { - super.initApplication() - saveDefaultSettings() - } - - override fun tearDown() { - super.tearDown() - restoreDefaultSettings() - } - protected fun doStepIntoTest(path: String) { val fileText = FileUtil.loadFile(File(path)) @@ -66,37 +52,6 @@ public abstract class AbstractKotlinSteppingTest : KotlinDebuggerTestBase() { finish() } - private fun configureSettings(fileText: String) { - val kotlinSettings = KotlinDebuggerSettings.getInstance() - kotlinSettings.DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED = false - kotlinSettings.DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES = fileText.getValueForSetting("DISABLE_KOTLIN_INTERNAL_CLASSES", oldDisableKotlinInternalClasses) - - val debuggerSettings = DebuggerSettings.getInstance()!! - debuggerSettings.SKIP_CONSTRUCTORS = fileText.getValueForSetting("SKIP_CONSTRUCTORS", oldSettings.SKIP_CONSTRUCTORS) - debuggerSettings.SKIP_CLASSLOADERS = fileText.getValueForSetting("SKIP_CLASSLOADERS", oldSettings.SKIP_CLASSLOADERS) - debuggerSettings.TRACING_FILTERS_ENABLED = fileText.getValueForSetting("TRACING_FILTERS_ENABLED", oldSettings.TRACING_FILTERS_ENABLED) - } - - private fun String.getValueForSetting(name: String, defaultValue: Boolean): Boolean { - return findStringWithPrefixes(this, "// $name: ")?.toBoolean() ?: defaultValue - } - - private fun saveDefaultSettings() { - oldIsFilterForStdlibAlreadyAdded = KotlinDebuggerSettings.getInstance().DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED - oldDisableKotlinInternalClasses = KotlinDebuggerSettings.getInstance().DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES - oldSettings = DebuggerSettings.getInstance()!!.clone() - } - - private fun restoreDefaultSettings() { - KotlinDebuggerSettings.getInstance().DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED = oldIsFilterForStdlibAlreadyAdded - KotlinDebuggerSettings.getInstance().DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES = oldDisableKotlinInternalClasses - - val debuggerSettings = DebuggerSettings.getInstance()!! - debuggerSettings.SKIP_CONSTRUCTORS = oldSettings.SKIP_CONSTRUCTORS - debuggerSettings.SKIP_CLASSLOADERS = oldSettings.SKIP_CLASSLOADERS - debuggerSettings.TRACING_FILTERS_ENABLED = oldSettings.TRACING_FILTERS_ENABLED - } - private fun SuspendContextImpl.smartStepInto() { this.smartStepInto(false) } diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt index c20e5e7c040..9c57d892b41 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt @@ -27,11 +27,60 @@ import org.jetbrains.kotlin.idea.JetJdkAndLibraryProjectDescriptor import com.intellij.openapi.roots.JdkOrderEntry import com.intellij.openapi.util.io.FileUtil import com.intellij.debugger.SourcePosition +import com.intellij.debugger.settings.DebuggerSettings +import kotlin.properties.Delegates +import org.jetbrains.kotlin.test.InTextDirectivesUtils.findStringWithPrefixes import kotlin.properties.Delegates import com.intellij.debugger.engine.evaluation.EvaluationContextImpl import com.intellij.debugger.impl.DebuggerContextImpl abstract class KotlinDebuggerTestBase : KotlinDebuggerTestCase() { + private var oldSettings: DebuggerSettings by Delegates.notNull() + private var oldIsFilterForStdlibAlreadyAdded: Boolean by Delegates.notNull() + private var oldDisableKotlinInternalClasses: Boolean by Delegates.notNull() + + override fun initApplication() { + super.initApplication() + saveDefaultSettings() + } + + override fun tearDown() { + super.tearDown() + restoreDefaultSettings() + } + + protected fun configureSettings(fileText: String) { + val kotlinSettings = KotlinDebuggerSettings.getInstance() + kotlinSettings.DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED = false + kotlinSettings.DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES = fileText.getValueForSetting("DISABLE_KOTLIN_INTERNAL_CLASSES", oldDisableKotlinInternalClasses) + + val debuggerSettings = DebuggerSettings.getInstance()!! + debuggerSettings.SKIP_SYNTHETIC_METHODS = fileText.getValueForSetting("SKIP_SYNTHETIC_METHODS", oldSettings.SKIP_SYNTHETIC_METHODS) + debuggerSettings.SKIP_CONSTRUCTORS = fileText.getValueForSetting("SKIP_CONSTRUCTORS", oldSettings.SKIP_CONSTRUCTORS) + debuggerSettings.SKIP_CLASSLOADERS = fileText.getValueForSetting("SKIP_CLASSLOADERS", oldSettings.SKIP_CLASSLOADERS) + debuggerSettings.TRACING_FILTERS_ENABLED = fileText.getValueForSetting("TRACING_FILTERS_ENABLED", oldSettings.TRACING_FILTERS_ENABLED) + } + + private fun String.getValueForSetting(name: String, defaultValue: Boolean): Boolean { + return findStringWithPrefixes(this, "// $name: ")?.toBoolean() ?: defaultValue + } + + private fun saveDefaultSettings() { + oldIsFilterForStdlibAlreadyAdded = KotlinDebuggerSettings.getInstance().DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED + oldDisableKotlinInternalClasses = KotlinDebuggerSettings.getInstance().DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES + oldSettings = DebuggerSettings.getInstance()!!.clone() + } + + private fun restoreDefaultSettings() { + KotlinDebuggerSettings.getInstance().DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED = oldIsFilterForStdlibAlreadyAdded + KotlinDebuggerSettings.getInstance().DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES = oldDisableKotlinInternalClasses + + val debuggerSettings = DebuggerSettings.getInstance()!! + debuggerSettings.SKIP_SYNTHETIC_METHODS = oldSettings.SKIP_SYNTHETIC_METHODS + debuggerSettings.SKIP_CONSTRUCTORS = oldSettings.SKIP_CONSTRUCTORS + debuggerSettings.SKIP_CLASSLOADERS = oldSettings.SKIP_CLASSLOADERS + debuggerSettings.TRACING_FILTERS_ENABLED = oldSettings.TRACING_FILTERS_ENABLED + } protected val dp: DebugProcessImpl get() = getDebugProcess() ?: throw AssertionError("createLocalProcess() should be called before getDebugProcess()") diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt index e229c6d8cff..e0072342756 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt @@ -103,6 +103,7 @@ public abstract class AbstractKotlinEvaluateExpressionTest : KotlinDebuggerTestB val file = File(path) val fileText = FileUtil.loadFile(file, true) + configureSettings(fileText) createAdditionalBreakpoints(fileText) val shouldPrintFrame = InTextDirectivesUtils.isDirectiveDefined(fileText, "// PRINT_FRAME")