Skip to content

Commit 473a169

Browse files
committed
As partest is now resolved from maven, `test/partest` uses `ant test.suite.init` to determine the classpath (serialized to build/pack/partest.properties) that's necessary to run `scala.tools.partest.nest.ConsoleRunner`. Thus, partest gets exactly the same classpath, whether run from the command line through `test/partest` or via `ant test`. The version of partest we're using is specified by properties defined in versions.properties (formerly `starr.number`). Currently, we're using: ``` scala.binary.version=2.11.0-M4 partest.version.number=1.0-RC3 ``` NOTES: - The version of Scala being tested must be backwards binary compatible with the version of Scala that was used to compile partest. - Once 2.11 goes final, `scala.binary.version=2.11`, and `starr.version=2.11.0`. - Need scalacheck on classpath for test/partest scalacheck tests. - Removed atrophied ant tests (haven't been run/changed for at least two years I checked 81d6591 as a "random" sample). - Removed scalacheck. It's resolved as a partest dependency. - For now, use a locally built scalap - Kept the trace macro in the main repo (partest-extras) - New targets for faster pr validation: test-core-opt, test-stab-opt - Reused partest eclipse/intellij project to partest-extras (note: the partest dependency is hard-coded)
1 parent 738441c commit 473a169

File tree

100 files changed

+380
-7385
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+380
-7385
lines changed

build.xml

Lines changed: 113 additions & 105 deletions
Large diffs are not rendered by default.

dbuild-meta.json

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -122,67 +122,6 @@
122122
"name": "scala-parser-combinators",
123123
"organization": "org.scala-lang"
124124
},
125-
{
126-
"artifacts": [
127-
{
128-
"extension": "jar",
129-
"name": "scalacheck",
130-
"organization": "org.scala-lang"
131-
}
132-
],
133-
"dependencies": [
134-
{
135-
"extension": "jar",
136-
"name": "scala-library",
137-
"organization": "org.scala-lang"
138-
},
139-
{
140-
"extension": "jar",
141-
"name": "scala-actors",
142-
"organization": "org.scala-lang"
143-
},
144-
{
145-
"extension": "jar",
146-
"name": "scala-parser-combinators",
147-
"organization": "org.scala-lang"
148-
}
149-
],
150-
"name": "scalacheck",
151-
"organization": "org.scala-lang"
152-
},
153-
{
154-
"artifacts": [
155-
{
156-
"extension": "jar",
157-
"name": "scala-partest",
158-
"organization": "org.scala-lang"
159-
}
160-
],
161-
"dependencies": [
162-
{
163-
"extension": "jar",
164-
"name": "scala-compiler",
165-
"organization": "org.scala-lang"
166-
},
167-
{
168-
"extension": "jar",
169-
"name": "scalap",
170-
"organization": "org.scala-lang"
171-
},
172-
{
173-
"extension": "jar",
174-
"name": "scala-xml",
175-
"organization": "org.scala-lang"
176-
},
177-
{
178-
"extension": "jar",
179-
"name": "scalacheck",
180-
"organization": "org.scala-lang"
181-
}
182-
],
183-
"name": "scala-partest",
184-
"organization": "org.scala-lang"
185-
},
186125
{
187126
"artifacts": [
188127
{

src/build/dbuild-meta-json-gen.scala

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// use this script to generate dbuild-meta.json
22
// make sure the version is specified correctly,
3-
// update the dependency structura and
3+
// update the dependency structure and
44
// check out distributed-build and run `sbt console`:
55
// TODO: also generate build.xml and eclipse config from a similar data-structure
66

@@ -40,15 +40,6 @@ val meta =
4040
Seq(ProjectRef("scala-parser-combinators", "org.scala-lang")),
4141
Seq(ProjectRef("scala-library", "org.scala-lang"))),
4242

43-
Project("scalacheck", "org.scala-lang",
44-
Seq(ProjectRef("scalacheck", "org.scala-lang")),
45-
Seq(ProjectRef("scala-library", "org.scala-lang"), ProjectRef("scala-actors", "org.scala-lang"), ProjectRef("scala-parser-combinators", "org.scala-lang"))),
46-
47-
Project("scala-partest", "org.scala-lang",
48-
Seq(ProjectRef("scala-partest", "org.scala-lang")),
49-
Seq(ProjectRef("scala-compiler", "org.scala-lang"), // TODO: refine to scala-repl
50-
ProjectRef("scalap", "org.scala-lang"), ProjectRef("scala-xml", "org.scala-lang"), ProjectRef("scalacheck", "org.scala-lang"))),
51-
5243
Project("scaladoc", "org.scala-lang",
5344
Seq(ProjectRef("scaladoc", "org.scala-lang")),
5445
Seq(ProjectRef("scala-compiler", "org.scala-lang"),ProjectRef("scala-partest", "org.scala-lang"), ProjectRef("scala-xml", "org.scala-lang"), ProjectRef("scala-parser-combinators", "org.scala-lang"))),

src/build/maven/maven-deploy.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@
110110
<deploy-one name="scala-library" version="${maven.version.number}" local="@{local}" signed="@{signed}"/>
111111
<deploy-one name="scala-xml" version="${maven.version.number}" local="@{local}" signed="@{signed}"/>
112112
<deploy-one name="scala-parser-combinators" version="${maven.version.number}" local="@{local}" signed="@{signed}"/>
113-
<deploy-one name="scala-partest" version="${maven.version.number}" local="@{local}" signed="@{signed}"/>
114113
<deploy-one name="scala-reflect" version="${maven.version.number}" local="@{local}" signed="@{signed}"/>
115114
<deploy-one name="scala-swing" version="${maven.version.number}" local="@{local}" signed="@{signed}"/>
116115
<deploy-one name="scalap" version="${maven.version.number}" local="@{local}" signed="@{signed}"/>

src/build/maven/scala-partest-pom.xml

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/build/pack.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ MAIN DISTRIBUTION PACKAGING
158158
<mvn-copy-lib mvn.artifact.name="scala-compiler"/>
159159
<mvn-copy-lib mvn.artifact.name="scala-swing"/>
160160
<mvn-copy-lib mvn.artifact.name="scala-actors"/>
161-
<mvn-copy-lib mvn.artifact.name="scala-partest"/>
162161
<mvn-copy-lib mvn.artifact.name="scalap"/>
163162
</target>
164163

@@ -210,10 +209,6 @@ MAIN DISTRIBUTION PACKAGING
210209
basedir="${build-docs.dir}/scalap">
211210
<include name="**/*"/>
212211
</jar>
213-
<jar whenmanifestonly="fail" destfile="${dists.dir}/maven/${version.number}/scala-partest/scala-partest-docs.jar"
214-
basedir="${build-docs.dir}/partest">
215-
<include name="**/*"/>
216-
</jar>
217212
<jar whenmanifestonly="fail" destfile="${dists.dir}/maven/${version.number}/plugins/continuations/continuations-docs.jar"
218213
basedir="${build-docs.dir}/continuations-plugin">
219214
<include name="**/*"/>

src/eclipse/partest/.classpath

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="src" path="partest"/>
4-
<classpathentry combineaccessrules="false" kind="src" path="/scalap"/>
3+
<classpathentry kind="src" path="partest-extras"/>
54
<classpathentry combineaccessrules="false" kind="src" path="/asm"/>
65
<classpathentry combineaccessrules="false" kind="src" path="/repl"/>
76
<classpathentry kind="var" path="M2_REPO/com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0.jar"/>
87
<classpathentry kind="var" path="M2_REPO/org/scala-tools/testing/test-interface/0.5/test-interface-0.5.jar"/>
8+
<classpathentry kind="var" path="M2_REPO/org/scala-lang/modules/scala-partest_2.11.0-M4/1.0-RC3/scala-partest_2.11.0-M4-1.0-RC3.jar"/>
99
<classpathentry kind="var" path="SCALA_BASEDIR/lib/ant/ant.jar"/>
1010
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
1111
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_COMPILER_CONTAINER"/>
1212
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
13-
<classpathentry kind="output" path="build-quick-partest"/>
13+
<classpathentry kind="output" path="build-quick-partest-extras"/>
1414
</classpath>

src/eclipse/partest/.project

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<projectDescription>
3-
<name>partest</name>
3+
<name>partest-extras</name>
44
<comment></comment>
55
<projects>
66
</projects>
@@ -17,19 +17,19 @@
1717
</natures>
1818
<linkedResources>
1919
<link>
20-
<name>build-quick-partest</name>
20+
<name>build-quick-partest-extras</name>
2121
<type>2</type>
22-
<locationURI>SCALA_BASEDIR/build/quick/classes/partest</locationURI>
22+
<locationURI>SCALA_BASEDIR/build/quick/classes/partest-extras</locationURI>
2323
</link>
2424
<link>
2525
<name>lib</name>
2626
<type>2</type>
2727
<locationURI>SCALA_BASEDIR/lib</locationURI>
2828
</link>
2929
<link>
30-
<name>partest</name>
30+
<name>partest-extras</name>
3131
<type>2</type>
32-
<locationURI>SCALA_BASEDIR/src/partest</locationURI>
32+
<locationURI>SCALA_BASEDIR/src/partest-extras</locationURI>
3333
</link>
3434
</linkedResources>
3535
</projectDescription>

src/intellij/partest.iml.SAMPLE

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,11 @@
1212
</component>
1313
<component name="NewModuleRootManager" inherit-compiler-output="true">
1414
<exclude-output />
15-
<content url="file://$MODULE_DIR$/../partest">
16-
<sourceFolder url="file://$MODULE_DIR$/../partest" isTestSource="false" />
15+
<content url="file://$MODULE_DIR$/../partest-extras">
16+
<sourceFolder url="file://$MODULE_DIR$/../partest-extras" isTestSource="false" />
1717
</content>
1818
<orderEntry type="inheritedJdk" />
1919
<orderEntry type="sourceFolder" forTests="false" />
20-
<orderEntry type="module" module-name="library" />
21-
<orderEntry type="module" module-name="xml" />
22-
<orderEntry type="module" module-name="reflect" />
23-
<orderEntry type="module" module-name="actors" />
24-
<orderEntry type="module" module-name="scalap" />
25-
<orderEntry type="module" module-name="compiler" />
2620
<orderEntry type="library" name="partest-deps" level="project" />
2721
<orderEntry type="module" module-name="repl" />
2822
</component>

src/partest/scala/tools/partest/ReplTest.scala renamed to src/partest-extras/scala/tools/partest/ReplTest.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package scala.tools.partest
77

88
import scala.tools.nsc.Settings
99
import scala.tools.nsc.interpreter.ILoop
10-
import scala.tools.partest.nest.FileUtil
1110
import java.lang.reflect.{ Method => JMethod, Field => JField }
1211

1312
/** A trait for testing repl code. It drops the first line
@@ -31,14 +30,14 @@ abstract class ReplTest extends DirectTest {
3130
def show() = eval() foreach println
3231
}
3332

34-
abstract class SessionTest extends ReplTest with FileUtil {
33+
abstract class SessionTest extends ReplTest {
3534
def session: String
3635
override final def code = expected filter (_.startsWith(prompt)) map (_.drop(prompt.length)) mkString "\n"
3736
def expected = session.stripMargin.lines.toList
3837
final def prompt = "scala> "
3938
override def show() = {
4039
val out = eval().toList
4140
if (out.size != expected.size) Console println s"Expected ${expected.size} lines, got ${out.size}"
42-
if (out != expected) Console print compareContents(expected, out, "expected", "actual")
41+
if (out != expected) Console print nest.FileManager.compareContents(expected, out, "expected", "actual")
4342
}
4443
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package scala.tools.partest
2+
3+
import scala.language.experimental.macros
4+
5+
object Util {
6+
/**
7+
* `trace("".isEmpty)` will return `true` and as a side effect print the following to standard out.
8+
* {{{
9+
* trace> "".isEmpty
10+
* res: Boolean = true
11+
*
12+
* }}}
13+
*
14+
* An alternative to [[scala.tools.partest.ReplTest]] that avoids the inconvenience of embedding
15+
* test code in a string.
16+
*/
17+
def trace[A](a: A) = macro traceImpl[A]
18+
19+
import scala.reflect.macros.Context
20+
def traceImpl[A: c.WeakTypeTag](c: Context)(a: c.Expr[A]): c.Expr[A] = {
21+
import c.universe._
22+
import definitions._
23+
24+
// xeno.by: reify shouldn't be used explicitly before the final release of 2.10.0,
25+
// because this impairs reflection refactorings
26+
//
27+
// val exprCode = c.literal(show(a.tree))
28+
// val exprType = c.literal(show(a.actualType))
29+
// reify {
30+
// println(s"trace> ${exprCode.splice}\nres: ${exprType.splice} = ${a.splice}\n")
31+
// a.splice
32+
// }
33+
34+
c.Expr(Block(
35+
List(Apply(
36+
Select(Ident(PredefModule), TermName("println")),
37+
List(Apply(
38+
Select(Apply(
39+
Select(Ident(ScalaPackage), TermName("StringContext")),
40+
List(
41+
Literal(Constant("trace> ")),
42+
Literal(Constant("\\nres: ")),
43+
Literal(Constant(" = ")),
44+
Literal(Constant("\\n")))),
45+
TermName("s")),
46+
List(
47+
Literal(Constant(show(a.tree))),
48+
Literal(Constant(show(a.actualType))),
49+
a.tree))))),
50+
a.tree))
51+
}
52+
}

0 commit comments

Comments
 (0)