Skip to content

Commit 0a3be65

Browse files
committed
Upgrade to Go 1.7
- 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
1 parent 12a5893 commit 0a3be65

7 files changed

+35
-13
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: go
22
go:
3-
- 1.5
3+
- 1.7
44

55
addons:
66
apt:
@@ -15,13 +15,15 @@ addons:
1515

1616
install:
1717
- mkdir -p /home/travis/bin
18+
- sudo ln -s /usr/bin/clang-3.4 /home/travis/bin/clang
1819
- sudo ln -s /usr/bin/llvm-config-3.4 /home/travis/bin/llvm-config
1920
- sudo ln -s /usr/lib/llvm-3.4/lib/libclang.so.1 /usr/lib/x86_64-linux-gnu/libclang.so
2021
- sudo ldconfig
2122

2223
- llvm-config --version
2324
- llvm-config --includedir
2425
- llvm-config --libdir
26+
- clang --version
2527

2628
- make install-dependencies
2729
- make install-tools
@@ -36,7 +38,9 @@ script:
3638
- make lint
3739

3840
# Do tests and code coverage
39-
- ginkgo -r -cover -skipPackage="testdata"
41+
- make test-throughout
42+
43+
- ginkgo -cover -skipPackage="testdata"
4044
- gover
4145
- if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then goveralls -coverprofile=gover.coverprofile -service=travis-ci -repotoken $COVERALLS_TOKEN; fi
4246

Makefile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
.PHONY: all install install-dependencies install-tools lint test test-verbose
1+
.PHONY: all install install-dependencies install-tools lint test test-throughout test-verbose
22

3-
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
4-
export ROOT_DIR
3+
export ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
4+
5+
export CC := clang
56

67
ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
78
$(eval $(ARGS):;@:) # turn arguments into do-nothing targets
@@ -26,8 +27,10 @@ install-tools:
2627
go get -u github.com/modocache/gover/...
2728
go get -u github.com/mattn/goveralls/...
2829
lint: install
29-
scripts/lint.sh
30+
$(ROOT_DIR)/scripts/lint.sh
3031
test:
31-
CGO_LDFLAGS="-L`llvm-config --libdir`" go test -timeout 60s -race ./...
32+
CGO_LDFLAGS="-L`llvm-config --libdir`" go test -timeout 60s ./...
33+
test-throughout:
34+
$(ROOT_DIR)/scripts/test-throughout.sh
3235
test-verbose:
33-
CGO_LDFLAGS="-L`llvm-config --libdir`" go test -timeout 60s -race -v ./...
36+
CGO_LDFLAGS="-L`llvm-config --libdir`" go test -timeout 60s -v ./...

scripts/generate-and-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export LLVM_VERSION=$1
1010
cd clang/ || exit
1111

1212
rm -rf clang-c/
13-
rm *_gen.go
13+
rm -f *_gen.go
1414

1515
go-clang-gen || exit
1616

scripts/switch-clang-version.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ export LLVM_VERSION=$1
1111
sudo add-apt-repository --enable-source "deb http://llvm.org/apt/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main"
1212
sudo apt-get update
1313

14-
sudo rm /usr/bin/llvm-config
15-
sudo rm /usr/lib/x86_64-linux-gnu/libclang.so
14+
sudo rm -f /usr/bin/clang
15+
sudo rm -f /usr/bin/llvm-config
16+
sudo rm -f /usr/lib/x86_64-linux-gnu/libclang.so
1617
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
18+
sudo ln -s /usr/bin/clang-$LLVM_VERSION /usr/bin/clang
1719
sudo ln -s /usr/bin/llvm-config-$LLVM_VERSION /usr/bin/llvm-config
1820
sudo ln -s /usr/lib/x86_64-linux-gnu/libclang-$LLVM_VERSION.so /usr/lib/x86_64-linux-gnu/libclang.so
21+
sudo ldconfig

scripts/test-throughout.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -exuo pipefail
4+
5+
LLVM_VERSION=$(clang --version | grep --max-count=1 "clang version" | sed -r 's/^.*clang version ([0-9]+\.[0-9]+).+$/\1/')
6+
7+
# Test with the address sanitizer
8+
# TODO there is maybe a problem within clang https://github.com/go-clang/gen/issues/123
9+
# 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
10+
11+
# Test with the race detector
12+
CGO_LDFLAGS="-L`llvm-config --libdir`" go test -timeout 60s -v -race ./...

scripts/update-bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ make -C $GOPATH/src/github.com/go-clang/gen install
1212
cd $GOPATH/src/github.com/go-clang/bootstrap/clang/
1313

1414
rm -rf clang-c/
15-
rm *_gen.go
15+
rm -f *_gen.go
1616

1717
go-clang-gen
1818

scripts/vagrant-environment.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
export GO_VERSION=1.5.3
3+
export GO_VERSION=1.7.1
44

55
# Install Go
66
mkdir -p $HOME/go

0 commit comments

Comments
 (0)