Implement basic unit tests to prevent regressions for crypto stuff#2171
Implement basic unit tests to prevent regressions for crypto stuff#2171nextgens wants to merge 1 commit intomeshcore-dev:devfrom
Conversation
|
Not sure I understand why the AES impl needs to be injected into the Utils::encrypt() / ::decrypt() ? I've always been skeptical of testing strategies that have to modify frameworks, and that they don't necessarily verify real environment, and are basically a LOT of work with little ROI |
That enables us to use the same test code path for both native & on device tests. We could test at a lower level but what we really care about not breaking against known test vectors is that.
The only difference in between this vendored in library and upstream is the I have not found a way to tell PIO to build/link it anyway without vendoring it in. If you know the magic invocation to override 'framework' of libraries I am all hears :) It would indeed be much cleaner.
My understanding is that they are not: native_crypto is only added to the "native" target in pio: native links against the vendored-in stuff, platform keep using upstream's version
I share your concerns, I do think that the long term solution is to have a single, minimal, vendored in copy of the library in lib/something that implements just the bits we need. I didn't want to do it in this PR because the whole idea is to introduce tests before any potential regression. This is pretty much step2 and what #1632 (not authored by me) proposes. |
|
Lliam pointed out that |
You can run them either natively or on device; they don't run by default.
Some of the tests are fairly slow (benchmarks), we may want to avoid them/optimise in the future.
I had to fight with the linker and vendor-in part of the crypto library to make it run natively.
Hopefully this will enable the merge of things like #1632 and inform any argument about performance.