Skip to content

[update-checkout] Make SWIFT_SOURCE_ROOT customizable and add a basic clone test #25673

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

gottesmm
Copy link
Contributor

For a while we have had the scaffolding for lit invoking update-checkout tests but never actually had any tests written.

This PR attempts to do the base work for update-checkout testing so that other people (as starter bugs) can fill in the rest of the coverage using this as an example. The only change to update-checkout itself is I had to remove the hard coding of SWIFT_SOURCE_ROOT as the assumed source root so I could mock during the testing. Now one can customize this by passing to update-checkout the argument --source-root. Of course by default, this is still just SWIFT_SOURCE_ROOT.

…rd coding to SWIFT_SOURCE_ROOT.

This enables mocking testing to work (otherwise we would create repos in
SWIFT_SOURCE_ROOT). SWIFT_SOURCE_ROOT is the default value so nothing changes
unless one specifies the argument explicitly.
@gottesmm gottesmm requested a review from shahmishal June 22, 2019 01:16
@gottesmm
Copy link
Contributor Author

@swift-ci python lint

@gottesmm gottesmm force-pushed the pr-346412d7746bf95e1c890610c95d7401bc4490c3 branch from 340529e to 8a6344a Compare June 22, 2019 01:22
@gottesmm
Copy link
Contributor Author

@swift-ci python lint

4 similar comments
@gottesmm
Copy link
Contributor Author

@swift-ci python lint

@gottesmm
Copy link
Contributor Author

@swift-ci python lint

@gottesmm
Copy link
Contributor Author

@swift-ci python lint

@gottesmm
Copy link
Contributor Author

@swift-ci python lint

…ure that we can clone.

This commit is not meant to completely test update-checkout, but rather create
some scaffolding for testing update-checkout so we can create starter bugs to
fill out the rest of the functionality. Once we have enough testing in place, we
can start refactoring/simplifying update-checkout.

Design
------

This is just a standard python unittest test suite except that the tests expect
an environment variable (UPDATECHECKOUT_TEST_WORKSPACE_DIR) to be set that
specifies the directory that the unittests have for creating mock git repos
during setup/teardown. lit invokes the test by calling the unittests with the
environment variable set to the appropriate temporary directory.

In this temporary directory, each test creates a pristine set of "fake" remote
repos and a test-config.json file that can be passed to update-checkout to work
with these "fake" remote repos. This allows each test that we write to test
various update-checkout functionalities against a pristime set of git repos. I
choose the git clone test, just b/c it was really simple.

NOTE: One can also run the tests locally using the script
test_update_checkout.sh that uses /tmp/workspace as the workspace directory.
@gottesmm gottesmm force-pushed the pr-346412d7746bf95e1c890610c95d7401bc4490c3 branch from 8a6344a to a9d384d Compare June 22, 2019 01:25
@gottesmm
Copy link
Contributor Author

@swift-ci python lint

5 similar comments
@gottesmm
Copy link
Contributor Author

@swift-ci python lint

@gottesmm
Copy link
Contributor Author

@swift-ci python lint

@gottesmm
Copy link
Contributor Author

@swift-ci python lint

@gottesmm
Copy link
Contributor Author

@swift-ci python lint

@gottesmm
Copy link
Contributor Author

@swift-ci python lint

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

1 similar comment
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm gottesmm merged commit 17d65dc into swiftlang:master Jun 22, 2019
@gottesmm gottesmm deleted the pr-346412d7746bf95e1c890610c95d7401bc4490c3 branch June 22, 2019 06:11
@AnthonyLatsis AnthonyLatsis added the update-checkout Area → utils: the `update-checkout` script label Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
update-checkout Area → utils: the `update-checkout` script
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants