Skip to content
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

Ignore --test flag when it is an user-provided argument #96926

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

Dowsley
Copy link
Contributor

@Dowsley Dowsley commented Sep 12, 2024

Simple fix for edge-case #95922

@Dowsley Dowsley requested a review from a team as a code owner September 12, 2024 17:55
@Dowsley Dowsley force-pushed the user-provided-arguments-fix branch 2 times, most recently from d202dcc to f03a54b Compare September 12, 2024 17:58
@AThousandShips AThousandShips added bug topic:core regression cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release and removed cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Sep 12, 2024
@AThousandShips AThousandShips added this to the 4.4 milestone Sep 12, 2024
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally (rebased on top of master 77d6283), it works as expected.

Should be good to merge after applying suggestions.

@Dowsley Dowsley requested a review from Calinou February 3, 2025 22:11
@Calinou
Copy link
Member

Calinou commented Feb 6, 2025

Looks good to me, please squash the commits together so we can merge this. See PR workflow for instructions 🙂

@Dowsley Dowsley force-pushed the user-provided-arguments-fix branch from d1254e1 to d481669 Compare February 6, 2025 15:27
@Dowsley
Copy link
Contributor Author

Dowsley commented Feb 6, 2025

Looks good to me, please squash the commits together so we can merge this. See PR workflow for instructions 🙂

Since the change was so small I made it again but on top of current master. Then force pushed it here.

Is that enough?

@akien-mga akien-mga changed the title Ignore --test flag when it is an user-provided argument Ignore --test flag when it is an user-provided argument Feb 7, 2025
Comment on lines +892 to +896
// Early return to ignore a possible user-provided "--test" argument.
if ((strlen(argv[x]) == 2) && ((strncmp(argv[x], "--", 2) == 0) || (strncmp(argv[x], "++", 2) == 0))) {
tests_need_run = false;
return EXIT_SUCCESS;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this make godot --test -- --yolo fail to run tests?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess not, this will process in order so --test would be seen and handled first.

Copy link
Contributor Author

@Dowsley Dowsley Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. But I agree that this is hacky and we should look for an alternative way to handle this.

Won't #90507 be missed though?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to make it better, in the end I concluded that it's probably good enough for now.

@akien-mga
Copy link
Member

This is getting somewhat hacky for a niche use case, I might be more in favor of reverting #90507 if this has such implications.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a quick look at improving this, but indeed --test gets processed before the regular argument parsing so it's naturally a bit hardcoded.

Should be fine for now, I might poke at it later to make this clear as I'm not fond of this TEST_MAIN_OVERRIDE.

@Repiteo Repiteo merged commit f45d2f8 into godotengine:master Feb 12, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Feb 12, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release regression topic:core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants