qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject qpid-proton git commit: PROTON-1762: [ruby] ruby-gem tests, examples and self-test
Date Thu, 15 Feb 2018 19:58:24 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master 9a8f9f59a -> 6b1518605


PROTON-1762: [ruby] ruby-gem tests, examples and self-test

- ctests to install and smoke test the gem with the example self-tests
- package ruby/tests/ and examples/ruby directories in ruby gem


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/6b151860
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/6b151860
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/6b151860

Branch: refs/heads/master
Commit: 6b15186051f7f535cdf2be38cac1355abaa8687c
Parents: 9a8f9f5
Author: Alan Conway <aconway@redhat.com>
Authored: Wed Feb 14 17:11:56 2018 -0500
Committer: Alan Conway <aconway@redhat.com>
Committed: Thu Feb 15 14:41:18 2018 -0500

----------------------------------------------------------------------
 proton-c/bindings/ruby/CMakeLists.txt         | 32 +++++++++++++++++++---
 proton-c/bindings/ruby/qpid_proton.gemspec.in |  2 ++
 2 files changed, 30 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6b151860/proton-c/bindings/ruby/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/CMakeLists.txt b/proton-c/bindings/ruby/CMakeLists.txt
index 8df7b55..039dea8 100644
--- a/proton-c/bindings/ruby/CMakeLists.txt
+++ b/proton-c/bindings/ruby/CMakeLists.txt
@@ -52,19 +52,43 @@ file(GLOB_RECURSE RUBY_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.rb *.rdoc)
 find_program(GEM_EXE gem DOC "Program to build and install ruby gem packages")
 mark_as_advanced(GEM_EXE)
 if (GEM_EXE)
+  set(GEM_FILE "${bin}/gem/qpid_proton-${PN_VERSION}.gem")
   # Copy source and generated files to the build tree so we can build the gem in one place
   configure_file(${src}/qpid_proton.gemspec.in ${bin}/gem/qpid_proton.gemspec)
   add_custom_command(
-    OUTPUT ${bin}/qpid_proton-${PN_VERSION}.gem
+    OUTPUT ${GEM_FILE}
     COMMAND ${CMAKE_COMMAND} -E copy_directory ${src} ${bin}/gem
+    COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/ruby/ ${bin}/gem/examples
     COMMAND ${CMAKE_COMMAND} -E copy ${bin}/cprotonRUBY_wrap.c ${bin}/gem/ext/cproton/cproton.c
     COMMAND ${GEM_EXE} build qpid_proton.gemspec
-    COMMAND ${CMAKE_COMMAND} -E copy ${bin}/gem/qpid_proton-${PN_VERSION}.gem ${bin}
     WORKING_DIRECTORY ${bin}/gem
-    DEPENDS ${RUBY_SRC} ${src}/LICENSE ${src}/TODO ${src}/ChangeLog cproton-ruby ${bin}/cprotonRUBY_wrap.c
+    DEPENDS ${bin}/gem/qpid_proton.gemspec ${RUBY_SRC} ${src}/LICENSE ${src}/TODO ${src}/ChangeLog
+    cproton-ruby
+    # NOTE: cproton-ruby is not strictly a dependency, we only need
+    # cprotonRUBY_wrap.c which is generated as a side effect of
+    # cproton-ruby. However it is easier to depend on cproton-ruby than to work
+    # around CMake's issues with dependencies on add_custom_command output in
+    # parallel builds.
     )
 
-  add_custom_target(ruby-gem ALL DEPENDS ${bin}/qpid_proton-${PN_VERSION}.gem )
+  add_custom_target(ruby-gem ALL DEPENDS ${GEM_FILE})
+
+  # Test installing the gem
+  to_native_path("${bin}/install" gem_home)
+  set(gem_env ${env_py} -- "GEM_HOME=${gem_home}" "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/proton-c")
+  add_test(
+    NAME ruby-gem-install COMMAND ${gem_env} ${GEM_EXE} install "${GEM_FILE}" --
+    "--with-qpid-proton-include=${CMAKE_SOURCE_DIR}/proton-c/include"
+    "--with-qpid-proton-lib=${CMAKE_BINARY_DIR}/proton-c"
+    )
+
+  # Test running examples against the installed gem
+  add_test(
+    NAME ruby-gem-examples
+    COMMAND ${gem_env} ${RUBY_EXECUTABLE} example_test.rb -v
+    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/examples/ruby
+    )
+  SET_TESTS_PROPERTIES(ruby-gem-examples PROPERTIES DEPENDS ruby-gem-install) # Run after
install
 endif ()
 
 ## CMake-based install

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6b151860/proton-c/bindings/ruby/qpid_proton.gemspec.in
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/qpid_proton.gemspec.in b/proton-c/bindings/ruby/qpid_proton.gemspec.in
index a78f25b..58f3614 100644
--- a/proton-c/bindings/ruby/qpid_proton.gemspec.in
+++ b/proton-c/bindings/ruby/qpid_proton.gemspec.in
@@ -26,6 +26,8 @@ EOF
                 "ext/cproton/*.rb",
                 "ext/cproton/*.c",
                 "lib/**/*.rb",
+                "tests/**/*.rb",
+                "examples/**/*"
                 ]
   s.require_path = 'lib'
   s.required_ruby_version = '>=  1.9.3'


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message