From 6bff168a06db366238a2823d06a0a3a6a1872f6d Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Wed, 18 Jan 2017 18:59:59 +0000 Subject: [PATCH] tris: add proper BoGo tests --- .travis.yml | 3 ++- _dev/bogo.sh | 7 +++++++ _dev/bogo/Dockerfile | 26 +++++++------------------ _dev/bogo/bogo-client.go | 41 ---------------------------------------- _dev/bogo/run.sh | 3 --- 5 files changed, 16 insertions(+), 64 deletions(-) create mode 100755 _dev/bogo.sh delete mode 100644 _dev/bogo/bogo-client.go delete mode 100755 _dev/bogo/run.sh diff --git a/.travis.yml b/.travis.yml index 485f386..71d7b62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,10 +9,10 @@ go: env: - MODE=interop CLIENT=boring - - MODE=interop CLIENT=bogo - MODE=interop CLIENT=tstclnt - MODE=interop CLIENT=picotls ZRTT=1 - MODE=interop CLIENT=mint + - MODE=bogo - MODE=gotest - MODE=interop CLIENT=tstclnt ZRTT=1 - MODE=interop CLIENT=boring REVISION=origin/master @@ -33,6 +33,7 @@ script: - if [ "$MODE" = "interop" ]; then ./_dev/interop.sh RUN $CLIENT; fi - if [ "$MODE" = "interop" ] && [ "$ZRTT" = "1" ]; then ./_dev/interop.sh 0-RTT $CLIENT; fi - if [ "$MODE" = "gotest" ]; then ./_dev/go.sh test -race crypto/tls; fi + - if [ "$MODE" = "bogo" ]; then ./_dev/bogo.sh; fi after_script: - if [ "$MODE" = "interop" ]; then docker ps -a; docker logs tris-localserver; fi diff --git a/_dev/bogo.sh b/_dev/bogo.sh new file mode 100755 index 0000000..1175e6d --- /dev/null +++ b/_dev/bogo.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -xeuo pipefail + +BASEDIR=$(cd "$(dirname "$0")" && pwd) + +docker build -t tls-tris:bogo _dev/bogo +docker run --rm -v $BASEDIR/..:/go/src/github.com/cloudflare/tls-tris tls-tris:bogo diff --git a/_dev/bogo/Dockerfile b/_dev/bogo/Dockerfile index c75245f..1c9ecf1 100644 --- a/_dev/bogo/Dockerfile +++ b/_dev/bogo/Dockerfile @@ -1,25 +1,13 @@ -FROM alpine +FROM golang:1.7-alpine RUN apk add --update \ git \ - cmake \ - perl \ - python \ - build-base \ - go \ - ninja \ + make \ + bash \ && rm -rf /var/cache/apk/* -RUN git clone https://boringssl.googlesource.com/boringssl +ENV CGO_ENABLED=0 -# see _dev/boring for REVISION info -ARG REVISION=9b885c5 - -RUN cd boringssl && git fetch -RUN cd boringssl && git checkout $REVISION - -ADD bogo-client.go /bogo-client.go -RUN go build /bogo-client.go - -ADD run.sh /run.sh -ENTRYPOINT ["/run.sh"] +RUN go get -d github.com/FiloSottile/crypto-tls-bogo-shim +WORKDIR /go/src/github.com/FiloSottile/crypto-tls-bogo-shim +CMD ["make", "run"] diff --git a/_dev/bogo/bogo-client.go b/_dev/bogo/bogo-client.go deleted file mode 100644 index 619e9f0..0000000 --- a/_dev/bogo/bogo-client.go +++ /dev/null @@ -1,41 +0,0 @@ -package main - -import ( - "log" - "net" - "net/http" - "os" - - "./boringssl/ssl/test/runner" -) - -func main() { - sessionCache := runner.NewLRUClientSessionCache(10) - tr := &http.Transport{ - DialTLS: func(network, addr string) (net.Conn, error) { - return runner.Dial(network, addr, &runner.Config{ - InsecureSkipVerify: true, - ClientSessionCache: sessionCache, - }) - }, - DisableKeepAlives: true, - } - client := &http.Client{Transport: tr} - - resp, err := client.Get("https://" + os.Args[1]) - if err != nil { - log.Fatal(err) - } - if err := resp.Write(os.Stdout); err != nil { - log.Fatal(err) - } - - // Resumption - resp, err = client.Get("https://" + os.Args[1]) - if err != nil { - log.Fatal(err) - } - if err := resp.Write(os.Stdout); err != nil { - log.Fatal(err) - } -} diff --git a/_dev/bogo/run.sh b/_dev/bogo/run.sh deleted file mode 100755 index 9f849a8..0000000 --- a/_dev/bogo/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh - -exec /bogo-client "$@"