RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

Incorporate tests/test_* application into tests/unittests if it makes sense

Open miri64 opened this issue 12 years ago • 16 comments

Identified candidates so far:

  • [x] tests/test_bloom
  • [ ] tests/test_bloom_bytes
  • [x] tests/test_netif
  • [ ] tests/test_posix_semaphore
  • [x] tests/test_sha256

miri64 avatar May 09 '14 18:05 miri64

@phiros, we postpone this until the next release, right?

OlegHahm avatar Dec 17 '14 08:12 OlegHahm

@OlegHahm : yes definitely. It is quite hard to transform the remaining tests into unit tests (at least with our current test setup). The main reasons for this are:

  • test_bloom_bytes: this test is designed to test the performance of the bloom module. It should therefore become a performance test instead of a unit test.
  • tests/net_if: I think this could be transformed into a unit test BUT we need some kind of mocking mechanism in order to do so (we could also do it without but I think that would consume to much development time)
  • tests/posix_semaphore: I think we could test some properties of the posix semaphores module with proper mocking support, however we shouldn't only rely on tests when it comes to code which is inherently concurrent.

phiros avatar Dec 17 '14 13:12 phiros

@authmillenon : So what are the part's that can be currently worked upon , Although the previous comment does explain the reason for shifting it to next release , however since it has been recently tagged as Newbie-Task-CandidateI think there might be some areas on which I could work upon , can you point out a few.

kushalsingh007 avatar Mar 18 '15 15:03 kushalsingh007

It would be great if I could get some sort of direction to start the work.

kushalsingh007 avatar Mar 20 '15 21:03 kushalsingh007

I think in the current version this applies only tests/libfixmath_unittests and tests/net_if. tests/libfixmath_unittests is notorious for having problems to download from the repository (which caused a lot of false positives on Travis e.g. yesterday and why it should remain seperated from the other unittests) and tests/net_if is on its way of being obsolete. But if you want to, you can go through the current sys modules and see if there are modules where no unittests are implemented at tests/unittests.

miri64 avatar Mar 20 '15 22:03 miri64

(and where it makes sense. modules that involve a lot of threading or timers usually can't be tested this way for now for example)

miri64 avatar Mar 20 '15 22:03 miri64

A quick evaluation later the following modules seem like suitable candidates:

  • hashes
  • hash_string
  • tm
  • utlist

miri64 avatar Mar 20 '15 22:03 miri64

Thanks for having a look , working on the these now ;)

kushalsingh007 avatar Mar 20 '15 23:03 kushalsingh007

I think along with the tests there needs to be some change in the code itself , for instance current hash string function has no check to ensure that the value of variable hash does not exceed size of unsigned long, so I am changing it by breaking the loop if size is greater than unsigned long size limit . So I am changing the code too.

kushalsingh007 avatar Mar 21 '15 17:03 kushalsingh007

That is good, if errors like this surface :-), but please do the fixes in a seperate PR than the tests (or do the fixes + the tests for the module in module-wise).

miri64 avatar Mar 21 '15 18:03 miri64

@authmillenon I think the list is not up to date, right?

PeterKietzmann avatar Jul 06 '15 15:07 PeterKietzmann

Not really, no. But don't hesitate to update it ;-)

miri64 avatar Jul 06 '15 16:07 miri64

As far as I see it there are some unittests fot the new netif. There are still no unittests for the semaphores. I don't get why you listed bloom and bloom_bytes separately.

PeterKietzmann avatar Jul 07 '15 05:07 PeterKietzmann

Because those were seperate test applications in the tests/ directory at the time I opened the issue.

miri64 avatar Jul 07 '15 11:07 miri64

Somehow this was reaaaally forgotten... moving for the next release.

kYc0o avatar Jul 26 '16 12:07 kYc0o

To be honest, reevaluating this issue I would say it is fixed. Except bloom_bytes and posix_semaphore they are all ported to unittests, but the two tests use threads and timers respectively, so they are less suitable for unittests anyway.

miri64 avatar Oct 31 '16 12:10 miri64