Add tests in the structure
numero-744 opened this issue · 7 comments
FYI https://github.com/numero-744/Aes has been updated; part of its contents could be put in the template:
- add
tb/
folder forTest
(not released contents) with sub-directories like forhw/
- add HTML report generation with
scalatest
- works with both App and SpinalTestBench (in its current state, changes will occur)
- tested with
mill
See the end of the readme with an IDE screenshot and the resulting directory structure with important things highlighted in blue on the left.
That is exactly what I want to say.
Btw, Scala use "main" and "test" directory name to distinct the source code and test code.
FYI https://github.com/numero-744/Aes has been updated; part of its contents could be put in the template:
- add
tb/
folder forTest
(not released contents) with sub-directories like forhw/
- add HTML report generation with
scalatest
- works with both App and SpinalTestBench (in its current state, changes will occur)
- tested with
mill
See the end of the readme with an IDE screenshot and the resulting directory structure with important things highlighted in blue on the left.
I tried to get test dir working.
However, the "hw/spinal" directory is really different from the other project in Scala, which makes it hard to work with sbt.
Although I have make the mill works, not perfect still.
@Readon I just tested sbt with :
Test / scalaSource := baseDirectory.value / "miaou" / "spinal",
It worked well for me.
What issue did you had ?
@Readon I just tested sbt with :
Test / scalaSource := baseDirectory.value / "miaou" / "spinal",
It worked well for me.
What issue did you had ?
I add test directory in this PR, which need to seperately depends on spinal.tester. Then use Test / scalaSource to specify the test sources would need to point to the test directory manually, or it will compile those source file several times.
On other hand, if the multiple-times-compilation is acceptable, a common dependency of scalatest is involved, to the compilation process.
I think as a template, efficiency and cleanliness are of utmost importance, especially for users just starting out.
Hmm bad news, the App
in tests requires to be run with Test/runMain
instead of just runMain
in sbt
- do I document that in the Getting started section of RTD? (SpinalHDL/SpinalDoc-RTD#162 is not enough)
- or do we just let things currently in main where they are, and add example files in test with only test suites
- or other ideas?
In the latter case no modification to the Getting started section of RTD would be needed, and I suggest to add this new structure in the next release, after:
- having released SpinalHDL/SpinalHDL#968 so that we can add an example using it, and
- having stabilized the
tester
repository structure so that we are sure things do not get moved later on (I'm moving things for SpinalHDL/SpinalHDL#982 so I'll PR and we'll be able to discuss a structure and move things again after that I think)
PS: I think having simulation tests in the tb
folder is consistent and other hardware engineers will like it so I vote for moving things and documenting it in RTD.
I think as a template, efficiency and cleanliness are of utmost importance, especially for users just starting out.
So, one thing i noticed, is that very often, people have already premade project structure. And trying to impose the SBT structure on them is a paine.
With that change, which explicitly specify where are the scala sources in the build.sbt, it show people a easy way to adapt / customise the template to their workflow.
do I document that in the Getting started section of RTD?
Yes i would say.
PS: I think having simulation tests in the tb folder is consistent and other hardware engineers will like it so I vote for moving things and documenting it in RTD.
Yes
@Dolu1990 I changed my mind during discussion with Readon #30 (comment) I suggest to continue discussion there