Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests in the structure #28

Open
numero-744 opened this issue Nov 30, 2022 · 7 comments · May be fixed by #30
Open

Add tests in the structure #28

numero-744 opened this issue Nov 30, 2022 · 7 comments · May be fixed by #30
Assignees

Comments

@numero-744
Copy link
Collaborator

FYI https://github.com/numero-744/Aes has been updated; part of its contents could be put in the template:

  • add tb/ folder for Test (not released contents) with sub-directories like for hw/
  • 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.

@Readon
Copy link

Readon commented Dec 6, 2022

That is exactly what I want to say.
Btw, Scala use "main" and "test" directory name to distinct the source code and test code.

@Readon
Copy link

Readon commented Dec 7, 2022

FYI https://github.com/numero-744/Aes has been updated; part of its contents could be put in the template:

  • add tb/ folder for Test (not released contents) with sub-directories like for hw/
  • 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.

@Dolu1990
Copy link
Member

Dolu1990 commented Dec 7, 2022

@Readon I just tested sbt with :

Test / scalaSource := baseDirectory.value / "miaou" / "spinal",

It worked well for me.

What issue did you had ?

@Readon
Copy link

Readon commented Dec 7, 2022

@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.

@numero-744 numero-744 self-assigned this Dec 7, 2022
@numero-744
Copy link
Collaborator Author

numero-744 commented Dec 7, 2022

Hmm bad news, the App in tests requires to be run with Test/runMain instead of just runMain in sbt

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:

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.

@numero-744 numero-744 linked a pull request Dec 7, 2022 that will close this issue
@Dolu1990
Copy link
Member

Dolu1990 commented Dec 8, 2022

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

@numero-744
Copy link
Collaborator Author

@Dolu1990 I changed my mind during discussion with Readon #30 (comment) I suggest to continue discussion there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants