Make QUIC work with -async tests.

This originally didn't work because we installed an async BIO, while
QUIC uses the BIO to mock out a QUIC transport. Our QUIC IO callbacks
don't have a meaningful notion of sync vs async, so no-op this portion
of the -async flag.

The immediate motivation is I'd like to make addExtensionTests run over
all protocols, and having the async tests fail is inconvenient. However,
async tests in QUIC is still meaningful anyway to support various
callbacks, so I've removed the workaround in the state machine coverage
tests. (Though most of those async tests are redundant as they're
concerned with IO, not callbacks.) Along the way, the various handshake
record controls are irrelevant to QUIC, so this actually results in a
net decrease in redundant tests.

Change-Id: I67c1ee48cb2d85b47ae3328fecfac86a24aa2ed1
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44987
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
chromium-5359
David Benjamin 4 years ago committed by CQ bot account: commit-bot@chromium.org
parent 71ed9d7538
commit 7a55c80271
  1. 9
      ssl/test/bssl_shim.cc
  2. 32
      ssl/test/runner/runner.go

@ -721,7 +721,9 @@ static bool DoConnection(bssl::UniquePtr<SSL_SESSION> *out_session,
BIO_push(packeted.get(), bio.release());
bio = std::move(packeted);
}
if (config->async) {
if (config->async && !config->is_quic) {
// Note async tests only affect callbacks in QUIC. The IO path does not
// behave differently when synchronous or asynchronous our QUIC APIs.
bssl::UniquePtr<BIO> async_scoped =
config->is_dtls ? AsyncBioCreateDatagram() : AsyncBioCreate();
if (!async_scoped) {
@ -968,6 +970,11 @@ static bool DoExchange(bssl::UniquePtr<SSL_SESSION> *out_session,
fprintf(stderr, "-read-with-unfinished-write requires -async.\n");
return false;
}
if (config->is_quic) {
fprintf(stderr,
"-read-with-unfinished-write is incompatible with QUIC.\n");
return false;
}
// Let only one byte of the record through.
AsyncBioAllowWrite(GetTestState(ssl)->async_bio, 1);

@ -4574,32 +4574,29 @@ type stateMachineTestConfig struct {
func addAllStateMachineCoverageTests() {
for _, async := range []bool{false, true} {
for _, protocol := range []protocol{tls, dtls, quic} {
if protocol == quic && async == true {
// QUIC doesn't work with async mode.
continue
}
addStateMachineCoverageTests(stateMachineTestConfig{
protocol: protocol,
async: async,
})
// QUIC doesn't work with implicit handshakes.
// QUIC doesn't work with the implicit handshake API. Additionally,
// splitting or packing handshake records is meaningless in QUIC.
if protocol != quic {
addStateMachineCoverageTests(stateMachineTestConfig{
protocol: protocol,
async: async,
implicitHandshake: true,
})
addStateMachineCoverageTests(stateMachineTestConfig{
protocol: protocol,
async: async,
splitHandshake: true,
})
addStateMachineCoverageTests(stateMachineTestConfig{
protocol: protocol,
async: async,
packHandshake: true,
})
}
addStateMachineCoverageTests(stateMachineTestConfig{
protocol: protocol,
async: async,
splitHandshake: true,
})
addStateMachineCoverageTests(stateMachineTestConfig{
protocol: protocol,
async: async,
packHandshake: true,
})
}
}
}
@ -4768,7 +4765,10 @@ func addStateMachineCoverageTests(config stateMachineTestConfig) {
// Unfinished writes can only be tested when operations are async. EarlyData
// can't be tested as part of an ImplicitHandshake in this case since
// otherwise the early data will be sent as normal data.
if config.async && !config.implicitHandshake {
//
// Note application data is external in QUIC, so unfinished writes do not
// apply.
if config.async && !config.implicitHandshake && config.protocol != quic {
tests = append(tests, testCase{
testType: clientTest,
name: "TLS13-EarlyData-UnfinishedWrite-Client",

Loading…
Cancel
Save