bazel 9 tests for csharp, hpb, objc, php, python, rust and upb

PiperOrigin-RevId: 918164613
This commit is contained in:
Jie Luo 2026-05-19 19:56:10 -07:00 committed by Copybara-Service
parent 46a1d94e94
commit f9e028f29f
25 changed files with 96 additions and 65 deletions

View file

@ -52,7 +52,7 @@ jobs:
# commit.
uses: protocolbuffers/protobuf-ci/bazel@v5
with:
version: 8.0.1 # Bazel version
version: 9.0.0 # Bazel version
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: staleness
bash: >

View file

@ -27,7 +27,7 @@ jobs:
- name: Run tests
uses: protocolbuffers/protobuf-ci/docker@v5
with:
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:8.0.1-3.1.415-6.0.100-b77fdae6d4771789dfc66a56bf8d806354e8011a
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:9.0.0-3.1.415-6.0.100-9fc33a0c378b5affd3c85d3f5ae4f330993048f7
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
entrypoint: /bin/bash
command: >-
@ -43,7 +43,7 @@ jobs:
- name: Run conformance tests
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
with:
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:8.0.1-3.1.415-6.0.100-b77fdae6d4771789dfc66a56bf8d806354e8011a
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:9.0.0-3.1.415-6.0.100-9fc33a0c378b5affd3c85d3f5ae4f330993048f7
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: csharp_linux
bazel: test //csharp:conformance_test --action_env=DOTNET_CLI_TELEMETRY_OPTOUT=1 --test_env=DOTNET_CLI_HOME=/home/bazel
@ -65,7 +65,7 @@ jobs:
- name: Run tests
uses: protocolbuffers/protobuf-ci/bash@v5
with:
bazel-version: 8.0.1
bazel-version: 9.0.0
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
command: |
dotnet build csharp/src/Google.Protobuf.sln

View file

@ -22,7 +22,7 @@ jobs:
include:
- targets: "//hpb/... //hpb_generator/..."
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.0.1-e78301df86b3e4c46ec9ac4d98be00e19305d8f3"
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-7932bf8b25fb76a111e7257d151a6a58d5c3c671"
- bazel_cmd: "test"
name: Linux ${{ matrix.config.name }}

View file

@ -70,7 +70,7 @@ jobs:
CODE_SIGN_IDENTITY: "-"
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-version: 8.0.1
bazel-version: 9.0.0
command: |
xcodebuild \
-project "objectivec/${{ matrix.xc_project }}" \
@ -113,7 +113,7 @@ jobs:
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/bazel@v5
with:
version: 8.0.1 # Bazel version
version: 9.0.0 # Bazel version
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: cocoapods/${{ matrix.XCODE }}
bash: |
@ -161,7 +161,7 @@ jobs:
if: ${{ !matrix.config.continuous-only || inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/bazel@v5
with:
version: 8.0.1 # Bazel version
version: 9.0.0 # Bazel version
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel: ${{ matrix.config.bazel_action }} ${{ matrix.config.flags }} ${{ matrix.bazel_targets }}
bazel-cache: objc_${{ matrix.platform }}_${{ matrix.config.name }}

View file

@ -65,7 +65,7 @@ jobs:
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
with:
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:8.0.1-${{ matrix.version }}-7d856878bb9d57cf17083cbf1078afe50f3013f3
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:9.0.0-${{ matrix.version }}-9fc33a0c378b5affd3c85d3f5ae4f330993048f7
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: php_linux/${{ matrix.version }}
bash: |
@ -115,7 +115,7 @@ jobs:
id: cross-compile
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v5
with:
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.0.1-e78301df86b3e4c46ec9ac4d98be00e19305d8f3
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-7932bf8b25fb76a111e7257d151a6a58d5c3c671
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
architecture: linux-i386
@ -147,7 +147,7 @@ jobs:
id: cross-compile
uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v5
with:
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.0.1-e78301df86b3e4c46ec9ac4d98be00e19305d8f3
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-7932bf8b25fb76a111e7257d151a6a58d5c3c671
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
architecture: linux-aarch64
@ -204,7 +204,7 @@ jobs:
uses: protocolbuffers/protobuf-ci/bash@v5
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-version: 8.0.1
bazel-version: 9.0.0
# TODO this shouldn't be necessary, remove it
bazel-flags: --xcode_version_config=//.github:host_xcodes_macos15
command: |
@ -220,6 +220,6 @@ jobs:
uses: protocolbuffers/protobuf-ci/bazel@v5
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
version: 8.0.1 # Bazel version
version: 9.0.0 # Bazel version
bazel-cache: php_macos15/${{ matrix.version }}
bazel: test //php:conformance_test //php:conformance_test_c --action_env=PATH --test_env=PATH --xcode_version_config=//.github:host_xcodes_macos15

View file

@ -35,7 +35,7 @@ jobs:
- name: Package extension
uses: protocolbuffers/protobuf-ci/bazel@v5
with:
version: 8.0.1 # Bazel version
version: 9.0.0 # Bazel version
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: php_ext/${{ matrix.version }}
bash: >

View file

@ -64,7 +64,7 @@ jobs:
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
with:
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:8.0.1-{0}-5237f14696e60e4b050edfbf7ba9b374f37f83c6', matrix.version) }}
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:9.0.0-{0}-7932bf8b25fb76a111e7257d151a6a58d5c3c671', matrix.version) }}
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: python_linux/${{ matrix.type }}_${{ matrix.version }}
bazel: test ${{ matrix.targets }} ${{ matrix.flags }} ${{ matrix.nobzlmod && '--noenable_bzlmod' || '' }} --test_env=KOKORO_PYTHON_VERSION
@ -115,7 +115,7 @@ jobs:
env:
KOKORO_PYTHON_VERSION: ${{ matrix.version }}
with:
version: 8.0.1 # Bazel version
version: 9.0.0 # Bazel version
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: python_macos/${{ matrix.type }}_${{ matrix.version }}
bazel: >-

View file

@ -24,14 +24,14 @@ jobs:
include:
- targets: "//rust/... //src/google/protobuf/compiler/rust/..."
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.0.1-e78301df86b3e4c46ec9ac4d98be00e19305d8f3"
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:9.0.0-7932bf8b25fb76a111e7257d151a6a58d5c3c671"
- bazel_cmd: "test"
# Override cases with custom images
- config: { name: Cargo }
# We need Rust 1.90 so that we can use the new workspace publishing
# feature.
image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:8.0.1-1.90.0-e1c2fe666ffa9b941b126541a26340d0ea787cea"
image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:9.0.0-1.90.0-98863a45066747115144a8a8fb4818189d1e0761"
bazel_cmd: "run"
targets: "//rust/release_crates:cargo_test"
@ -73,4 +73,4 @@ jobs:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel: run //rust/release_crates:cargo_test
bazel-cache: windows-cargo
version: 8.0.1
version: 9.0.0

View file

@ -74,7 +74,7 @@ jobs:
bazel-cache: "upb-bazel-windows"
# TODO: Enable python tests here once rules_python supports Windows better.
bazel: test //upb/... //upb_generator/...
version: 8.0.1
version: 9.0.0
exclude-targets: -//python:conformance_test -//upb/reflection:def_builder_test
macos:
@ -103,7 +103,7 @@ jobs:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: "upb-bazel-macos"
bazel: ${{ matrix.config.bazel-command }} ${{ matrix.config.flags }} //benchmarks/... //lua/... //python/... //upb/... //upb_generator/...
version: 8.0.1
version: 9.0.0
build_wheels:
name: Build Wheels
@ -117,7 +117,7 @@ jobs:
- name: Build Wheels
uses: protocolbuffers/protobuf-ci/bazel-docker@v5
with:
image: us-docker.pkg.dev/protobuf-build/release-containers/linux/apple:8.0.1-8c286adfa190f9d0caa666ab605189345f362c02
image: us-docker.pkg.dev/protobuf-build/release-containers/linux/apple:9.0.0-9fc33a0c378b5affd3c85d3f5ae4f330993048f7
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: upb-bazel-python
bazel: build --config=cross_config --symlink_prefix=/ -c dbg //python/dist //python/dist:test_wheel //python/dist:source_wheel

View file

@ -8,6 +8,9 @@
#ifndef PYUPB_DESCRIPTOR_H__
#define PYUPB_DESCRIPTOR_H__
// clang-format off
#include "Python.h"
// clang-format on
#include <stdbool.h>
#include "python/python_api.h"

View file

@ -20,6 +20,9 @@
// those functions directly inside these vtables, greatly reducing the amount of
// "adaptor" code we need to write.
// clang-format on
#include "Python.h"
// clang-format off
#include <stdbool.h>
#include "protobuf.h"

View file

@ -8,6 +8,9 @@
#ifndef PYUPB_DESCRIPTOR_POOL_H__
#define PYUPB_DESCRIPTOR_POOL_H__
// clang-format off
#include "Python.h"
// clang-format on
#include <stdbool.h>
#include "protobuf.h"

View file

@ -3,6 +3,8 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
limited_api_build_file = """
load("@rules_cc//cc:defs.bzl", "cc_library")
cc_library(
name = "python_headers",
hdrs = glob(["**/Include/**/*.h"]),
@ -33,6 +35,8 @@ def python_source_archive(version, sha256):
)
nuget_build_file = """
load("@rules_cc//cc:defs.bzl", "cc_import")
cc_import(
name = "python_full_api",
hdrs = glob(["**/*.h"]),

View file

@ -8,6 +8,9 @@
#ifndef PYUPB_EXTENSION_DICT_H__
#define PYUPB_EXTENSION_DICT_H__
// clang-format off
#include "Python.h"
// clang-format on
#include <stdbool.h>
#include "python/python_api.h"

View file

@ -8,6 +8,9 @@
#ifndef PYUPB_MAP_H__
#define PYUPB_MAP_H__
// clang-format off
#include "Python.h"
// clang-format on
#include <stdbool.h>
#include "python/protobuf.h"

View file

@ -8,6 +8,9 @@
#ifndef PYPB_MESSAGE_H__
#define PYPB_MESSAGE_H__
// clang-format off
#include "Python.h"
// clang-format on
#include <stdbool.h>
#include "python/protobuf.h"

View file

@ -8,6 +8,9 @@
#ifndef PYUPB_PROTOBUF_H__
#define PYUPB_PROTOBUF_H__
// clang-format off
#include "Python.h"
// clang-format on
#include <assert.h>
#include <stdbool.h>

View file

@ -8,6 +8,9 @@
#ifndef PYUPB_REPEATED_H__
#define PYUPB_REPEATED_H__
// clang-format off
#include "Python.h"
// chang-format on
#include <stdbool.h>
#include "python/protobuf.h"

View file

@ -8,6 +8,9 @@
#ifndef PYUPB_UNKNOWN_FIELDS_H__
#define PYUPB_UNKNOWN_FIELDS_H__
// clang-format off
#include "Python.h"
// clang-format on
#include <stdbool.h>
#include "python/python_api.h"

View file

@ -108,7 +108,7 @@ TEST(MessageTest, Extensions) {
char* serialized =
upb_test_TestExtensions_serialize(ext_msg, arena.ptr(), &size);
ASSERT_TRUE(serialized != nullptr);
ASSERT_GE(size, 0);
ASSERT_GE(size, 0u);
upb_test_TestExtensions* ext_msg2 = upb_test_TestExtensions_parse_ex(
serialized, size, upb_DefPool_ExtensionRegistry(defpool.ptr()), 0,
@ -167,7 +167,7 @@ TEST(MessageTest, ExtensionsDeterministic) {
char* serialized =
upb_test_TestExtensions_serialize(ext_msg, arena.ptr(), &size);
ASSERT_TRUE(serialized != nullptr);
ASSERT_GE(size, 0);
ASSERT_GE(size, 0u);
size_t deterministic_size;
char* deterministic_serialized = upb_test_TestExtensions_serialize_ex(
@ -216,7 +216,7 @@ TEST(MessageTest, ExtensionsEmpty) {
char* serialized = upb_test_TestExtensions_serialize_ex(
ext_msg_with_empty, options, arena.ptr(), &size_with_empty);
ASSERT_TRUE(serialized != nullptr);
ASSERT_GE(size_with_empty, 0);
ASSERT_GE(size_with_empty, 0u);
size_t size;
serialized = upb_test_TestExtensions_serialize_ex(ext_msg, options,
@ -282,7 +282,7 @@ TEST(MessageTest, MessageSet) {
char* serialized =
upb_test_TestMessageSet_serialize(ext_msg, arena.ptr(), &size);
ASSERT_TRUE(serialized != nullptr);
ASSERT_GE(size, 0);
ASSERT_GE(size, 0u);
upb_test_TestMessageSet* ext_msg2 = upb_test_TestMessageSet_parse_ex(
serialized, size, upb_DefPool_ExtensionRegistry(defpool.ptr()), 0,
@ -328,7 +328,7 @@ TEST(MessageTest, UnknownMessageSet) {
char* serialized =
upb_test_FakeMessageSet_serialize(fake, arena.ptr(), &size);
ASSERT_TRUE(serialized != nullptr);
ASSERT_GE(size, 0);
ASSERT_GE(size, 0u);
upb::DefPool defpool;
upb::MessageDefPtr m(upb_test_TestMessageSet_getmsgdef(defpool.ptr()));
@ -341,7 +341,7 @@ TEST(MessageTest, UnknownMessageSet) {
char* serialized2 =
upb_test_TestMessageSet_serialize(message_set, arena.ptr(), &size);
ASSERT_TRUE(serialized2 != nullptr);
ASSERT_GE(size, 0);
ASSERT_GE(size, 0u);
// Parse back into a fake MessageSet and verify that the unknown MessageSet
// item was preserved in full (both type_id and message).
@ -351,7 +351,7 @@ TEST(MessageTest, UnknownMessageSet) {
const upb_test_FakeMessageSet_Item* const* items =
upb_test_FakeMessageSet_item(fake2, &size);
ASSERT_EQ(1, size);
ASSERT_EQ(1u, size);
EXPECT_EQ(12345, upb_test_FakeMessageSet_Item_type_id(items[0]));
EXPECT_TRUE(upb_StringView_IsEqual(
data_view, upb_test_FakeMessageSet_Item_message(items[0])));
@ -382,7 +382,7 @@ TEST(MessageTest, MessageSetSubmessageEncoding) {
char* serialized =
upb_test_TestExtensions_serialize(ext_msg, arena.ptr(), &size);
ASSERT_TRUE(serialized != nullptr);
ASSERT_GE(size, 0);
ASSERT_GE(size, 0u);
upb::DefPool defpool;
upb::MessageDefPtr m(upb_test_TestMessageSet_getmsgdef(defpool.ptr()));
@ -433,7 +433,7 @@ TEST(MessageTest, Proto2Enum) {
EXPECT_EQ(false, upb_test_Proto2EnumMessage_has_optional_enum(enum_msg));
const int32_t* vals_const =
upb_test_Proto2EnumMessage_repeated_enum(enum_msg, &size);
EXPECT_EQ(4, size); // Two unknown values moved to the unknown field set.
EXPECT_EQ(4u, size); // Two unknown values moved to the unknown field set.
// Parsing back into the fake message shows the original data, except the
// repeated enum is rearranged.
@ -455,12 +455,12 @@ TEST(MessageTest, Proto2Enum) {
};
vals_const = upb_test_Proto2FakeEnumMessage_repeated_enum(fake_msg2, &size);
EXPECT_EQ(6, size);
EXPECT_EQ(6u, size);
EXPECT_THAT(std::vector<int32_t>(vals_const, vals_const + size),
::testing::ElementsAreArray(expected));
vals_const = upb_test_Proto2FakeEnumMessage_packed_enum(fake_msg2, &size);
EXPECT_EQ(6, size);
EXPECT_EQ(6u, size);
EXPECT_THAT(std::vector<int32_t>(vals_const, vals_const + size),
::testing::ElementsAreArray(expected));
}
@ -500,7 +500,7 @@ TEST(MessageTest, OneOf32BitStringViewInt64Alignment) {
uint16_t offset = UPB_PRIVATE(_upb_MiniTableField_Offset)(mtfield);
size_t alignment = 1 << absl::countr_zero(offset);
// Must align to at least 64 bit
EXPECT_GE(alignment, 8);
EXPECT_GE(alignment, 8u);
}
TEST(MessageTest, DecodeRequiredFieldsTopLevelMessage) {
@ -523,7 +523,7 @@ TEST(MessageTest, DecodeRequiredFieldsTopLevelMessage) {
char* serialized =
upb_test_TestRequiredFields_serialize(test_msg, arena.ptr(), &size);
ASSERT_TRUE(serialized != nullptr);
EXPECT_NE(0, size);
EXPECT_NE(0u, size);
// Fails, but the code path is slightly different because the serialized
// payload is not empty.
@ -547,7 +547,7 @@ TEST(MessageTest, DecodeRequiredFieldsTopLevelMessage) {
serialized =
upb_test_TestRequiredFields_serialize(test_msg, arena.ptr(), &size);
ASSERT_TRUE(serialized != nullptr);
EXPECT_NE(0, size);
EXPECT_NE(0u, size);
upb_test_TestRequiredFields* test_msg2 = upb_test_TestRequiredFields_parse_ex(
serialized, size, nullptr, kUpb_DecodeOption_CheckRequired, arena.ptr());
@ -575,7 +575,7 @@ TEST(MessageTest, DecodeRequiredFieldsSubMessage) {
size_t size;
char* serialized =
upb_test_SubMessageHasRequired_serialize(sub_msg, arena.ptr(), &size);
EXPECT_NE(0, size);
EXPECT_NE(0u, size);
// No parse error when parsing normally.
EXPECT_NE(nullptr, upb_test_SubMessageHasRequired_parse(serialized, size,
@ -592,7 +592,7 @@ TEST(MessageTest, DecodeRequiredFieldsSubMessage) {
serialized =
upb_test_SubMessageHasRequired_serialize(sub_msg, arena.ptr(), &size);
EXPECT_NE(0, size);
EXPECT_NE(0u, size);
// No parse error; sub-message now is complete.
EXPECT_NE(nullptr, upb_test_SubMessageHasRequired_parse_ex(
@ -610,7 +610,7 @@ TEST(MessageTest, EncodeRequiredFields) {
char* serialized =
upb_test_TestRequiredFields_serialize_ex(test_msg, 0, arena.ptr(), &size);
ASSERT_TRUE(serialized != nullptr);
EXPECT_EQ(size, 0);
EXPECT_EQ(size, 0u);
// Fails, we asked for required field checking but the required field is
// missing.
@ -681,7 +681,7 @@ TEST(MessageTest, MapField) {
char* serialized = upb_test_TestMapFieldExtra_serialize_ex(
test_msg_extra, 0, arena.ptr(), &size);
ASSERT_NE(nullptr, serialized);
ASSERT_NE(0, size);
ASSERT_NE(0u, size);
upb_test_TestMapField* test_msg =
upb_test_TestMapField_parse(serialized, size, arena.ptr());
@ -690,7 +690,7 @@ TEST(MessageTest, MapField) {
ASSERT_FALSE(upb_test_TestMapField_map_field_get(test_msg, 0, nullptr));
serialized =
upb_test_TestMapField_serialize_ex(test_msg, 0, arena.ptr(), &size);
ASSERT_NE(0, size);
ASSERT_NE(0u, size);
// parse into second instance
upb_test_TestMapFieldExtra* test_msg_extra2 =
upb_test_TestMapFieldExtra_parse(serialized, size, arena.ptr());
@ -793,13 +793,13 @@ TEST(MessageTest, AdjacentAliasedUnknown) {
uintptr_t iter = kUpb_Message_UnknownBegin;
ASSERT_TRUE(upb_Message_NextUnknown(msg, &data, &iter));
EXPECT_EQ(region, data.data);
EXPECT_EQ(300, data.size);
EXPECT_EQ(300u, data.size);
ASSERT_TRUE(upb_Message_NextUnknown(msg, &data, &iter));
EXPECT_EQ(region + 300, data.data);
EXPECT_EQ(300, data.size);
EXPECT_EQ(300u, data.size);
ASSERT_TRUE(upb_Message_NextUnknown(msg, &data, &iter));
EXPECT_EQ(region + 600, data.data);
EXPECT_EQ(300, data.size);
EXPECT_EQ(300u, data.size);
ASSERT_FALSE(upb_Message_NextUnknown(msg, &data, &iter));
}
}
@ -822,7 +822,7 @@ TEST(MessageTest, Freeze) {
upb_Array* arr = _upb_test_TestFreeze_array_int_mutable_upb_array(
raw, &size, arena.ptr());
ASSERT_NE(arr, nullptr);
ASSERT_EQ(size, 0);
ASSERT_EQ(size, 0u);
ASSERT_FALSE(upb_Array_IsFrozen(arr));
upb_Map* map =
_upb_test_TestFreeze_map_int_mutable_upb_map(raw, arena.ptr());
@ -845,7 +845,7 @@ TEST(MessageTest, Freeze) {
upb_Array* arr = _upb_test_TestFreeze_array_int_mutable_upb_array(
raw, &size, arena.ptr());
ASSERT_NE(arr, nullptr);
ASSERT_EQ(size, 0);
ASSERT_EQ(size, 0u);
ASSERT_FALSE(upb_Array_IsFrozen(arr));
upb_Map* map =
_upb_test_TestFreeze_map_int_mutable_upb_map(raw, arena.ptr());
@ -985,5 +985,5 @@ TEST(MessageTest, ArenaSpaceAllocatedAfterDecode) {
EXPECT_NE(msg, nullptr);
uintptr_t space_allocated_after =
upb_Arena_SpaceAllocated(arena.ptr(), nullptr);
EXPECT_GT(space_allocated_after, space_allocated_before + 297);
EXPECT_GT(space_allocated_after, space_allocated_before + 297u);
}

View file

@ -49,7 +49,7 @@ TEST_P(MiniTableTest, AllScalarTypes) {
upb::Arena arena;
upb::MtDataEncoder e;
ASSERT_TRUE(e.StartMessage(0));
int count = 0;
uint32_t count = 0;
for (int i = kUpb_FieldType_Double; i < kUpb_FieldType_SInt64; i++) {
ASSERT_TRUE(e.PutField(static_cast<upb_FieldType>(i), i, 0));
count++;
@ -62,7 +62,7 @@ TEST_P(MiniTableTest, AllScalarTypes) {
absl::flat_hash_set<size_t> offsets;
for (int i = 0; i < 16; i++) {
const upb_MiniTableField* f = &table->UPB_PRIVATE(fields)[i];
EXPECT_EQ(i + 1, upb_MiniTableField_Number(f));
EXPECT_EQ(i + 1u, upb_MiniTableField_Number(f));
EXPECT_TRUE(upb_MiniTableField_IsScalar(f));
EXPECT_TRUE(offsets.insert(f->UPB_PRIVATE(offset)).second);
EXPECT_TRUE(f->UPB_PRIVATE(offset) < table->UPB_PRIVATE(size));
@ -74,7 +74,7 @@ TEST_P(MiniTableTest, AllRepeatedTypes) {
upb::Arena arena;
upb::MtDataEncoder e;
ASSERT_TRUE(e.StartMessage(0));
int count = 0;
uint32_t count = 0;
for (int i = kUpb_FieldType_Double; i < kUpb_FieldType_SInt64; i++) {
ASSERT_TRUE(e.PutField(static_cast<upb_FieldType>(i), i,
kUpb_FieldModifier_IsRepeated));
@ -88,7 +88,7 @@ TEST_P(MiniTableTest, AllRepeatedTypes) {
absl::flat_hash_set<size_t> offsets;
for (int i = 0; i < 16; i++) {
const upb_MiniTableField* f = &table->UPB_PRIVATE(fields)[i];
EXPECT_EQ(i + 1, upb_MiniTableField_Number(f));
EXPECT_EQ(i + 1u, upb_MiniTableField_Number(f));
EXPECT_TRUE(upb_MiniTableField_IsArray(f));
EXPECT_TRUE(offsets.insert(f->UPB_PRIVATE(offset)).second);
EXPECT_TRUE(f->UPB_PRIVATE(offset) < table->UPB_PRIVATE(size));
@ -100,10 +100,10 @@ TEST_P(MiniTableTest, Skips) {
upb::Arena arena;
upb::MtDataEncoder e;
ASSERT_TRUE(e.StartMessage(0));
int count = 0;
std::vector<int> field_numbers;
uint32_t count = 0;
std::vector<uint32_t> field_numbers;
for (int i = 0; i < 25; i++) {
int field_number = 1 << i;
uint32_t field_number = 1u << i;
field_numbers.push_back(field_number);
ASSERT_TRUE(e.PutField(kUpb_FieldType_Float, field_number, 0));
count++;
@ -129,7 +129,7 @@ TEST_P(MiniTableTest, AllScalarTypesOneof) {
upb::Arena arena;
upb::MtDataEncoder e;
ASSERT_TRUE(e.StartMessage(0));
int count = 0;
uint32_t count = 0;
for (int i = kUpb_FieldType_Double; i < kUpb_FieldType_SInt64; i++) {
ASSERT_TRUE(e.PutField(static_cast<upb_FieldType>(i), i, 0));
count++;
@ -146,7 +146,7 @@ TEST_P(MiniTableTest, AllScalarTypesOneof) {
absl::flat_hash_set<size_t> offsets;
for (int i = 0; i < 16; i++) {
const upb_MiniTableField* f = &table->UPB_PRIVATE(fields)[i];
EXPECT_EQ(i + 1, upb_MiniTableField_Number(f));
EXPECT_EQ(i + 1u, upb_MiniTableField_Number(f));
EXPECT_TRUE(upb_MiniTableField_IsScalar(f));
// For a oneof all fields have the same offset.
EXPECT_EQ(table->UPB_PRIVATE(fields)[0].UPB_PRIVATE(offset),

View file

@ -31,7 +31,7 @@ static void TestEncodeDecodeRoundTrip(
ASSERT_TRUE(upb_EncodeLengthPrefixed(UPB_UPCAST(msg), kTestMiniTable, 0,
arena, &buf,
&size) == kUpb_EncodeStatus_Ok);
ASSERT_GT(size, 0); // Even empty messages are 1 byte in this encoding.
ASSERT_GT(size, 0u); // Even empty messages are 1 byte in this encoding.
s.append(std::string(buf, size));
}
@ -44,7 +44,7 @@ static void TestEncodeDecodeRoundTrip(
ASSERT_TRUE(upb_DecodeLengthPrefixed(
s.data(), s.length(), UPB_UPCAST(msg), &num_bytes_read,
kTestMiniTable, nullptr, 0, arena) == kUpb_DecodeStatus_Ok);
ASSERT_GT(num_bytes_read, 0);
ASSERT_GT(num_bytes_read, 0u);
decoded.push_back(msg);
s = s.substr(num_bytes_read);
}

View file

@ -55,7 +55,7 @@ TEST(Cpp, Default) {
upb_test_TestMessage* msg = upb_test_TestMessage_new(arena.ptr());
size_t size = upb_JsonEncode(UPB_UPCAST(msg), md.ptr(), nullptr, 0, nullptr,
0, nullptr);
EXPECT_EQ(2, size); // "{}"
EXPECT_EQ(2u, size); // "{}"
}
TEST(Cpp, JsonNull) {
@ -67,7 +67,7 @@ TEST(Cpp, JsonNull) {
ASSERT_TRUE(str_f);
EXPECT_EQ(5, i32_f.default_value().int32_val);
EXPECT_EQ(0, strcmp(str_f.default_value().str_val.data, "abc"));
EXPECT_EQ(3, str_f.default_value().str_val.size);
EXPECT_EQ(3u, str_f.default_value().str_val.size);
}
TEST(Cpp, TimestampEncoder) {

View file

@ -330,7 +330,7 @@ TEST(RepeatedFieldTest, RepeatedMessageFallback) {
const upb_Array* arr = upb_Message_GetArray(msg, field);
ASSERT_NE(arr, nullptr);
EXPECT_EQ(upb_Array_Size(arr), 2);
EXPECT_EQ(upb_Array_Size(arr), 2u);
}
TEST(RepeatedFieldTest, LongRepeatedField) {

View file

@ -65,7 +65,7 @@ TEST(EncodeTest, EncodeFieldSuccess) {
upb_EncodeStatus status = UPB_PRIVATE(_upb_Encode_Field)(
&e, (upb_Message*)msg, field, &buf, &size, e.options);
EXPECT_EQ(status, kUpb_EncodeStatus_Ok);
EXPECT_GT(size, 0);
EXPECT_GT(size, 0u);
// Verify that the encoded field can be decoded back to the original message
// with the same value.
@ -96,7 +96,7 @@ TEST(EncodeTest, EncodeFieldSuccessEmptyMessage) {
upb_EncodeStatus status = UPB_PRIVATE(_upb_Encode_Field)(
&e, (upb_Message*)msg, field, &buf, &size, e.options);
EXPECT_EQ(status, kUpb_EncodeStatus_Ok);
EXPECT_EQ(size, 0);
EXPECT_EQ(size, 0u);
_upb_mapsorter_destroy(&e.sorter);
upb_Arena_Free(arena);
@ -141,7 +141,7 @@ TEST(EncodeTest, EncodeExtensionSuccess) {
upb_EncodeStatus status = UPB_PRIVATE(_upb_Encode_Extension)(
&e, ext, ext_val, false, &buf, &size, e.options);
EXPECT_EQ(status, kUpb_EncodeStatus_Ok);
EXPECT_GT(size, 0);
EXPECT_GT(size, 0u);
// Verify that the encoded extension can be decoded back to the original
// extension value.
@ -177,7 +177,7 @@ TEST(EncodeTest, EncodeExtensionSuccessEmptyMessage) {
upb_EncodeStatus status = UPB_PRIVATE(_upb_Encode_Extension)(
&e, ext, ext_val, false, &buf, &size, e.options);
EXPECT_EQ(status, kUpb_EncodeStatus_Ok);
EXPECT_GT(size, 0);
EXPECT_GT(size, 0u);
_upb_mapsorter_destroy(&e.sorter);
upb_Arena_Free(arena);