envoyproxy / envoy-openssl

Envoy OpenSSL extensions
Apache License 2.0
44 stars 39 forks source link

utest failures when run directly but not via ctest #77

Closed tedjpoole closed 1 year ago

tedjpoole commented 1 year ago

If the utests binary is executed directly, there are a couple of tests which fail:

[ FAILED ] All/BIOPairTest.TestPair/0, where GetParam() = false [ FAILED ] All/BIOPairTest.TestPair/1, where GetParam() = true

whereas if they are run via ctest, they all pass.

tedjpoole commented 1 year ago

Turns out that ctest runs each individual test in a separate child process so there can be no side effects between tests.

However, when running the utests executable directly, it runs all the tests in the same process. This allows the state of the OpenSSL error queue, from one test, to be observed in subsequent tests, and cause these failures.

One solution would be to add a ERR_clear_error() call at the beginning of the affected test, or in the fixture. However, in the interests of keeping the BoringSSL utests untouched, that's not an attractive option.

Instead, we should continue to run the unit tests as separate processes, via CTest.