-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Extend common_test
PropEr with atomlimit-safe generator variants
#7364
Conversation
common_test
PropEr with atomlimit-safe generator variants
Hm, ok, there is a problem... The In a sense, the calls to maybe-unknown functions was on purpose: they would magically pop into existence when PropEr was used, and if not, the include of the respective file would just not happen. For the same reason, none of the PropEr macros like Is there a better way to do this? Please advise 🥺 |
I suggest that you place at least the BEAM file for |
Thanks @bjorng 🙂 |
Wouldn't it be better to fix PropEr instead? We're not the only ones to have this problem and it feels rather strange to call internals of a 3rd-party library in tests. |
@jhogberg yes...
OTOH, I have been adding a few property test suites to OTP, last of them in #7256, which make heavy use of the |
Isn't it a bit of a layering violation, making OTP source code aware of PropEr? Appears to be a sort of a circular dependency. I do support @jhogberg suggestion to try fitting it into PropEr, rather than OTP, as it also allows usages from |
It is an optional dependency, not even mandatory for testing OTP. Basic functionality should always be tested with "plain" test suites. Since the maintainers of PropER won't accept the updated generators, I think this is the best we can do. One thing regarding layering, the property-based tests are supposed to work with any of the known property-based tools, so if another tool than PropER is used, it would be nice if the new generators would fall back to calling the standard generators in that tool. |
I wouldn't go as far as unconditional "won't accept", but it looks like it's very difficult to come up with something that they will accept...
Ah well, as to that... 😅 At least the proptests I wrote for OTP in the past (for If the goal is that the proptests in OTP work with all three tools, this PR is actually obsolete: the atom generator is not present in all of them but only PropEr, so we can't use it, so we don't need a safe version of it as far as OTP proptests are concerned. And the existing PropEr-dependent tests need to be reworked (not sure how much boilerplate code that would require and how much "steam" it would take out of those tests). |
Wait... Triq does have Anyway, looking over all the tools, it looks like staying on the common ground is pretty limiting overall... And some of the things they do share work in somewhat different ways. |
@Maria-12648430 It is no longer a goal that property tests should work in all of them. We use PropER exclusively in our daily builds. There is no need trying to maintain compatibility with EQC and Triq. |
@bjorng great, that's one worry less 🤗 |
So, @bjorng, I take this as a "go ahead" then? 😉 To be sure, the intention here is to use these new generators in OTP-internal tests only, ie they're not for the general public. In the future, PropEr may accept my PR for the same issue, one way or other. In that case, we may have clashing That said, what is OTPs rule in respect to what PropEr releases to use? The latest? A fixed one? |
Yes, it is a go ahead! Requiring an explicit external call is a good idea to make it clear that it is not a standard PropER feature. At least on some of the build machines we only update PropEr when there is a new feature we'll need. I have just updated PropER to the latest master commit while rebuilding it because of #7396 (before that, we used 1.04, the latest tagged release). I am not sure exactly how PropEr is updated for our Docker builds. If there is some new feature in PropER that you'll need for the property test, just tell us and we'll make sure that it used on all our test machines. |
Ok, great, then I will pick this up again in the next few days 🙂 |
0752cf5
to
d98facc
Compare
The last commits remove the calls to PropEr-internal functions in the Also, the importing of the new custom generators has been removed again. |
Umm... how do I go about that? 😅 I guess it means fiddling around in the |
@Maria-12648430 I can help with that. I'll try to get to it next week. |
Thanks, that would be great 🤗 |
@bjorng by "just", I assume you mean less than ~8 months ago, later than October 27th, 2022, yes? That was when the |
The last commits fix a bug in the I'm still at a loss regarding a handy module name, open for suggestions 😅 |
Yes, I did the update the same day that I wrote the comment. |
This week has been busy for me, so I'll do the I will not work tomorrow. Tomorrow is Midsummer Eve in Sweden. I will be back on Monday. |
Sure, no hurry
Enjoy your holiday (which we here in Germany know mainly by ways of IKEA 😅) |
I have pushed a new commit that renames your extension module to |
I have tried it out with the property tests for the The name |
Nice, works great, thanks @bjorng 🤗 |
Yes, that's probably better. @Maria-12648430, will you do the renaming? When done, please squash the commits. |
On it 👍 Should I rename only the module or the directory as well?
Will do 🙂 |
I see no reason to rename the directory. |
The atom generator of PropEr generates atoms from random strings and its use, explicitly or implicitly, is prone to exhausting the atom limit. This commit adds variants to the atom generator which pick from the existing atoms and do not generate any new ones. It also provides variants of the any, list, map, term and tuple generators which implicitly use the atom generator. This extension is intended for internal use in property-based tests in OTP. It will only be enabled when PropEr is detected as property testing tool. Co-authored-by: Jan Uhlig <juhlig@hnc-agency.org> Co-authored-by: Björn Gustavsson <bjorn@erlang.org>
e1402d5
to
c39caa3
Compare
@bjorng all done 😃 |
Thanks! Added to our daily builds. |
Thanks for your pull request. |
Yay 😃 |
The
atom
generator of PropEr generates atoms from random strings and its use, explicitly or implicitly, is prone to exhausting the atom limit.This PR adds two variants to the
atom
generator (calledexisting_atom
andsafe_atom
) which pick from the existing atoms and do not generate any new ones. It also provides variants of theany
(-->safe_any
),list
(-->safe_list
), andtuple
(-->safe_tuple
) generators which implicitly use thesafe_atom
generator.The
existing_atom
generator simply picks from the set of existing atoms. Thesafe_atom
generator does the same but emphasizes some of the most common atoms, the list of known node names, and some "weird" atoms (non-ASCII, latin1 and UTF-8).The code for the
safe_any
generator mimicks theany
generator in PropEr and makes use of some PropEr-internal functions in theproper_arith
module.The additions of this PR have been locally tested in the
lists_property_test_SUITE
and work well there. However, the PR does not include those changes, as they are better suited in a seperate PR. OTOH, the absence of a use case probably makes it difficult to review...