JPS: Add tests for mpp complementary files tracking after build error (KT-27868)

Original commit: cc9892a27d
This commit is contained in:
Sergey Rostov
2018-11-20 13:39:59 +03:00
parent 63e3b273de
commit c09054326a
18 changed files with 156 additions and 0 deletions
@@ -579,11 +579,47 @@ public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("jps-plugin/testData/incremental/multiModule/multiplatform/custom"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, true);
}
@TestMetadata("buildError")
public void testBuildError() throws Exception {
runTest("jps-plugin/testData/incremental/multiModule/multiplatform/custom/buildError/");
}
@TestMetadata("buildError2Levels")
public void testBuildError2Levels() throws Exception {
runTest("jps-plugin/testData/incremental/multiModule/multiplatform/custom/buildError2Levels/");
}
@TestMetadata("commonSourcesCompilerArg")
public void testCommonSourcesCompilerArg() throws Exception {
runTest("jps-plugin/testData/incremental/multiModule/multiplatform/custom/commonSourcesCompilerArg/");
}
@TestMetadata("jps-plugin/testData/incremental/multiModule/multiplatform/custom/buildError")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BuildError extends AbstractIncrementalJpsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInBuildError() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("jps-plugin/testData/incremental/multiModule/multiplatform/custom/buildError"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, true);
}
}
@TestMetadata("jps-plugin/testData/incremental/multiModule/multiplatform/custom/buildError2Levels")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BuildError2Levels extends AbstractIncrementalJpsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInBuildError2Levels() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("jps-plugin/testData/incremental/multiModule/multiplatform/custom/buildError2Levels"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, true);
}
}
@TestMetadata("jps-plugin/testData/incremental/multiModule/multiplatform/custom/commonSourcesCompilerArg")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -0,0 +1,7 @@
c [sourceSetHolder]
pJvm [compilationAndSourceSetHolder, jvm]
pJvm -> c [include]
pJs [compilationAndSourceSetHolder, js]
pJs -> c [include]
@@ -0,0 +1,2 @@
make compilation fail
fix error
@@ -0,0 +1,39 @@
================ Step #1 make compilation fail =================
Building c
Building pJs
Cleaning output files:
out/production/pJs/pJs.js
out/production/pJs/pJs.meta.js
out/production/pJs/pJs/root-package.kjsm
End of files
Compiling files:
c/src/a.kt
pJs/src/c.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
[pJs] Expecting a top level declaration
[pJs] Expecting a top level declaration
================ Step #2 fix error =================
Building c
Building pJs
Compiling files:
c/src/a.kt
pJs/src/c.kt
End of files
Exit code: OK
------------------------------------------
Building pJvm
Cleaning output files:
out/production/pJvm/META-INF/pJvm.kotlin_module
End of files
Compiling files:
c/src/a.kt
pJvm/src/c.kt
End of files
Exit code: OK
------------------------------------------
@@ -0,0 +1 @@
actual fun f() = Unit
@@ -0,0 +1 @@
actual fun f() = Unit
@@ -0,0 +1,7 @@
c [sourceSetHolder]
pJvm [compilationAndSourceSetHolder, jvm]
pJvm -> c [include]
pJs [compilationAndSourceSetHolder, js]
pJs -> c [include]
@@ -0,0 +1,2 @@
make compilation fail
fix error
@@ -0,0 +1,44 @@
================ Step #1 make compilation fail =================
Building c
Building pJs
Cleaning output files:
out/production/pJs/pJs.js
out/production/pJs/pJs.meta.js
out/production/pJs/pJs/root-package.kjsm
End of files
Compiling files:
c/src/a.kt
c/src/b.kt
pJs/src/c.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
[pJs] Expecting a top level declaration
[pJs] Expecting a top level declaration
================ Step #2 fix error =================
Building c
Building pJs
Compiling files:
c/src/a.kt
c/src/b.kt
pJs/src/c.kt
End of files
Exit code: OK
------------------------------------------
Marked as dirty by Kotlin:
c/src/b.kt
Building pJvm
Cleaning output files:
out/production/pJvm/META-INF/pJvm.kotlin_module
End of files
Compiling files:
c/src/a.kt
c/src/b.kt
pJvm/src/c.kt
End of files
Exit code: OK
------------------------------------------
@@ -0,0 +1,3 @@
actual fun f() = Unit
actual fun g() = Unit
@@ -0,0 +1,3 @@
actual fun f() = Unit
actual fun g() = Unit