Skip to content

Commit

Permalink
SSL tests: compress generated output a little
Browse files Browse the repository at this point in the history
Don't emit duplicate server/client sections when they are
identical. Instead, just point to the same section.

Reviewed-by: Rich Salz <[email protected]>
  • Loading branch information
ekasper committed Jul 22, 2016
1 parent d972af2 commit d0c4415
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 462 deletions.
31 changes: 17 additions & 14 deletions test/generate_ssl_tests.pl
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,35 @@ sub print_templates {
$test->{"server"} = { (%ssltests::base_server, %{$test->{"server"}}) };
if (defined $test->{"server2"}) {
$test->{"server2"} = { (%ssltests::base_server, %{$test->{"server2"}}) };
} elsif (defined $test->{"test"}->{"ServerNameCallback"}) {
# Default is the same as server.
$test->{"server2"} = { (%ssltests::base_server, %{$test->{"server"}}) };
} else {
# Do not emit an empty "server2" section.
if (defined $test->{"test"}->{"ServerNameCallback"}) {
# Default is the same as server.
$test->{"reuse_server2"} = 1;
}
# Do not emit an empty/duplicate "server2" section.
$test->{"server2"} = { };
}
if (defined $test->{"resume_server"}) {
$test->{"resume_server"} = { (%ssltests::base_server, %{$test->{"resume_server"}}) };
} elsif (defined $test->{"test"}->{"HandshakeMode"} &&
$test->{"test"}->{"HandshakeMode"} eq "Resume") {
# Default is the same as server.
$test->{"resume_server"} = { (%ssltests::base_server, %{$test->{"server"}}) };
} else {
# Do not emit an empty "resume-server" section.
if (defined $test->{"test"}->{"HandshakeMode"} &&
$test->{"test"}->{"HandshakeMode"} eq "Resume") {
# Default is the same as server.
$test->{"reuse_resume_server"} = 1;
}
# Do not emit an empty/duplicate "resume-server" section.
$test->{"resume_server"} = { };
}
$test->{"client"} = { (%ssltests::base_client, %{$test->{"client"}}) };
if (defined $test->{"resume_client"}) {
$test->{"resume_client"} = { (%ssltests::base_client, %{$test->{"resume_client"}}) };
} elsif (defined $test->{"test"}->{"HandshakeMode"} &&
$test->{"test"}->{"HandshakeMode"} eq "Resume") {
# Default is the same as client.
$test->{"resume_client"} = { (%ssltests::base_client, %{$test->{"client"}}) };
} else {
# Do not emit an empty "resume-client" section.
if (defined $test->{"test"}->{"HandshakeMode"} &&
$test->{"test"}->{"HandshakeMode"} eq "Resume") {
# Default is the same as client.
$test->{"reuse_resume_client"} = 1;
}
# Do not emit an empty/duplicate "resume-client" section.
$test->{"resume_client"} = { };
}
}
Expand Down
35 changes: 5 additions & 30 deletions test/ssl-tests/05-sni.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@ ssl_conf = 0-SNI-switch-context-ssl

[0-SNI-switch-context-ssl]
server = 0-SNI-switch-context-server
server2 = 0-SNI-switch-context-server2
client = 0-SNI-switch-context-client
server2 = 0-SNI-switch-context-server

[0-SNI-switch-context-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
CipherString = DEFAULT
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem

[0-SNI-switch-context-server2]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
CipherString = DEFAULT
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem

[0-SNI-switch-context-client]
CipherString = DEFAULT
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
Expand All @@ -47,19 +42,14 @@ ssl_conf = 1-SNI-keep-context-ssl

[1-SNI-keep-context-ssl]
server = 1-SNI-keep-context-server
server2 = 1-SNI-keep-context-server2
client = 1-SNI-keep-context-client
server2 = 1-SNI-keep-context-server

[1-SNI-keep-context-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
CipherString = DEFAULT
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem

[1-SNI-keep-context-server2]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
CipherString = DEFAULT
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem

[1-SNI-keep-context-client]
CipherString = DEFAULT
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
Expand Down Expand Up @@ -103,19 +93,14 @@ ssl_conf = 3-SNI-no-client-support-ssl

[3-SNI-no-client-support-ssl]
server = 3-SNI-no-client-support-server
server2 = 3-SNI-no-client-support-server2
client = 3-SNI-no-client-support-client
server2 = 3-SNI-no-client-support-server

[3-SNI-no-client-support-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
CipherString = DEFAULT
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem

[3-SNI-no-client-support-server2]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
CipherString = DEFAULT
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem

[3-SNI-no-client-support-client]
CipherString = DEFAULT
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
Expand All @@ -134,19 +119,14 @@ ssl_conf = 4-SNI-bad-sni-ignore-mismatch-ssl

[4-SNI-bad-sni-ignore-mismatch-ssl]
server = 4-SNI-bad-sni-ignore-mismatch-server
server2 = 4-SNI-bad-sni-ignore-mismatch-server2
client = 4-SNI-bad-sni-ignore-mismatch-client
server2 = 4-SNI-bad-sni-ignore-mismatch-server

[4-SNI-bad-sni-ignore-mismatch-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
CipherString = DEFAULT
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem

[4-SNI-bad-sni-ignore-mismatch-server2]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
CipherString = DEFAULT
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem

[4-SNI-bad-sni-ignore-mismatch-client]
CipherString = DEFAULT
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
Expand All @@ -166,19 +146,14 @@ ssl_conf = 5-SNI-bad-sni-reject-mismatch-ssl

[5-SNI-bad-sni-reject-mismatch-ssl]
server = 5-SNI-bad-sni-reject-mismatch-server
server2 = 5-SNI-bad-sni-reject-mismatch-server2
client = 5-SNI-bad-sni-reject-mismatch-client
server2 = 5-SNI-bad-sni-reject-mismatch-server

[5-SNI-bad-sni-reject-mismatch-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
CipherString = DEFAULT
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem

[5-SNI-bad-sni-reject-mismatch-server2]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
CipherString = DEFAULT
PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem

[5-SNI-bad-sni-reject-mismatch-client]
CipherString = DEFAULT
VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem
Expand Down
34 changes: 17 additions & 17 deletions test/ssl-tests/06-sni-ticket.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ ssl_conf = 0-sni-session-ticket-ssl

[0-sni-session-ticket-ssl]
server = 0-sni-session-ticket-server
server2 = 0-sni-session-ticket-server2
client = 0-sni-session-ticket-client
server2 = 0-sni-session-ticket-server2

[0-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -60,8 +60,8 @@ ssl_conf = 1-sni-session-ticket-ssl

[1-sni-session-ticket-ssl]
server = 1-sni-session-ticket-server
server2 = 1-sni-session-ticket-server2
client = 1-sni-session-ticket-client
server2 = 1-sni-session-ticket-server2

[1-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -96,8 +96,8 @@ ssl_conf = 2-sni-session-ticket-ssl

[2-sni-session-ticket-ssl]
server = 2-sni-session-ticket-server
server2 = 2-sni-session-ticket-server2
client = 2-sni-session-ticket-client
server2 = 2-sni-session-ticket-server2

[2-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -132,8 +132,8 @@ ssl_conf = 3-sni-session-ticket-ssl

[3-sni-session-ticket-ssl]
server = 3-sni-session-ticket-server
server2 = 3-sni-session-ticket-server2
client = 3-sni-session-ticket-client
server2 = 3-sni-session-ticket-server2

[3-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -168,8 +168,8 @@ ssl_conf = 4-sni-session-ticket-ssl

[4-sni-session-ticket-ssl]
server = 4-sni-session-ticket-server
server2 = 4-sni-session-ticket-server2
client = 4-sni-session-ticket-client
server2 = 4-sni-session-ticket-server2

[4-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -204,8 +204,8 @@ ssl_conf = 5-sni-session-ticket-ssl

[5-sni-session-ticket-ssl]
server = 5-sni-session-ticket-server
server2 = 5-sni-session-ticket-server2
client = 5-sni-session-ticket-client
server2 = 5-sni-session-ticket-server2

[5-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -240,8 +240,8 @@ ssl_conf = 6-sni-session-ticket-ssl

[6-sni-session-ticket-ssl]
server = 6-sni-session-ticket-server
server2 = 6-sni-session-ticket-server2
client = 6-sni-session-ticket-client
server2 = 6-sni-session-ticket-server2

[6-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -276,8 +276,8 @@ ssl_conf = 7-sni-session-ticket-ssl

[7-sni-session-ticket-ssl]
server = 7-sni-session-ticket-server
server2 = 7-sni-session-ticket-server2
client = 7-sni-session-ticket-client
server2 = 7-sni-session-ticket-server2

[7-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -312,8 +312,8 @@ ssl_conf = 8-sni-session-ticket-ssl

[8-sni-session-ticket-ssl]
server = 8-sni-session-ticket-server
server2 = 8-sni-session-ticket-server2
client = 8-sni-session-ticket-client
server2 = 8-sni-session-ticket-server2

[8-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -348,8 +348,8 @@ ssl_conf = 9-sni-session-ticket-ssl

[9-sni-session-ticket-ssl]
server = 9-sni-session-ticket-server
server2 = 9-sni-session-ticket-server2
client = 9-sni-session-ticket-client
server2 = 9-sni-session-ticket-server2

[9-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -384,8 +384,8 @@ ssl_conf = 10-sni-session-ticket-ssl

[10-sni-session-ticket-ssl]
server = 10-sni-session-ticket-server
server2 = 10-sni-session-ticket-server2
client = 10-sni-session-ticket-client
server2 = 10-sni-session-ticket-server2

[10-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -420,8 +420,8 @@ ssl_conf = 11-sni-session-ticket-ssl

[11-sni-session-ticket-ssl]
server = 11-sni-session-ticket-server
server2 = 11-sni-session-ticket-server2
client = 11-sni-session-ticket-client
server2 = 11-sni-session-ticket-server2

[11-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -456,8 +456,8 @@ ssl_conf = 12-sni-session-ticket-ssl

[12-sni-session-ticket-ssl]
server = 12-sni-session-ticket-server
server2 = 12-sni-session-ticket-server2
client = 12-sni-session-ticket-client
server2 = 12-sni-session-ticket-server2

[12-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -492,8 +492,8 @@ ssl_conf = 13-sni-session-ticket-ssl

[13-sni-session-ticket-ssl]
server = 13-sni-session-ticket-server
server2 = 13-sni-session-ticket-server2
client = 13-sni-session-ticket-client
server2 = 13-sni-session-ticket-server2

[13-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -528,8 +528,8 @@ ssl_conf = 14-sni-session-ticket-ssl

[14-sni-session-ticket-ssl]
server = 14-sni-session-ticket-server
server2 = 14-sni-session-ticket-server2
client = 14-sni-session-ticket-client
server2 = 14-sni-session-ticket-server2

[14-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -564,8 +564,8 @@ ssl_conf = 15-sni-session-ticket-ssl

[15-sni-session-ticket-ssl]
server = 15-sni-session-ticket-server
server2 = 15-sni-session-ticket-server2
client = 15-sni-session-ticket-client
server2 = 15-sni-session-ticket-server2

[15-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -600,8 +600,8 @@ ssl_conf = 16-sni-session-ticket-ssl

[16-sni-session-ticket-ssl]
server = 16-sni-session-ticket-server
server2 = 16-sni-session-ticket-server2
client = 16-sni-session-ticket-client
server2 = 16-sni-session-ticket-server2

[16-sni-session-ticket-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down
10 changes: 5 additions & 5 deletions test/ssl-tests/08-npn.conf
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ ssl_conf = 6-npn-with-sni-no-context-switch-ssl

[6-npn-with-sni-no-context-switch-ssl]
server = 6-npn-with-sni-no-context-switch-server
server2 = 6-npn-with-sni-no-context-switch-server2
client = 6-npn-with-sni-no-context-switch-client
server2 = 6-npn-with-sni-no-context-switch-server2

[6-npn-with-sni-no-context-switch-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -202,8 +202,8 @@ ssl_conf = 7-npn-with-sni-context-switch-ssl

[7-npn-with-sni-context-switch-ssl]
server = 7-npn-with-sni-context-switch-server
server2 = 7-npn-with-sni-context-switch-server2
client = 7-npn-with-sni-context-switch-client
server2 = 7-npn-with-sni-context-switch-server2

[7-npn-with-sni-context-switch-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -237,8 +237,8 @@ ssl_conf = 8-npn-selected-sni-server-supports-npn-ssl

[8-npn-selected-sni-server-supports-npn-ssl]
server = 8-npn-selected-sni-server-supports-npn-server
server2 = 8-npn-selected-sni-server-supports-npn-server2
client = 8-npn-selected-sni-server-supports-npn-client
server2 = 8-npn-selected-sni-server-supports-npn-server2

[8-npn-selected-sni-server-supports-npn-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -271,8 +271,8 @@ ssl_conf = 9-npn-selected-sni-server-does-not-support-npn-ssl

[9-npn-selected-sni-server-does-not-support-npn-ssl]
server = 9-npn-selected-sni-server-does-not-support-npn-server
server2 = 9-npn-selected-sni-server-does-not-support-npn-server2
client = 9-npn-selected-sni-server-does-not-support-npn-client
server2 = 9-npn-selected-sni-server-does-not-support-npn-server2

[9-npn-selected-sni-server-does-not-support-npn-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down Expand Up @@ -331,8 +331,8 @@ ssl_conf = 11-sni-npn-preferred-over-alpn-ssl

[11-sni-npn-preferred-over-alpn-ssl]
server = 11-sni-npn-preferred-over-alpn-server
server2 = 11-sni-npn-preferred-over-alpn-server2
client = 11-sni-npn-preferred-over-alpn-client
server2 = 11-sni-npn-preferred-over-alpn-server2

[11-sni-npn-preferred-over-alpn-server]
Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem
Expand Down
Loading

0 comments on commit d0c4415

Please sign in to comment.