LDFLAGS in test.sh; improve format check

This commit is contained in:
Trevor Rosen 2017-11-14 11:08:41 -06:00
parent 591c2909c6
commit c0088f5d61
No known key found for this signature in database
GPG Key ID: 56054B6FF40DE0F9
3 changed files with 17 additions and 4 deletions

View File

@ -51,9 +51,7 @@ before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script:
- export CGO_CPPFLAGS="-I${HOME}/usr/include"
- export CGO_LDFLAGS="-L${HOME}/usr/lib -lopencv_core -lopencv_videoio -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_objdetect -lopencv_calib3d -lopencv_video"
- echo "Running tests"
- echo "Running tests
- make test_with_coverage
- echo "Checking that code is well-formatted"
- make fmt_check

View File

@ -6,7 +6,8 @@
pushd $PWD/..
GO_FILES_EXCLUDING_VENDOR=$(find . -type f -name '*.go' -not -path "./vendor/*")
FMT_RESULTS=$(gofmt -l $GO_FILES_EXCLUDING_VENDOR)
if [ ${#FMT_RESULTS[@]} -ne 0 ]; then
FMT_RESULTS_COUNT=$(echo $FMT_RESULTS | wc -l) # returns one empty line when everything passes
if [ "$FMT_RESULTS_COUNT" -gt 1 ]; then
# some files have formatting errors
echo "--- gofmt found errors found in the following files:"
echo $FMT_RESULTS

View File

@ -11,6 +11,20 @@ echo $GO_VERSION
# Hold the package names that contain failures
FAIL_PACKAGES=()
# OpenCV components to link in CGO compile
OPENCV_LDFLAGS="-lopencv_core -lopencv_videoio -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_objdetect -lopencv_calib3d -lopencv_video"
# Use $HOME on Travis
# Use /usr/local on local
if [[ $TRAVIS == "true" ]]; then
export CGO_CPPFLAGS="-I${HOME}/usr/include"
export CGO_LDFLAGS="-L${HOME}/usr/lib $OPENCV_LDFLAGS"
else
export CGO_CPPFLAGS="-I/usr/local/include"
export CGO_LDFLAGS="-L/usr/local/lib $OPENCV_LDFLAGS"
fi
pushd $PWD/..
# Set up coverage report file
COVERAGE_REPORT_LOCATION="./profile.cov"