-
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
Use generator for existing atoms in lists
property tests
#7287
Use generator for existing atoms in lists
property tests
#7287
Conversation
CT Test Results 2 files 89 suites 42m 19s ⏱️ For more details on these failures, see this check. Results for commit da5a69b. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
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.
It generally looks good, but I'd recommend keeping a few hardcoded possible atoms, covering things like "non-ascii but latin1", "non-latin1 but valid utf8", etc..
As long as it is a small finite set it won't cause exhaustion of the atom table, and it will make sure that special code-paths for handling of non-ascii characters are exercised.
Adding such special atoms in erlfuzz helped find things like #7153.
Anyway, this is local to tests for the That said, one day I will try to do an extension to the property-based testing facility of |
Oh, I had not realized that this is only for the list module. |
I don't mind the trick for accessing existing atoms, but I only want to see it in one place in the test suite for STDLIB. That is, if you plan to use the same generator for other tests, please place in its own module that can be shared between property tests for STDLIB. |
If #7364 is accepted, this PR is obsolete. In that case, a new PR should be created to make use of the new generators. |
Obsoleted by #7364, will make another PR that uses |
Superseded by #7454. |
The
atom()
generator of PropEr creates atoms from random strings, and is thereby prone to exhaust the atom limit. By extension, so are the generators containing theatom()
generator, such asany()
orlist()
.The
lists
property test suite exhausted the atom limit at around 80 (of 107) properties, and we had to find a workaround by pre-generating a limited set of random atoms, store them inpersistent_term
, and a generator that subsequently took atoms only from this set instead of generating new ones.This PR changes the custom atom generator again to not pre-generate anything but pick from the set of already existing atoms. This has the following benefits over the current version:
Unfortunately, there is no official way of getting at the existing atoms, so this has to rely on an obscure "trick" that somebody figured out at some point. For OTP-internal tests like this one, I think it is justifiable, though.