Ejemplo n.º 1
0
        private void MountGVFS(string workingDirectory, string enlistmentPath = null)
        {
            string mountCommand;

            if (enlistmentPath != null)
            {
                mountCommand = $"mount \"{enlistmentPath}\" {TestConstants.InternalUseOnlyFlag} {GVFSHelpers.GetInternalParameter()}";
            }
            else
            {
                mountCommand = $"mount {TestConstants.InternalUseOnlyFlag} {GVFSHelpers.GetInternalParameter()}";
            }

            ProcessStartInfo startInfo = new ProcessStartInfo(GVFSTestConfig.PathToGVFS);

            startInfo.Arguments              = mountCommand;
            startInfo.UseShellExecute        = false;
            startInfo.RedirectStandardOutput = true;
            startInfo.RedirectStandardError  = true;
            startInfo.CreateNoWindow         = true;
            startInfo.WorkingDirectory       = workingDirectory;

            ProcessResult result = ProcessHelper.Run(startInfo);

            result.ExitCode.ShouldEqual(0, result.Errors);

            this.RepoStatusShouldBeMounted(workingDirectory, enlistmentPath);
        }
Ejemplo n.º 2
0
        private Process StartUnmount(string extraParams = "")
        {
            string enlistmentRoot = this.Enlistment.EnlistmentRoot;

            // TODO: 865304 Use app.config instead of --internal* arguments
            ProcessStartInfo processInfo = new ProcessStartInfo(GVFSTestConfig.PathToGVFS);

            processInfo.Arguments        = "unmount " + extraParams + " " + TestConstants.InternalUseOnlyFlag + " " + GVFSHelpers.GetInternalParameter();
            processInfo.WindowStyle      = ProcessWindowStyle.Hidden;
            processInfo.WorkingDirectory = enlistmentRoot;
            processInfo.UseShellExecute  = false;

            Process executingProcess = new Process();

            executingProcess.StartInfo = processInfo;
            executingProcess.Start();

            return(executingProcess);
        }
Ejemplo n.º 3
0
        private void MountShouldFail(int expectedExitCode, string expectedErrorMessage, string mountWorkingDirectory = null)
        {
            string enlistmentRoot = this.Enlistment.EnlistmentRoot;

            // TODO: 865304 Use app.config instead of --internal* arguments
            ProcessStartInfo processInfo = new ProcessStartInfo(GVFSTestConfig.PathToGVFS);

            processInfo.Arguments              = "mount " + TestConstants.InternalUseOnlyFlag + " " + GVFSHelpers.GetInternalParameter();
            processInfo.WindowStyle            = ProcessWindowStyle.Hidden;
            processInfo.WorkingDirectory       = string.IsNullOrEmpty(mountWorkingDirectory) ? enlistmentRoot : mountWorkingDirectory;
            processInfo.UseShellExecute        = false;
            processInfo.RedirectStandardOutput = true;

            ProcessResult result = ProcessHelper.Run(processInfo);

            result.ExitCode.ShouldEqual(expectedExitCode, $"mount exit code was not {expectedExitCode}. Output: {result.Output}");
            result.Output.ShouldContain(expectedErrorMessage);
        }
Ejemplo n.º 4
0
        private ProcessResult RunDehydrateProcess(bool confirm, bool noStatus)
        {
            string dehydrateFlags = string.Empty;

            if (confirm)
            {
                dehydrateFlags += " --confirm ";
            }

            if (noStatus)
            {
                dehydrateFlags += " --no-status ";
            }

            string enlistmentRoot = this.Enlistment.EnlistmentRoot;

            ProcessStartInfo processInfo = new ProcessStartInfo(GVFSTestConfig.PathToGVFS);

            processInfo.Arguments              = "dehydrate " + dehydrateFlags + " " + TestConstants.InternalUseOnlyFlag + " " + GVFSHelpers.GetInternalParameter();
            processInfo.WindowStyle            = ProcessWindowStyle.Hidden;
            processInfo.WorkingDirectory       = enlistmentRoot;
            processInfo.UseShellExecute        = false;
            processInfo.RedirectStandardOutput = true;

            return(ProcessHelper.Run(processInfo));
        }