Add windows test runner.

This commit is contained in:
peteraaser 2020-06-01 17:42:31 +02:00
parent d08bad4c25
commit 743734c346
2 changed files with 32 additions and 2 deletions

View file

@ -18,7 +18,7 @@ import LogParser._
object Manifest {
val singleTest = "forward2.s"
val singleTest = "addi.s"
val nopPadded = false
@ -98,3 +98,30 @@ class AllTests extends FlatSpec with Matchers {
}
}
}
/**
* Not tested at all
*/
class AllTestsWindows extends FlatSpec with Matchers {
it should "just werk" in {
val werks = getAllWindowsTestNames.filterNot(_ == "convolution.s").map{testname =>
say(s"testing $testname")
val opts = Manifest.allTestOptions(testname)
(testname, TestRunner.run(opts))
}
if(werks.foldLeft(true)(_ && _._2))
say(Console.GREEN + "All tests successful!" + Console.RESET)
else {
val success = werks.map(x => if(x._2) 1 else 0).sum
val total = werks.size
say(s"$success/$total tests successful")
werks.foreach{ case(name, success) =>
val msg = if(success) Console.GREEN + s"$name successful" + Console.RESET
else Console.RED + s"$name failed" + Console.RESET
say(msg)
}
}
}
}

View file

@ -61,7 +61,10 @@ object fileUtils {
def getAllTests: List[File] = getListOfFilesRecursive(getTestDir.getPath)
.filter( f => f.getPath.endsWith(".s") )
def getAllTestNames: List[String] = getAllTests.map(_.toString.split("/").takeRight(1).mkString)
def getAllTestNames: List[String] = getAllTests.map(_.toString.split("/").takeRight(1).mkString)
// Not tested.
def getAllWindowsTestNames: List[String] = getAllTests.map(_.toString.split("\\\\").takeRight(1).mkString)
def clearTestResults = {
try {