Hi René, unittest framework was developed assuming that apps themselves would not have test suites. Only individual packages/libraries.
So the method you described is pretty much what you’d need to do. Or alternatively create a library out of the components you want to create unittests for. > On Jun 27, 2018, at 11:42 AM, Rene Beckmann <beckm...@itemis.de> wrote: > > Hello, > > I hope this is the right place to ask this, I'm very sorry if not. > I am currently experimenting with Apache MyNewt, have written a tiny app > (apps/simple) and created a test suite (apps/simple/test) for it. > The apps/simple/test/pkg.yml contains "apps/simple/" as pkg.deps. > The problem is that my app itself contains a main function, as well as the > test suite (guarded by #if MYNEWT_VAL(SELFTEST) ). When running "newt test > apps/simple", newt properly compiles the test, seems to find its main > function, however it happily overrides it with the one found in the main > app, so the test does not run. The test project found in the docs tests a > library, which does not contain a main function, so this is not covered. I > could help myself by using: > #if MYNEWT_VAL(SELFTEST) > #else > int main... > #endif > However, that's neither pretty nor do I believe that this is the correct > way to do it. Maybe someone can point me to something that makes newt > ignore the app's main by default? > > Regards, > René Beckmann > -- > > René Beckmann > > Student Assistant > > > http://www.itemis.de > > > itemis AG > Am Brambusch 15-24 > 44536 Lünen > > Rechtlicher Hinweis: > Amtsgericht Dortmund, HRB 20621 > Vorstand: Jens Wagener (Vors.), Wolfgang Neuhaus > Aufsichtsrat: Prof. Dr. Burkhard Igel (Vors.), Michael Neuhaus, > Jennifer Fiorentino