Skip to content
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

Merged
merged 6 commits into from
Jul 27, 2018

Conversation

TeBoring
Copy link
Contributor

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.

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.
@TeBoring TeBoring force-pushed the protobuf-conformance2 branch from 9660f99 to 0db71dc Compare July 25, 2018 22:55
@TeBoring TeBoring force-pushed the protobuf-conformance2 branch from 0db71dc to 666d107 Compare July 25, 2018 23:31
@TeBoring TeBoring force-pushed the protobuf-conformance2 branch from 0529c51 to 142eb93 Compare July 25, 2018 23:52
@TeBoring TeBoring force-pushed the protobuf-conformance2 branch from 04e42cf to 1928e05 Compare July 26, 2018 02:07
@xfxyjwf xfxyjwf self-assigned this Jul 26, 2018
@@ -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
Copy link
Contributor

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...

Copy link
Contributor

Choose a reason for hiding this comment

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

"spedific"?

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,
Copy link
Contributor

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.

@thomasvl
Copy link
Contributor

@xfxyjwf did you want to also require the required/suggested concept in favor of categories?

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jul 26, 2018

@thomasvl I don't understand your question...

@thomasvl
Copy link
Contributor

We also have enum ConformanceLevel which we document as as categories, should that get retired and modeled instead by the enum provided in the conformance.proto instead? They testees can also choose to say the "recommended" ones aren't supported just like they can do for these new json unknown parsing tests.

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jul 26, 2018

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.

@thomasvl
Copy link
Contributor

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 --enforce_recommended you have --skip_recommended, and then folks have to go out of their way not to run time.

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jul 26, 2018

If you really want them by default, maybe flip the command line flag so instead of --enforce_recommended you have --skip_recommended, and then folks have to go out of their way not to run time.

Yeah, I think that's what we should do. I can do that after the current conformance test cleanup is done. #4968

@TeBoring
Copy link
Contributor Author

Is there any more change needed?

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jul 27, 2018

When a test fails, can you make sure the test category is included in the error message?

@TeBoring
Copy link
Contributor Author

TeBoring commented Jul 27, 2018

When tests fail, the error log shows something like:

json_payload: "{
  \"optionalAny\": {
     \"@type\": \"type.googleapis.com/google.protobuf.Value\",
     \"value\": 2
  }
}"
requested_output_format: JSON
message_type: "protobuf_test_messages.proto3.TestAllTypesProto3"
test_category: JSON_TEST

@TeBoring TeBoring changed the title [WIP] Give a unique category to each test. Give a specific category to each test. Jul 27, 2018
@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jul 27, 2018

Seems good enough.

@TeBoring TeBoring merged commit 8705adc into protocolbuffers:master Jul 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants