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
pull/13629/head
Adam Cozzette 2 years ago committed by Copybara-Service
parent 66cf6b1d9c
commit 7d5592e518
  1. 22
      .github/workflows/test_upb.yml
  2. 45
      php/ext/google/protobuf/php-upb.c
  3. 86
      php/ext/google/protobuf/php-upb.h
  4. 4
      protobuf_deps.bzl
  5. 45
      ruby/ext/google/protobuf_c/ruby-upb.c
  6. 86
      ruby/ext/google/protobuf_c/ruby-upb.h

@ -97,3 +97,25 @@ jobs:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: "upb-bazel-macos"
bazel: ${{ matrix.config.bazel-command }} --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} @upb//...
no-python:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
name: No System Python
runs-on: ubuntu-latest
steps:
- name: Checkout pending changes
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ inputs.safe-checkout }}
- name: Run tests
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
with:
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: "upb-bazel-no-python"
bash: >-
which python3 &&
mv `which python3` /tmp &&
! which python3 &&
bazel test $BAZEL_FLAGS --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 @upb//python/... -- -@upb//python/dist:source_wheel

@ -41,10 +41,13 @@
#include <assert.h>
#include <setjmp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#ifndef UINTPTR_MAX
Error, UINTPTR_MAX is undefined
#endif
#if UINTPTR_MAX == 0xffffffff
#define UPB_SIZE(size32, size64) size32
#else
@ -267,7 +270,7 @@
#define UPB_ASAN 1
#define UPB_ASAN_GUARD_SIZE 32
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
void __asan_poison_memory_region(void const volatile *addr, size_t size);
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,
}
const char _kUpb_ToBase92[] = {
' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
'Z', '[', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '{', '|', '}', '~',
};
const int8_t _kUpb_FromBase92[] = {
0, 1, -1, 2, 3, 4, 5, -1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, -1, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
};
// Must be last.
@ -7699,25 +7721,6 @@ char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr) {
}
const char _kUpb_ToBase92[] = {
' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
'Z', '[', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '{', '|', '}', '~',
};
const int8_t _kUpb_FromBase92[] = {
0, 1, -1, 2, 3, 4, 5, -1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, -1, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
};
// Must be last.

@ -40,10 +40,13 @@
#include <assert.h>
#include <setjmp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#ifndef UINTPTR_MAX
Error, UINTPTR_MAX is undefined
#endif
#if UINTPTR_MAX == 0xffffffff
#define UPB_SIZE(size32, size64) size32
#else
@ -266,7 +269,7 @@
#define UPB_ASAN 1
#define UPB_ASAN_GUARD_SIZE 32
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
void __asan_poison_memory_region(void const volatile *addr, size_t size);
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
@ -468,7 +471,10 @@ typedef struct {
const char* data;
size_t size;
} upb_StringView;
// LINT.ThenChange(GoogleInternalName0)
// LINT.ThenChange(
// GoogleInternalName0,
// //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string
// )
#ifdef __cplusplus
extern "C" {
@ -503,14 +509,14 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) {
#include <stdint.h>
#ifndef UPB_MESSAGE_TYPEDEF_H_
#define UPB_MESSAGE_TYPEDEF_H_
#ifndef UPB_MESSAGE_TYPES_H_
#define UPB_MESSAGE_TYPES_H_
// This typedef needs its own header to resolve a circular dependency between
// This typedef is in a leaf header to resolve a circular dependency between
// messages and mini tables.
typedef void upb_Message;
#endif /* UPB_MESSAGE_TYPEDEF_H_ */
#endif /* UPB_MESSAGE_TYPES_H_ */
// Must be last.
@ -577,6 +583,8 @@ UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetEmptyMessage(
#ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_
#define UPB_MINI_TABLE_INTERNAL_ENUM_H_
#include <stdint.h>
// Must be last.
struct upb_MiniTableEnum {
@ -646,6 +654,8 @@ UPB_INLINE bool upb_MiniTableEnum_CheckValue(const struct upb_MiniTableEnum* e,
#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
#include <stdint.h>
// Must be last.
@ -1037,6 +1047,8 @@ typedef union {
#ifndef UPB_MEM_ARENA_H_
#define UPB_MEM_ARENA_H_
#include <stddef.h>
#include <stdint.h>
#include <string.h>
@ -2776,6 +2788,7 @@ UPB_INLINE void _upb_Message_ClearNonExtensionField(
UPB_INLINE void _upb_Message_AssertMapIsUntagged(
const upb_Message* msg, const upb_MiniTableField* field) {
UPB_UNUSED(msg);
_upb_MiniTableField_CheckIsMap(field);
#ifndef NDEBUG
upb_TaggedMessagePtr default_val = 0;
@ -3418,6 +3431,23 @@ typedef struct upb_MiniTableFile upb_MiniTableFile;
#define UPB_WIRE_DECODE_H_
#ifndef UPB_WIRE_TYPES_H_
#define UPB_WIRE_TYPES_H_
#define kUpb_WireFormat_DefaultDepthLimit 100
// A list of types as they are encoded on the wire.
typedef enum {
kUpb_WireType_Varint = 0,
kUpb_WireType_64Bit = 1,
kUpb_WireType_Delimited = 2,
kUpb_WireType_StartGroup = 3,
kUpb_WireType_EndGroup = 4,
kUpb_WireType_32Bit = 5
} upb_WireType;
#endif /* UPB_WIRE_TYPES_H_ */
// Must be last.
#ifdef __cplusplus
@ -11459,6 +11489,8 @@ UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg,
#ifndef UPB_LEX_ATOI_H_
#define UPB_LEX_ATOI_H_
#include <stdint.h>
// Must be last.
#ifdef __cplusplus
@ -11484,6 +11516,8 @@ const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
#ifndef UPB_LEX_UNICODE_H_
#define UPB_LEX_UNICODE_H_
#include <stdint.h>
// Must be last.
#ifdef __cplusplus
@ -11870,23 +11904,6 @@ UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,
#endif // UPB_PORT_ATOMIC_H_
#ifndef UPB_WIRE_COMMON_H_
#define UPB_WIRE_COMMON_H_
// Must be last.
#ifdef __cplusplus
extern "C" {
#endif
#define kUpb_WireFormat_DefaultDepthLimit 100
#ifdef __cplusplus
}
#endif
#endif // UPB_WIRE_COMMON_H_
#ifndef UPB_WIRE_READER_H_
#define UPB_WIRE_READER_H_
@ -11894,6 +11911,8 @@ extern "C" {
#ifndef UPB_WIRE_INTERNAL_SWAP_H_
#define UPB_WIRE_INTERNAL_SWAP_H_
#include <stdint.h>
// Must be last.
#ifdef __cplusplus
@ -11926,21 +11945,6 @@ UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val) {
#endif /* UPB_WIRE_INTERNAL_SWAP_H_ */
#ifndef UPB_WIRE_TYPES_H_
#define UPB_WIRE_TYPES_H_
// A list of types as they are encoded on the wire.
typedef enum {
kUpb_WireType_Varint = 0,
kUpb_WireType_64Bit = 1,
kUpb_WireType_Delimited = 2,
kUpb_WireType_StartGroup = 3,
kUpb_WireType_EndGroup = 4,
kUpb_WireType_32Bit = 5
} upb_WireType;
#endif /* UPB_WIRE_TYPES_H_ */
// Must be last.
#ifdef __cplusplus
@ -12140,6 +12144,8 @@ UPB_INLINE const char* upb_WireReader_SkipValue(
#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
#define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
#include <stdint.h>
// Must be last.
@ -12315,6 +12321,8 @@ typedef enum {
#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
#define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
#include <stdint.h>
// Must be last.

@ -150,6 +150,6 @@ def protobuf_deps():
_github_archive(
name = "upb",
repo = "https://github.com/protocolbuffers/upb",
commit = "cd176a0cd1913ea8c643680d206c8ca278815c2c",
sha256 = "661b2d63dff82c6868cd1dea5e7be2ca1a6467746a146c293834f18aaa709077",
commit = "823a12e80934f9c8fb9178191d69f06a1bbfd604",
sha256 = "165f425714d32018a1a856b1935cfa24206878f8a469384808d2dce1d7c4003a",
)

@ -41,10 +41,13 @@
#include <assert.h>
#include <setjmp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#ifndef UINTPTR_MAX
Error, UINTPTR_MAX is undefined
#endif
#if UINTPTR_MAX == 0xffffffff
#define UPB_SIZE(size32, size64) size32
#else
@ -267,7 +270,7 @@
#define UPB_ASAN 1
#define UPB_ASAN_GUARD_SIZE 32
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
void __asan_poison_memory_region(void const volatile *addr, size_t size);
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,
}
const char _kUpb_ToBase92[] = {
' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
'Z', '[', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '{', '|', '}', '~',
};
const int8_t _kUpb_FromBase92[] = {
0, 1, -1, 2, 3, 4, 5, -1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, -1, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
};
// Must be last.
@ -7238,25 +7260,6 @@ char* upb_MtDataEncoder_EndEnum(upb_MtDataEncoder* e, char* ptr) {
}
const char _kUpb_ToBase92[] = {
' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
'Z', '[', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '{', '|', '}', '~',
};
const int8_t _kUpb_FromBase92[] = {
0, 1, -1, 2, 3, 4, 5, -1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, -1, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
};
// Must be last.

@ -42,10 +42,13 @@
#include <assert.h>
#include <setjmp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#ifndef UINTPTR_MAX
Error, UINTPTR_MAX is undefined
#endif
#if UINTPTR_MAX == 0xffffffff
#define UPB_SIZE(size32, size64) size32
#else
@ -268,7 +271,7 @@
#define UPB_ASAN 1
#define UPB_ASAN_GUARD_SIZE 32
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
void __asan_poison_memory_region(void const volatile *addr, size_t size);
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
@ -470,7 +473,10 @@ typedef struct {
const char* data;
size_t size;
} upb_StringView;
// LINT.ThenChange(GoogleInternalName0)
// LINT.ThenChange(
// GoogleInternalName0,
// //depot/google3/third_party/upb/bits/golang/accessor.go:map_go_string
// )
#ifdef __cplusplus
extern "C" {
@ -505,14 +511,14 @@ UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b) {
#include <stdint.h>
#ifndef UPB_MESSAGE_TYPEDEF_H_
#define UPB_MESSAGE_TYPEDEF_H_
#ifndef UPB_MESSAGE_TYPES_H_
#define UPB_MESSAGE_TYPES_H_
// This typedef needs its own header to resolve a circular dependency between
// This typedef is in a leaf header to resolve a circular dependency between
// messages and mini tables.
typedef void upb_Message;
#endif /* UPB_MESSAGE_TYPEDEF_H_ */
#endif /* UPB_MESSAGE_TYPES_H_ */
// Must be last.
@ -579,6 +585,8 @@ UPB_INLINE upb_Message* _upb_TaggedMessagePtr_GetEmptyMessage(
#ifndef UPB_MINI_TABLE_INTERNAL_ENUM_H_
#define UPB_MINI_TABLE_INTERNAL_ENUM_H_
#include <stdint.h>
// Must be last.
struct upb_MiniTableEnum {
@ -648,6 +656,8 @@ UPB_INLINE bool upb_MiniTableEnum_CheckValue(const struct upb_MiniTableEnum* e,
#ifndef UPB_MINI_TABLE_INTERNAL_FIELD_H_
#define UPB_MINI_TABLE_INTERNAL_FIELD_H_
#include <stdint.h>
// Must be last.
@ -1039,6 +1049,8 @@ typedef union {
#ifndef UPB_MEM_ARENA_H_
#define UPB_MEM_ARENA_H_
#include <stddef.h>
#include <stdint.h>
#include <string.h>
@ -2740,6 +2752,7 @@ UPB_INLINE void _upb_Message_ClearNonExtensionField(
UPB_INLINE void _upb_Message_AssertMapIsUntagged(
const upb_Message* msg, const upb_MiniTableField* field) {
UPB_UNUSED(msg);
_upb_MiniTableField_CheckIsMap(field);
#ifndef NDEBUG
upb_TaggedMessagePtr default_val = 0;
@ -3382,6 +3395,23 @@ typedef struct upb_MiniTableFile upb_MiniTableFile;
#define UPB_WIRE_DECODE_H_
#ifndef UPB_WIRE_TYPES_H_
#define UPB_WIRE_TYPES_H_
#define kUpb_WireFormat_DefaultDepthLimit 100
// A list of types as they are encoded on the wire.
typedef enum {
kUpb_WireType_Varint = 0,
kUpb_WireType_64Bit = 1,
kUpb_WireType_Delimited = 2,
kUpb_WireType_StartGroup = 3,
kUpb_WireType_EndGroup = 4,
kUpb_WireType_32Bit = 5
} upb_WireType;
#endif /* UPB_WIRE_TYPES_H_ */
// Must be last.
#ifdef __cplusplus
@ -11229,6 +11259,8 @@ UPB_API bool upb_JsonDecode(const char* buf, size_t size, upb_Message* msg,
#ifndef UPB_LEX_ATOI_H_
#define UPB_LEX_ATOI_H_
#include <stdint.h>
// Must be last.
#ifdef __cplusplus
@ -11254,6 +11286,8 @@ const char* upb_BufToInt64(const char* ptr, const char* end, int64_t* val,
#ifndef UPB_LEX_UNICODE_H_
#define UPB_LEX_UNICODE_H_
#include <stdint.h>
// Must be last.
#ifdef __cplusplus
@ -11640,23 +11674,6 @@ UPB_INLINE bool _upb_NonAtomic_CompareExchangeStrongP(void* addr,
#endif // UPB_PORT_ATOMIC_H_
#ifndef UPB_WIRE_COMMON_H_
#define UPB_WIRE_COMMON_H_
// Must be last.
#ifdef __cplusplus
extern "C" {
#endif
#define kUpb_WireFormat_DefaultDepthLimit 100
#ifdef __cplusplus
}
#endif
#endif // UPB_WIRE_COMMON_H_
#ifndef UPB_WIRE_READER_H_
#define UPB_WIRE_READER_H_
@ -11664,6 +11681,8 @@ extern "C" {
#ifndef UPB_WIRE_INTERNAL_SWAP_H_
#define UPB_WIRE_INTERNAL_SWAP_H_
#include <stdint.h>
// Must be last.
#ifdef __cplusplus
@ -11696,21 +11715,6 @@ UPB_INLINE uint64_t _upb_BigEndian_Swap64(uint64_t val) {
#endif /* UPB_WIRE_INTERNAL_SWAP_H_ */
#ifndef UPB_WIRE_TYPES_H_
#define UPB_WIRE_TYPES_H_
// A list of types as they are encoded on the wire.
typedef enum {
kUpb_WireType_Varint = 0,
kUpb_WireType_64Bit = 1,
kUpb_WireType_Delimited = 2,
kUpb_WireType_StartGroup = 3,
kUpb_WireType_EndGroup = 4,
kUpb_WireType_32Bit = 5
} upb_WireType;
#endif /* UPB_WIRE_TYPES_H_ */
// Must be last.
#ifdef __cplusplus
@ -11910,6 +11914,8 @@ UPB_INLINE const char* upb_WireReader_SkipValue(
#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
#define UPB_MINI_DESCRIPTOR_INTERNAL_BASE92_H_
#include <stdint.h>
// Must be last.
@ -12085,6 +12091,8 @@ typedef enum {
#ifndef UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
#define UPB_MINI_DESCRIPTOR_INTERNAL_ENCODE_H_
#include <stdint.h>
// Must be last.

Loading…
Cancel
Save