Skip to content

Commit

Permalink
Get Bogo test working on M1 ("Apple Silicon") macOS Big Sur.
Browse files Browse the repository at this point in the history
Fix the "build bogo_shim if it doesn't exist" logic; it was broken even
on Linux as newer versions of Rust don't allow `--features` to be used
at workspace level.

I had to bootstrap Go on a Linux machine using the procedure at
golang/go#42684 (comment):
```
git clone https://go.googlesource.com/go
cd go
git fetch https://go.googlesource.com/go refs/changes/58/272258/1 && git checkout FETCH_HEAD
cd src
GOOS=darwin GOARCH=arm64 ./bootstrap.bash
```

This version of Go required me to have a go.mod file. Change the way Bogo is
downloaded from BoringSSL's repo to get this to work. The script tries to use
sparse checkouts and a single-revision checkout but it is still slow so maybe
one or both of those things aren't working as I expect.

In particular, avoid `wget` since my Mac doesn't have `wget` available.

Remove two of the patches to Bogo that seem to not be necessary if using a
newer version of Go. Patch the remaining patch to work with the new directory
structure.

I verified that ./runme runs the tests and spits out "PASS" at the end on both macOS
and Linux.
  • Loading branch information
briansmith committed Dec 2, 2020
1 parent 47d3092 commit 049fd89
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 84 deletions.
29 changes: 16 additions & 13 deletions bogo/fetch-and-build
@@ -1,19 +1,22 @@
#!/bin/sh
#!/bin/bash

set -ex

mkdir bogo
pushd bogo

git init
cat << EOF > .git/info/sparse-checkout
go.mod
ssl/test/runner
util/testresult
EOF

# a known-good commit
COMMIT=47a6f5b4bf4d7acd8d5f7d43cb9c94335cec1c60

rm -f runner.tar.gz testresult.tar.gz
wget https://boringssl.googlesource.com/boringssl/+archive/$COMMIT/ssl/test/runner.tar.gz
wget https://boringssl.googlesource.com/boringssl/+archive/$COMMIT/util/testresult.tar.gz
mkdir -p bogo
cd bogo/
mkdir -p testresult
tar -xzf ../runner.tar.gz
( cd testresult && tar -xzf ../../testresult.tar.gz )
git fetch https://boringssl.googlesource.com/boringssl $COMMIT
git checkout $COMMIT
patch -p1 < ../patches/testerrormap.diff
patch -p1 < ../patches/go-1.13-breakage.diff
patch -p1 < ../patches/vendor.diff
go test -c
(cd ssl/test/runner && go test -c)

popd
27 changes: 0 additions & 27 deletions bogo/patches/go-1.13-breakage.diff

This file was deleted.

6 changes: 3 additions & 3 deletions bogo/patches/testerrormap.diff
@@ -1,6 +1,6 @@
diff -u original/runner.go bogo/runner.go
--- original/runner.go 2018-09-13 21:07:29.000000000 +0100
+++ bogo/runner.go 2019-01-20 11:51:00.705040230 +0000
diff -u original/ssl/test/runner/runner.go bogo/ssl/test/runner/runner.go
--- original/ssl/test/runner/runner.go 2018-09-13 21:07:29.000000000 +0100
+++ bogo/ssl/test/runner/runner.go 2019-01-20 11:51:00.705040230 +0000
@@ -84,6 +84,14 @@
// like “SSL_ERROR_NO_CYPHER_OVERLAP”.
ErrorMap map[string]string
Expand Down
38 changes: 0 additions & 38 deletions bogo/patches/vendor.diff

This file was deleted.

6 changes: 3 additions & 3 deletions bogo/runme
Expand Up @@ -6,7 +6,7 @@
set -xe

if [ ! -e ../target/debug/examples/bogo_shim ] ; then
cargo test --no-run --features dangerous_configuration,quic
(cd ../rustls && cargo build --example bogo_shim --features dangerous_configuration,quic)
fi

if [ ! -e bogo/ ] ; then
Expand All @@ -17,7 +17,7 @@ fi
# Best effort on OS-X
case $OSTYPE in darwin*) set +e ;; esac

( cd bogo && ./bogo.test -shim-path ../../target/debug/examples/bogo_shim \
-shim-config ../config.json \
( cd bogo/ssl/test/runner && ./runner.test -shim-path ../../../../../target/debug/examples/bogo_shim \
-shim-config ../../../../config.json \
-pipe -allow-unimplemented )
true

0 comments on commit 049fd89

Please sign in to comment.