Add a JVM backend debug information test, this commit is for verifying

line numbers for stepping.

Running JVM instance and read stepping events from it to verify with the
test data.
This commit is contained in:
Jiaxiang Chen
2019-06-06 01:37:06 -07:00
committed by max-kammerer
parent f17e9ba9fe
commit 0a2812f83b
13 changed files with 626 additions and 12 deletions
@@ -0,0 +1,61 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.debugInformation;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/debug/stepping")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class IrSteppingTestGenerated extends AbstractIrSteppingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public void testAllFilesPresentInStepping() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/debug/stepping"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
}
@TestMetadata("conjunction.kt")
public void testConjunction() throws Exception {
runTest("compiler/testData/debug/stepping/conjunction.kt");
}
@TestMetadata("functionInAnotherFile.kt")
public void testFunctionInAnotherFile() throws Exception {
runTest("compiler/testData/debug/stepping/functionInAnotherFile.kt");
}
@TestMetadata("if.kt")
public void testIf() throws Exception {
runTest("compiler/testData/debug/stepping/if.kt");
}
@TestMetadata("IfTrueThenFalse.kt")
public void testIfTrueThenFalse() throws Exception {
runTest("compiler/testData/debug/stepping/IfTrueThenFalse.kt");
}
@TestMetadata("recursion.kt")
public void testRecursion() throws Exception {
runTest("compiler/testData/debug/stepping/recursion.kt");
}
@TestMetadata("throwException.kt")
public void testThrowException() throws Exception {
runTest("compiler/testData/debug/stepping/throwException.kt");
}
}
@@ -0,0 +1,61 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.debugInformation;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/debug/stepping")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class SteppingTestGenerated extends AbstractSteppingTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInStepping() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/debug/stepping"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("conjunction.kt")
public void testConjunction() throws Exception {
runTest("compiler/testData/debug/stepping/conjunction.kt");
}
@TestMetadata("functionInAnotherFile.kt")
public void testFunctionInAnotherFile() throws Exception {
runTest("compiler/testData/debug/stepping/functionInAnotherFile.kt");
}
@TestMetadata("if.kt")
public void testIf() throws Exception {
runTest("compiler/testData/debug/stepping/if.kt");
}
@TestMetadata("IfTrueThenFalse.kt")
public void testIfTrueThenFalse() throws Exception {
runTest("compiler/testData/debug/stepping/IfTrueThenFalse.kt");
}
@TestMetadata("recursion.kt")
public void testRecursion() throws Exception {
runTest("compiler/testData/debug/stepping/recursion.kt");
}
@TestMetadata("throwException.kt")
public void testThrowException() throws Exception {
runTest("compiler/testData/debug/stepping/throwException.kt");
}
}
@@ -14,6 +14,8 @@ import org.jetbrains.kotlin.checkers.*
import org.jetbrains.kotlin.checkers.javac.*
import org.jetbrains.kotlin.cli.AbstractCliTest
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.debugInformation.AbstractIrSteppingTest
import org.jetbrains.kotlin.codegen.debugInformation.AbstractSteppingTest
import org.jetbrains.kotlin.codegen.defaultConstructor.AbstractDefaultArgumentsReflectionTest
import org.jetbrains.kotlin.codegen.flags.AbstractWriteFlagsTest
import org.jetbrains.kotlin.codegen.ir.*
@@ -342,6 +344,10 @@ fun main(args: Array<String>) {
model("lineNumber")
}
testClass<AbstractSteppingTest> {
model("debug/stepping", targetBackend = TargetBackend.JVM)
}
testClass<AbstractLocalClassProtoTest> {
model("serialization/local")
}
@@ -419,6 +425,10 @@ fun main(args: Array<String>) {
model("lineNumber", targetBackend = TargetBackend.JVM_IR)
}
testClass<AbstractIrSteppingTest> {
model("debug/stepping", targetBackend = TargetBackend.JVM_IR)
}
testClass<AbstractIrBlackBoxInlineCodegenTest> {
model("codegen/boxInline", targetBackend = TargetBackend.JVM_IR)
}