Skip to content

Enable custom unit test location with standard location fallback #1035

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 1 commit into from
Apr 29, 2015
Merged

Enable custom unit test location with standard location fallback #1035

merged 1 commit into from
Apr 29, 2015

Conversation

whoisj
Copy link

@whoisj whoisj commented Apr 28, 2015

Enables developers of Libgit2Sharp to use a custom path for the temporary repositories used during unit testing. For example, I've setup a RAM disk on my development machine. While the RAM disk isn't suitable for all of operating system's %TEMP% needs, it's ideal for unit testing Libgit2Sharp.

On my Surface Pro 3 (Core i5 version) unit tests are reduced from roughly 17 minute to around 2 minutes. Basically an order of magnitude improvement.

Of course, we should fallback to the traditional %TEMP% folder if the developer hasn't provided a viable alternative.

This PR has no impact on non-Windows development environments.

if (Environment.GetEnvironmentVariables().Contains(LibGit2TestPath))
{
tempPath = Environment.GetEnvironmentVariables()[LibGit2TestPath] as String;
}
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add a new line after this brace?

Copy link
Author

Choose a reason for hiding this comment

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

Done

@whoisj
Copy link
Author

whoisj commented Apr 29, 2015

Added instructions to the README.md per @nulltoken

1. Set the `LibGit2TestPath` environment variable to a path in your development environment.
2. Set the Instruct your anti-virus software to ignore the `LibGit2TestPath` path.
3. Install a RAM disk like [IMDisk](http://www.ltr-data.se/opencode.html/#ImDisk) and set `LibGit2TestPath` to use it.
* Use `imdisk.exe -a -s 256M -m X: -p "/fs:fat /q /v:ramdisk /y` to create a RAM disk. This command can be placed into a scheduled task or run manually before you begin unit-testing.
Copy link
Member

Choose a reason for hiding this comment

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

How about adding a bullet point with a quick one liner (Powershell, maybe?) showing how to set the LibGit2TestPath to the new mounted drive.

Copy link
Member

Choose a reason for hiding this comment

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

Also maybe should we adding a quick note explaining that if the path doesn't exist, the test repos will fallback to standard location?

Copy link
Member

Choose a reason for hiding this comment

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

Two more nitpicks:

  • Regarding the command line to imdisk.exe, I think a quote (") is missing at the end
  • It may be worth it to specifiy that this command should be run with elevated privileges.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, missing quote on the command (copy/paste error there). Agreed, need to mention elevated privileges requirement.

I'll add the fallback note to reassure readers.

As for PowerShell, I've no PowerShell experience and would have no idea where to begin.

Copy link
Member

Choose a reason for hiding this comment

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

As for PowerShell, I've no PowerShell experience and would have no idea where to begin.

Ok. We'll update the doc if users struggle with this.

nulltoken added a commit that referenced this pull request Apr 29, 2015
Enable custom unit test location with standard location fallback
@nulltoken nulltoken merged commit 0b31090 into libgit2:vNext Apr 29, 2015
@nulltoken
Copy link
Member

Awesome feature ‼️

Thanks!

@nulltoken nulltoken added this to the v0.22 milestone Apr 29, 2015
@whoisj whoisj deleted the custom-unit-test-folder branch May 7, 2015 20:12
@whoisj whoisj restored the custom-unit-test-folder branch May 7, 2015 20:12
@nulltoken
Copy link
Member

Published as NuGet pre-release package LibGit2Sharp.0.22.0-pre20150507080442

@whoisj whoisj deleted the custom-unit-test-folder branch June 5, 2015 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants