Exemplo n.º 1
0
        public void ServiceCopiesNonInboxNativeDll()
        {
            if (IsProjFSInbox())
            {
                Assert.Ignore("Skipping test, ProjFS is inbox");
            }

            if (!GVFSTestConfig.TestGVFSOnPath)
            {
                Assert.Ignore("Skipping test, test only enabled when --test-gvfs-on-path is set");
            }

            NativeLibPath.ShouldBeAFile(this.fileSystem);
            this.Enlistment.UnmountGVFS();
            this.fileSystem.DeleteFile(NativeLibPath);
            NativeLibPath.ShouldNotExistOnDisk(this.fileSystem);
            GVFSServiceProcess.StopService();
            GVFSServiceProcess.StartService();

            int count = 0;

            while (!this.fileSystem.FileExists(NativeLibPath) && count < 10)
            {
                Thread.Sleep(1000);
                ++count;
            }

            NativeLibPath.ShouldBeAFile(this.fileSystem);
            this.Enlistment.MountGVFS();
        }
Exemplo n.º 2
0
        private static void RunBeforeAnyTests()
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                if (GVFSTestConfig.ReplaceInboxProjFS)
                {
                    ProjFSFilterInstaller.ReplaceInboxProjFS();
                }

                GVFSServiceProcess.InstallService();
            }
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            NUnitRunner runner = new NUnitRunner(args);

            if (runner.HasCustomArg("--no-shared-gvfs-cache"))
            {
                Console.WriteLine("Running without a shared git object cache");
                GVFSTestConfig.NoSharedCache = true;
            }

            GVFSTestConfig.LocalCacheRoot = runner.GetCustomArgWithParam("--shared-gvfs-cache-root");

            if (runner.HasCustomArg("--full-suite"))
            {
                Console.WriteLine("Running the full suite of tests");
                GVFSTestConfig.UseAllRunners = true;
            }

            GVFSTestConfig.RepoToClone =
                runner.GetCustomArgWithParam("--repo-to-clone")
                ?? Properties.Settings.Default.RepoToClone;

            string servicePath = Path.Combine(TestContext.CurrentContext.TestDirectory, Properties.Settings.Default.PathToGVFSService);

            GVFSServiceProcess.InstallService(servicePath);
            try
            {
                Environment.ExitCode = runner.RunTests(Properties.Settings.Default.TestRepeatCount);
            }
            finally
            {
                string serviceLogFolder = Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
                    "GVFS",
                    GVFSServiceProcess.TestServiceName,
                    "Logs");

                Console.WriteLine("GVFS.Service logs at '{0}' attached below.\n\n", serviceLogFolder);
                foreach (string filename in TestResultsHelper.GetAllFilesInDirectory(serviceLogFolder))
                {
                    TestResultsHelper.OutputFileContents(filename);
                }

                GVFSServiceProcess.UninstallService();
            }

            if (Debugger.IsAttached)
            {
                Console.WriteLine("Tests completed. Press Enter to exit.");
                Console.ReadLine();
            }
        }
Exemplo n.º 4
0
        public void ServiceStartsPrjFltService()
        {
            this.Enlistment.UnmountGVFS();
            StopPrjFlt();
            GVFSServiceProcess.StopService();
            GVFSServiceProcess.StartService();

            ServiceController controller = new ServiceController("prjflt");

            controller.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(10));
            controller.Status.ShouldEqual(ServiceControllerStatus.Running);

            this.Enlistment.MountGVFS();
        }
Exemplo n.º 5
0
        public static void Main(string[] args)
        {
            NUnitRunner runner = new NUnitRunner(args);

            if (runner.HasCustomArg("--full-suite"))
            {
                Console.WriteLine("Running the full suite of tests");
                FileSystemRunners.FileSystemRunner.UseAllRunners = true;
            }

            if (!runner.HasCustomArg("--run-builds"))
            {
                runner.ExcludeCategory(CategoryConstants.Build);
            }

            string servicePath = Path.Combine(TestContext.CurrentContext.TestDirectory, Properties.Settings.Default.PathToGVFSService);

            GVFSServiceProcess.InstallService(servicePath);
            try
            {
                Environment.ExitCode = runner.RunTests(Properties.Settings.Default.TestRepeatCount);
            }
            finally
            {
                string serviceLogFolder = Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
                    "GVFS",
                    GVFSServiceProcess.TestServiceName,
                    "Logs");

                Console.WriteLine("GVFS.Service logs at '{0}' attached below.\n\n", serviceLogFolder);
                foreach (string filename in TestResultsHelper.GetAllFilesInDirectory(serviceLogFolder))
                {
                    TestResultsHelper.OutputFileContents(filename);
                }

                GVFSServiceProcess.UninstallService();
            }

            if (Debugger.IsAttached)
            {
                Console.WriteLine("Tests completed. Press Enter to exit.");
                Console.ReadLine();
            }
        }
Exemplo n.º 6
0
        public void ServiceStartsPrjFltService()
        {
            if (!GVFSTestConfig.TestGVFSOnPath)
            {
                Assert.Ignore("Skipping test, test only enabled when --test-gvfs-on-path is set");
            }

            this.Enlistment.UnmountGVFS();
            StopPrjFlt();
            GVFSServiceProcess.StopService();
            GVFSServiceProcess.StartService();

            ServiceController controller = new ServiceController("prjflt");

            controller.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(10));
            controller.Status.ShouldEqual(ServiceControllerStatus.Running);

            this.Enlistment.MountGVFS();
        }
Exemplo n.º 7
0
        private static void RunAfterAllTests()
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                string serviceLogFolder = Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
                    "GVFS",
                    GVFSServiceProcess.TestServiceName,
                    "Logs");

                Console.WriteLine("GVFS.Service logs at '{0}' attached below.\n\n", serviceLogFolder);
                foreach (string filename in TestResultsHelper.GetAllFilesInDirectory(serviceLogFolder))
                {
                    TestResultsHelper.OutputFileContents(filename);
                }

                GVFSServiceProcess.UninstallService();
            }

            PrintTestCaseStats.PrintRunTimeStats();
        }
Exemplo n.º 8
0
        private static void RunBeforeAnyTests()
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                if (GVFSTestConfig.ReplaceInboxProjFS)
                {
                    ProjFSFilterInstaller.ReplaceInboxProjFS();
                }

                GVFSServiceProcess.InstallService();

                string statusCacheVersionTokenPath = Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData, Environment.SpecialFolderOption.Create),
                    "GVFS",
                    "GVFS.Service",
                    "EnableGitStatusCacheToken.dat");

                if (!File.Exists(statusCacheVersionTokenPath))
                {
                    File.WriteAllText(statusCacheVersionTokenPath, string.Empty);
                }
            }
        }
Exemplo n.º 9
0
        private static void RunBeforeAnyTests()
        {
            if (GVFSTestConfig.ReplaceInboxProjFS)
            {
                ProjFSFilterInstaller.ReplaceInboxProjFS();
            }

            GVFSServiceProcess.InstallService();

            string serviceProgramDataDir = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles, Environment.SpecialFolderOption.Create),
                "GVFS",
                "ProgramData",
                "GVFS.Service");

            string statusCacheVersionTokenPath = Path.Combine(
                serviceProgramDataDir, "EnableGitStatusCacheToken.dat");

            if (!File.Exists(statusCacheVersionTokenPath))
            {
                Directory.CreateDirectory(serviceProgramDataDir);
                File.WriteAllText(statusCacheVersionTokenPath, string.Empty);
            }
        }
 private void RestartService()
 {
     GVFSServiceProcess.StopService();
     GVFSServiceProcess.StartService();
 }