コード例 #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 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);
        }
コード例 #3
0
        public void DeleteEnlistment()
        {
            string watchmanLocation = ProcessHelper.GetProgramLocation("watchman");

            if (!string.IsNullOrEmpty(watchmanLocation))
            {
                try
                {
                    ProcessHelper.Run(Path.Combine(watchmanLocation, "watchman"), $"watch-del {this.RepoRoot}");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Failed to delete watch on {this.RepoRoot}. {ex.ToString()}");
                }
            }

            TestResultsHelper.OutputScalarLogs(this);
            RepositoryHelpers.DeleteTestDirectory(this.EnlistmentRoot);
        }