Closed ducky64 closed 1 year ago
@seldridge @chick @ucbjrl @azidar @jackkoenig since you were all part of that discussion
I think this is a good summary. I am open to any approach that brings this capability to the stack. I'd like to add that there be a diagnostic interface, .i.e. a way to get the relevant Stage to report what options are in play and where they are coming from.
I see test configuration management as out of scope for chiseltest
. Users should be able to create their own solutions on top of the testing APIs that we provide.
This arose out of support for
-DwriteVcd=1
in ScalaTest being broken, and whether that breakage was intentional or not. At the chisel-dev meeting, this turned into a longer discussion about configurations, in particular addressing #65.There seems to be agreement about using annotations as the internal mechanism for representing configurations, including (as currently supported) dumping VCDs and simulator backend.
The overall design requirements are:
That being said, there was a debate on what the interface should look like.
Proposal 1: universal configurations in a separate file
Under this proposal, there would be a configuration file, probably in the resources folder, formatted as annotations command line syntax, that would be read in to provide default annotations for all tests.
Pros:
.withAnnotations(...)
.Cons:
I personally think the cons outweigh the pros here, especially since the configuration is somewhat implicit.
Proposal 2: two mechanisms for two purposes
This proposal provides both a temporary mechanism (akin to the debug printf - something that isn't pushed to version control) for changing global configurations, and a permanent mechanism (something that does get pushed to version control) for sharing annotations across multiple test classes while remaining in Scala.
Temporary (per-run) annotations through test infrastructure arguments
Basically, bring back (and possibly expand) the
-DwriteVcd=1
option that can be passed to ScalaTest in sbt.Pros:
Cons:
.withAnnotations(...)
.Permanent annotations in the class hierarchy
Currently, tests are largely written with
This proposal would allow subclassing
ChiselScalatestTester
with annotations, for example:Potential solution for #65.
Pros:
MyTestConfig
in the unittest class hierarchy provides a dead giveaway of some non-default configuration being applied, and IDEs can furthermore navigate to that link.withAnnotations(...)
, managed by existing infrastructure like sbt.Cons:
Misc
Still up for debate how to run multiple backends. Should this be a responsibility of the build system (and above the ChiselTest level)? Or should there be an annotation that runs a single test multiple times under different backends? Should all tests be written such that they can run multiple times in the same JVM invocation? How would this coexist with proposals to avoid multiple elaboration?