-
Notifications
You must be signed in to change notification settings - Fork 592
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
Switch 'Ice/optional' Tests to use Optional Structs Instead of Optional Classes #2094
Changes from 2 commits
7d3c7c1
9947059
356a13e
11ae20f
1468b4c
8725b8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,20 +161,20 @@ class OptionalWithCustom | |
|
||
class E | ||
{ | ||
A ae; | ||
FixedStruct fse; | ||
} | ||
|
||
class F extends E | ||
{ | ||
optional(1) A af; | ||
optional(1) FixedStruct fsf; | ||
} | ||
|
||
class G1 | ||
struct G1 | ||
{ | ||
string a; | ||
} | ||
|
||
class G2 | ||
struct G2 | ||
{ | ||
long a; | ||
} | ||
|
@@ -278,9 +278,9 @@ interface Initial | |
|
||
void opClassAndUnknownOptional(A p); | ||
|
||
void sendOptionalClass(bool req, optional(1) OneOptional o); | ||
void sendOptionalStruct(bool req, optional(1) FixedStruct ofs); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already have extensive testing for struct above, with opSmallStruct, opFixedStryct, opVarStruct and even tests for struct list. What are these newly renamed operations sendOptionalStruct and returnOptionalStruct adding in terms of test coverage? It's ok to delete redundant tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, these functions are used to test interop with the 1.0 encoding. Specifically: optional values are a 1.1-only feature, but we support adding them to operations called with the 1.0 encoding. In this case, the optionals are simply ignored. This behavior isn't class specific, so using optional structs instead of optional classes is fine. Hence my change. Note that there isn't really any other operation we could of co-opted for this purpose. Since all the other operations just echo whatever value you pass in. This isn't useful for this test case, since we want to separately ensure that sending and receiving optionals are ignored. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After reading the comment in the .cpp file, I think you missed the intent of this test. It's not about passing an optional parameter, but about passing a class parameter with optional fields. The additional layer of making the parameter optional is superfluous. So I would keep the names and simplify the signature: void sendOneOptionalClass(OneOptional o);
... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want to remove it, that's fine with me, I don't really care.
It doesn't say alot. But it sounds like the point is "... parameters are optional" I tracked down the original issue: https://zeroc.atlassian.net/browse/ICE-4930 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the initial commit that fixes this 493caea I think this test was about the class encoding, more concretely about a bogus call to 493caea#diff-a6f653e19cbe0e6ef7bfee702bbb838ccd86ce17d0454083c81e670e4a8020cdL2173-L2176 If we are only sending optional classes seems we don't have to call the method, but be were calling it. The PR added this additional I think we can remove the test, as it was class encoding related and the new version doesn't use classes. |
||
|
||
void returnOptionalClass(bool req, out optional(1) OneOptional o); | ||
void returnOptionalStruct(bool req, out optional(1) FixedStruct ofs); | ||
|
||
G opG(G g); | ||
|
||
|
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.
G1/G2 and G are apparently used for opG below. It's not clear to me what is special with this test, especially now that G1 and G2 are plain structs.
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.
All of these
G
types are for testing the combination of optionals andmarshaled-result
:We have a 4 marshaled-result tests in total.
The first uses optional structs (which hold a single required byte),
the second uses an optional sequence, the third uses an optional dictionary.
But none of these test marshaled-result with optional members.
Hence, I kept the 4th test, since, that's what it tests. A class which holds a combination of optional and required data members. And this test doesn't seem class specific. All we need is a class which holds some optional things internally.
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.
Now, maybe we could remove
opG()
.It seems we added it as part of a bug-fix:
Fixed ICE-6602: optionals marshaling bug
, so to play it safe I kept it.I couldn't find any more detailed explanation in the logs, and forgot how to log into JIRA.