Skip to content

Commit

Permalink
Upgrade to Go 1.7
Browse files Browse the repository at this point in the history
- Upgrades to Go 1.7
- Introduces test-throughout to test with the race detector and (new)
  with the address sanitizer if it is supported by the environment
- Cleanup of some scripts

Fixes #113
  • Loading branch information
zimmski committed Sep 9, 2016
1 parent 12a5893 commit 0a3be65
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 13 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: go
go:
- 1.5
- 1.7

addons:
apt:
Expand All @@ -15,13 +15,15 @@ addons:

install:
- mkdir -p /home/travis/bin
- sudo ln -s /usr/bin/clang-3.4 /home/travis/bin/clang
- sudo ln -s /usr/bin/llvm-config-3.4 /home/travis/bin/llvm-config
- sudo ln -s /usr/lib/llvm-3.4/lib/libclang.so.1 /usr/lib/x86_64-linux-gnu/libclang.so
- sudo ldconfig

- llvm-config --version
- llvm-config --includedir
- llvm-config --libdir
- clang --version

- make install-dependencies
- make install-tools
Expand All @@ -36,7 +38,9 @@ script:
- make lint

# Do tests and code coverage
- ginkgo -r -cover -skipPackage="testdata"
- make test-throughout

- ginkgo -cover -skipPackage="testdata"
- gover
- if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then goveralls -coverprofile=gover.coverprofile -service=travis-ci -repotoken $COVERALLS_TOKEN; fi

Expand Down
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.PHONY: all install install-dependencies install-tools lint test test-verbose
.PHONY: all install install-dependencies install-tools lint test test-throughout test-verbose

ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
export ROOT_DIR
export ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

export CC := clang

ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(ARGS):;@:) # turn arguments into do-nothing targets
Expand All @@ -26,8 +27,10 @@ install-tools:
go get -u github.com/modocache/gover/...
go get -u github.com/mattn/goveralls/...
lint: install
scripts/lint.sh
$(ROOT_DIR)/scripts/lint.sh
test:
CGO_LDFLAGS="-L`llvm-config --libdir`" go test -timeout 60s -race ./...
CGO_LDFLAGS="-L`llvm-config --libdir`" go test -timeout 60s ./...
test-throughout:
$(ROOT_DIR)/scripts/test-throughout.sh
test-verbose:
CGO_LDFLAGS="-L`llvm-config --libdir`" go test -timeout 60s -race -v ./...
CGO_LDFLAGS="-L`llvm-config --libdir`" go test -timeout 60s -v ./...
2 changes: 1 addition & 1 deletion scripts/generate-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export LLVM_VERSION=$1
cd clang/ || exit

rm -rf clang-c/
rm *_gen.go
rm -f *_gen.go

go-clang-gen || exit

Expand Down
7 changes: 5 additions & 2 deletions scripts/switch-clang-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ export LLVM_VERSION=$1
sudo add-apt-repository --enable-source "deb http://llvm.org/apt/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main"
sudo apt-get update

sudo rm /usr/bin/llvm-config
sudo rm /usr/lib/x86_64-linux-gnu/libclang.so
sudo rm -f /usr/bin/clang
sudo rm -f /usr/bin/llvm-config
sudo rm -f /usr/lib/x86_64-linux-gnu/libclang.so
sudo apt-get install -y clang-$LLVM_VERSION libclang1-$LLVM_VERSION libclang-$LLVM_VERSION-dev llvm-$LLVM_VERSION llvm-$LLVM_VERSION-dev llvm-$LLVM_VERSION-runtime libclang-common-$LLVM_VERSION-dev
sudo ln -s /usr/bin/clang-$LLVM_VERSION /usr/bin/clang
sudo ln -s /usr/bin/llvm-config-$LLVM_VERSION /usr/bin/llvm-config
sudo ln -s /usr/lib/x86_64-linux-gnu/libclang-$LLVM_VERSION.so /usr/lib/x86_64-linux-gnu/libclang.so
sudo ldconfig
12 changes: 12 additions & 0 deletions scripts/test-throughout.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -exuo pipefail

LLVM_VERSION=$(clang --version | grep --max-count=1 "clang version" | sed -r 's/^.*clang version ([0-9]+\.[0-9]+).+$/\1/')

# Test with the address sanitizer
# TODO there is maybe a problem within clang https://github.com/go-clang/gen/issues/123
# if [ $(echo "$LLVM_VERSION>=3.9" | bc -l) -ne 0 ] && [ $(find `llvm-config --libdir` | grep libclang_rt.san-x86_64.a | wc -l) -ne 0 ]; then CGO_LDFLAGS="-L`llvm-config --libdir` -fsanitize=memory" CGO_CPPFLAGS='-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer' go test -timeout 60s -v -msan ./...; fi

# Test with the race detector
CGO_LDFLAGS="-L`llvm-config --libdir`" go test -timeout 60s -v -race ./...
2 changes: 1 addition & 1 deletion scripts/update-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ make -C $GOPATH/src/github.com/go-clang/gen install
cd $GOPATH/src/github.com/go-clang/bootstrap/clang/

rm -rf clang-c/
rm *_gen.go
rm -f *_gen.go

go-clang-gen

Expand Down
2 changes: 1 addition & 1 deletion scripts/vagrant-environment.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

export GO_VERSION=1.5.3
export GO_VERSION=1.7.1

# Install Go
mkdir -p $HOME/go
Expand Down

0 comments on commit 0a3be65

Please sign in to comment.