Skip to content

Commit 7d5592e

Browse files
Adam Cozzettecopybara-github
authored andcommitted
Add upb "No System Python" test run
This test validates that upb Python targets can be built successfully even if Python is not installed locally. I also updated our pinned upb version to pull in some recent fixes needed for this test run. PiperOrigin-RevId: 559504790
1 parent 66cf6b1 commit 7d5592e

File tree

6 files changed

+166
-122
lines changed

6 files changed

+166
-122
lines changed

.github/workflows/test_upb.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,25 @@ jobs:
9797
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
9898
bazel-cache: "upb-bazel-macos"
9999
bazel: ${{ matrix.config.bazel-command }} --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} @upb//...
100+
101+
no-python:
102+
strategy:
103+
fail-fast: false # Don't cancel all jobs if one fails.
104+
name: No System Python
105+
runs-on: ubuntu-latest
106+
steps:
107+
- name: Checkout pending changes
108+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
109+
with:
110+
ref: ${{ inputs.safe-checkout }}
111+
- name: Run tests
112+
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
113+
with:
114+
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d
115+
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
116+
bazel-cache: "upb-bazel-no-python"
117+
bash: >-
118+
which python3 &&
119+
mv `which python3` /tmp &&
120+
! which python3 &&
121+
bazel test $BAZEL_FLAGS --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 @upb//python/... -- -@upb//python/dist:source_wheel

php/ext/google/protobuf/php-upb.c

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@
4141
#include <assert.h>
4242
#include <setjmp.h>
4343
#include <stdbool.h>
44-
#include <stddef.h>
4544
#include <stdint.h>
4645
#include <stdio.h>
4746

47+
#ifndef UINTPTR_MAX
48+
Error, UINTPTR_MAX is undefined
49+
#endif
50+
4851
#if UINTPTR_MAX == 0xffffffff
4952
#define UPB_SIZE(size32, size64) size32
5053
#else
@@ -267,7 +270,7 @@
267270
#define UPB_ASAN 1
268271
#define UPB_ASAN_GUARD_SIZE 32
269272
#ifdef __cplusplus
270-
extern "C" {
273+
extern "C" {
271274
#endif
272275
void __asan_poison_memory_region(void const volatile *addr, size_t size);
273276
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
@@ -7405,6 +7408,25 @@ bool upb_MiniTable_Link(upb_MiniTable* mt, const upb_MiniTable** sub_tables,
74057408
}
74067409

74077410

7411+
const char _kUpb_ToBase92[] = {
7412+
' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/',
7413+
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
7414+
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
7415+
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
7416+
'Z', '[', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
7417+
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
7418+
'w', 'x', 'y', 'z', '{', '|', '}', '~',
7419+
};
7420+
7421+
const int8_t _kUpb_FromBase92[] = {
7422+
0, 1, -1, 2, 3, 4, 5, -1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
7423+
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
7424+
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
7425+
55, 56, 57, -1, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
7426+
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
7427+
};
7428+
7429+
74087430

74097431
// Must be last.
74107432

@@ -7699,25 +7721,6 @@ char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr) {
76997721
}
77007722

77017723

7702-
const char _kUpb_ToBase92[] = {
7703-
' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/',
7704-
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
7705-
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
7706-
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
7707-
'Z', '[', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
7708-
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
7709-
'w', 'x', 'y', 'z', '{', '|', '}', '~',
7710-
};
7711-
7712-
const int8_t _kUpb_FromBase92[] = {
7713-
0, 1, -1, 2, 3, 4, 5, -1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
7714-
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
7715-
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
7716-
55, 56, 57, -1, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
7717-
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
7718-
};
7719-
7720-
77217724

77227725
// Must be last.
77237726

php/ext/google/protobuf/php-upb.h

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@
4040
#include <assert.h>
4141
#include <setjmp.h>
4242
#include <stdbool.h>
43-
#include <stddef.h>
4443
#include <stdint.h>
4544
#include <stdio.h>
4645

46+
#ifndef UINTPTR_MAX
47+
Error, UINTPTR_MAX is undefined
48+
#endif
49+
4750
#if UINTPTR_MAX == 0xffffffff
4851
#define UPB_SIZE(size32, size64) size32
4952
#else
@@ -266,7 +269,7 @@
266269
#define UPB_ASAN 1
267270
#define UPB_ASAN_GUARD_SIZE 32
268271
#ifdef __cplusplus
269-
extern "C" {
272+
extern "C" {
270273
#endif
271274
void __asan_poison_memory_region(void const volatile *addr, size_t size);
272275
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
@@ -468,7 +471,10 @@ typedef struct {
468471
const char* data;
469472
size_t size;
470473
} upb_StringView;
471-
// LINT.ThenChange(GoogleInternalName0)
474+
// LINT.ThenChange(
475+
// GoogleInternalName0,
476+
// //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string
477+
// )
472478

473479
#ifdef __cplusplus
474480
extern "C" {
@@ -503,14 +509,14 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) {
503509
#include <stdint.h>
504510

505511

506-
#ifndef UPB_MESSAGE_TYPEDEF_H_
507-
#define UPB_MESSAGE_TYPEDEF_H_
512+
#ifndef UPB_MESSAGE_TYPES_H_
513+
#define UPB_MESSAGE_TYPES_H_
508514

509-
// This typedef needs its own header to resolve a circular dependency between
515+
// This typedef is in a leaf header to resolve a circular dependency between
510516
// messages and mini tables.
511517
typedef void upb_Message;
512518

513-
#endif /* UPB_MESSAGE_TYPEDEF_H_ */
519+
#endif /* UPB_MESSAGE_TYPES_H_ */
514520

515521
// Must be last.
516522

@@ -577,6 +583,8 @@ UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetEmptyMessage(
577583
#ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_
578584
#define UPB_MINI_TABLE_INTERNAL_ENUM_H_
579585

586+
#include <stdint.h>
587+
580588
// Must be last.
581589

582590
struct upb_MiniTableEnum {
@@ -646,6 +654,8 @@ UPB_INLINE bool upb_MiniTableEnum_CheckValue(const struct upb_MiniTableEnum* e,
646654
#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
647655
#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
648656

657+
#include <stdint.h>
658+
649659

650660
// Must be last.
651661

@@ -1037,6 +1047,8 @@ typedef union {
10371047
#ifndef UPB_MEM_ARENA_H_
10381048
#define UPB_MEM_ARENA_H_
10391049

1050+
#include <stddef.h>
1051+
#include <stdint.h>
10401052
#include <string.h>
10411053

10421054

@@ -2776,6 +2788,7 @@ UPB_INLINE void _upb_Message_ClearNonExtensionField(
27762788

27772789
UPB_INLINE void _upb_Message_AssertMapIsUntagged(
27782790
const upb_Message* msg, const upb_MiniTableField* field) {
2791+
UPB_UNUSED(msg);
27792792
_upb_MiniTableField_CheckIsMap(field);
27802793
#ifndef NDEBUG
27812794
upb_TaggedMessagePtr default_val = 0;
@@ -3418,6 +3431,23 @@ typedef struct upb_MiniTableFile upb_MiniTableFile;
34183431
#define UPB_WIRE_DECODE_H_
34193432

34203433

3434+
#ifndef UPB_WIRE_TYPES_H_
3435+
#define UPB_WIRE_TYPES_H_
3436+
3437+
#define kUpb_WireFormat_DefaultDepthLimit 100
3438+
3439+
// A list of types as they are encoded on the wire.
3440+
typedef enum {
3441+
kUpb_WireType_Varint = 0,
3442+
kUpb_WireType_64Bit = 1,
3443+
kUpb_WireType_Delimited = 2,
3444+
kUpb_WireType_StartGroup = 3,
3445+
kUpb_WireType_EndGroup = 4,
3446+
kUpb_WireType_32Bit = 5
3447+
} upb_WireType;
3448+
3449+
#endif /* UPB_WIRE_TYPES_H_ */
3450+
34213451
// Must be last.
34223452

34233453
#ifdef __cplusplus
@@ -11459,6 +11489,8 @@ UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg,
1145911489
#ifndef UPB_LEX_ATOI_H_
1146011490
#define UPB_LEX_ATOI_H_
1146111491

11492+
#include <stdint.h>
11493+
1146211494
// Must be last.
1146311495

1146411496
#ifdef __cplusplus
@@ -11484,6 +11516,8 @@ const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
1148411516
#ifndef UPB_LEX_UNICODE_H_
1148511517
#define UPB_LEX_UNICODE_H_
1148611518

11519+
#include <stdint.h>
11520+
1148711521
// Must be last.
1148811522

1148911523
#ifdef __cplusplus
@@ -11870,30 +11904,15 @@ UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,
1187011904

1187111905
#endif // UPB_PORT_ATOMIC_H_
1187211906

11873-
#ifndef UPB_WIRE_COMMON_H_
11874-
#define UPB_WIRE_COMMON_H_
11875-
11876-
// Must be last.
11877-
11878-
#ifdef __cplusplus
11879-
extern "C" {
11880-
#endif
11881-
11882-
#define kUpb_WireFormat_DefaultDepthLimit 100
11883-
11884-
#ifdef __cplusplus
11885-
}
11886-
#endif
11887-
11888-
#endif // UPB_WIRE_COMMON_H_
11889-
1189011907
#ifndef UPB_WIRE_READER_H_
1189111908
#define UPB_WIRE_READER_H_
1189211909

1189311910

1189411911
#ifndef UPB_WIRE_INTERNAL_SWAP_H_
1189511912
#define UPB_WIRE_INTERNAL_SWAP_H_
1189611913

11914+
#include <stdint.h>
11915+
1189711916
// Must be last.
1189811917

1189911918
#ifdef __cplusplus
@@ -11926,21 +11945,6 @@ UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val) {
1192611945

1192711946
#endif /* UPB_WIRE_INTERNAL_SWAP_H_ */
1192811947

11929-
#ifndef UPB_WIRE_TYPES_H_
11930-
#define UPB_WIRE_TYPES_H_
11931-
11932-
// A list of types as they are encoded on the wire.
11933-
typedef enum {
11934-
kUpb_WireType_Varint = 0,
11935-
kUpb_WireType_64Bit = 1,
11936-
kUpb_WireType_Delimited = 2,
11937-
kUpb_WireType_StartGroup = 3,
11938-
kUpb_WireType_EndGroup = 4,
11939-
kUpb_WireType_32Bit = 5
11940-
} upb_WireType;
11941-
11942-
#endif /* UPB_WIRE_TYPES_H_ */
11943-
1194411948
// Must be last.
1194511949

1194611950
#ifdef __cplusplus
@@ -12140,6 +12144,8 @@ UPB_INLINE const char* upb_WireReader_SkipValue(
1214012144
#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
1214112145
#define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
1214212146

12147+
#include <stdint.h>
12148+
1214312149

1214412150
// Must be last.
1214512151

@@ -12315,6 +12321,8 @@ typedef enum {
1231512321
#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
1231612322
#define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
1231712323

12324+
#include <stdint.h>
12325+
1231812326

1231912327
// Must be last.
1232012328

protobuf_deps.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,6 @@ def protobuf_deps():
150150
_github_archive(
151151
name = "upb",
152152
repo = "https://github.com/protocolbuffers/upb",
153-
commit = "cd176a0cd1913ea8c643680d206c8ca278815c2c",
154-
sha256 = "661b2d63dff82c6868cd1dea5e7be2ca1a6467746a146c293834f18aaa709077",
153+
commit = "823a12e80934f9c8fb9178191d69f06a1bbfd604",
154+
sha256 = "165f425714d32018a1a856b1935cfa24206878f8a469384808d2dce1d7c4003a",
155155
)

ruby/ext/google/protobuf_c/ruby-upb.c

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@
4141
#include <assert.h>
4242
#include <setjmp.h>
4343
#include <stdbool.h>
44-
#include <stddef.h>
4544
#include <stdint.h>
4645
#include <stdio.h>
4746

47+
#ifndef UINTPTR_MAX
48+
Error, UINTPTR_MAX is undefined
49+
#endif
50+
4851
#if UINTPTR_MAX == 0xffffffff
4952
#define UPB_SIZE(size32, size64) size32
5053
#else
@@ -267,7 +270,7 @@
267270
#define UPB_ASAN 1
268271
#define UPB_ASAN_GUARD_SIZE 32
269272
#ifdef __cplusplus
270-
extern "C" {
273+
extern "C" {
271274
#endif
272275
void __asan_poison_memory_region(void const volatile *addr, size_t size);
273276
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
@@ -6944,6 +6947,25 @@ bool upb_MiniTable_Link(upb_MiniTable* mt, const upb_MiniTable** sub_tables,
69446947
}
69456948

69466949

6950+
const char _kUpb_ToBase92[] = {
6951+
' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/',
6952+
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
6953+
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
6954+
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
6955+
'Z', '[', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
6956+
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
6957+
'w', 'x', 'y', 'z', '{', '|', '}', '~',
6958+
};
6959+
6960+
const int8_t _kUpb_FromBase92[] = {
6961+
0, 1, -1, 2, 3, 4, 5, -1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
6962+
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
6963+
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
6964+
55, 56, 57, -1, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
6965+
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
6966+
};
6967+
6968+
69476969

69486970
// Must be last.
69496971

@@ -7238,25 +7260,6 @@ char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr) {
72387260
}
72397261

72407262

7241-
const char _kUpb_ToBase92[] = {
7242-
' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/',
7243-
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
7244-
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
7245-
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
7246-
'Z', '[', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
7247-
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
7248-
'w', 'x', 'y', 'z', '{', '|', '}', '~',
7249-
};
7250-
7251-
const int8_t _kUpb_FromBase92[] = {
7252-
0, 1, -1, 2, 3, 4, 5, -1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
7253-
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
7254-
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
7255-
55, 56, 57, -1, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
7256-
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
7257-
};
7258-
7259-
72607263

72617264
// Must be last.
72627265

0 commit comments

Comments
 (0)