-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests.sc to split tests from common.sc
- Loading branch information
Showing
3 changed files
with
143 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import mill._ | ||
import mill.api.Result | ||
import mill.scalalib._ | ||
import mill.scalalib.api.CompilationResult | ||
import mill.util.Jvm | ||
|
||
import java.util | ||
import scala.jdk.StreamConverters.StreamHasToScala | ||
|
||
trait SvsimUnitTestModule | ||
extends TestModule | ||
with ScalaModule | ||
with TestModule.ScalaTest { | ||
def svsimModule: common.SvsimModule | ||
|
||
def scalatestIvy: Dep | ||
|
||
def scalacheckIvy: Dep | ||
|
||
override def moduleDeps = Seq(svsimModule) | ||
|
||
override def defaultCommandName() = "test" | ||
|
||
override def ivyDeps = super.ivyDeps() ++ Agg( | ||
scalatestIvy, | ||
scalacheckIvy | ||
) | ||
} | ||
|
||
trait FirrtlUnitTestModule | ||
extends TestModule | ||
with ScalaModule | ||
with TestModule.ScalaTest { | ||
def firrtlModule: common.FirrtlModule | ||
|
||
def scalatestIvy: Dep | ||
|
||
def scalacheckIvy: Dep | ||
|
||
override def moduleDeps = Seq(firrtlModule) | ||
|
||
override def defaultCommandName() = "test" | ||
|
||
override def ivyDeps = super.ivyDeps() ++ Agg( | ||
scalatestIvy, | ||
scalacheckIvy | ||
) | ||
} | ||
|
||
trait ChiselUnitTestModule | ||
extends TestModule | ||
with ScalaModule | ||
with common.HasChisel | ||
with common.HasMacroAnnotations | ||
with TestModule.ScalaTest { | ||
def scalatestIvy: Dep | ||
|
||
def scalacheckIvy: Dep | ||
|
||
override def defaultCommandName() = "test" | ||
|
||
override def ivyDeps = super.ivyDeps() ++ Agg( | ||
scalatestIvy, | ||
scalacheckIvy | ||
) | ||
} | ||
|
||
trait CIRCTPanamaBinderModuleTestModule | ||
extends TestModule | ||
with ScalaModule | ||
with common.HasCIRCTPanamaBinderModule | ||
with common.HasMacroAnnotations | ||
with TestModule.ScalaTest { | ||
def scalatestIvy: Dep | ||
|
||
def scalacheckIvy: Dep | ||
|
||
override def defaultCommandName() = "test" | ||
|
||
override def ivyDeps = super.ivyDeps() ++ Agg( | ||
scalatestIvy, | ||
scalacheckIvy | ||
) | ||
} | ||
|
||
trait LitUtilityModule | ||
extends ScalaModule | ||
with common.HasCIRCTPanamaBinderModule | ||
with common.HasMacroAnnotations | ||
|
||
trait LitModule | ||
extends Module { | ||
def scalaVersion: T[String] | ||
def runClasspath: T[Seq[os.Path]] | ||
def pluginJars: T[Seq[os.Path]] | ||
def javaLibraryPath: T[Seq[os.Path]] | ||
def javaHome: T[os.Path] | ||
def chiselLitDir: T[os.Path] | ||
def litConfigIn: T[PathRef] | ||
def litConfig: T[PathRef] = T { | ||
os.write( | ||
T.dest / "lit.site.cfg.py", | ||
os.read(litConfigIn().path) | ||
.replaceAll("@SCALA_VERSION@", scalaVersion()) | ||
.replaceAll("@RUN_CLASSPATH@", runClasspath().mkString(",")) | ||
.replaceAll("@SCALA_PLUGIN_JARS@", pluginJars().mkString(",")) | ||
.replaceAll("@JAVA_HOME@", javaHome().toString) | ||
.replaceAll("@JAVA_LIBRARY_PATH@", javaLibraryPath().mkString(",")) | ||
.replaceAll("@CHISEL_LIT_DIR@", chiselLitDir().toString) | ||
) | ||
PathRef(T.dest) | ||
} | ||
def run(args: String*) = T.command(os.proc("lit", litConfig().path).call(T.dest, stdout = os.ProcessOutput.Readlines(line => T.ctx().log.info("[lit] " + line)))) | ||
} |