aboutsummaryrefslogtreecommitdiff
path: root/test/test/CompilerTest.scala
diff options
context:
space:
mode:
authorvsalvis <salvisbergvera@gmail.com>2015-04-20 11:10:08 +0200
committervsalvis <salvisbergvera@gmail.com>2015-04-20 11:10:08 +0200
commit346ad4ff58f32397ec943353bf5ebe54aca5a3c8 (patch)
tree23d4fa948f17f5c061037bc89e7a04a973b670b5 /test/test/CompilerTest.scala
parent8d08915765848d1370542742c8b7482bd1bf86d0 (diff)
downloaddotty-346ad4ff58f32397ec943353bf5ebe54aca5a3c8.tar.gz
dotty-346ad4ff58f32397ec943353bf5ebe54aca5a3c8.tar.bz2
dotty-346ad4ff58f32397ec943353bf5ebe54aca5a3c8.zip
Using FileLock to distinguish between test and partest mode
Diffstat (limited to 'test/test/CompilerTest.scala')
-rw-r--r--test/test/CompilerTest.scala12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/test/CompilerTest.scala b/test/test/CompilerTest.scala
index 23bdfd829..1dd65b6e0 100644
--- a/test/test/CompilerTest.scala
+++ b/test/test/CompilerTest.scala
@@ -6,7 +6,8 @@ import dotty.tools.dotc.reporting.Reporter
import scala.collection.mutable.ListBuffer
import scala.reflect.io.{ Path, Directory, File => SFile }
import scala.tools.partest.nest.FileManager
-import java.io.{ File => JFile }
+import java.io.{ RandomAccessFile, File => JFile }
+
import org.junit.Test
@@ -39,7 +40,14 @@ abstract class CompilerTest extends DottyTest {
def partestableDir(prefix: String, dirName: String, args: List[String], xerrors: Int) = true
def partestableList(testName: String, files: List[String], args: List[String], xerrors: Int) = true
- val generatePartestFiles = new JFile("tests", "runPartest.flag").exists
+ val generatePartestFiles = {
+ val partestLockFile = "." + JFile.separator + "tests" + JFile.separator + "partest.lock"
+ val partestLock = new RandomAccessFile(partestLockFile, "rw").getChannel.tryLock
+ if (partestLock != null) { // file not locked by sbt -> don't generate partest
+ partestLock.release
+ false
+ } else true
+ }
// Delete generated files from previous run
if (generatePartestFiles)