-
-
Notifications
You must be signed in to change notification settings - Fork 216
Add sanitize flag to dev.py, fix UBSAN issues and run UBSAN check on CI #3493
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
Conversation
60cb872 to
333f3bb
Compare
oddbookworm
left a comment
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.
LGTM! 🎉
Spring cleaning time (in June)
gresm
left a comment
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.
LGTM 👍
gresm
left a comment
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.
While it's good as it is, I propose a slightly different scheme for --sanitize argument to allow mixing more modes.
| build_parser.add_argument( | ||
| "--sanitize", | ||
| choices=[ | ||
| "address", | ||
| "undefined", | ||
| "address,undefined", | ||
| "leak", | ||
| "thread", | ||
| "memory", | ||
| "none", | ||
| ], | ||
| default="none", | ||
| help="Enable compiler sanitizers. Defaults to 'none'.", | ||
| ) |
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.
| build_parser.add_argument( | |
| "--sanitize", | |
| choices=[ | |
| "address", | |
| "undefined", | |
| "address,undefined", | |
| "leak", | |
| "thread", | |
| "memory", | |
| "none", | |
| ], | |
| default="none", | |
| help="Enable compiler sanitizers. Defaults to 'none'.", | |
| ) | |
| build_parser.add_argument( | |
| "--sanitize", | |
| choices=[ | |
| "address", | |
| "undefined", | |
| "leak", | |
| "thread", | |
| "memory", | |
| "none", | |
| ], | |
| action="append", | |
| help="Enable compiler sanitizers. Defaults to 'none'.", | |
| ) |
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.
Arbitrary choices cannot be mixed. Meson errors if you try to do that. The only mix that is allowed is address,undefined. Hence I have gone with this approach.
| install_args.extend(COVERAGE_ARGS) | ||
|
|
||
| if sanitize: | ||
| install_args.append(f"-Csetup-args=-Db_sanitize={sanitize}") |
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.
| install_args.append(f"-Csetup-args=-Db_sanitize={sanitize}") | |
| parsed_sanitize = ",".join(sanitize) if sanitize else "none" | |
| install_args.append(f"-Csetup-args=-Db_sanitize={parsed_sanitize}") |
fixes #767
closes #766
In the first commit I added a
--sanitizeflag todev.pyto make it more convenient to enable sanitizers. While I was at it I also made editable rebuilds verbose by default (though one can still disable it with a--quietflag now).In the second commit I fixed all UBSAN issues and also added it to our CI. ASAN however catches too many issues and many of them seem to be from python, SDL and other dependencies of ours. So I don't think adding it to CI is feasible at all. However it would still be supported from
dev.pyincase one wants to go over the wall of errors and filter pygame-ce specific issues xD