Skip to content

Avoid calling os.chdir() in test. #2989

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

Merged

Conversation

adrian-prantl
Copy link

No description provided.

@adrian-prantl
Copy link
Author

This may or may not explain flakyness in the tests.

@jimingham
Copy link

It looks like the test suite already resets the cwd to the source directory before beginning a new test, so the chdir that you are removing should not be necessary, but mostly because it's redundant.

However, I can't see how it would have caused the test to be flakey?

@adrian-prantl
Copy link
Author

Yeah, I think you are right.
I recently removed all instances of os.chdir from tests and it may be that not all of them had a cleanup action registered. I'd still feel better about not changing global state in any test so at least I don't have to go back thinking whether this could have an unintended impact.

@adrian-prantl
Copy link
Author

We keep having very rare test failures where tests suddenly hit the wrong number of breakpoints and my best guess is that, for example, we are attaching to the wrong a.out so I'm trying to eliminate all possible avenues where such a thing might happen

@adrian-prantl
Copy link
Author

@swift-ci test

@jimingham
Copy link

jimingham commented May 24, 2021 via email

@adrian-prantl
Copy link
Author

Yeah, I always thought it was a little unfortunate that we didn't have a system that would base executable names off of the test name or something, so that we couldn't make this kind of mistake... But short of that this seems a reasonable thing to try.

That is still (way down) on my list to figure out who the a.out zombies are that tend to accumulate on the bots.

@adrian-prantl adrian-prantl merged commit 0fbb794 into swiftlang:swift/release/5.5 May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants