Add the ability to create tests which can import microzig. #781
+106
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #230
This is really great, but I need some more eyes on whether this is how we want to do things. It seems that we have the limitation that our tests can no longer live within the same file as our executable. Using the modules directly from the Firmware object have linking errors because we are overloading the linker script (no _start symbol). And if I try to make a new module targetting the host using the same path, we get an error that multiple modules aren't allowed to have the same path.
There might be a way around this that I'm not sure of. Otherwise, perhaps having to separate tests into their own files is an acceptable workaround? I imagine even if we magically fixed this, there would be many cases of linker errors, because of code depending on the embedded linkerscripts.
Another pattern we might prefer is requiring any tests in the embedded executable to be run on the hardware itself. that would mean this patch should be providing a new test runner, and if a user wanted to write unit tests that ran on their PC, then they would have to put them elsewhere, which sounds reasonable to me.