Pārlūkot izejas kodu

Add ruby 2.3, 2.4 and 2.5 test for linux. (#5256)

* Add ruby 2.3, 2.4 and 2.5 test for linux.

* Update kokoro files

* Add back commented gc test

* Fix gc_test failure

* Remove unused code

* Update ruby 2.5.0 to 2.5.1

* Update ruby 2.3 to 2.3.8

* Remove useless comment
Paul Yang 7 gadi atpakaļ
vecāks
revīzija
333b3ceab6

+ 17 - 0
kokoro/linux/ruby23/build.sh

@@ -0,0 +1,17 @@
+#!/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 DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="ruby23"
+./kokoro/linux/build_and_run_docker.sh

+ 11 - 0
kokoro/linux/ruby23/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/ruby23/build.sh"
+timeout_mins: 120
+
+action {
+  define_artifacts {
+    regex: "**/sponge_log.xml"
+  }
+}

+ 11 - 0
kokoro/linux/ruby23/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/ruby23/build.sh"
+timeout_mins: 120
+
+action {
+  define_artifacts {
+    regex: "**/sponge_log.xml"
+  }
+}

+ 17 - 0
kokoro/linux/ruby24/build.sh

@@ -0,0 +1,17 @@
+#!/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 DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="ruby24"
+./kokoro/linux/build_and_run_docker.sh

+ 11 - 0
kokoro/linux/ruby24/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/ruby24/build.sh"
+timeout_mins: 120
+
+action {
+  define_artifacts {
+    regex: "**/sponge_log.xml"
+  }
+}

+ 11 - 0
kokoro/linux/ruby24/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/ruby24/build.sh"
+timeout_mins: 120
+
+action {
+  define_artifacts {
+    regex: "**/sponge_log.xml"
+  }
+}

+ 17 - 0
kokoro/linux/ruby25/build.sh

@@ -0,0 +1,17 @@
+#!/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 DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="ruby25"
+./kokoro/linux/build_and_run_docker.sh

+ 11 - 0
kokoro/linux/ruby25/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/ruby25/build.sh"
+timeout_mins: 120
+
+action {
+  define_artifacts {
+    regex: "**/sponge_log.xml"
+  }
+}

+ 11 - 0
kokoro/linux/ruby25/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/ruby25/build.sh"
+timeout_mins: 120
+
+action {
+  define_artifacts {
+    regex: "**/sponge_log.xml"
+  }
+}

+ 2 - 2
ruby/ext/google/protobuf_c/defs.c

@@ -540,8 +540,8 @@ void FileDescriptor_register(VALUE module) {
   rb_define_method(klass, "name", FileDescriptor_name, 0);
   rb_define_method(klass, "name", FileDescriptor_name, 0);
   rb_define_method(klass, "syntax", FileDescriptor_syntax, 0);
   rb_define_method(klass, "syntax", FileDescriptor_syntax, 0);
   rb_define_method(klass, "syntax=", FileDescriptor_syntax_set, 1);
   rb_define_method(klass, "syntax=", FileDescriptor_syntax_set, 1);
-  cFileDescriptor = klass;
   rb_gc_register_address(&cFileDescriptor);
   rb_gc_register_address(&cFileDescriptor);
+  cFileDescriptor = klass;
 }
 }
 
 
 /*
 /*
@@ -2130,7 +2130,7 @@ VALUE Builder_add_file(int argc, VALUE* argv, VALUE _self) {
   rb_funcall_with_block(ctx, rb_intern("instance_eval"), 0, NULL, block);
   rb_funcall_with_block(ctx, rb_intern("instance_eval"), 0, NULL, block);
 
 
   rb_ary_concat(self->pending_list,
   rb_ary_concat(self->pending_list,
-		FileBuilderContext_pending_descriptors(ctx));
+      FileBuilderContext_pending_descriptors(ctx));
   return Qnil;
   return Qnil;
 }
 }
 
 

+ 4 - 8
ruby/tests/gc_test.rb

@@ -6,9 +6,7 @@ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
 old_gc = GC.stress
 old_gc = GC.stress
 GC.stress = 0x01 | 0x04
 GC.stress = 0x01 | 0x04
 require 'generated_code_pb'
 require 'generated_code_pb'
-# TODO(teboring): The following line is commented out for unblocking CI. Add
-# it back when it's fixed.
-# require 'generated_code_proto2_pb'
+require 'generated_code_proto2_pb'
 GC.stress = old_gc
 GC.stress = old_gc
 
 
 require 'test/unit'
 require 'test/unit'
@@ -95,11 +93,9 @@ class GCTest < Test::Unit::TestCase
     data = A::B::C::TestMessage.encode(from)
     data = A::B::C::TestMessage.encode(from)
     to = A::B::C::TestMessage.decode(data)
     to = A::B::C::TestMessage.decode(data)
 
 
-    # TODO(teboring): The following line is commented out for unblocking CI.
-    # Add it back when it's fixed.
-    # from = get_msg_proto2
-    # data = A::B::Proto2::TestMessage.encode(from)
-    # to = A::B::Proto2::TestMessage.decode(data)
+    from = get_msg_proto2
+    data = A::B::Proto2::TestMessage.encode(from)
+    to = A::B::Proto2::TestMessage.decode(data)
     GC.stress = old_gc
     GC.stress = old_gc
     puts "passed"
     puts "passed"
   end
   end

+ 2 - 2
tests.sh

@@ -254,7 +254,7 @@ build_ruby22() {
 }
 }
 build_ruby23() {
 build_ruby23() {
   internal_build_cpp  # For conformance tests.
   internal_build_cpp  # For conformance tests.
-  cd ruby && bash travis-test.sh ruby-2.3 && cd ..
+  cd ruby && bash travis-test.sh ruby-2.3.8 && cd ..
 }
 }
 build_ruby24() {
 build_ruby24() {
   internal_build_cpp  # For conformance tests.
   internal_build_cpp  # For conformance tests.
@@ -262,7 +262,7 @@ build_ruby24() {
 }
 }
 build_ruby25() {
 build_ruby25() {
   internal_build_cpp  # For conformance tests.
   internal_build_cpp  # For conformance tests.
-  cd ruby && bash travis-test.sh ruby-2.5.0 && cd ..
+  cd ruby && bash travis-test.sh ruby-2.5.1 && cd ..
 }
 }
 build_ruby_all() {
 build_ruby_all() {
   build_ruby23
   build_ruby23