예제 #1
0
        private static ScalarFunctionalTestEnlistment Clone(
            string pathToScalar,
            string enlistmentRoot,
            string commitish,
            string localCacheRoot,
            bool skipFetchCommitsAndTrees = false,
            bool fullClone = true,
            string url     = null)
        {
            enlistmentRoot = enlistmentRoot ?? GetUniqueEnlistmentRoot();

            ScalarFunctionalTestEnlistment enlistment = new ScalarFunctionalTestEnlistment(
                pathToScalar,
                enlistmentRoot,
                url ?? ScalarTestConfig.RepoToClone,
                commitish ?? Properties.Settings.Default.Commitish,
                localCacheRoot ?? ScalarTestConfig.LocalCacheRoot,
                fullClone);

            try
            {
                enlistment.Clone(skipFetchCommitsAndTrees);
            }
            catch (Exception e)
            {
                Console.WriteLine($"Unhandled exception in {nameof(ScalarFunctionalTestEnlistment.Clone)}: " + e.ToString());
                TestResultsHelper.OutputScalarLogs(enlistment);
                throw;
            }

            return(enlistment);
        }
예제 #2
0
        public static ScalarFunctionalTestEnlistment CloneWithPerRepoCache(string pathToGvfs, bool skipFetchCommitsAndTrees)
        {
            string enlistmentRoot = ScalarFunctionalTestEnlistment.GetUniqueEnlistmentRoot();
            string localCache     = ScalarFunctionalTestEnlistment.GetRepoSpecificLocalCacheRoot(enlistmentRoot);

            return(Clone(pathToGvfs, enlistmentRoot, null, localCacheRoot: localCache, skipFetchCommitsAndTrees: skipFetchCommitsAndTrees));
        }
예제 #3
0
        public static ScalarFunctionalTestEnlistment CloneGitRepo(string pathToScalar)
        {
            string enlistmentRoot = Path.Combine(GetUniqueEnlistmentRoot(), GitRepoSrcDir);

            ScalarFunctionalTestEnlistment enlistment = new ScalarFunctionalTestEnlistment(
                pathToScalar,
                enlistmentRoot,
                ScalarTestConfig.RepoToClone,
                Properties.Settings.Default.Commitish,
                ScalarTestConfig.LocalCacheRoot,
                isScalarRepo: false);

            try
            {
                enlistment.CloneGitRepo();
            }
            catch (Exception e)
            {
                Console.WriteLine($"Unhandled exception in {nameof(ScalarFunctionalTestEnlistment.Clone)}: " + e.ToString());
                TestResultsHelper.OutputScalarLogs(enlistment);
                throw;
            }

            return(enlistment);
        }
예제 #4
0
        public static ScalarFunctionalTestEnlistment CloneEnlistmentWithSpacesInPath(string pathToScalar, string commitish = null)
        {
            string enlistmentRoot = ScalarFunctionalTestEnlistment.GetUniqueEnlistmentRootWithSpaces();
            string localCache     = ScalarFunctionalTestEnlistment.GetRepoSpecificLocalCacheRoot(enlistmentRoot);

            return(Clone(pathToScalar, enlistmentRoot, commitish, localCache));
        }
예제 #5
0
        public static void ValidateGitCommand(
            ScalarFunctionalTestEnlistment enlistment,
            ControlGitRepo controlGitRepo,
            string command,
            params object[] args)
        {
            command = string.Format(command, args);
            string controlRepoRoot = controlGitRepo.RootPath;
            string scalarRepoRoot  = enlistment.RepoRoot;
            int    pair_id         = Interlocked.Increment(ref TraceCommandSequenceId);

            Dictionary <string, string> environmentVariables = new Dictionary <string, string>();

            environmentVariables["GIT_QUIET"]          = "true";
            environmentVariables["GIT_COMMITTER_DATE"] = "Thu Feb 16 10:07:35 2017 -0700";
            environmentVariables["XXX_SEQUENCE_ID"]    = pair_id.ToString();

            ProcessResult expectedResult = GitProcess.InvokeProcess(controlRepoRoot, command, environmentVariables);
            ProcessResult actualResult   = GitHelpers.InvokeGitAgainstScalarRepo(scalarRepoRoot, command, environmentVariables);

            LinesShouldMatch(command + " Errors Lines", actualResult.Errors, expectedResult.Errors);
            LinesShouldMatch(command + " Output Lines", actualResult.Output, expectedResult.Output);

            if (command != "status")
            {
                ValidateGitCommand(enlistment, controlGitRepo, "status");
            }
        }
예제 #6
0
        public static void ValidateGitCommand(
            ScalarFunctionalTestEnlistment enlistment,
            ControlGitRepo controlGitRepo,
            string command,
            params object[] args)
        {
            command = string.Format(command, args);
            string controlRepoRoot = controlGitRepo.RootPath;
            string scalarRepoRoot  = enlistment.RepoRoot;

            Dictionary <string, string> environmentVariables = new Dictionary <string, string>();

            environmentVariables["GIT_QUIET"] = "true";

            ProcessResult expectedResult = GitProcess.InvokeProcess(controlRepoRoot, command, environmentVariables);
            ProcessResult actualResult   = GitHelpers.InvokeGitAgainstScalarRepo(scalarRepoRoot, command, environmentVariables);

            ErrorsShouldMatch(command, expectedResult, actualResult);
            actualResult.Output.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
            .ShouldMatchInOrder(expectedResult.Output.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries), LinesAreEqual, command + " Output Lines");

            if (command != "status")
            {
                ValidateGitCommand(enlistment, controlGitRepo, "status");
            }
        }
예제 #7
0
        public static ScalarFunctionalTestEnlistment Clone(
            string pathToScalar,
            string commitish              = null,
            string localCacheRoot         = null,
            bool skipFetchCommitsAndTrees = false,
            bool fullClone = true)
        {
            string enlistmentRoot = ScalarFunctionalTestEnlistment.GetUniqueEnlistmentRoot();

            return(Clone(pathToScalar, enlistmentRoot, commitish, localCacheRoot, skipFetchCommitsAndTrees, fullClone));
        }
예제 #8
0
 public ScalarProcess(ScalarFunctionalTestEnlistment enlistment)
     : this(ScalarTestConfig.PathToScalar, enlistment.EnlistmentRoot, Path.Combine(enlistment.EnlistmentRoot, ".scalarCache"))
 {
 }