diff --git a/src/test/scala/leon/regression/synthesis/SynthesisSuite.scala b/src/test/scala/leon/regression/synthesis/SynthesisSuite.scala index bd5ff225ef190cd82f1b51a8975c495925d7d17a..f95d7b964df84fb1d44b8a560ea4a01bdbd51b6e 100644 --- a/src/test/scala/leon/regression/synthesis/SynthesisSuite.scala +++ b/src/test/scala/leon/regression/synthesis/SynthesisSuite.scala @@ -82,9 +82,9 @@ class SynthesisSuite extends LeonRegressionSuite { } - def forProgram(title: String, opts: Seq[LeonOption[Any]] = Nil)(content: String)(strats: PartialFunction[String, SynStrat]) { + def forProgram(title: String, opts: Seq[String] = Nil)(content: String)(strats: PartialFunction[String, SynStrat]) { test(f"Synthesizing ${nextInt()}%3d: [$title]") { - val ctx = testContext.copy(options = opts ++ testContext.options) + val ctx = createLeonContext(opts: _*) val pipeline = leon.utils.TemporaryInputPhase andThen leon.frontends.scalac.ExtractionPhase andThen @@ -118,7 +118,7 @@ class SynthesisSuite extends LeonRegressionSuite { } } - forProgram("Ground Enum", Seq(LeonOption(SharedOptions.optSelectedSolvers)(Set("enum"))))( + forProgram("Ground Enum", Seq("--solvers=enum"))( """ import leon.annotation._ import leon.lang._ diff --git a/src/test/scala/leon/regression/termination/TerminationSuite.scala b/src/test/scala/leon/regression/termination/TerminationSuite.scala index 321160563a2b0348bb7a52bd740c36d1071ea1a0..c58a4b0aceab03a00257ed48429028412e9cf643 100644 --- a/src/test/scala/leon/regression/termination/TerminationSuite.scala +++ b/src/test/scala/leon/regression/termination/TerminationSuite.scala @@ -22,7 +22,7 @@ class TerminationSuite extends LeonRegressionSuite { new leon.utils.PreprocessingPhase andThen leon.termination.TerminationPhase - private def mkTest(file : File, leonOptions: Seq[LeonOption[Any]], forError: Boolean)(block: Output=>Unit) = { + private def mkTest(file : File, leonOptions: Seq[String], forError: Boolean)(block: Output=>Unit) = { val fullName = file.getPath val start = fullName.indexOf("regression") @@ -38,7 +38,7 @@ class TerminationSuite extends LeonRegressionSuite { "verification/purescala/valid/InductiveQuantification.scala" ) - val t = if (ignored.exists(displayName endsWith _)) { + val t = if (ignored.exists(displayName.endsWith)) { ignore _ } else { test _ @@ -48,10 +48,7 @@ class TerminationSuite extends LeonRegressionSuite { assert(file.exists && file.isFile && file.canRead, s"Benchmark $displayName is not a readable file") - val ctx = testContext.copy( - options = leonOptions, - files = List(file) - ) + val ctx = createLeonContext((leonOptions ++ List(file.getAbsolutePath)): _* ) val pipeline = mkPipeline diff --git a/src/test/scala/leon/test/LeonRegressionSuite.scala b/src/test/scala/leon/test/LeonRegressionSuite.scala index 07ca12b58a07d8215a9b1eb29ecf411a80745a7e..929c2be3b2120e73d12426bd296ffb1411e25399 100644 --- a/src/test/scala/leon/test/LeonRegressionSuite.scala +++ b/src/test/scala/leon/test/LeonRegressionSuite.scala @@ -6,14 +6,12 @@ import leon._ import leon.utils._ import org.scalatest._ -import org.scalatest.time.Span import org.scalatest.concurrent._ -import org.scalatest.time.SpanSugar._ import org.scalatest.exceptions.TestFailedException import java.io.File -trait LeonRegressionSuite extends FunSuite with Timeouts with BeforeAndAfterEach { +trait LeonRegressionSuite extends FunSuite with Timeouts { val regressionTestDirectory = "src/test/resources" @@ -23,47 +21,23 @@ trait LeonRegressionSuite extends FunSuite with Timeouts with BeforeAndAfterEach Main.processOptions(opts.toList).copy(reporter = reporter, interruptManager = new InterruptManager(reporter)) } - var testContext: LeonContext = null - - override def beforeEach() = { - testContext = createLeonContext() - super.beforeEach() - } - def testIdentifier(name: String): String = { def sanitize(s: String) = s.replaceAll("[^0-9a-zA-Z-]", "") sanitize(this.getClass.getName)+"/"+sanitize(name) } - override implicit val defaultInterruptor = new Interruptor { - def apply(t: Thread) { - testContext.interruptManager.interrupt() - } - } - - def testWithTimeout(name: String, timeout: Span)(body: => Unit) { + override def test(name: String, tags: Tag*)(body: => Unit) { super.test(name) { - failAfter(timeout) { - try { - body - } catch { - case fe: LeonFatalError => - testContext.reporter match { - case sr: TestSilentReporter => - sr.lastErrors ++= fe.msg - throw new TestFailedException(sr.lastErrors.mkString("\n"), fe, 5) - } - } + try { + body + } catch { + case fe: LeonFatalError => + throw new TestFailedException("", fe, 5) } } } - - override def test(name: String, tags: Tag*)(body: => Unit) { - testWithTimeout(name, 5.minutes)(body) - } - protected val all : String=>Boolean = (s : String) => true def scanFilesIn(f: File, filter: String=>Boolean = all, recursive: Boolean = false): Iterable[File] = {