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

Move tests #1001

Draft
wants to merge 119 commits into
base: dev
Choose a base branch
from
Draft

Move tests #1001

wants to merge 119 commits into from

Conversation

numero-744
Copy link
Collaborator

@numero-744 numero-744 commented Dec 18, 2022

TL;DR: gl hf

This PR moves tests to their standard location according to SBT. To do so:

  • "test" dependencies between the different subprojects were added (see build.sbt)
  • The things that I had to put common (or I thought I had to) were moved to tester, and its organization in packages should be discussed (eg: sim vs formal)
  • I could not associate some tests with a specific item / file so for them, they are in integration folder of the appropriate sub-project.

TODO list:

  • Find and apply a better name than fixes
  • Check licenses
  • Squash "only rename" commits
  • Organize tester/main (suggestions appreciated)

Closes #982

@numero-744 numero-744 marked this pull request as draft December 18, 2022 21:16
@Readon
Copy link
Collaborator

Readon commented Dec 19, 2022

So the dependency graph becomes complex though.

@numero-744
Copy link
Collaborator Author

I would say we just add one single rule: in tests, everything can access to everything 😅

Didn't change release (main) dependency graph.

@@ -311,7 +311,7 @@ class VecBitwisePimper[T <: Data with BitwiseOp[T]](pimped : Vec[T]) extends Bit

private def map2with(f: (T, T) => T)(other: Vec[T]): Vec[T] = {
if (pimped.length != other.length)
SpinalError(s"Cannot apply a bitwize opration on vectors with different size (${pimped.length} vs ${other.length})")
SpinalError(s"Cannot apply a bitwize operation on vectors with different sizes (${pimped.length} vs ${other.length})")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please commit this individually?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added in this PR a fixup! commit cancelling this change. I'll squash this fixup with the appropriate commit when rebasing before merging this PR (I don't rebase/force push for now else you will hate me ^^').

I've added the reversion of this new commit in a new local branch I'll publish later, when things don't move anymore ^^'

@@ -1,10 +1,10 @@
package spinal.tester.scalatest
package fixes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package name is a little bit weird.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially put issues but then found a PR test which had no issue attached to it, so this is why I have chosen this name: to fix bugs.

Maybe something like bugs, ghbugs, bughistory?

def checkOutputHash(gen: => Component): Unit = {
checkOutputHashCounter = checkOutputHashCounter + 1
var ref = ""
for (i <- 0 until 8) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason that constant 8 and 50MHz should be fixed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have split into a lot of small commits to make it possible to find things back in history (please don't squash).

This part comes from c90ddf5#diff-0733323f702a7bd2f7f1b39fa25465375e98deb1811887c62089e95caecc2b23R466-R467

@kleinai
Copy link
Collaborator

kleinai commented Jan 4, 2023

I have a few concerns. You should keep the refactoring to as little changes as necessary. I understand package names and some imports will change. I also feel we should squash these commits down to avoid creating a large commit log of "refractor moved X" that's annoying to look at. Listing all the files out in fewer commits is fine.

Also if we're moving files from core, lib, and test we need to make sure the licenses are compatible. We probably haven't thought about this in the past but there's a considerable amount of code moving around now.

@numero-744
Copy link
Collaborator Author

I planned to have a semi-linear history for this, to ease reading the graph, but yes we can consider reducing the number of commits.

My concern is that sometimes there were several files testing the same thing; so I have put them together into a single file to match the SBT convention. In this case, mixing all the commits together might be annoying because it makes it harder to find from which file comes this added code chunk. If the blame shows that it comes from a commit with only:

  • the file modified with adds
  • and one deleted file

then, the code comes from this deleted file. See #1001 (comment)

To sum up:

  • history readability (that you mentioned)
  • code traceability (that I mention)

What do you think about squashing commits which "only rename" files (even if there are some modifications)? So that we reduce the number of commits (maybe a lot?) while keeping good code traceability for when files are merged together.

Note: for now I'm working fast-forward only, I'll rebase and squash things when we agree on the code we get.


I think I have only moved files from tester/scalatest and I don't know what are the rules for this project, should check this. As we'll publish tester (the structure has to be defined, for now I just have put everything in the same folder) we should clearly define that it is the same license as lib IMO.

@Readon
Copy link
Collaborator

Readon commented Jan 5, 2023

I have a few concerns. You should keep the refactoring to as little changes as necessary. I understand package names and some imports will change. I also feel we should squash these commits down to avoid creating a large commit log of "refractor moved X" that's annoying to look at. Listing all the files out in fewer commits is fine.

Also if we're moving files from core, lib, and test we need to make sure the licenses are compatible. We probably haven't thought about this in the past but there's a considerable amount of code moving around now.

I am also think that one PR simply move the tester into right directory is enough.
More patchs can be commit by other PR, it's really too big to review now.

@Readon
Copy link
Collaborator

Readon commented Jan 17, 2023

When would this be finished?^^
The existing test is really take too much time to finish.

@numero-744
Copy link
Collaborator Author

numero-744 commented Jan 17, 2023

@Readon thanks for the ping, it is nice to know that what I've been working on will be useful 😃


I think I won't be able to spend significant time on this PR until early Feb but:

I will need feedback for the following points (among the points of the TODO list in the PR description) so this PR can progress through discussion before I'm back on it:

When I'll be back on this PR I'll be able to:

  • Squash "only rename" commits to reduce commits number as suggested in Move tests #1001 (comment)
  • Apply suggestions according to the feedback (especially change fixes package name if needed and organize tester/main)
  • Rebase to fix merge conflicts + move more stuff if needed + re-squash if needed
  • Force-push that for review
  • Remove draft status

@Readon
Copy link
Collaborator

Readon commented Jan 18, 2023

@Readon thanks for the ping, it is nice to know that what I've been working on will be useful 😃

I think I won't be able to spend significant time on this PR until early Feb but:

I will need feedback for the following points (among the points of the TODO list in the PR description) so this PR can progress through discussion before I'm back on it:

When I'll be back on this PR I'll be able to:

  • Squash "only rename" commits to reduce commits number as suggested in Move tests #1001 (comment)
  • Apply suggestions according to the feedback (especially change fixes package name if needed and organize tester/main)
  • Rebase to fix merge conflicts + move more stuff if needed + re-squash if needed
  • Force-push that for review
  • Remove draft status

Maybe the first step is just move those test into their corresponding directory to speed up the CI.
^^

@Dolu1990
Copy link
Member

thanks for the ping, it is nice to know that what I've been working on will be useful

Sure :D

The main thing to be carefull about, is to not let such massive PR too long in flight, as the more the time pass, the more conflict may popup.

fixes

could be regression ? or something else, as you feel it ^^

@andreasWallner
Copy link
Collaborator

Maybe another ping ;-)
To throw in another possible name: spinal.issues (since we are currently referring to issues in those?)
Long term those might make more sense as TestIssueXxx tests with theirs respective modules I think, that would be the most likely place to look for them?

@Dolu1990
Copy link
Member

Dolu1990 commented Feb 6, 2023

@andreasWallner
Yes why not ^^

@Readon
Copy link
Collaborator

Readon commented Nov 2, 2023

I think this have been done, so can we close this? @numero-744

@Dolu1990
Copy link
Member

Dolu1990 commented Nov 2, 2023

It isn't fully completted, but better to do it from upstream i think

@Readon
Copy link
Collaborator

Readon commented Nov 3, 2023

It isn't fully completted, but better to do it from upstream i think

What is still missing currently?

@Dolu1990
Copy link
Member

Dolu1990 commented Nov 6, 2023

What is still missing currently?

https://github.com/SpinalHDL/SpinalHDL/tree/dev/tester/src/test/scala/spinal/tester/scalatest is still full of things :)

@Readon
Copy link
Collaborator

Readon commented Nov 6, 2023

What is still missing currently?

https://github.com/SpinalHDL/SpinalHDL/tree/dev/tester/src/test/scala/spinal/tester/scalatest is still full of things :)

ahh, that is only remained for the balance for running time of ci test.

@andreasWallner
Copy link
Collaborator

I think that we should not choose a folder structure solely to split test execution.
If we need to split there are a bunch of ways (tags, running tests for specific packages, etc.)

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

Successfully merging this pull request may close these issues.

About tests organization
5 participants