Эх сурвалжийг харах

Add ruby 2.6 test (#5528)

* Add ruby 2.6 test

* Fix broken tests

* Fix compatibility test

* Fix bundler version

* Use new docker image

* Fix broken test

* Use new docker image in ruby26 test

* Install ruby for mac
Paul Yang 6 жил өмнө
parent
commit
de9e1a04a6

+ 37 - 0
kokoro/linux/dockerfile/test/ruby/Dockerfile

@@ -0,0 +1,37 @@
+FROM debian:jessie
+
+# Install dependencies.  We start with the basic ones require to build protoc
+# and the C++ build
+RUN apt-get update && apt-get install -y \
+  autoconf \
+  autotools-dev \
+  build-essential \
+  bzip2 \
+  ccache \
+  curl \
+  gcc \
+  git \
+  libc6 \
+  libc6-dbg \
+  libc6-dev \
+  libgtest-dev \
+  libtool \
+  make \
+  parallel \
+  time \
+  wget \
+  && apt-get clean
+
+# Install rvm
+RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys \
+    409B6B1796C275462A1703113804BB82D39DC0E3 \
+    7D2BAF1CF37B13E2069D6956105BD0E739499BDB
+RUN \curl -sSL https://get.rvm.io | bash -s stable
+
+RUN /bin/bash -l -c "rvm install 2.3.8"
+RUN /bin/bash -l -c "rvm install 2.4.5"
+RUN /bin/bash -l -c "rvm install 2.5.1"
+RUN /bin/bash -l -c "rvm install 2.6.0"
+
+RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
+RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"

+ 2 - 1
kokoro/linux/ruby23/build.sh

@@ -10,7 +10,8 @@
 # Change to repo root
 cd $(dirname $0)/../../..
 
-export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKERHUB_ORGANIZATION=protobuftesting
+export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/ruby
 export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
 export OUTPUT_DIR=testoutput
 export TEST_SET="ruby23"

+ 2 - 1
kokoro/linux/ruby24/build.sh

@@ -10,7 +10,8 @@
 # Change to repo root
 cd $(dirname $0)/../../..
 
-export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKERHUB_ORGANIZATION=protobuftesting
+export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/ruby
 export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
 export OUTPUT_DIR=testoutput
 export TEST_SET="ruby24"

+ 2 - 1
kokoro/linux/ruby25/build.sh

@@ -10,7 +10,8 @@
 # Change to repo root
 cd $(dirname $0)/../../..
 
-export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKERHUB_ORGANIZATION=protobuftesting
+export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/ruby
 export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
 export OUTPUT_DIR=testoutput
 export TEST_SET="ruby25"

+ 18 - 0
kokoro/linux/ruby26/build.sh

@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image.  Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERHUB_ORGANIZATION=protobuftesting
+export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/ruby
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="ruby26"
+./kokoro/linux/build_and_run_docker.sh

+ 11 - 0
kokoro/linux/ruby26/continuous.cfg

@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/ruby26/build.sh"
+timeout_mins: 120
+
+action {
+  define_artifacts {
+    regex: "**/sponge_log.xml"
+  }
+}

+ 11 - 0
kokoro/linux/ruby26/presubmit.cfg

@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/ruby26/build.sh"
+timeout_mins: 120
+
+action {
+  define_artifacts {
+    regex: "**/sponge_log.xml"
+  }
+}

+ 11 - 0
kokoro/macos/ruby26/build.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# Build file to set up and run tests
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+# Prepare worker environment to run tests
+source kokoro/macos/prepare_build_macos_rc
+
+./tests.sh ruby26

+ 5 - 0
kokoro/macos/ruby26/continuous.cfg

@@ -0,0 +1,5 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/macos/ruby26/build.sh"
+timeout_mins: 1440

+ 5 - 0
kokoro/macos/ruby26/presubmit.cfg

@@ -0,0 +1,5 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/macos/ruby26/build.sh"
+timeout_mins: 1440

+ 1 - 0
ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb

@@ -19,6 +19,7 @@ class RepeatedFieldTest < Test::Unit::TestCase
     arr_methods -= [ :indices, :iter_for_each, :iter_for_each_index,
       :iter_for_each_with_index, :dimensions, :copy_data, :copy_data_simple,
       :nitems, :iter_for_reverse_each, :indexes, :append, :prepend]
+    arr_methods -= [:union, :difference, :filter!]
     arr_methods.each do |method_name|
       assert m.repeated_string.respond_to?(method_name) == true, "does not respond to #{method_name}"
     end

+ 1 - 0
ruby/tests/repeated_field_test.rb

@@ -19,6 +19,7 @@ class RepeatedFieldTest < Test::Unit::TestCase
     arr_methods -= [ :indices, :iter_for_each, :iter_for_each_index,
       :iter_for_each_with_index, :dimensions, :copy_data, :copy_data_simple,
       :nitems, :iter_for_reverse_each, :indexes, :append, :prepend]
+    arr_methods -= [:union, :difference, :filter!]
     arr_methods.each do |method_name|
       assert m.repeated_string.respond_to?(method_name) == true, "does not respond to #{method_name}"
     end

+ 12 - 1
ruby/travis-test.sh

@@ -13,12 +13,23 @@ test_version() {
        git clean -f && \
        gem install bundler && bundle && \
        rake test"
+  elif [ "$version" == "ruby-2.6.0" ] ; then
+    bash --login -c \
+      "rvm install $version && rvm use $version && \
+       which ruby && \
+       git clean -f && \
+       gem install bundler -v 1.17.3 && bundle && \
+       rake test &&
+       rake gc_test &&
+       cd ../conformance && make test_ruby &&
+       cd ../ruby/compatibility_tests/v3.0.0 &&
+       cp -R ../../lib lib && ./test.sh"
   else
     bash --login -c \
       "rvm install $version && rvm use $version && \
        which ruby && \
        git clean -f && \
-       gem install bundler && bundle && \
+       gem install bundler -v 1.17.3 && bundle && \
        rake test &&
        rake gc_test &&
        cd ../conformance && make test_ruby &&

+ 4 - 4
tests.sh

@@ -322,10 +322,9 @@ build_ruby25() {
   internal_build_cpp  # For conformance tests.
   cd ruby && bash travis-test.sh ruby-2.5.1 && cd ..
 }
-build_ruby_all() {
-  build_ruby23
-  build_ruby24
-  build_ruby25
+build_ruby26() {
+  internal_build_cpp  # For conformance tests.
+  cd ruby && bash travis-test.sh ruby-2.6.0 && cd ..
 }
 
 build_javascript() {
@@ -616,6 +615,7 @@ Usage: $0 { cpp |
             ruby23 |
             ruby24 |
             ruby25 |
+            ruby26 |
             jruby |
             ruby_all |
             php5.5   |