Skip to content

Commit

Permalink
Merge pull request #121 from go-clang/upgrade-to-go-1.7
Browse files Browse the repository at this point in the history
Upgrade to Go 1.7
  • Loading branch information
zimmski authored Sep 20, 2016
2 parents e221311 + 76de4c0 commit 1a6b51e
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 18 deletions.
20 changes: 12 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: go
go:
- 1.5
- 1.7.1

addons:
apt:
Expand All @@ -13,20 +13,26 @@ addons:
- libclang1-3.4
- libclang-3.4-dev

env:
global:
- CC=clang CXX=clang++
# Coveralls.io
- secure: "pMyHrYdVIexMTlzQJj9lH6OJWEOSjeAg1qlq2BWndzTZgQ7etsokg3B6z7Lafpyt9bMFPt6ZIMwmSe5K4wa9UiGvroadjlHqNwl298Xa5P3ixbZYMtCNWHMz4y/FluzZPNOSKMpdXUcqF+pOPlmaxEh8Me3vvGTaQcNGXiqC1h//FDJNrtuBNymOkTRV7Us5bnVgwgXOrwSdVoOe4MvLcTeCOYn/iXCSjI+bZDdx3t3M3os5l2dbgW1xWSPlYojnHK3etByHNwJyK+LzVOY0TCbQCyxRQwtURmI+f9Ljgws9lEPbv7GCINi2y9RWxNydRHlxmoS/fsj1aWAPtmsVIVZpHE9wrXeY3zcCeQ7tYC8qI7JFba/IWnqplq5Z6Y3y998d1JzoSF4FZc6f34rEfMZEZOdk2PwqUzosB9lBGw/n3hOC6meth3SkqhZfW7QC1vM8EvsvOxdXQpsDluTX8DOace50YM3HTiSYls2KpNwXxSzAqVu46CZiqsbkQHjAXa2fdgmJzFpgRaXU3Ln8GOU4aVDI+2wJCR/XBTDHl32jR3uHlAdLPLpYpALm9ZcgzzDXRDFq5zUnKhEgau1HIOLeKL6HdVGD1x5W+/FP8PTtblgLkCMTctOQt+49Go9fk6DqI4Rv95tbUAnF+NXU/Zd4TA1eroG/wpuRIj2/e/E="

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 ldconfig

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

- make install-dependencies
- make install-tools

- CGO_LDFLAGS="-L`llvm-config --libdir`" go get -u github.com/go-clang/bootstrap/...

script:
# Install the project
- make install
Expand All @@ -35,10 +41,8 @@ script:
- make lint

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

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

env:
# Coveralls.io
secure: "pMyHrYdVIexMTlzQJj9lH6OJWEOSjeAg1qlq2BWndzTZgQ7etsokg3B6z7Lafpyt9bMFPt6ZIMwmSe5K4wa9UiGvroadjlHqNwl298Xa5P3ixbZYMtCNWHMz4y/FluzZPNOSKMpdXUcqF+pOPlmaxEh8Me3vvGTaQcNGXiqC1h//FDJNrtuBNymOkTRV7Us5bnVgwgXOrwSdVoOe4MvLcTeCOYn/iXCSjI+bZDdx3t3M3os5l2dbgW1xWSPlYojnHK3etByHNwJyK+LzVOY0TCbQCyxRQwtURmI+f9Ljgws9lEPbv7GCINi2y9RWxNydRHlxmoS/fsj1aWAPtmsVIVZpHE9wrXeY3zcCeQ7tYC8qI7JFba/IWnqplq5Z6Y3y998d1JzoSF4FZc6f34rEfMZEZOdk2PwqUzosB9lBGw/n3hOC6meth3SkqhZfW7QC1vM8EvsvOxdXQpsDluTX8DOace50YM3HTiSYls2KpNwXxSzAqVu46CZiqsbkQHjAXa2fdgmJzFpgRaXU3Ln8GOU4aVDI+2wJCR/XBTDHl32jR3uHlAdLPLpYpALm9ZcgzzDXRDFq5zUnKhEgau1HIOLeKL6HdVGD1x5W+/FP8PTtblgLkCMTctOQt+49Go9fk6DqI4Rv95tbUAnF+NXU/Zd4TA1eroG/wpuRIj2/e/E="
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.PHONY: all install install-dependencies install-tools lint test test-verbose
.PHONY: all install install-dependencies install-tools lint test test-full 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
export CXX := clang++

ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(ARGS):;@:) # turn arguments into do-nothing targets
Expand All @@ -15,6 +17,8 @@ install-dependencies:
go get -u golang.org/x/tools/imports/...
go get -u github.com/stretchr/testify/...
go get -u github.com/termie/go-shutil/...

CGO_LDFLAGS="-L`llvm-config --libdir`" go get -u github.com/go-clang/bootstrap/...
install-tools:
# Install linting tools
go get -u github.com/golang/lint/...
Expand All @@ -26,8 +30,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-full:
$(ROOT_DIR)/scripts/test-full.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 @@ -12,7 +12,7 @@ export LLVM_VERSION=$1
cd $GOPATH/src/github.com/go-clang/v${LLVM_VERSION}/clang/

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

go-clang-gen

Expand Down
5 changes: 4 additions & 1 deletion scripts/switch-clang-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ 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 -f /usr/bin/clang
sudo rm -f /usr/bin/llvm-config
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 ldconfig
12 changes: 12 additions & 0 deletions scripts/test-full.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 race detector
CGO_LDFLAGS="-L`llvm-config --libdir`" go test -timeout 60s -v -race ./...

# 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
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
Expand Up @@ -2,7 +2,7 @@

set -exuo pipefail

export GO_VERSION=1.5.3
export GO_VERSION=1.7.1

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

0 comments on commit 1a6b51e

Please sign in to comment.