Skip to content

[Compile perf] Use lit tmpdir in scale-test, rdar://29090287 #5675

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

graydon
Copy link
Contributor

@graydon graydon commented Nov 7, 2016

This PR makes the scale-test script and lit.cfg configury a little more precise in its use of paths, to try to work around some CI failures we were seeing. Changes are:

  • Use the exact swiftc path rather than searching $PATH
  • Pass and use the lit %t test tempdir rather than letting python's tempfile search for one
  • Run the subprocess with cwd set to the tempdir, not passing full paths

The second change is likely the one that was causing the CI failure (lit.py scrubs the environment of the subprocess, meaning scale-test was putting files in /tmp/... not /var/folders/...) but the first and third changes here improve the precision and reduce the chatter of the subprocess along the way.

The CI breakage is tracked in rdar://29090287

Copy link
Contributor

@modocache modocache left a comment

Choose a reason for hiding this comment

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

Looks great! But you'll need to fix some linter errors for this to pass CI.

@swift-ci please lint Python

with open(ifile,'w+') as f:
fname = "in%d.swift" % n
pathname = os.path.join(d, fname)
with open(pathname,'w+') as f:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit-pick: You should run the flake8 linter over this code. I think this line will produce a warning, because it's missing a space after the comma.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting. I see the results in the jenkins job, but when I install and run flake8 locally I get no errors. Is there some particular version or configuration of flake8 to install to get such results?

r = {}
try:
d = tempfile.mkdtemp()
if args.tmpdir != None and not os.path.exists(args.tmpdir):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit-pick: The linter will probably complain here as well. None is a singleton, the convention is to check for identity, not equality. So this should be if args.tmpdir is not None.

@modocache
Copy link
Contributor

@swift-ci Please Python lint

@@ -269,6 +275,8 @@ def main():

args = parser.parse_args(sys.argv[1:])
(rng, runs) = run_many(args)
if args.tmpdir != None:
shutil.rmtree(args.tmpdir)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason we have to delete this at all? If there is, can we do it before the test instead of after? Otherwise we delete valuable artifacts for debugging failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No strong reason, just thought I'd clean up. Will move to before-test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Eh, on second thought some users might not expect a tmpdir to be deleted before use, I'll just remove these lines.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool. LGTM with that change!

@graydon graydon force-pushed the rdar-29090287-failing-scale-test-tmpdir branch from 6b30fb2 to 2a89323 Compare November 7, 2016 23:58
@graydon
Copy link
Contributor Author

graydon commented Nov 7, 2016

Updated with flake8 fixes and removal of rmtree call.

@graydon
Copy link
Contributor Author

graydon commented Nov 8, 2016

@swift-ci please smoke test and merge

@graydon graydon merged commit 982a57f into swiftlang:master Nov 8, 2016
@graydon graydon deleted the rdar-29090287-failing-scale-test-tmpdir branch January 18, 2017 22:35
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