Skip to content

Conversation

@csegarragonz
Copy link
Collaborator

This had been a long standing to-do that I address here. Remove the globbing for files and add them manually instead.

@Shillaker
Copy link
Collaborator

Can you remind me again what the problem with globbing is? This looks verbose and easy to miss tests by accident.

@csegarragonz
Copy link
Collaborator Author

csegarragonz commented Nov 7, 2022

Can you remind me again what the problem with globbing is? This looks verbose and easy to miss tests by accident.

@Shillaker see the Note in the CMake docs. In my experience, the Note translates to having to remember to re-run CMake for the globbed file list to be re-generated, otherwise CMake has no way of knowing what files have changed. This is counter-intuitive, as it defeats a bit the purpose of globbing. On the other hand, adding the test names is more verbose, but once you get used to it you don't forget to add new files, and don't need to explicitly run CMake again.

@Shillaker
Copy link
Collaborator

Hmm, I'm still worried that somebody will accidentally delete a test file or forget to add one. Is it possible to have a catch-all glob at the end as well or is that really gross?

@csegarragonz
Copy link
Collaborator Author

Why is this a problem? AFAICT we list sources by name everywhere else in the the repo, why should tests be any different?

@Shillaker
Copy link
Collaborator

Shillaker commented Nov 9, 2022

If we leave sources out in the rest of the codebase, something will fail to compile (unless the code in that file isn't used anywhere, in which case it should be deleted). Tests are different because they're at the end of the include chain, i.e. they are not included by any other files implicitly or explicitly, so it's impossible to tell whether all of them are being run.

Even looking at this review, I have to go through the file tree to make sure that all of them are listed in the CMake file, as there's no way to check whether we've missed one (AFAICT). To me, this problem of accidentally missing tests (and thus thinking code is tested when it's actually not) outweighs the inconvenience of having to run cmake when you add a new one, however, if you feel strongly about it, I'm happy to merge as it's not a big deal and you're actively working on it atm.

@csegarragonz csegarragonz merged commit 77277d2 into main Nov 22, 2022
@csegarragonz csegarragonz deleted the tests-noglob branch November 22, 2022 18:14
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.

3 participants