Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 162901884F for ; Wed, 30 Dec 2015 21:12:51 +0000 (UTC) Received: (qmail 66249 invoked by uid 500); 30 Dec 2015 21:12:50 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 66029 invoked by uid 500); 30 Dec 2015 21:12:50 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 65467 invoked by uid 99); 30 Dec 2015 21:12:50 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Dec 2015 21:12:50 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1BFFDE08E9; Wed, 30 Dec 2015 21:12:50 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aconway@apache.org To: commits@qpid.apache.org Date: Wed, 30 Dec 2015 21:13:09 -0000 Message-Id: <91895282f1204905beb63009d2d66e0a@git.apache.org> In-Reply-To: <2f9bc23054864a0aad0675b27e0ef8e5@git.apache.org> References: <2f9bc23054864a0aad0675b27e0ef8e5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [21/50] [abbrv] qpid-proton git commit: PROTON-1075: go: Enable -race by default for go tests, use go tools for dependency checking. PROTON-1075: go: Enable -race by default for go tests, use go tools for dependency checking. Added the -race flag by default with golang go, disabled by default for gccgo as it does not work for me - errors about circular dependencies. Removed cumbersome and incorrect CMake code for checking go dependencies, use the simple go tools instead. `go install` runs each time you run make, but it does nothing if nothing needs to be done so there is no impact on build times. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/22c3ee91 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/22c3ee91 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/22c3ee91 Branch: refs/heads/go1 Commit: 22c3ee91039d0a53730e60b94bf6cb7dddc24bce Parents: d9c0ed5 Author: Alan Conway Authored: Fri Dec 11 12:11:44 2015 -0500 Committer: Alan Conway Committed: Fri Dec 11 13:13:29 2015 -0500 ---------------------------------------------------------------------- proton-c/bindings/go/CMakeLists.txt | 56 +++++++------------------------- 1 file changed, 12 insertions(+), 44 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/22c3ee91/proton-c/bindings/go/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/go/CMakeLists.txt b/proton-c/bindings/go/CMakeLists.txt index b1ed962..cea6671 100644 --- a/proton-c/bindings/go/CMakeLists.txt +++ b/proton-c/bindings/go/CMakeLists.txt @@ -22,13 +22,14 @@ execute_process(COMMAND ${GO_EXE} version OUTPUT_VARIABLE go_ver OUTPUT_STRIP_TR message(STATUS "Found Go: ${GO_EXE} (${go_ver})") set(GO_BUILD_FLAGS "" CACHE STRING "Flags for 'go build'") -set(GO_TEST_FLAGS "-v" CACHE STRING "Flags for 'go test'") # Flags that differ for golang go and gcc go. -if (go_out MATCHES "gccgo") +if (go_ver MATCHES "gccgo") # TODO aconway 2015-10-08: import cycles with -race under gccgo, investigate. + set(GO_TEST_FLAGS "-v" CACHE STRING "Flags for 'go test'") set(GO_RPATH_FLAGS -gccgoflags "-Wl,-rpath=${CMAKE_BINARY_DIR}/proton-c") else() + set(GO_TEST_FLAGS "-v -race" CACHE STRING "Flags for 'go test'") set(GO_RPATH_FLAGS -ldflags "-r ${CMAKE_BINARY_DIR}/proton-c") endif() @@ -48,52 +49,19 @@ set(GO_BUILD ${GO} build ${GO_BUILD_FLAGS} ${GO_RPATH_FLAGS} CACHE INTERNAL "Run set(GO_INSTALL ${GO} install ${GO_BUILD_FLAGS} CACHE INTERNAL "Run go install" ) set(GO_TEST ${GO} test ${GO_BUILD_FLAGS} ${GO_RPATH_FLAGS} ${GO_TEST_FLAGS} CACHE INTERNAL "Run go test") -# Go build depends on the C headers -file(GLOB cheaders ${CMAKE_SOURCE_DIR}/proton_c/include/proton/*.h) -set(cdepends ${headers} qpid-proton) - # Go tools insist on standard Go layout which puts compiled code in the source tree :( # Build output is all under git-ignored pkg or bin subdirectories, they are removed by make clean. -foreach (pkg amqp proton electron) - - set(package "qpid.apache.org/${pkg}") - - # Get the target library location - macro(go_list var template) - execute_process(COMMAND ${GO} list -f "${template}" ${package} - OUTPUT_VARIABLE ${var} OUTPUT_STRIP_TRAILING_WHITESPACE) - endmacro() - go_list(lib "{{.Target}}") - - # Get package sources - go_list(dir "{{.Dir}}") - macro(go_sources field) - go_list(${field} "{{range .${field}}}${dir}/{{.}};{{end}}") - endmacro() - go_sources(GoFiles) - go_sources(CgoFiles) - set(sources "${GoFiles}${CgoFiles}") - - # Build the package library - add_custom_command( - OUTPUT ${lib} COMMAND ${GO_INSTALL} ${package} - DEPENDS ${sources} ${cdepends} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) - set(target go-package-${pkg}) - add_custom_target(${target} ALL DEPENDS ${lib}) - # Package test - go_sources(TestGoFiles) - set(test_exe ${CMAKE_CURRENT_BINARY_DIR}/${pkg}.test) - add_custom_command( - OUTPUT ${test_exe} COMMAND ${GO_TEST} -c -o ${test_exe} ${package} - DEPENDS ${sources} ${cdepends} qpid-proton - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) - add_custom_target(go-package-test-${pkg} ALL DEPENDS ${test_exe}) - add_test(NAME go_test_${pkg} COMMAND ${test_exe} WORKING_DIRECTORY ${dir}) +# The go build tools handle dependency checks and incremental builds better than +# CMake so just run them every time, they do nothing if nothing needs to be +# done. +add_custom_target(go-build ALL + COMMAND ${GO_INSTALL} qpid.apache.org/... + WORKING_DIRECTORY $ENV{PWD}) # get error filenames relative to the directory you ran 'make' in - list(APPEND targets ${target}) -endforeach() +add_test( + NAME go-test COMMAND ${GO_TEST} qpid.apache.org/... + WORKING_DIRECTORY $ENV{PWD}) # Make available to examples/go/CMakeLists set(GO_TARGETS ${targets} CACHE INTERNAL "Go package library targets") --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org For additional commands, e-mail: commits-help@qpid.apache.org