Fix FallbackSCSV test.
It wasn't actually testing SSL_enable_fallback_scsv, just that not calling it
didn't send an SCSV. Plumb the 'flag' parameter to testCase through and add a
test that asserts it does get sent when expected. (Make it a []string since Go
doesn't distinguish nil string from "" and for flexibility.)
Change-Id: I124c01e045aebbed5c1d87b7196de7c2026f26f3
Reviewed-on: https://boringssl-review.googlesource.com/1071
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/test/runner/runner.go b/ssl/test/runner/runner.go
index 1ec3795..1b86a95 100644
--- a/ssl/test/runner/runner.go
+++ b/ssl/test/runner/runner.go
@@ -53,9 +53,9 @@
// messageLen is the length, in bytes, of the test message that will be
// sent.
messageLen int
- // flag, if not nil, contains a command line flag that will be passed
- // to the shim program.
- flag string
+ // flags, if not empty, contains a list of command-line flags that will
+ // be passed to the shim program.
+ flags []string
}
var clientTests = []testCase{
@@ -95,7 +95,7 @@
expectedError: ":WRONG_CURVE:",
},
{
- name: "FallbackSCSV",
+ name: "NoFallbackSCSV",
config: Config{
Bugs: ProtocolBugs{
FailIfNotFallbackSCSV: true,
@@ -104,6 +104,15 @@
shouldFail: true,
expectedLocalError: "no fallback SCSV found",
},
+ {
+ name: "FallbackSCSV",
+ config: Config{
+ Bugs: ProtocolBugs{
+ FailIfNotFallbackSCSV: true,
+ },
+ },
+ flags: []string{"-fallback-scsv"},
+ },
}
func doExchange(tlsConn *Conn, messageLen int) error {
@@ -134,21 +143,23 @@
return nil
}
-func valgrindOf(dbAttach bool, baseArgs ...string) *exec.Cmd {
- args := []string{"--error-exitcode=99", "--track-origins=yes", "--leak-check=full"}
+func valgrindOf(dbAttach bool, path string, args ...string) *exec.Cmd {
+ valgrindArgs := []string{"--error-exitcode=99", "--track-origins=yes", "--leak-check=full"}
if dbAttach {
- args = append(args, "--db-attach=yes", "--db-command=xterm -e gdb -nw %f %p")
+ valgrindArgs = append(valgrindArgs, "--db-attach=yes", "--db-command=xterm -e gdb -nw %f %p")
}
- args = append(args, baseArgs...)
+ valgrindArgs = append(valgrindArgs, path)
+ valgrindArgs = append(valgrindArgs, args...)
- return exec.Command("valgrind", args...)
+ return exec.Command("valgrind", valgrindArgs...)
}
-func gdbOf(baseArgs ...string) *exec.Cmd {
- args := []string{"-e", "gdb", "--args"}
- args = append(args, baseArgs...)
+func gdbOf(path string, args ...string) *exec.Cmd {
+ xtermArgs := []string{"-e", "gdb", "--args"}
+ xtermArgs = append(xtermArgs, path)
+ xtermArgs = append(xtermArgs, args...)
- return exec.Command("xterm", args...)
+ return exec.Command("xterm", xtermArgs...)
}
func runTest(test *testCase) error {
@@ -170,9 +181,9 @@
const shim_path = "../../../build/ssl/test/client_shim"
var client *exec.Cmd
if *useValgrind {
- client = valgrindOf(false, shim_path)
+ client = valgrindOf(false, shim_path, test.flags...)
} else {
- client = exec.Command(shim_path)
+ client = exec.Command(shim_path, test.flags...)
}
//client := gdbOf(shim_path)
client.ExtraFiles = []*os.File{clientEnd}