-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Run tests for partest #554
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
Conversation
Should test contain the |
Not sure I understand your question... The code being run by partest is the main method of the Test object, so the "..." in the code above... |
I mean, if I name object not |
No, it runs exactly the main method of the Test object, nothing else. It
|
Good to know. Thanks. |
try { | ||
partestLock = new RandomAccessFile(partestLockFile, "rw").getChannel.tryLock | ||
} catch { | ||
case ex: java.nio.channels.OverlappingFileLockException => // locked already |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure it is locked by same SBT instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exception is thrown when the lock is held by the same JVM. This could happen if Tests.Cleanup doesn't run for some reason. If the lock is held by another JVM, tryLock returns null. In both cases, we just continue because the file is locked (even though not by us). In general it's a bad idea to have two sbt instances run tests at the same time since we only communicate partest-ness through the file locking, which is a global property, not a per-sbt property. So maybe it would be better to fail if we can't lock the file?
The JUnit test switches between partest file generation and running the tests based on the lock file. So if one sbt instance does partest
and the other test
, then the second will still generate partest files (because the file is still locked at the time when the JUnit test runs). So in the second case, the tests are neither run by JUnit nor by partest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added exceptions in those two cases (commit below), however running test
while a concurrent partest
is running will not throw an exception and result in the undesired behavior described above, and depending on the timing other interleavings of test & partest could mess things up as well... So generally one should avoid running tests in two concurrent sbt instances.
bf6ce11
to
f64762b
Compare
Added
runFile
/runDir
methods toCompilerTest
. A run test needs to contain anand a testname.check file which needs to match the output of the run test.