qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [1/2] qpid-proton git commit: PROTON-1075: go: Enable -race by default for go tests, use go tools for dependency checking.
Date Fri, 11 Dec 2015 18:14:30 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master d9c0ed5a4 -> 3f4dc74a4


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/master
Commit: 22c3ee91039d0a53730e60b94bf6cb7dddc24bce
Parents: d9c0ed5
Author: Alan Conway <aconway@redhat.com>
Authored: Fri Dec 11 12:11:44 2015 -0500
Committer: Alan Conway <aconway@redhat.com>
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


Mime
View raw message