Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API tests #187

Open
gmaxwell opened this issue Jan 11, 2015 · 4 comments
Open

API tests #187

gmaxwell opened this issue Jan 11, 2015 · 4 comments

Comments

@gmaxwell
Copy link
Contributor

We're under-covered currently for tests that simulate crazy callers. The practise of asserting on statically wrong use limits the space of things that can / need to be tested here, but there is still some freedom.

This should be less "test" and more "mechanical verification that the interface we present to callers isn't unintentionally changed".

(As an example, libopus' test_opus_api, calls into the library about 116 million times. I'd say that libopus has an API surface area of about 50x larger that libsecp256k1)

@gmaxwell gmaxwell self-assigned this Jan 11, 2015
@gmaxwell gmaxwell added this to the initial release milestone Aug 31, 2015
@gmaxwell
Copy link
Contributor Author

API tests should explicitly perform tests with variously unaligned input/output buffers.

(not likely to currently be a source of bugs except through compiler screwup, but if anyone starts going around adding SIMD code it would rapidly become a potential source of extremely hard to spot bugs).

@real-or-random
Copy link
Contributor

From all the existing work, what comes probably closest is #744 .

This should be less "test" and more "mechanical verification that the interface we present to callers isn't unintentionally changed".

@gmaxwell Does fuzzing match this idea, or did you have something else in mind?

@gmaxwell
Copy link
Contributor Author

gmaxwell commented Dec 5, 2020

I would describe that test as the opposite of an api test: All it tests is the payloads, the usage of the API is hardcoded into the harness.

An API test does stuff like calls with a null context or a number of pubkeys = 0, it acts like callers that fail to check errors or which call functions out of order... the goal is to validate the contract implied by the header documentation and maybe a little beyond it.

@gmaxwell gmaxwell removed their assignment Dec 5, 2020
@rickmark
Copy link

It seems to me one of the first steps here is to separate the library code from the test code better. (Compile the library, then compile tests that link to that library from code in a separate directory)

Broadly I see:

  • Conformance tests - Like OpenSSL to ensure that the cyrpto is correct, these are very good today
  • Performance tests - ensure that the operations are performant (handed by bench*.c and friends), these exist
  • Client tests - Build and sanity check that a consumer can accomplish it's task, needs work
  • (NEW) API tests - Do all the things that a client shouldn't do and make sure its gracefully handled. Because of the nature of this it seems like the wise idea might be to use a language like python/ruby and FFI the API surface because it's easier to create a large matrix of tests this way. It also tests that FFI works correctly (as much as I hate FFI 😆)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants