Skip to content

Protoc comparison test#32

Merged
cb372 merged 4 commits intomasterfrom
protoc-comparison-tests
Dec 30, 2019
Merged

Protoc comparison test#32
cb372 merged 4 commits intomasterfrom
protoc-comparison-tests

Conversation

@cb372
Copy link
Copy Markdown
Member

@cb372 cb372 commented Dec 30, 2019

Add a property-based test to check that the bytes generated by pbdirect for a complex message are identical to the output of the protoc command-line tool.

The test works as follows.

For a given randomly-generated message:

  1. Encode the message to protobuf bytes using pbdirect
  2. Encode the message to protobuf text format using a simple hand-written encoder. This is the format that protoc wants as its input
  3. Use protoc to encode the message to protobuf bytes, passing it the text-format encoded message and a .proto file as input
  4. Assert that the output from pbdirect and protoc are identical

We generate a random message, encode it in protobuf text format, use
both pbdirect and protoc to encode it as protobuf binary, and compare
the resulting bytes.
Copy link
Copy Markdown

@BenFradet BenFradet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* But then we'd be basically reinventing the whole
* library but for text instead of binary, and then using
* that to test the behaviour of the library. Feels a bit
* weird.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😁

Copy link
Copy Markdown

@fedefernandez fedefernandez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@cb372 cb372 merged commit c2c5daf into master Dec 30, 2019
@cb372 cb372 deleted the protoc-comparison-tests branch December 30, 2019 18:34
@cb372
Copy link
Copy Markdown
Member Author

cb372 commented Dec 30, 2019

Looks like this test is flaky on Travis, but works fine for me locally. So the build is broken on master now 😞

Looking at this log, it looks like protoc sometimes outputs nothing, which means the process probably failed to run. I'll investigate.

@cb372 cb372 mentioned this pull request Dec 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants