The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
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.

293 lines
8.4 KiB

/* This is a upb implementation of the upb conformance tests, see:
* https://github.com/google/protobuf/tree/master/conformance
*/
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "conformance/conformance.upb.h"
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
#include "conformance/conformance.upbdefs.h"
#include "src/google/protobuf/test_messages_proto2.upbdefs.h"
#include "src/google/protobuf/test_messages_proto3.upbdefs.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/reflection.h"
#include "upb/json_decode.h"
#include "upb/json_encode.h"
#include "upb/text_encode.h"
#include "upb/port_def.inc"
int test_count = 0;
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
bool verbose = false; /* Set to true to get req/resp printed on stderr. */
bool CheckedRead(int fd, void *buf, size_t len) {
size_t ofs = 0;
while (len > 0) {
ssize_t bytes_read = read(fd, (char*)buf + ofs, len);
if (bytes_read == 0) return false;
if (bytes_read < 0) {
perror("reading from test runner");
exit(1);
}
len -= bytes_read;
ofs += bytes_read;
}
return true;
}
void CheckedWrite(int fd, const void *buf, size_t len) {
if ((size_t)write(fd, buf, len) != len) {
perror("writing to test runner");
exit(1);
}
}
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
typedef struct {
const conformance_ConformanceRequest *request;
conformance_ConformanceResponse *response;
upb_arena *arena;
const upb_symtab *symtab;
} ctx;
bool parse_proto(upb_msg *msg, const upb_msgdef *m, const ctx* c) {
upb_strview proto =
conformance_ConformanceRequest_protobuf_payload(c->request);
if (upb_decode(proto.data, proto.size, msg, upb_msgdef_layout(m), c->arena)) {
return true;
} else {
static const char msg[] = "Parse error";
conformance_ConformanceResponse_set_parse_error(
c->response, upb_strview_make(msg, strlen(msg)));
return false;
}
}
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
void serialize_proto(const upb_msg *msg, const upb_msgdef *m, const ctx *c) {
size_t len;
char *data = upb_encode(msg, upb_msgdef_layout(m), c->arena, &len);
if (data) {
conformance_ConformanceResponse_set_protobuf_payload(
c->response, upb_strview_make(data, len));
} else {
static const char msg[] = "Error serializing.";
conformance_ConformanceResponse_set_serialize_error(
c->response, upb_strview_make(msg, strlen(msg)));
}
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
}
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
void serialize_text(const upb_msg *msg, const upb_msgdef *m, const ctx *c) {
size_t len;
size_t len2;
int opts = 0;
char *data;
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
if (!conformance_ConformanceRequest_print_unknown_fields(c->request)) {
opts |= UPB_TXTENC_SKIPUNKNOWN;
}
len = upb_text_encode(msg, m, c->symtab, opts, NULL, 0);
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
data = upb_arena_malloc(c->arena, len + 1);
len2 = upb_text_encode(msg, m, c->symtab, opts, data, len + 1);
UPB_ASSERT(len == len2);
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
conformance_ConformanceResponse_set_text_payload(
c->response, upb_strview_make(data, len));
}
bool parse_json(upb_msg *msg, const upb_msgdef *m, const ctx* c) {
upb_strview json =
conformance_ConformanceRequest_json_payload(c->request);
upb_status status;
int opts = 0;
if (conformance_ConformanceRequest_test_category(c->request) ==
conformance_JSON_IGNORE_UNKNOWN_PARSING_TEST) {
opts |= UPB_JSONDEC_IGNOREUNKNOWN;
}
upb_status_clear(&status);
if (upb_json_decode(json.data, json.size, msg, m, c->symtab, opts, c->arena,
&status)) {
return true;
} else {
const char *inerr = upb_status_errmsg(&status);
size_t len = strlen(inerr);
char *err = upb_arena_malloc(c->arena, len + 1);
memcpy(err, inerr, strlen(inerr));
err[len] = '\0';
conformance_ConformanceResponse_set_parse_error(c->response,
upb_strview_makez(err));
return false;
}
}
void serialize_json(const upb_msg *msg, const upb_msgdef *m, const ctx *c) {
size_t len;
size_t len2;
int opts = 0;
char *data;
upb_status status;
upb_status_clear(&status);
len = upb_json_encode(msg, m, c->symtab, opts, NULL, 0, &status);
if (len == (size_t)-1) {
const char *inerr = upb_status_errmsg(&status);
size_t len = strlen(inerr);
char *err = upb_arena_malloc(c->arena, len + 1);
memcpy(err, inerr, strlen(inerr));
err[len] = '\0';
conformance_ConformanceResponse_set_serialize_error(c->response,
upb_strview_makez(err));
return;
}
data = upb_arena_malloc(c->arena, len + 1);
len2 = upb_json_encode(msg, m, c->symtab, opts, data, len + 1, &status);
UPB_ASSERT(len == len2);
conformance_ConformanceResponse_set_json_payload(
c->response, upb_strview_make(data, len));
}
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
bool parse_input(upb_msg *msg, const upb_msgdef *m, const ctx* c) {
switch (conformance_ConformanceRequest_payload_case(c->request)) {
case conformance_ConformanceRequest_payload_protobuf_payload:
return parse_proto(msg, m, c);
case conformance_ConformanceRequest_payload_json_payload:
return parse_json(msg, m, c);
case conformance_ConformanceRequest_payload_NOT_SET:
fprintf(stderr, "conformance_upb: Request didn't have payload.\n");
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
return false;
default: {
static const char msg[] = "Unsupported input format.";
conformance_ConformanceResponse_set_skipped(
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
c->response, upb_strview_make(msg, strlen(msg)));
return false;
}
}
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
}
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
void write_output(const upb_msg *msg, const upb_msgdef *m, const ctx* c) {
switch (conformance_ConformanceRequest_requested_output_format(c->request)) {
case conformance_UNSPECIFIED:
fprintf(stderr, "conformance_upb: Unspecified output format.\n");
exit(1);
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
case conformance_PROTOBUF:
serialize_proto(msg, m, c);
break;
case conformance_TEXT_FORMAT:
serialize_text(msg, m, c);
break;
case conformance_JSON:
serialize_json(msg, m, c);
break;
default: {
static const char msg[] = "Unsupported output format.";
conformance_ConformanceResponse_set_skipped(
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
c->response, upb_strview_make(msg, strlen(msg)));
break;
}
}
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
}
void DoTest(const ctx* c) {
upb_msg *msg;
upb_strview name = conformance_ConformanceRequest_message_type(c->request);
const upb_msgdef *m = upb_symtab_lookupmsg2(c->symtab, name.data, name.size);
if (!m) {
static const char msg[] = "Unknown message type.";
conformance_ConformanceResponse_set_skipped(
c->response, upb_strview_make(msg, strlen(msg)));
return;
}
msg = upb_msg_new(m, c->arena);
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
if (parse_input(msg, m, c)) {
write_output(msg, m, c);
}
}
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
void debug_print(const char *label, const upb_msg *msg, const upb_msgdef *m,
const ctx *c) {
char buf[512];
upb_text_encode(msg, m, c->symtab, UPB_TXTENC_SINGLELINE, buf, sizeof(buf));
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
fprintf(stderr, "%s: %s\n", label, buf);
}
bool DoTestIo(upb_symtab *symtab) {
upb_status status;
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
char *input;
char *output;
uint32_t input_size;
size_t output_size;
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
ctx c;
if (!CheckedRead(STDIN_FILENO, &input_size, sizeof(uint32_t))) {
/* EOF. */
return false;
}
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
c.symtab = symtab;
c.arena = upb_arena_new();
input = upb_arena_malloc(c.arena, input_size);
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
if (!CheckedRead(STDIN_FILENO, input, input_size)) {
fprintf(stderr, "conformance_upb: unexpected EOF on stdin.\n");
exit(1);
}
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
c.request = conformance_ConformanceRequest_parse(input, input_size, c.arena);
c.response = conformance_ConformanceResponse_new(c.arena);
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
if (c.request) {
DoTest(&c);
} else {
fprintf(stderr, "conformance_upb: parse of ConformanceRequest failed: %s\n",
upb_status_errmsg(&status));
}
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
output = conformance_ConformanceResponse_serialize(c.response, c.arena,
&output_size);
CheckedWrite(STDOUT_FILENO, &output_size, sizeof(uint32_t));
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
CheckedWrite(STDOUT_FILENO, output, output_size);
test_count++;
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
if (verbose) {
debug_print("Request", c.request,
conformance_ConformanceRequest_getmsgdef(symtab), &c);
debug_print("Response", c.response,
conformance_ConformanceResponse_getmsgdef(symtab), &c);
fprintf(stderr, "\n");
}
upb_arena_free(c.arena);
return true;
}
int main(void) {
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
upb_symtab *symtab = upb_symtab_new();
protobuf_test_messages_proto2_TestAllTypesProto2_getmsgdef(symtab);
protobuf_test_messages_proto3_TestAllTypesProto3_getmsgdef(symtab);
while (1) {
Squashed 'third_party/upb/' changes from d8f3d6f9d4..ce1a399a19 ce1a399a19 Text format serializer for upb_msg (#242) 888f35cae6 Merge pull request #241 from haberman/conformance-fixes 46b93f8cea A bit more cleanup in the decoder. ad2eb65a4b Refactored conformance_upb to use reflection, and fixed a decoder bug. a202c5f84d Merge pull request #234 from haberman/parser 4c974cf72d Fixed generated files. 9a870d957f Removed upb_decframe and made ptr an explicit parameter and return. a6c54729df Added UPB_ASSUME(), to work around warnings when optimization is enabled: 9e1f89ef2c Merge pull request #224 from haberman/maps ce0496eb86 Merge branch 'master' into maps e911aae5f6 Factored upb_map_entry into a shared place. 4c1a97ae9c Merge branch 'master' into maps 59fe620fa0 Merge branch 'maps' of github.com:haberman/upb into maps 744f8588da Cleanup to remove END_GROUP from descriptortype -> type tables. f9efbcd5d6 Added missing append fallback. c4b64e6a20 Slight simplification: NULL arena will avoid creating a new sub-object. d541566a7b Moved upb_array_new() to upb/reflection.h where it belongs. 059f226d41 Unit tests for maps generated code. 520ddc1f11 c89 fixes. 806c8c9c6e Removed obsolete testing files. 2a85bef825 Generated code interface for maps is complete, though not yet tested. 7f5fe52dfa Fixes for non-C89 code. 6c2d732082 Fixed upb's map parsing to overwrite existing elements. 090a0c33a4 Fixed VLA error and rewrote the map parsing code to be clearer. 0fbae939d2 Removed stray fprintf(). 572ba75d1c Removed comma after final enumerator. c9135e5276 Fixed the build. d040aa1302 Merge branch 'master' into maps e18541a9dd Added some missing files. 92509cc3b2 Rename lua_test. 382f92a87f Maps encode and decode successfully! 4c57b1fefd More progress on Lua extension. d6c3152c0b Added more Lua tests that are passing. ae66e571d4 Fixed some bugs and added a few more tests. bfc86d3577 Fixed many bugs, basic Lua test passes! b518b06d75 Lua test program is loaded successfully. 6ae4a2694c Merge branch 'maps' of github.com:haberman/upb into maps cc6db9fb0b Fixed crash bug. 88d996132e Added Lua main.c test driver program. 626ec4bfcf Everything builds, test pass except test_decoder. 5239655b99 WIP. 23825332e1 WIP. 27b95c969a WIP. 9a360ad43d Moved legacy_msg_reflection.{c,h} -> reflection.{c.h}. dc58b657ee New reflection API doesn't need types as parameters for map/array. c486da3970 WIP. b76040cfcc Merge branch 'maps' of github.com:haberman/upb into maps cc8e894b63 Merge branch 'master' into maps 946880c105 Merge branch 'master' into maps 1461da5056 WIP. 0a07f2714b Merge branch 'master' into maps 18de110b00 Merge branch 'master' into maps 283857f308 WIP. 5dea3f8486 Merge branch 'master' into maps 07ac6f0e8e Merge branch 'master' into maps 0c64c4b594 WIP. git-subtree-dir: third_party/upb git-subtree-split: ce1a399a19f11683d58ba4c2569ec3fdd5a67621
5 years ago
if (!DoTestIo(symtab)) {
fprintf(stderr, "conformance_upb: received EOF from test runner "
"after %d tests, exiting\n", test_count);
return 0;
}
}
}