-
Notifications
You must be signed in to change notification settings - Fork 15.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give a specific category to each test. #4965
Give a specific category to each test. #4965
Conversation
This change introduce a TestCategory enum to ConformanceRequest. Existing tests are divided into three categories: binary format test, json format test and json format (ignore unknown when parsing) test. For the previous two categories, there is no change to existing testee programs. For tests with the last category, testee programs should either enable ignoring unknown field during json parsing or skip the test.
9660f99
to
0db71dc
Compare
0db71dc
to
666d107
Compare
0529c51
to
142eb93
Compare
04e42cf
to
1928e05
Compare
conformance/conformance.proto
Outdated
@@ -83,7 +91,10 @@ message ConformanceRequest { | |||
// protobuf_test_messages.proto2.TestAllTypesProto2. | |||
string message_type = 4; | |||
|
|||
bool ignore_unknown_json = 5; | |||
// Each test is given a unique test category. Some category may need spedific |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Each test is given a unique test category" seems to indicate each test has a different category...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"spedific"?
conformance/conformance.proto
Outdated
enum TestCategory { | ||
BINARY_TEST = 0; // Test binary wire format. | ||
JSON_TEST = 1; // Test json wire format. | ||
JSON_IGNORE_UNKNOWN_PARSING_TEST = 2; // Similar to JSON_TEST. However, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a link to https://developers.google.com/protocol-buffers/docs/proto3#json_options and point out this is an optional feature of proto3 JSON.
@xfxyjwf did you want to also require the required/suggested concept in favor of categories? |
@thomasvl I don't understand your question... |
We also have |
No, I did not indent to replace that. I think test category is different from conformance level. Test category is to group tests into feature sets. It's ok to not implement a certain optional feature so we can allow testees to skip tests for that feature entirely. However, failing recommended tests should be discouraged. Instead of making it more skippable, I would rather go the opposite direction and make it unskippable. |
To that last point, a testee doesn't get them by default (I missed this at first when we supported the tests for SwiftProtobuf). You have to know to pass an extra arg when invoking the runner: https://github.com/google/protobuf/blob/master/conformance/Makefile.am#L329-L367 If you really want them by default, maybe flip the command line flag so instead of |
Yeah, I think that's what we should do. I can do that after the current conformance test cleanup is done. #4968 |
Is there any more change needed? |
When a test fails, can you make sure the test category is included in the error message? |
When tests fail, the error log shows something like:
|
Seems good enough. |
This change introduce a TestCategory enum to ConformanceRequest. Existing tests
are divided into three categories: binary format test, json format test and json
format (ignore unknown when parsing) test. For the previous two categories, there
is no change to existing testee programs. For tests with the last category, testee programs
should either enable ignoring unknown field during json parsing or skip the test.