-
-
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
Changes from all commits
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,6 +15,8 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from typing import Any, Union | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from buildconfig.get_version import version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MOD_NAME = "pygame-ce" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DIST_DIR = "dist" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -204,9 +206,11 @@ def __init__(self) -> None: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def cmd_build(self): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| wheel_dir = self.args.get("wheel", DIST_DIR) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| quiet = self.args.get("quiet", False) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| debug = self.args.get("debug", False) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| lax = self.args.get("lax", False) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sdl3 = self.args.get("sdl3", False) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sanitize = self.args.get("sanitize") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| coverage = self.args.get("coverage", False) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if wheel_dir and coverage: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pprint("Cannot pass --wheel and --coverage together", Colors.RED) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -228,6 +232,8 @@ def cmd_build(self): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not wheel_dir: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # editable install | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not quiet: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| install_args.append("-Ceditable-verbose=true") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| install_args.append("--editable") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| install_args.append(".") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -245,15 +251,19 @@ def cmd_build(self): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if coverage: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| install_args.extend(COVERAGE_ARGS) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if sanitize: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| install_args.append(f"-Csetup-args=-Db_sanitize={sanitize}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| info_str = f"with {debug=}, {lax=}, {sdl3=}, and {coverage=}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if wheel_dir: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pprint(f"Building wheel at '{wheel_dir}' ({info_str})") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cmd_run( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [self.py, "-m", "pip", "wheel", "-v", "-w", wheel_dir, *install_args] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pprint("Installing wheel") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mod_name = f"{MOD_NAME}=={version}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pip_install( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.py, ["--no-index", "--force", "--find-links", wheel_dir, MOD_NAME] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.py, ["--no-index", "--force", "--find-links", wheel_dir, mod_name] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pprint(f"Installing in editable mode ({info_str})") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -352,6 +362,11 @@ def parse_args(self): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"wheel (if not passed, '{DIST_DIR}' is used)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build_parser.add_argument( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--quiet", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| action="store_true", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| help="Silence build log in editable install (doing editable-verbose=false)", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build_parser.add_argument( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--debug", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| action="store_true", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -367,6 +382,20 @@ def parse_args(self): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| action="store_true", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| help="Build against SDL3 instead of the default SDL2", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build_parser.add_argument( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--sanitize", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| choices=[ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "address", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "undefined", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "address,undefined", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "leak", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "thread", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "memory", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "none", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| default="none", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| help="Enable compiler sanitizers. Defaults to 'none'.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+385
to
+398
Contributor
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.
Suggested change
Member
Author
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. Arbitrary choices cannot be mixed. Meson errors if you try to do that. The only mix that is allowed is |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build_parser.add_argument( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--coverage", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| action="store_true", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.