From d27253e4519092558765743859f2a5eee53bafc2 Mon Sep 17 00:00:00 2001
From: Etienne Kneuss <ekneuss@gmail.com>
Date: Mon, 17 Aug 2015 17:40:51 +0200
Subject: [PATCH] One test per file compiled

---
 .../test/testcases/TestCasesCompile.scala     | 48 +++++++------------
 1 file changed, 16 insertions(+), 32 deletions(-)

diff --git a/src/regression/scala/leon/test/testcases/TestCasesCompile.scala b/src/regression/scala/leon/test/testcases/TestCasesCompile.scala
index 48f2b9716..7c4f348b3 100644
--- a/src/regression/scala/leon/test/testcases/TestCasesCompile.scala
+++ b/src/regression/scala/leon/test/testcases/TestCasesCompile.scala
@@ -11,22 +11,6 @@ import org.scalatest.ParallelTestExecution
 class TestCasesCompile extends LeonTestSuite {
   val pipeline = frontends.scalac.ExtractionPhase andThen utils.PreprocessingPhase
 
-  def testFrontend(f: File, strip: Int): Boolean = {
-    val name = f.getAbsolutePath.split("/").toList.drop(strip).mkString("/")
-
-    val ctx = createLeonContext()
-
-    try {
-      pipeline.run(ctx)(List(f.getAbsolutePath))
-      info(name)
-      true
-    } catch {
-      case _: LeonFatalError =>
-        info(Console.YELLOW+" Failed to compile "+name)
-        false
-    }
-  }
-
   private def filesIn(path : String): Seq[File] = {
     val fs = filesInResourceDir(path, _.endsWith(".scala"), recursive=true)
 
@@ -37,25 +21,25 @@ class TestCasesCompile extends LeonTestSuite {
 
   val slashes = resourceDir(baseDir).getAbsolutePath.split("/").toList.size
 
-  testWithTimeout("Compiling testcases", 20.minutes) {
-    val all = (filesIn(baseDir+"repair/") ++
-               filesIn(baseDir+"runtime/") ++
-               filesIn(baseDir+"synthesis/") ++
-               filesIn(baseDir+"verification/") ++
-               filesIn(baseDir+"web/")).sortBy(_.getAbsolutePath)
+  val allTests = (filesIn(baseDir+"repair/") ++
+                 filesIn(baseDir+"runtime/") ++
+                 filesIn(baseDir+"synthesis/") ++
+                 filesIn(baseDir+"verification/") ++
+                 filesIn(baseDir+"web/")).sortBy(_.getAbsolutePath)
 
-    info("Compiling "+all.size+" testcases...")
+  allTests.foreach { f =>
+    val name = f.getAbsolutePath.split("/").toList.drop(slashes).mkString("/")
 
-    var nFailed = new java.util.concurrent.atomic.AtomicInteger(0)
-    all.foreach { f =>
-      if (!testFrontend(f, slashes)) {
-        nFailed.incrementAndGet()
-      }
-    }
+    test("Compiling "+name) {
+
+      val ctx = createLeonContext()
 
-    val nFailedInt = nFailed.get()
-    if (nFailedInt > 0) {
-      fail(s"$nFailedInt test(s) failed to compile")
+      try {
+        pipeline.run(ctx)(List(f.getAbsolutePath))
+      } catch {
+        case _: LeonFatalError =>
+          fail(" Failed to compile "+name)
+      }
     }
   }
 }
-- 
GitLab