Protocol Buffers - Google's data interchange format (grpc依赖) https://developers.google.com/protocol-buffers/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

318 lines
10 KiB

Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
// -----------------------------------------------------------------------------
// Ruby <-> upb data conversion functions.
//
// This file Also contains a few other assorted algorithms on upb_MessageValue.
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
//
// None of the algorithms in this file require any access to the internal
// representation of Ruby or upb objects.
// -----------------------------------------------------------------------------
#include "convert.h"
#include "message.h"
#include "protobuf.h"
#include "shared_convert.h"
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
static upb_StringView Convert_StringData(VALUE str, upb_Arena* arena) {
upb_StringView ret;
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
if (arena) {
char* ptr = upb_Arena_Malloc(arena, RSTRING_LEN(str));
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
memcpy(ptr, RSTRING_PTR(str), RSTRING_LEN(str));
ret.data = ptr;
} else {
// Data is only needed temporarily (within map lookup).
ret.data = RSTRING_PTR(str);
}
ret.size = RSTRING_LEN(str);
return ret;
}
static bool is_ruby_num(VALUE value) {
return (TYPE(value) == T_FLOAT || TYPE(value) == T_FIXNUM ||
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
TYPE(value) == T_BIGNUM);
}
static void Convert_CheckInt(const char* name, upb_CType type, VALUE val) {
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
if (!is_ruby_num(val)) {
rb_raise(cTypeError,
"Expected number type for integral field '%s' (given %s).", name,
rb_class2name(CLASS_OF(val)));
}
// NUM2{INT,UINT,LL,ULL} macros do the appropriate range checks on upper
// bound; we just need to do precision checks (i.e., disallow rounding) and
// check for < 0 on unsigned types.
if (TYPE(val) == T_FLOAT) {
double dbl_val = NUM2DBL(val);
if (floor(dbl_val) != dbl_val) {
rb_raise(rb_eRangeError,
"Non-integral floating point value assigned to integer field "
"'%s' (given %s).",
name, rb_class2name(CLASS_OF(val)));
}
}
if (type == kUpb_CType_UInt32 || type == kUpb_CType_UInt64) {
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
if (NUM2DBL(val) < 0) {
rb_raise(
rb_eRangeError,
"Assigning negative value to unsigned integer field '%s' (given %s).",
name, rb_class2name(CLASS_OF(val)));
}
}
}
static int32_t Convert_ToEnum(VALUE value, const char* name,
const upb_EnumDef* e) {
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
int32_t val;
switch (TYPE(value)) {
case T_FLOAT:
case T_FIXNUM:
case T_BIGNUM:
Convert_CheckInt(name, kUpb_CType_Int32, value);
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
val = NUM2INT(value);
break;
case T_STRING: {
const upb_EnumValueDef* ev = upb_EnumDef_FindValueByNameWithSize(
e, RSTRING_PTR(value), RSTRING_LEN(value));
if (!ev) goto unknownval;
val = upb_EnumValueDef_Number(ev);
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
break;
}
case T_SYMBOL: {
const upb_EnumValueDef* ev =
upb_EnumDef_FindValueByName(e, rb_id2name(SYM2ID(value)));
if (!ev) goto unknownval;
val = upb_EnumValueDef_Number(ev);
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
break;
}
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
default:
rb_raise(cTypeError,
"Expected number or symbol type for enum field '%s'.", name);
}
return val;
unknownval:
rb_raise(rb_eRangeError, "Unknown symbol value for enum field '%s'.", name);
}
upb_MessageValue Convert_RubyToUpb(VALUE value, const char* name,
TypeInfo type_info, upb_Arena* arena) {
upb_MessageValue ret;
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
switch (type_info.type) {
case kUpb_CType_Float:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
if (!is_ruby_num(value)) {
rb_raise(cTypeError,
"Expected number type for float field '%s' (given %s).", name,
rb_class2name(CLASS_OF(value)));
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
}
ret.float_val = NUM2DBL(value);
break;
case kUpb_CType_Double:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
if (!is_ruby_num(value)) {
rb_raise(cTypeError,
"Expected number type for double field '%s' (given %s).", name,
rb_class2name(CLASS_OF(value)));
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
}
ret.double_val = NUM2DBL(value);
break;
case kUpb_CType_Bool: {
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
if (value == Qtrue) {
ret.bool_val = 1;
} else if (value == Qfalse) {
ret.bool_val = 0;
} else {
rb_raise(cTypeError,
"Invalid argument for boolean field '%s' (given %s).", name,
rb_class2name(CLASS_OF(value)));
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
}
break;
}
case kUpb_CType_String: {
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
VALUE utf8 = rb_enc_from_encoding(rb_utf8_encoding());
if (rb_obj_class(value) == rb_cSymbol) {
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
value = rb_funcall(value, rb_intern("to_s"), 0);
Fix TypeError when passing an instance of a subclass of String to a string field (#13818) ## Issue When an object that is an instance of a string-derived class is passed to a string field in a protobuf message in Ruby, it results in a `Google::Protobuf::TypeError`. ### Steps to reproduce ```rb ~/src/github.com/protocolbuffers/protobuf/ruby/tests ❯❯❯ irb -I . irb(main):001:0> require 'basic_test_pb' => true irb(main):002:0> myString = Class.new(String) => #<Class:0x00000001531540d8> irb(main):003:0> str = myString.new("foo") => "foo" irb(main):004:0> BasicTest::TestMessage.new(optional_string: "foo") => <BasicTest::TestMessage: optional_string: "foo", repeated_int32: [], repeated_int64: [], repeated_uint32: [], repeated_uint64: [], repeated_bool: [], repeated_float: [], repeated_double: [], repeated_string: [], repeated_bytes: [], repeated_msg: [], repeated_enum: []> irb(main):005:0> BasicTest::TestMessage.new(optional_string: str) (irb):5:in `initialize': Invalid argument for string field 'optional_string' (given #<Class:0x00000001531540d8>). (Google::Protobuf::TypeError) irb(main):006:0> ``` ## Fix The issue appears to be caused by the field checking mechanism not properly handling instances of classes that inherit from basic types like String. My proposed solution is to improve the type checking for string fields to consider not just String instances but also instances of subclasses of String. ## Impact The changes will allow instances of classes derived from String to be passed to string fields without any error. This is a backwards-compatible change and will not affect the existing behaviour with standard String instances. Closes #13818 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/13818 from NotFounds:support-string-subclass-for-ruby 2d2796c4f96d5a182a269b54e893f436f2211ea2 PiperOrigin-RevId: 590941235
12 months ago
} else if (!rb_obj_is_kind_of(value, rb_cString)) {
rb_raise(cTypeError,
"Invalid argument for string field '%s' (given %s).", name,
rb_class2name(CLASS_OF(value)));
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
}
if (rb_obj_encoding(value) != utf8) {
// Note: this will not duplicate underlying string data unless
// necessary.
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
value = rb_str_encode(value, utf8, 0, Qnil);
if (rb_enc_str_coderange(value) == ENC_CODERANGE_BROKEN) {
rb_raise(rb_eEncodingError, "String is invalid UTF-8");
}
}
ret.str_val = Convert_StringData(value, arena);
break;
}
case kUpb_CType_Bytes: {
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
VALUE bytes = rb_enc_from_encoding(rb_ascii8bit_encoding());
if (rb_obj_class(value) != rb_cString) {
rb_raise(cTypeError,
"Invalid argument for bytes field '%s' (given %s).", name,
rb_class2name(CLASS_OF(value)));
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
}
if (rb_obj_encoding(value) != bytes) {
// Note: this will not duplicate underlying string data unless
// necessary.
// TODO: is this really necessary to get raw bytes?
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
value = rb_str_encode(value, bytes, 0, Qnil);
}
ret.str_val = Convert_StringData(value, arena);
break;
}
case kUpb_CType_Message:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
ret.msg_val =
Message_GetUpbMessage(value, type_info.def.msgdef, name, arena);
break;
case kUpb_CType_Enum:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
ret.int32_val = Convert_ToEnum(value, name, type_info.def.enumdef);
break;
case kUpb_CType_Int32:
case kUpb_CType_Int64:
case kUpb_CType_UInt32:
case kUpb_CType_UInt64:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
Convert_CheckInt(name, type_info.type, value);
switch (type_info.type) {
case kUpb_CType_Int32:
ret.int32_val = NUM2INT(value);
break;
case kUpb_CType_Int64:
ret.int64_val = NUM2LL(value);
break;
case kUpb_CType_UInt32:
ret.uint32_val = NUM2UINT(value);
break;
case kUpb_CType_UInt64:
ret.uint64_val = NUM2ULL(value);
break;
default:
break;
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
}
break;
default:
rb_raise(cTypeError,
"Convert_RubyToUpb(): Unexpected type %d", (int)type_info.type);
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
}
return ret;
}
VALUE Convert_UpbToRuby(upb_MessageValue upb_val, TypeInfo type_info,
VALUE arena) {
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
switch (type_info.type) {
case kUpb_CType_Float:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
return DBL2NUM(upb_val.float_val);
case kUpb_CType_Double:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
return DBL2NUM(upb_val.double_val);
case kUpb_CType_Bool:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
return upb_val.bool_val ? Qtrue : Qfalse;
case kUpb_CType_Int32:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
return INT2NUM(upb_val.int32_val);
case kUpb_CType_Int64:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
return LL2NUM(upb_val.int64_val);
case kUpb_CType_UInt32:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
return UINT2NUM(upb_val.uint32_val);
case kUpb_CType_UInt64:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
return ULL2NUM(upb_val.int64_val);
case kUpb_CType_Enum: {
const upb_EnumValueDef* ev = upb_EnumDef_FindValueByNumber(
type_info.def.enumdef, upb_val.int32_val);
if (ev) {
return ID2SYM(rb_intern(upb_EnumValueDef_Name(ev)));
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
} else {
return INT2NUM(upb_val.int32_val);
}
}
case kUpb_CType_String: {
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
VALUE str_rb = rb_str_new(upb_val.str_val.data, upb_val.str_val.size);
rb_enc_associate(str_rb, rb_utf8_encoding());
rb_obj_freeze(str_rb);
return str_rb;
}
case kUpb_CType_Bytes: {
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
VALUE str_rb = rb_str_new(upb_val.str_val.data, upb_val.str_val.size);
rb_enc_associate(str_rb, rb_ascii8bit_encoding());
rb_obj_freeze(str_rb);
return str_rb;
}
case kUpb_CType_Message:
return Message_GetRubyWrapper((upb_Message*)upb_val.msg_val,
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
type_info.def.msgdef, arena);
default:
rb_raise(rb_eRuntimeError, "Convert_UpbToRuby(): Unexpected type %d",
(int)type_info.type);
}
}
upb_MessageValue Msgval_DeepCopy(upb_MessageValue msgval, TypeInfo type_info,
upb_Arena* arena) {
upb_MessageValue new_msgval;
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
switch (type_info.type) {
default:
memcpy(&new_msgval, &msgval, sizeof(msgval));
break;
case kUpb_CType_String:
case kUpb_CType_Bytes: {
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
size_t n = msgval.str_val.size;
char* mem = upb_Arena_Malloc(arena, n);
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
new_msgval.str_val.data = mem;
new_msgval.str_val.size = n;
memcpy(mem, msgval.str_val.data, n);
break;
}
case kUpb_CType_Message:
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
new_msgval.msg_val =
Message_deep_copy(msgval.msg_val, type_info.def.msgdef, arena);
break;
}
return new_msgval;
}
bool Msgval_IsEqual(upb_MessageValue val1, upb_MessageValue val2,
TypeInfo type_info) {
upb_Status status;
upb_Status_Clear(&status);
bool return_value = shared_Msgval_IsEqual(val1, val2, type_info.type,
type_info.def.msgdef, &status);
if (upb_Status_IsOk(&status)) {
return return_value;
} else {
rb_raise(rb_eRuntimeError, "Msgval_IsEqual(): %s",
upb_Status_ErrorMessage(&status));
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
}
}
uint64_t Msgval_GetHash(upb_MessageValue val, TypeInfo type_info,
uint64_t seed) {
upb_Status status;
upb_Status_Clear(&status);
uint64_t return_value = shared_Msgval_GetHash(
val, type_info.type, type_info.def.msgdef, seed, &status);
if (upb_Status_IsOk(&status)) {
return return_value;
} else {
rb_raise(rb_eRuntimeError, "Msgval_GetHash(): %s",
upb_Status_ErrorMessage(&status));
Ported Ruby extension to upb_msg (#8184) * WIP. * WIP. * WIP. * WIP. * WIP. * WIP. * Added some missing files. * WIP. * WIP. * Updated upb. * Extension loads, but crashes immediately. * Gets through the test suite without SEGV! Still a lot of bugs to fix, but it is a major step! 214 tests, 378 assertions, 37 failures, 147 errors, 0 pendings, 0 omissions, 0 notifications 14.0187% passed * Test and build for Ruby 3.0 * Fixed a few more bugs, efficient #inspect is almost done. 214 tests, 134243 assertions, 30 failures, 144 errors, 0 pendings, 0 omissions, 0 notifications 18.6916% passed * Fixed message hash initialization and encode depth checking. 214 tests, 124651 assertions, 53 failures, 70 errors, 0 pendings, 0 omissions, 0 notifications 42.5234% passed * A bunch of fixes to failing tests, now 70% passing. 214 tests, 202091 assertions, 41 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications 70.0935% passed * More than 80% of tests are passing now. 214 tests, 322331 assertions, 30 failures, 9 errors, 0 pendings, 0 omissions, 0 notifications 81.7757% passed Unfortunately there is also a sporadic bug/segfault hanging around that appears to be GC-related. * Add linux/ruby30 and macos/ruby30 * Use rvm master for 3.0.0-preview2 * Over 90% of tests are passing! 214 tests, 349898 assertions, 15 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.5234% passed * Passes all tests! 214 tests, 369388 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed * A bunch of cleanup. 1. Removed a bunch of internal-only symbols from headers. 2. Required a frozen check to get a non-const pointer to a map or array. 3. De-duplicated the code to get a type argument for Map/RepeatedField. * Removed a bunch more stuff from protobuf.h. There is an intermittent assert failure. Intermittent failure: ruby: ../../../../ext/google/protobuf_c/protobuf.c:263: ObjectCache_Add: Assertion `rb_funcall(obj_cache2, (__builtin_constant_p("[]") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2((("[]") ), (long)strlen(("[]"))); (ID) rb_intern_id_cache; }) : rb_intern("[]")), 1, key_rb) == val' failed * Removed a few more things from protobuf.h. * Ruby 3.0.0-preview2 to 3.0.0 * Require rake-compiler-dock >= 1.1.0 * More progress, fighting with the object cache. * Passes on all Ruby versions! * Updated and clarified comment regarding WeakMap. * Fixed the wyhash compile. * Fixed conformance tests for Ruby. Conformance results now look like: RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 1955 successes, 0 skipped, 58 expected failures, 0 unexpected failures. CONFORMANCE TEST BEGIN ==================================== CONFORMANCE SUITE PASSED: 0 successes, 111 skipped, 8 expected failures, 0 unexpected failures. Fixes include: - Changed Ruby compiler to no longer reject proto2 maps. - Changed Ruby compiler to emit a warning when proto2 extensions are present instead of rejecting the .proto file completely. - Fixed conformance tests to allow proto2 and look up message by name instead of hardcoding a specific list of messages. - Fixed conformance test to support the "ignore unknown" option for JSON. - Fixed conformance test to properly report serialization errors. * Removed debug printf and fixed #inspect for floats. * Fixed compatibility test to have proper semantics for #to_json. * Updated Makefile.am with new file list. * Don't try to copy wyhash when inside Docker. * Fixed bug where we would forget that a sub-object is frozen in Ruby >=2.7. * Avoid exporting unneeded symbols and refactored a bit of code. * Some more refactoring. * Simplified and added more comments. * Some more comments and simplification. Added a missing license block. Co-authored-by: Masaki Hara <hara@wantedly.com>
4 years ago
}
}