summaryrefslogtreecommitdiff
path: root/src/partest
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert.plociniczak@epfl.ch>2010-03-19 09:09:00 +0000
committerHubert Plociniczak <hubert.plociniczak@epfl.ch>2010-03-19 09:09:00 +0000
commitbf2da77cefaed778008a2ede6b129a58adc86913 (patch)
tree1b682c39ff93610c631de3139dd0c8c83ff20ad0 /src/partest
parent46ddf14b459ff18f7fd1904249c6916384030546 (diff)
downloadscala-bf2da77cefaed778008a2ede6b129a58adc86913.tar.gz
scala-bf2da77cefaed778008a2ede6b129a58adc86913.tar.bz2
scala-bf2da77cefaed778008a2ede6b129a58adc86913.zip
Fixes #3054. No review.
Diffstat (limited to 'src/partest')
-rw-r--r--src/partest/scala/tools/partest/nest/FileManager.scala30
-rw-r--r--src/partest/scala/tools/partest/nest/Worker.scala10
2 files changed, 27 insertions, 13 deletions
diff --git a/src/partest/scala/tools/partest/nest/FileManager.scala b/src/partest/scala/tools/partest/nest/FileManager.scala
index 12a4fdf40f..bdbb34b3c4 100644
--- a/src/partest/scala/tools/partest/nest/FileManager.scala
+++ b/src/partest/scala/tools/partest/nest/FileManager.scala
@@ -73,16 +73,26 @@ trait FileManager {
def overwriteFileWith(dest: File, file: File) =
dest.isFile && copyFile(file, dest)
- def copyFile(from: File, to: File): Boolean =
- try {
- val appender = StreamAppender(from, to)
- appender.run()
- appender.closeAll()
- true
- }
- catch {
- case _: IOException => false
- }
+
+ def copyFile(from: File, dest: File): Boolean = {
+ def copyFile0(from: File, to: File): Boolean =
+ try {
+ val appender = StreamAppender(from, to)
+ appender.run()
+ appender.closeAll()
+ true
+ } catch {
+ case _: IOException => false
+ }
+
+ if (from.isDirectory) {
+ assert(dest.isDirectory, "cannot copy directory to file")
+ val subDir:Directory = Path(dest) / Directory(from.getName)
+ subDir.createDirectory()
+ from.listFiles.toList.forall(copyFile(_, subDir))
+ } else
+ copyFile0(from, if (dest.isDirectory) new File(dest, from.getName) else dest)
+ }
def mapFile(file: File, suffix: String, dir: File, replace: String => String) {
val tmpFile = File.createTempFile("tmp", suffix, dir) // prefix required by API
diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala
index 39137d8bd0..992ceba99f 100644
--- a/src/partest/scala/tools/partest/nest/Worker.scala
+++ b/src/partest/scala/tools/partest/nest/Worker.scala
@@ -511,6 +511,8 @@ class Worker(val fileManager: FileManager) extends Actor {
val changesDir = new File(file, fileBase + ".changes")
if (changesDir.isFile || !testFile.isFile) {
// if changes exists then it has to be a dir
+ if (!testFile.isFile) NestUI.verbose("invalid build manager test file")
+ if (changesDir.isFile) NestUI.verbose("invalid build manager changes directory")
succeeded = false
(null, null, null, null)
} else {
@@ -1050,9 +1052,11 @@ class Worker(val fileManager: FileManager) extends Actor {
fs flatMap (s => Option(AbstractFile getFile (pre + s))) toSet
private def copyTestFiles(testDir: File, destDir: File) {
- testDir.listFiles.toList filter (f => isJavaOrScala(f) && f.isFile) foreach { f =>
- fileManager.copyFile(f, new File(destDir, f.getName))
- }
+ val invalidExts = List("changes", "svn", "obj")
+ testDir.listFiles.toList filter (
+ f => (isJavaOrScala(f) && f.isFile) ||
+ (f.isDirectory && !(invalidExts.contains(SFile(f).extension)))) foreach
+ { f => fileManager.copyFile(f, destDir) }
}
def showLog(logFile: File) {