8000 Sandbox test repositories in TMP by nulltoken · Pull Request #1018 · libgit2/libgit2sharp · GitHub
[go: up one dir, main page]

Skip to content

Sandbox test repositories in TMP #1018

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
merged 2 commits into from
Apr 15, 2015
Merged

Sandbox test repositories in TMP #1018

merged 2 commits into from
Apr 15, 2015

Conversation

nulltoken
Copy link
Member

No description provided.

@nulltoken
Copy link
Member Author

/cc @carlosmn @ethomson

@Therzok
Copy link
Member
Therzok commented Apr 10, 2015

Mac has a weird /private/var/tmp vs /var/tmp usage for temporary directory paths.

Also, what happens when the test suite fails? Is the directory guaranteed to be cleaned up? Windows is that weird OS which doesn't cleanup Temp dir on restart.

@ethomson
Copy link
Member

Is the directory guaranteed to be cleaned up?

Are they ever?

@Therzok
Copy link
Member
Therzok commented Apr 10, 2015

Is it ok to add a dependency on Mono.Unix? What about people who use CoreCLR?

@Therzok
Copy link
Member
Therzok commented Apr 10, 2015

Rephrased: I'm totally ok with this solution, but we need to ensure coreclr as a target doesn't fail. 💃

Other than that, reflection usage there is fine by me. I'm not suggesting we depend on Mono.Unix assembly for the test run.

@carlosmn
Copy link
Member

It's much more likely that the temp directory gets cleaned that a relative path to your bin/ directory. And the temp dir is where I would expect to look to clean up if I've been crashing tests.

We don't take a hard dependency on Mono.Unix, we just use it if it's available. If you're using CoreCLR on OSX, then some tests are going to fail, but that's OSX' fault; the only way we've found to get to the path which libgit2 returns is to do the libc realpath() work.

@ethomson
Copy link
Member

👍

@nulltoken
Copy link
Member Author

@Therzok The test repositories are cleaned in a "best effort" mode. From time to time, we forget to properly release a handle and DirectoryHelper.DeleteDirectory() goes on strike.

Ok to squash and merge?

@Therzok
Copy link
Member
Therzok commented Apr 10, 2015

Fine by me.

@carlosmn
Copy link
Member

👍

@nulltoken nulltoken force-pushed the ntk/temp branch 2 times, most recently from cca5705 to 956691f Compare April 10, 2015 19:46
@nulltoken
Copy link
Member Author

I've added some minor tweaks:

  • Remove the ShadowCopyFixture special casing
  • Add some garbage collecting prior to every test run that removes old test repos
    • That may haven't been removed because of leaks/failures
    • That cannot be removed (ie. ShadowCopyFixture)

I'd be a taker for a final review

@nulltoken
Copy link
Member Author

Ok to merge?

@nulltoken nulltoken added this to the v0.22 milestone Apr 14, 2015
nulltoken added a commit that referenced this pull request Apr 15, 2015
Sandbox test repositories in TMP
@nulltoken nulltoken merged commit 7027de2 into vNext Apr 15, 2015
@nulltoken nulltoken deleted the ntk/temp branch April 15, 2015 07:42
{
string tempPath;

var unixPath = Type.GetType("Mono.Unix.UnixPath, Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
Copy link
Member

Choose a reason for hiding this comment

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

I know this feedback is a bit late, but here we go:

Elsewhere we use Type type = Type.GetType("Mono.Runtime") to determine if we are running on mono - should we put this logic into a function that can be called? Or maybe this is only expected to succeed when running on Mono and *nix?

Also, might be nice to include a little more documentation around why this extra logic is necessary, where the publicKeytoken was found, (and maybe change the name to BuildTemporaryReposPath).

Copy link
Member

Choose a reason for hiding this comment

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

This is a bit different. You could be running with Mono on Windows (lol :D) or embedded systems that don't have Mono.Unix. We're only doing that if we have the supplied functionality.

Copy link
Member

Choose a reason for hiding this comment

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

The bit we care about isn't that we're running on mono, but that we can run realpath(), and we only really need it for OS X because that's the one with the silly rewrites of temp paths. Anywhere else we can take it or leave it.

< A18B path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"> Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation - I think having this captured in code comments could be valuable. Also, it seems we are looking for a version of the assembly with a particular public key - This is because we only expect to work with version built by who ever controls that key?

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.

5 participants
0