From f00e842609cf659e6f4ce625c09bfb8058f9d5bd Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 18 Feb 2022 08:48:36 -0800 Subject: [PATCH] Enable GRPC_ERROR_IS_ABSEIL_STATUS (#28898) * Python support * Fix Ruby errors * Eanble GRPC_ERROR_IS_ABSEIL_STATUS * Remove use_abseil_status=true build --- BUILD | 5 ----- bazel/grpc_build_system.bzl | 4 ---- include/grpc/impl/codegen/port_platform.h | 4 +--- src/python/grpcio_tests/tests/unit/_rpc_part_1_test.py | 6 ++---- src/ruby/lib/grpc/errors.rb | 2 +- tools/internal_ci/linux/grpc_bazel_build_in_docker.sh | 7 ------- 6 files changed, 4 insertions(+), 24 deletions(-) diff --git a/BUILD b/BUILD index 7d79013ea12..f0a7fe28beb 100644 --- a/BUILD +++ b/BUILD @@ -143,11 +143,6 @@ config_setting( values = {"define": "use_strict_warning=true"}, ) -config_setting( - name = "use_abseil_status", - values = {"define": "use_abseil_status=true"}, -) - python_config_settings() # This should be updated along with build_handwritten.yaml diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index e7a2676ac8e..190904657f5 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -177,10 +177,6 @@ def grpc_cc_library( "//:grpc_allow_exceptions": ["GRPC_ALLOW_EXCEPTIONS=1"], "//:grpc_disallow_exceptions": ["GRPC_ALLOW_EXCEPTIONS=0"], "//conditions:default": [], - }) + - select({ - "//:use_abseil_status": ["GRPC_ERROR_IS_ABSEIL_STATUS=1"], - "//conditions:default": [], }), hdrs = hdrs + public_hdrs, deps = deps + _get_external_deps(external_deps), diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index 3227f5115bd..a28b0311c40 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -51,9 +51,7 @@ /* * Defines GRPC_ERROR_IS_ABSEIL_STATUS to use absl::Status for grpc_error_handle */ -#ifndef GRPC_ERROR_IS_ABSEIL_STATUS -// #define GRPC_ERROR_IS_ABSEIL_STATUS 1 -#endif +#define GRPC_ERROR_IS_ABSEIL_STATUS 1 /* Get windows.h included everywhere (we need it) */ #if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32) diff --git a/src/python/grpcio_tests/tests/unit/_rpc_part_1_test.py b/src/python/grpcio_tests/tests/unit/_rpc_part_1_test.py index 1c0886cc069..c3354a621a1 100644 --- a/src/python/grpcio_tests/tests/unit/_rpc_part_1_test.py +++ b/src/python/grpcio_tests/tests/unit/_rpc_part_1_test.py @@ -114,10 +114,8 @@ class RPCPart1Test(BaseRPCTest, unittest.TestCase): # sanity checks on to make sure returned string contains default members # of the error debug_error_string = exception_context.exception.debug_error_string() - self.assertIn('created', debug_error_string) - self.assertIn('description', debug_error_string) - self.assertIn('file', debug_error_string) - self.assertIn('file_line', debug_error_string) + self.assertIn('grpc_status', debug_error_string) + self.assertIn('grpc_message', debug_error_string) def testFailedUnaryRequestFutureUnaryResponse(self): request = b'\x37\x17' diff --git a/src/ruby/lib/grpc/errors.rb b/src/ruby/lib/grpc/errors.rb index 1ab0811d327..1fceb6ba447 100644 --- a/src/ruby/lib/grpc/errors.rb +++ b/src/ruby/lib/grpc/errors.rb @@ -43,7 +43,7 @@ module GRPC debug_error_string = nil) exception_message = "#{code}:#{details}" if debug_error_string - exception_message += ". debug_error_string:#{debug_error_string}" + exception_message += ". debug_error_string:{#{debug_error_string}}" end super(exception_message) @code = code diff --git a/tools/internal_ci/linux/grpc_bazel_build_in_docker.sh b/tools/internal_ci/linux/grpc_bazel_build_in_docker.sh index 5043e312b98..21c4bb2472e 100755 --- a/tools/internal_ci/linux/grpc_bazel_build_in_docker.sh +++ b/tools/internal_ci/linux/grpc_bazel_build_in_docker.sh @@ -38,13 +38,6 @@ bazel build --define=use_strict_warning=true \ //examples/... \ -//examples/android/binder/... -# TODO(veblush): Remove this test after migration to abseil-status is done. -bazel build --define=use_strict_warning=true --define=use_abseil_status=true \ - -- \ - //src/core/... \ - //src/compiler/... \ - //test/... - # TODO(jtattersmusch): Adding a build here for --define=grpc_no_xds is not ideal # and we should find a better place for this. Refer # https://github.com/grpc/grpc/pull/24536#pullrequestreview-517466531 for more