Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2015-04-29 22:48:08 +0300
committernulltoken <emeric.fermas@gmail.com>2015-04-29 22:48:08 +0300
commit0b3109048f0ec3ac8fd991370c40aba69526f742 (patch)
treee63242febcd11abf99564f18910f9c0f157579cd
parent8febb35461b3391851df7ec9ca25c34313e70a9c (diff)
parentb5223d5ca82a8cb39d3cd7d7fae829ef286cc5be (diff)
Merge pull request #1035 from whoisj/custom-unit-test-folder
Enable custom unit test location with standard location fallback
-rw-r--r--LibGit2Sharp.Tests/TestHelpers/Constants.cs20
-rw-r--r--README.md11
2 files changed, 28 insertions, 3 deletions
diff --git a/LibGit2Sharp.Tests/TestHelpers/Constants.cs b/LibGit2Sharp.Tests/TestHelpers/Constants.cs
index 954ed6aa..450746ff 100644
--- a/LibGit2Sharp.Tests/TestHelpers/Constants.cs
+++ b/LibGit2Sharp.Tests/TestHelpers/Constants.cs
@@ -1,4 +1,5 @@
using System;
+using System.Diagnostics;
using System.IO;
namespace LibGit2Sharp.Tests.TestHelpers
@@ -34,7 +35,7 @@ namespace LibGit2Sharp.Tests.TestHelpers
public static string BuildPath()
{
- string tempPath;
+ string tempPath = null;
var unixPath = Type.GetType("Mono.Unix.UnixPath, Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
@@ -48,11 +49,24 @@ namespace LibGit2Sharp.Tests.TestHelpers
}
else
{
+ const string LibGit2TestPath = "LibGit2TestPath";
// We're running on .Net/Windows
- tempPath = Path.GetTempPath();
+ if (Environment.GetEnvironmentVariables().Contains(LibGit2TestPath))
+ {
+ Trace.TraceInformation("{0} environment variable detected", LibGit2TestPath);
+ tempPath = Environment.GetEnvironmentVariables()[LibGit2TestPath] as String;
+ }
+
+ if (String.IsNullOrWhiteSpace(tempPath) || !Directory.Exists(tempPath))
+ {
+ Trace.TraceInformation("Using default test path value");
+ tempPath = Path.GetTempPath();
+ }
}
- return Path.Combine(tempPath, "LibGit2Sharp-TestRepos");
+ string testWorkingDirectory = Path.Combine(tempPath, "LibGit2Sharp-TestRepos");
+ Trace.TraceInformation("Test working directory set to '{0}'", testWorkingDirectory);
+ return testWorkingDirectory;
}
}
}
diff --git a/README.md b/README.md
index 647e5c34..e47e4674 100644
--- a/README.md
+++ b/README.md
@@ -57,6 +57,17 @@ More thorough information available in the [wiki][wiki].
[wiki]: https://github.com/libgit2/libgit2sharp/wiki
+## Optimizing unit testing
+LibGit2Sharp strives to have comprehensive and robust unit test suite to insure the quality of the software and to assist new contributors and users who can use the tests as sample to jump start development. There are over one-thousand unit-tests for LibGit2Sharp, this number will only grow as functionality is added.
+
+You can do a few things to optimize running unit-tests on Windows:
+
+1. Set the `LibGit2TestPath` environment variable to a path in your development environment.
+ * If the unit-test framework cannot find the specified folder at runtime, it will fall back to the default location.
+2. Configure 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 requires elevated privileges and can be placed into a scheduled task or run manually before you begin unit-testing.
+
## Authors
- **Code:** The LibGit2Sharp [contributors][committers]