Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
ci(benchmarks): clean up scripts
Browse files Browse the repository at this point in the history
Remove unused code, follow conventions
  • Loading branch information
hannahhoward committed Jul 3, 2019
1 parent 31553b7 commit 1d55e09
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 71 deletions.
2 changes: 0 additions & 2 deletions bin/benchmark-to-file.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash
output="$1"
branch="$2"

git checkout "$2"

Expand Down
24 changes: 0 additions & 24 deletions bin/build.sh

This file was deleted.

5 changes: 1 addition & 4 deletions bin/diff-benchmarks.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash

before="$1"
after="$2"

parse() {
sed -n \
-e 's/ *\t */\t/g' \
Expand All @@ -29,4 +26,4 @@ if [[ $? -ne 4 ]]; then
exit 1
else
echo "PASS"
fi
fi
43 changes: 2 additions & 41 deletions bin/run-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,12 @@ set -eo pipefail

display_and_run() {
echo "***" "$@"
eval $(printf '%q ' "$@")
eval "$(printf '%q ' "$@")"
}

# reset workdir to state from git (to remove possible rewritten dependencies)
display_and_run git reset --hard

# Environment
echo "*** Setting up test environment"
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
if [[ "$TRAVIS_SUDO" == true ]]; then
# Ensure that IPv6 is enabled.
# While this is unsupported by TravisCI, it still works for localhost.
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
fi
else
# OSX has a default file limit of 256, for some tests we need a
# maximum of 8192.
ulimit -Sn 8192
fi

list_buildable() {
go list -f '{{if (len .GoFiles)}}{{.ImportPath}} {{if .Module}}{{.Module.Dir}}{{else}}{{.Dir}}{{end}}{{end}}' ./... | grep -v /vendor/
}

build_all() {
# Make sure everything can compile since some package may not have tests
# Note: that "go build ./..." will fail if some packages have only
# tests (will get "no buildable Go source files" error) so we
# have to do this the hard way.
list_buildable | while read -r pkg dir; do
echo '*** go build' "$pkg"
buildmode=archive
if [[ "$(go list -f '{{.Name}}')" == "main" ]]; then
# plugin works even when a "main" function is missing.
buildmode=plugin
fi
( cd "$dir"; go build -buildmode=$buildmode -o /dev/null "$pkg")
done
}

export GO111MODULE=on
display_and_run go get golang.org/x/tools/cmd/benchcmp
build_all
display_and_run git reset --hard
git checkout -b after
git fetch origin master:refs/remotes/origin/before
Expand All @@ -59,4 +20,4 @@ git checkout after
display_and_run BENCHMARK_SEED="$$" ./bin/benchmark-to-file.sh benchmark-after.txt after
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
display_and_run ./bin/diff-benchmarks.sh benchmark-before.txt benchmark-after.txt
fi
fi

0 comments on commit 1d55e09

Please sign in to comment.