Permalink
Browse files

Updated README.md. Created new functional-tests. Updated sbt Build.sc…

…ala. Some minor cleanup in the project structure.
  • Loading branch information...
1 parent 396bddc commit f24137b5a177ee56915c8365845676709025251f Mirco committed Apr 13, 2011
Showing with 357 additions and 36 deletions.
  1. +2 −5 .gitignore
  2. +37 −3 README.md
  3. +24 −15 core/src/test/scala/ssol/tools/mima/ui/CollectProblemsTest.scala
  4. +1 −0 functional-tests-exposing-bugs/class-became-final-nok/README.txt
  5. +1 −0 functional-tests-exposing-bugs/class-became-final-nok/v1/A.scala
  6. +1 −0 functional-tests-exposing-bugs/class-became-final-nok/v2/A.scala
  7. +1 −0 functional-tests-exposing-bugs/class-concrete-become-abstract-in-new-version-is-nok/README.txt
  8. 0 ...→ functional-tests-exposing-bugs/class-concrete-become-abstract-in-new-version-is-nok}/v1/A.scala
  9. +3 −0 functional-tests-exposing-bugs/class-concrete-become-abstract-in-new-version-is-nok/v2/A.scala
  10. +3 −0 functional-tests-exposing-bugs/class-method-became-final-nok copy/v1/A.scala
  11. 0 ...thod-became-final → functional-tests-exposing-bugs/class-method-became-final-nok copy}/v2/A.scala
  12. +1 −0 functional-tests-exposing-bugs/class-method-became-final-nok/README.txt
  13. +3 −0 functional-tests-exposing-bugs/class-method-became-final-nok/v1/A.scala
  14. +3 −0 functional-tests-exposing-bugs/class-method-became-final-nok/v2/A.scala
  15. +3 −0 functional-tests-exposing-bugs/class-type-became-final-nok/v1/A.scala
  16. +3 −0 functional-tests-exposing-bugs/class-type-became-final-nok/v2/A.scala
  17. +1 −0 functional-tests-exposing-bugs/class-type-hierarchy-changed/README.txt
  18. +2 −0 functional-tests-exposing-bugs/class-type-hierarchy-changed/v1/A.scala
  19. +2 −0 functional-tests-exposing-bugs/class-type-hierarchy-changed/v2/A.scala
  20. +3 −0 functional-tests-exposing-bugs/class-val-became-final-nok/v1/A.scala
  21. +3 −0 functional-tests-exposing-bugs/class-val-became-final-nok/v2/A.scala
  22. +3 −0 functional-tests-exposing-bugs/class-var-became-final-nok/v1/A.scala
  23. +3 −0 functional-tests-exposing-bugs/class-var-became-final-nok/v2/A.scala
  24. +3 −0 functional-tests-exposing-bugs/package-missing-in-new-version-is-ok/README.txt
  25. 0 functional-tests-exposing-bugs/package-missing-in-new-version-is-ok/problems.txt
  26. +8 −0 functional-tests-exposing-bugs/package-missing-in-new-version-is-ok/v1/A.scala
  27. +5 −0 functional-tests-exposing-bugs/package-missing-in-new-version-is-ok/v2/A.scala
  28. +1 −0 functional-tests-exposing-bugs/package-with-classes-missing-in-new-version-is-nok/README.txt
  29. +1 −0 functional-tests-exposing-bugs/package-with-classes-missing-in-new-version-is-nok/problems.txt
  30. +9 −0 functional-tests-exposing-bugs/package-with-classes-missing-in-new-version-is-nok/v1/A.scala
  31. +5 −0 functional-tests-exposing-bugs/package-with-classes-missing-in-new-version-is-nok/v2/A.scala
  32. +3 −0 functional-tests-exposing-bugs/trait-abstract-var-become-concrete-nok/README.txt
  33. 0 functional-tests-exposing-bugs/trait-abstract-var-become-concrete-nok/problems.txt
  34. +3 −0 functional-tests-exposing-bugs/trait-abstract-var-become-concrete-nok/v1/A.scala
  35. +3 −0 functional-tests-exposing-bugs/trait-abstract-var-become-concrete-nok/v2/A.scala
  36. 0 functional-tests/class-added-class-in-new-version-ok/problems.txt
  37. +1 −0 functional-tests/class-added-class-in-new-version-ok/v1/A.scala
  38. +2 −0 functional-tests/class-added-class-in-new-version-ok/v2/A.scala
  39. 0 functional-tests/class-added-method-in-new-version-ok/problems.txt
  40. +3 −0 functional-tests/class-added-method-in-new-version-ok/v1/A.scala
  41. +4 −0 functional-tests/class-added-method-in-new-version-ok/v2/A.scala
  42. 0 functional-tests/class-added-same-class-in-different-package-is-ok/problems.txt
  43. +3 −0 functional-tests/class-added-same-class-in-different-package-is-ok/v1/A.scala
  44. +7 −0 functional-tests/class-added-same-class-in-different-package-is-ok/v2/A.scala
  45. 0 functional-tests/class-added-val-in-new-version-ok/problems.txt
  46. +1 −0 functional-tests/class-added-val-in-new-version-ok/v1/A.scala
  47. +3 −0 functional-tests/class-added-val-in-new-version-ok/v2/A.scala
  48. 0 functional-tests/class-added-var-in-new-version-ok/problems.txt
  49. +1 −0 functional-tests/class-added-var-in-new-version-ok/v1/A.scala
  50. +3 −0 functional-tests/class-added-var-in-new-version-ok/v2/A.scala
  51. +1 −0 functional-tests/class-changed-method-type-in-new-version-nok/problems.txt
  52. +3 −0 functional-tests/class-changed-method-type-in-new-version-nok/v1/A.scala
  53. +3 −0 functional-tests/class-changed-method-type-in-new-version-nok/v2/A.scala
  54. 0 functional-tests/class-changed-method-with-val-in-new-version-ok/problems.txt
  55. +3 −0 functional-tests/class-changed-method-with-val-in-new-version-ok/v1/A.scala
  56. +3 −0 functional-tests/class-changed-method-with-val-in-new-version-ok/v2/A.scala
  57. 0 functional-tests/class-changed-method-with-var-in-new-version-ok/problems.txt
  58. +3 −0 functional-tests/class-changed-method-with-var-in-new-version-ok/v1/A.scala
  59. +3 −0 functional-tests/class-changed-method-with-var-in-new-version-ok/v2/A.scala
  60. +1 −0 functional-tests/class-changed-val-type-in-new-version-nok/problems.txt
  61. +3 −0 functional-tests/class-changed-val-type-in-new-version-nok/v1/A.scala
  62. +3 −0 functional-tests/class-changed-val-type-in-new-version-nok/v2/A.scala
  63. 0 functional-tests/class-changed-val-with-method-in-new-version-ok/problems.txt
  64. +3 −0 functional-tests/class-changed-val-with-method-in-new-version-ok/v1/A.scala
  65. +3 −0 functional-tests/class-changed-val-with-method-in-new-version-ok/v2/A.scala
  66. +2 −0 functional-tests/class-changed-var-type-in-new-version-nok/problems.txt
  67. +3 −0 functional-tests/class-changed-var-type-in-new-version-nok/v1/A.scala
  68. +3 −0 functional-tests/class-changed-var-type-in-new-version-nok/v2/A.scala
  69. +1 −0 functional-tests/class-changed-var-with-method-in-new-version-nok/problems.txt
  70. +3 −0 functional-tests/class-changed-var-with-method-in-new-version-nok/v1/A.scala
  71. +3 −0 functional-tests/class-changed-var-with-method-in-new-version-nok/v2/A.scala
  72. +1 −0 functional-tests/class-method-changed-parameter-type-nok/problems.txt
  73. +3 −0 functional-tests/class-method-changed-parameter-type-nok/v1/A.scala
  74. +3 −0 functional-tests/class-method-changed-parameter-type-nok/v2/A.scala
  75. +1 −0 functional-tests/class-method-changed-parameters-nok/problems.txt
  76. +3 −0 functional-tests/class-method-changed-parameters-nok/v1/A.scala
  77. +3 −0 functional-tests/class-method-changed-parameters-nok/v2/A.scala
  78. +1 −0 functional-tests/class-method-changed-parameters2-nok/problems.txt
  79. +3 −0 functional-tests/class-method-changed-parameters2-nok/v1/A.scala
  80. +3 −0 functional-tests/class-method-changed-parameters2-nok/v2/A.scala
  81. 0 functional-tests/{missing-class-method → class-missing-method-in-new-version-nok}/problems.txt
  82. 0 functional-tests/{missing-class-method → class-missing-method-in-new-version-nok}/v1/A.scala
  83. 0 functional-tests/{missing-class-method → class-missing-method-in-new-version-nok}/v2/A.scala
  84. 0 ...ests/{missing-class-method-empty-package → class-missing-method-in-root-package-nok}/problems.txt
  85. 0 ...-tests/{missing-class-method-empty-package → class-missing-method-in-root-package-nok}/v1/A.scala
  86. 0 ...-tests/{missing-class-method-empty-package → class-missing-method-in-root-package-nok}/v2/A.scala
  87. +1 −0 functional-tests/class-missing-nok/problems.txt
  88. +2 −0 functional-tests/class-missing-nok/v1/A.scala
  89. +1 −0 functional-tests/class-missing-nok/v2/A.scala
  90. +1 −0 functional-tests/class-removed-constructor-in-new-version-nok/problems.txt
  91. +1 −0 functional-tests/class-removed-constructor-in-new-version-nok/v1/A.scala
  92. +3 −0 functional-tests/class-removed-constructor-in-new-version-nok/v2/A.scala
  93. 0 functional-tests/package-with-classes-splitted-into-two-files-in-new-version-is-ok/problems.txt
  94. +9 −0 functional-tests/package-with-classes-splitted-into-two-files-in-new-version-is-ok/v1/A.scala
  95. +5 −0 functional-tests/package-with-classes-splitted-into-two-files-in-new-version-is-ok/v2/A.scala
  96. +3 −0 functional-tests/package-with-classes-splitted-into-two-files-in-new-version-is-ok/v2/B.scala
  97. +3 −0 functional-tests/trait-abstract-method-become-concrete-ok/README.txt
  98. 0 functional-tests/trait-abstract-method-become-concrete-ok/problems.txt
  99. +7 −0 functional-tests/trait-abstract-method-become-concrete-ok/v1/A.scala
  100. +9 −0 functional-tests/trait-abstract-method-become-concrete-ok/v2/A.scala
  101. +3 −0 functional-tests/trait-abstract-val-become-concrete-ok/README.txt
  102. +1 −0 functional-tests/trait-abstract-val-become-concrete-ok/problems.txt
  103. +7 −0 functional-tests/trait-abstract-val-become-concrete-ok/v1/A.scala
  104. +7 −0 functional-tests/trait-abstract-val-become-concrete-ok/v2/A.scala
  105. +1 −0 functional-tests/trait-abstract-var-become-concrete-ok/README.txt
  106. 0 functional-tests/trait-abstract-var-become-concrete-ok/problems.txt
  107. +7 −0 functional-tests/trait-abstract-var-become-concrete-ok/v1/A.scala
  108. +7 −0 functional-tests/trait-abstract-var-become-concrete-ok/v2/A.scala
  109. +1 −0 functional-tests/trait-added-method-in-new-version-nok/problems.txt
  110. +1 −3 functional-tests/{trait-1 → trait-added-method-in-new-version-nok}/v1/A.scala
  111. +0 −2 functional-tests/{trait-1 → trait-added-method-in-new-version-nok}/v2/A.scala
  112. +2 −0 functional-tests/trait-added-val-in-new-version-nok/problems.txt
  113. +3 −0 functional-tests/trait-added-val-in-new-version-nok/v1/A.scala
  114. +4 −0 functional-tests/trait-added-val-in-new-version-nok/v2/A.scala
  115. +2 −0 functional-tests/trait-added-var-in-new-version-nok/problems.txt
  116. +3 −0 functional-tests/trait-added-var-in-new-version-nok/v1/A.scala
  117. +4 −0 functional-tests/trait-added-var-in-new-version-nok/v2/A.scala
  118. 0 functional-tests/trait-use-type-alias-in-new-version-ok/problems.txt
  119. +3 −0 functional-tests/trait-use-type-alias-in-new-version-ok/v1/A.scala
  120. +4 −0 functional-tests/trait-use-type-alias-in-new-version-ok/v2/A.scala
  121. +12 −8 project/Build.scala
View
@@ -1,14 +1,11 @@
target/
+**/target
*.scala_dependencies
project/boot
-project/build/target
-lib_managed
-test/project/boot
-test/project/build/target
bin/
.classpath
.project
.DS_Store
-**/DS_Store
+**/.DS_Store
.settings
.history
View
@@ -6,9 +6,43 @@ A tool for diagnosing and fixing migration problems for Scala libraries.
Build
-------
-Using [the sbt tool][sbt].
+Using [the xsbt tool][xsbt].
- $ sbt update compile
+ $ xsbt update compile
-[sbt]: http://code.google.com/p/simple-build-tool/
+Make sure to build the sources of branch 0.9, installation notes can be found in the README.md file of the [xsbt git repository][xsbt].
+
+[xsbt]: https://github.com/harrah/xsbt/tree/0.9
+
+Functional Tests
+-------
+
+The 'functional-tests' folder contains a good number of functional tests that exercise the Mima's error reporting functionality. All tests are executed by running the following command:
+
+ $ xsbt package
+
+If you desire prefer to run a single test, then run the following command
+
+ $ xsbt <test-folder-name>/fun-tests
+
+To create add a new functional test to the suite, create a new folder within 'functional-tests' directory with the following structure:
+
+ functional-tests
+ |
+ | --> <your-new-test> (folder for your new test)
+ |
+ |-----> problems.txt (the expected list of reported errors - 1 line per error)
+ |-----> v1 (folder containing sources @ version 1)
+ |-----> v2 (folder containing sources @ version 2)
+
+After doing that, `reload` if you are in a `xsbt` console session (don't worry if that makes nosense to you, then you are fine and you can run the test as usual).
+
+All tests in this folder should always pass. If you spot a bug/missing feature then you can create a test that demonstrates the problem and put it in the `functional-tests-exposing-bugs` directory, located in the project root.
+
+Bugs and Feature requests
+-------
+
+Use the [Assembla project page][mima-assembla] for filing new tickets.
+
+[mima-assembla]: https://www.assembla.com/spaces/mima/tickets
@@ -1,34 +1,43 @@
package ssol.tools.mima.ui
-import ssol.tools.mima.{MiMaLib, Config}
+import ssol.tools.mima.{MiMaLib, Config, Settings, PathResolver}
import scala.io.Source
+import scala.tools.nsc.util._
class CollectProblemsTest {
- class TestFailed extends Exception
-
- def runTest(testName: String, oldJarPath: String, newJarPath: String, oraclePath: String) {
- Config.setup("scala ssol.tools.misco.MiMaLibUI <old-dir> <new-dir>", Array(oldJarPath, newJarPath), xs => true)
+ def runTest(testName: String, oldJarPath: String, newJarPath: String, oraclePath: String): Unit = {
+ // load test setup
+ Config.setup("scala ssol.tools.misco.MiMaLibUI <old-dir> <new-dir>", Array(oldJarPath, newJarPath))
+ var scalaLib = "/Applications/dev-tools/eclipse/configuration/org.eclipse.osgi/bundles/390/1/.cp/lib/scala-library.jar"
+ val cp = scalaLib :: ClassPath.split(Config.baseClassPath.asClasspathString)
+ val cpString = ClassPath.join(cp : _*)
+ Config.baseClassPath = new JavaClassPath(ClassPath.DefaultJavaContext.classesInPath(cpString), ClassPath.DefaultJavaContext)
+
val mima = new MiMaLib
- var problems = mima.collectProblems(oldJarPath, newJarPath).map(_.description)
+ // SUT
+ val problems = mima.collectProblems(oldJarPath, newJarPath).map(_.description)
+
+ // compare result against oracle
var expectedProblems = Source.fromFile(oraclePath).getLines.toList
val unexpectedProblems = problems -- expectedProblems
val unreportedProblem = expectedProblems -- problems
- var mess = new StringBuilder
+ val mess = new StringBuilder
if(!unexpectedProblems.isEmpty)
- mess ++= "The following problems were not expected\n" + unexpectedProblems.mkString("\t- ", "\n","")
-
- if(!unreportedProblem.isEmpty)
- mess ++= "The following expected problems were not reported\n" + unreportedProblem.mkString("\t- ", "\n","")
+ mess ++= "\tThe following problems were not expected\n" + unexpectedProblems.mkString("\t- ", "\n","")
+
+ if(!mess.isEmpty) mess ++= "\n\n"
- if(!mess.isEmpty) {
- println("[error] Test '" + testName + "' failed.\n" + mess.toString)
+ if(!unreportedProblem.isEmpty)
+ mess ++= "\tThe following expected problems were not reported\n" + unreportedProblem.mkString("\t- ", "\n","\n")
- throw new TestFailed
- }
+ if (!mess.isEmpty)
+ println("[error] Test '" + testName + "' failed.\n" + mess)
+ else
+ println("[info] Test '" + testName + "' succeeded.")
}
}
@@ -0,0 +1 @@
+A class that become final in the new version can break the user code because it can no longer be overidden.
@@ -0,0 +1 @@
+final class A
@@ -0,0 +1 @@
+A concrete class that become abstract in the new version can break client code because it can no longer be instantiated...
@@ -0,0 +1,3 @@
+abstract class A {
+ def foo: Int = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ def foo = 2
+}
@@ -0,0 +1 @@
+A class method that become final in the new version can break client code because it can no longer be overidden.
@@ -0,0 +1,3 @@
+class A {
+ def foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ final def foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ type Foo = Int
+}
@@ -0,0 +1,3 @@
+class A {
+ final type Foo = Int
+}
@@ -0,0 +1 @@
+Changes in the hierarchy can potentially break the user code.
@@ -0,0 +1,2 @@
+class A
+class B extends A
@@ -0,0 +1,2 @@
+class A
+class B
@@ -0,0 +1,3 @@
+class A {
+ val foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ final val foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ var foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ final var foo = 2
+}
@@ -0,0 +1,3 @@
+The fact that a package is missing is not an issue. An issue exists if any visible class located in the deleted package is no longer available.
+
+(Hint: Sometime this is due to some heavy refactoring. One way to fix this would be to provide an alias from the deleted package to the new one�)
@@ -0,0 +1,8 @@
+package me {
+ abstract class A {
+ def foo: Int
+ }
+}
+
+package you {
+}
@@ -0,0 +1,5 @@
+package me {
+ abstract class A {
+ def foo: Int
+ }
+}
@@ -0,0 +1 @@
+This should simply report the missing class.
@@ -0,0 +1 @@
+class you.B does not have a correspondent in new version
@@ -0,0 +1,9 @@
+package me {
+ abstract class A {
+ def foo: Int
+ }
+}
+
+package you {
+ class B
+}
@@ -0,0 +1,5 @@
+package me {
+ abstract class A {
+ def foo: Int
+ }
+}
@@ -0,0 +1,3 @@
+A trait containing an abstract var that becomes concrete in the new binary will for sure generate an incompatibility if the trait is used in the user code.
+
+This is because var cannot be overridden!
@@ -0,0 +1,3 @@
+trait A {
+ var foo: Int
+}
@@ -0,0 +1,3 @@
+trait A {
+ var foo = 2
+}
@@ -0,0 +1,2 @@
+class A
+class B
@@ -0,0 +1,3 @@
+class A {
+ def foo = 2
+}
@@ -0,0 +1,4 @@
+class A {
+ def foo = 2
+ def bar = foo
+}
@@ -0,0 +1,3 @@
+package me {
+ class A
+}
@@ -0,0 +1,7 @@
+package me {
+ class A
+
+ package you {
+ abstract class A
+ }
+}
@@ -0,0 +1,3 @@
+class A {
+ val foo = 0
+}
@@ -0,0 +1,3 @@
+class A {
+ val foo = 0
+}
@@ -0,0 +1 @@
+method foo()Int in class A has now a different result type; was: Int, is now: java.lang.Object
@@ -0,0 +1,3 @@
+class A {
+ def foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ def foo = new Object()
+}
@@ -0,0 +1,3 @@
+class A {
+ def foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ val foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ def foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ var foo = 2
+}
@@ -0,0 +1 @@
+method foo()Int in class A has now a different result type; was: Int, is now: java.lang.Object
@@ -0,0 +1,3 @@
+class A {
+ val foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ val foo = new Object()
+}
@@ -0,0 +1,3 @@
+class A {
+ val foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ def foo = 2
+}
@@ -0,0 +1,2 @@
+method foo()Int in class A has now a different result type; was: Int, is now: java.lang.Object
+method foo_=(Int)Unit in class A's type has changed; was (Int)Unit, is now: (java.lang.Object)Unit
@@ -0,0 +1,3 @@
+class A {
+ var foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ var foo = new Object()
+}
@@ -0,0 +1 @@
+method foo_=(Int)Unit in class A does not have a correspondent in new version
@@ -0,0 +1,3 @@
+class A {
+ var foo = 2
+}
@@ -0,0 +1,3 @@
+class A {
+ def foo = 2
+}
@@ -0,0 +1 @@
+method foo(Int)Int in class A's type has changed; was (Int)Int, is now: (java.lang.Object)java.lang.Object
@@ -0,0 +1,3 @@
+class A {
+ def foo(x: Int) = x
+}
@@ -0,0 +1,3 @@
+class A {
+ def foo(x: Any) = x
+}
@@ -0,0 +1 @@
+method foo(Int)Int in class A's type has changed; was (Int)Int, is now: (Int,java.lang.Object)Int
@@ -0,0 +1,3 @@
+class A {
+ def foo(x: Int) = x
+}
@@ -0,0 +1,3 @@
+class A {
+ def foo(x: Int)(y: Any) = x
+}
@@ -0,0 +1 @@
+method foo(java.lang.Object,Int)Int in class A's type has changed; was (java.lang.Object,Int)Int, is now: (Int,java.lang.Object)Int
@@ -0,0 +1,3 @@
+class A {
+ def foo(y: Any)(x: Int) = x
+}
Oops, something went wrong.

0 comments on commit f24137b

Please sign in to comment.