randombytes icon indicating copy to clipboard operation
randombytes copied to clipboard

Tracking issue: test suite

Open jaromil opened this issue 7 years ago • 6 comments

Still to do:

  • [x] Create functional tests (call randombytes twice, check if output differs)
  • [x] Write a mocking test suite (using ~cmocka~ a home-brewed mocking framework)

Platforms:

  • [ ] windows: use Appveyor (only builds)
  • [ ] linux<3.17 (/dev/urandom): use Travis
  • [ ] linux>=3.17 (getrandom): use Travis?
  • [ ] osx: use Travis
  • [ ] bsd: ??
  • [ ] node: Use Travis (https://github.com/dsprenkels/randombytes/commit/d4a32f8e2b82630459d8bf5c0f30d5d49fdca185)

Original report:

Hi there again :^) thanks for sharing this pretty clean and handy implementation. Have you thought of adding a test suite that helps measuring the entropy on each system it is ran? This library may be of help https://github.com/dyne/libdisorder

jaromil avatar Jan 09 '18 11:01 jaromil

Sorry, but unfortunately I do not think measuring entropy will be particularly useful. Shannon entropy does not guarantee the cryptographic properties of a random generator. I think an entropy test would give (if anything) only a false sense of security).

I agree that this library should include test cases though.

dsprenkels avatar Jan 09 '18 12:01 dsprenkels

As an update to this, I suggest we (I?) could use CMocka for testing C objects. The hard part will be to get a cluster of build targets though. Perhaps use Buildbot?

dsprenkels avatar Mar 25 '18 21:03 dsprenkels

I can help to setup a travis build to covers linux, osx and nodejs targets. No idea how to automate windows or bsd.

jaromil avatar Mar 26 '18 11:03 jaromil

For Windows I would like to keep using Appveyor. For Linux we will want to build on linux<3.17 and linux>=3.17 (not sure how to do this on Travis). We already have osx (which is working fine).

A Node.js target on Travis would be helpful.

dsprenkels avatar Mar 26 '18 11:03 dsprenkels

Update: Travis CI seems to have been discontinued. We have to find an alternative.

dsprenkels avatar Sep 06 '21 20:09 dsprenkels

Hi Dan! I am using github actions with succes and our own in-house jenkins for exotic targets that aren't covered.

Also about tests, using randombytes in zenroom I setup another kind of test measuring the average hamming distance between a large number of iterations, perhaps interesting.

I wish to contribute something in these directions, will try.

jaromil avatar Sep 13 '21 06:09 jaromil