diff options
author | David Benjamin <davidben@chromium.org> | 2014-07-02 03:40:31 +0400 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-07-02 04:30:29 +0400 |
commit | 325b5c36677dd29e6eb64dd5b5991dd8950108ac (patch) | |
tree | b0807d7cc3265931c6d21b54041b6da69d39a2ac | |
parent | 7ac79ebe5552518fc550f609e61770effe69da89 (diff) |
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>
-rw-r--r-- | ssl/test/runner/runner.go | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/ssl/test/runner/runner.go b/ssl/test/runner/runner.go index 1ec3795f..1b86a959 100644 --- a/ssl/test/runner/runner.go +++ b/ssl/test/runner/runner.go @@ -53,9 +53,9 @@ type testCase struct { // 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 @@ var clientTests = []testCase{ expectedError: ":WRONG_CURVE:", }, { - name: "FallbackSCSV", + name: "NoFallbackSCSV", config: Config{ Bugs: ProtocolBugs{ FailIfNotFallbackSCSV: true, @@ -104,6 +104,15 @@ var clientTests = []testCase{ 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 @@ func doExchange(tlsConn *Conn, messageLen int) error { 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 @@ func runTest(test *testCase) error { 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} |