Skip to content

Cleanup tests #3926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Feb 5, 2018
Merged

Cleanup tests #3926

merged 24 commits into from
Feb 5, 2018

Conversation

OlivierBlanvillain
Copy link
Contributor

This PR cleans up the tests, to summarize:

  • Activate all the passing tests from tests/pending/* and tests/untried/*

  • Disable all the the pending tests that use scala.reflect._, existential types and are depending on things from scala.tools.partest._

  • Clean up warnings from pending tests

  • Clean up all orphan .check and .flags files

This is best reviewed commit by commit

@OlivierBlanvillain OlivierBlanvillain force-pushed the cleanup-tests branch 2 times, most recently from 8f6701c to aacd5ca Compare January 26, 2018 16:04
@liufengyun
Copy link
Contributor

Need to rebase because of #3892

@allanrenucci allanrenucci self-assigned this Jan 29, 2018
@OlivierBlanvillain OlivierBlanvillain force-pushed the cleanup-tests branch 4 times, most recently from 2835fdc to 1442757 Compare January 30, 2018 15:06
@OlivierBlanvillain
Copy link
Contributor Author

@allanrenucci This is ready for review!

Copy link
Contributor

@allanrenucci allanrenucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two remarks:

  • 9cfe19b moves tests that fail under legacy. Why do they fail under legacy and not with vulpix?
  • I think a lot of tests in pending/run are not meant to be ran but only meant to check warnings. We should convert them to neg tests with -Xfatal-warnings. Also, until they are converted, we should keep their .flags

case self: JointCompilationSource =>
if (self.files.length > 1) name
else self.files.head.getPath

case self: SeparateCompilationSource =>
self.dir.getPath
}
}).stripPrefix("../")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about we change the working directory when running tests? Something like:

baseDirectory in test := baseDirectory in ThisBuild

We could get rid of all the "../ in CompilationTest

@@ -69,7 +69,7 @@ object Test extends dotty.runtime.LegacyApp {


println("x.hashCode: "+x.hashCode)
println("x == 1: "+(x == 1))
println("x == 1: "+false) // Values of types a.Meter and Int cannot be compared with == or !=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this line or comment it out

@@ -66,7 +66,7 @@ object Test extends dotty.runtime.LegacyApp {


println("x.hashCode: "+x.hashCode)
println("x == 1: "+(x == 1))
println("x == 1: "+false) // Values of types a.Meter and Int cannot be compared with == or !=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this line or comment it out

@@ -90,10 +90,10 @@ object Test {
check_success("1e1f == 10.0f", 1e1f, 10.0f)
check_success(".3f == 0.3f", .3f, 0.3f)
check_success("0f == 0.0f", 0f, 0.0f)
check_success("01.23f == 1.23f", 01.23f, 1.23f)
check_success("01.23f == 1.23f", /*0*/1.23f, 1.23f) // Non-zero numbers may not have a leading zero.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this line or comment it out

@@ -189,7 +189,6 @@ class CompilationTests extends ParallelTesting {
compileFile("../tests/neg-custom-args/xfatalWarnings.scala", defaultOptions.and("-Xfatal-warnings")) +
compileFile("../tests/neg-custom-args/i3561.scala", defaultOptions.and("-Xfatal-warnings")) +
compileFile("../tests/neg-custom-args/pureStatement.scala", defaultOptions.and("-Xfatal-warnings")) +
compileFile("../tests/neg-custom-args/i3589-a.scala", defaultOptions.and("-Xfatal-warnings")) +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! We support emitting switch on value classes. Maybe open an issue to figure out if this is expected or not.

@OlivierBlanvillain OlivierBlanvillain force-pushed the cleanup-tests branch 3 times, most recently from ef1bd27 to 9af5e08 Compare January 31, 2018 15:46
@OlivierBlanvillain
Copy link
Contributor Author

OlivierBlanvillain commented Jan 31, 2018

@allanrenucci

  • No idea about the tests that fail only on legacy or with dotty bootstrapped. But that fact that you see these in commits is just an artifact of the way I did moves things around: first move the tests that were green under sbt testCompilation, then fix what broke.

  • I don't see how the tests in pending/run would check warnings, then only tests that could potentially check warnings would be in pending/neg with the fatal warnings flag. I manually checked all the flags touched by 6a950cd, and none of them where neg/*.flags, so I think I didn't lose any warning related flags.

  • I tried the change in Build.scala that you suggested, let see if the CI is happy with it!

@OlivierBlanvillain
Copy link
Contributor Author

@allanrenucci There is an unfortunate side effect of baseDirectory in Test := baseDirectory.value / "..", which is that .class at the root of the dotty repo will be picked up when compiling the tests. I'm not sure that's better than the original .stripPrefix("../") solution...

@OlivierBlanvillain OlivierBlanvillain force-pushed the cleanup-tests branch 3 times, most recently from 80518fa to a3fa888 Compare February 2, 2018 11:16
This is to simplify the scripts written in the next commits. I don't
believe this separation brings a lot of value, so propose to just keep
it that way.
Using the following script:

find tests/untried/???/ tests/pending/???/ -maxdepth 1 -mindepth 1 -not
-name "*.check" -not -name "*.flags" | while read t; do
  pref=$(echo "$t" | cut -f 1-2 -d "/")
  name=$(echo "$t" | rev | cut -f 1 -d "/" | rev)
  type=$(echo "$t" | cut -f 3 -d "/")
  mv "$t" "tests/$type"
  base=$(basename $name .scala)
  mv "$pref/$type/$base.check" "tests/$type" 2>/dev/null
  mv "$pref/$type/$base.flags" "tests/$type" 2>/dev/null

  echo ";testCompilation $name ;eval
scala.tools.nsc.io.File(\"/home/olivier/works\").appendAll(\"$t\\n\")"
done | sbt

git stash

cat /home/olivier/works | while read t; do # same loop as above
Some of these warnning are also emitted by dotc, but they are not
captured by the testing infreastructure and shouldn't be part of check
files.
I used the following script:

mkdir filtered filtered/pos filtered/neg filtered/run

find tests/untried/???/ tests/pending/???/ -name *.scala | while read t;
do
  grep --silent '.partest.' "$t" && (
    pref=$(echo "$t" | cut -f 1-2 -d "/")
    type=$(echo "$t" | cut -f 3 -d "/")
    name=$(echo "$t" | cut -f 4 -d "/")
    echo "$pref/$type/$name"
    mv "$pref/$type/$name" "filtered/$type"

    base=$(basename $name .scala)
    mv "$pref/$type/$base.check" "filtered/$type" 2>/dev/null
    mv "$pref/$type/$base.flags" "filtered/$type" 2>/dev/null
  )
done

mv filtered tests/untried/partest

With '.partest.', '.reflect.' and ' forSome {'.
@OlivierBlanvillain
Copy link
Contributor Author

OlivierBlanvillain commented Feb 2, 2018

@allanrenucci Review addressed and CI green, let me know what you think!

Copy link
Contributor

@allanrenucci allanrenucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @OlivierBlanvillain for taking care of this tedious work

@OlivierBlanvillain OlivierBlanvillain merged commit e011862 into scala:master Feb 5, 2018
@allanrenucci allanrenucci deleted the cleanup-tests branch February 5, 2018 14:57
allanrenucci added a commit to dotty-staging/dotty that referenced this pull request Feb 7, 2018
After scala#3926, test logs were outputted to the dotty project parent folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants