diff --git a/src/partest/scala/tools/partest/nest/AbstractRunner.scala b/src/partest/scala/tools/partest/nest/AbstractRunner.scala index 8a19b6e893a0..4212873beaf1 100644 --- a/src/partest/scala/tools/partest/nest/AbstractRunner.scala +++ b/src/partest/scala/tools/partest/nest/AbstractRunner.scala @@ -296,7 +296,8 @@ class AbstractRunner(val config: RunnerSpec.Config, protected final val testSour val isRerun = config.optFailed val rerunTests = if (isRerun) testKinds.failedTests else Nil - def miscTests = individualTests ++ greppedTests ++ branchedTests ++ rerunTests + val specialTests = if (realeasy) List(Path("test/files/run/t6240-universe-code-gen.scala")) else Nil + def miscTests = List(individualTests, greppedTests, branchedTests, rerunTests, specialTests).flatten val givenKinds = standardKinds filter config.parsed.isSet val kinds = ( @@ -312,16 +313,21 @@ class AbstractRunner(val config: RunnerSpec.Config, protected final val testSour def testContributors = { List( - if (rerunTests.isEmpty) "" else "previously failed tests", - if (kindsTests.isEmpty) "" else s"${kinds.size} named test categories", - if (greppedTests.isEmpty) "" else s"${greppedTests.size} tests matching '$grepExpr'", - if (branchedTests.isEmpty) "" else s"${branchedTests.size} tests modified on this branch", - if (individualTests.isEmpty) "" else "specified tests", - ).filterNot(_.isEmpty).mkString(", ") + (rerunTests, "previously failed tests"), + (kindsTests, s"${kinds.size} named test categories"), + (greppedTests, s"${greppedTests.size} tests matching '$grepExpr'"), + (branchedTests, s"${branchedTests.size} tests modified on this branch"), + (individualTests, "specified tests"), + (specialTests, "other tests you might have forgotten"), + ).filterNot(_._1.isEmpty).map(_._2) match { + case Nil => "the well of despair. I see you're not in a testing mood." + case one :: Nil => one + case all => all.init.mkString("", ", ", s", and ${all.last}") + } } - val allTests: Array[Path] = distinctBy(miscTests ++ kindsTests)(_.toCanonical).sortBy(_.toString).toArray - val grouped = (allTests groupBy kindOf).toArray sortBy (x => standardKinds indexOf x._1) + val allTests: Array[Path] = distinctBy(miscTests ::: kindsTests)(_.toCanonical).sortBy(_.toString).toArray + val grouped = allTests.groupBy(kindOf).toArray.sortBy(x => standardKinds.indexOf(x._1)) onlyIndividualTests = individualTests.nonEmpty && rerunTests.isEmpty && kindsTests.isEmpty && greppedTests.isEmpty totalTests = allTests.size diff --git a/src/partest/scala/tools/partest/nest/Runner.scala b/src/partest/scala/tools/partest/nest/Runner.scala index 0ceafe355dde..a44cea9b3635 100644 --- a/src/partest/scala/tools/partest/nest/Runner.scala +++ b/src/partest/scala/tools/partest/nest/Runner.scala @@ -531,7 +531,8 @@ class Runner(val testInfo: TestInfo, val suiteRunner: AbstractRunner) { else from.toInt <= currentJavaVersion && currentJavaVersion <= to.toInt else currentJavaVersion >= from.toInt - if (ok) None + if (ok && suiteRunner.realeasy && from.toInt > 8) Some(genSkip(s"skipped on Java $javaSpecVersion, compiling against JDK8 but must run on $v")) + else if (ok) None else Some(genSkip(s"skipped on Java $javaSpecVersion, only running on $v")) case v => Some(genFail(s"invalid javaVersion range in test comment: $v")) diff --git a/test/files/run/blank.scala b/test/files/run/blank.scala new file mode 100644 index 000000000000..0a96ee5f5b49 --- /dev/null +++ b/test/files/run/blank.scala @@ -0,0 +1,11 @@ +// javaVersion: 11+ +// +// skalac: --release:8 +// trivial manual test for partest --realeasy, which sets --release:8. +// under --realeasy, skip this test because of the javaVersion, irrespective of JDK in use. +// otherwise, this test passes trivially on JDK11+ and is skipped on lesser JDKs. +// note that explicit --release:8 asks to compile against JDK8 but only run on the requested version. + +object Test extends App { + assert("".isBlank) // String#isBlank was added in JDK11 +}