Пример #1
0
        static void RunPreload(string pathToAssemblies)
        {
            mLog.Debug("Preload started. Path To assemblies:" + pathToAssemblies);
            InitServices.InitNUnitServices();

            PNUnitTestRunner runner = new PNUnitTestRunner(pathToAssemblies);

            runner.Preload();

            int pidOfThisExpectedByAgent = Codice.Test.PlatformIdentifier.IsWindows() ?
                                           System.Diagnostics.Process.GetCurrentProcess().Id :
                                           Mono.Unix.UnixEnvironment.GetParentProcessId();

            string testInfoFile = Path.Combine(
                Path.GetTempPath(),
                PNUnit.Agent.AssemblyPreload.PRELOADED_PROCESS_FILE_PREFIX + pidOfThisExpectedByAgent.ToString());

            int count = 0;

            while (!File.Exists(testInfoFile))
            {
                System.Threading.Thread.Sleep(150);
                mLog.DebugFormat("Waiting for testinfo file to be created...: {0}", testInfoFile);

                count++;

                if (count >= 6000) //wait 1,5 minutes for test arrival
                {
                    mLog.Fatal("Tired of waiting: Cannot execute tests without information; exiting ...");
                    Environment.Exit(1);
                }
            }

            mLog.DebugFormat("Preload read {0} from file", testInfoFile);

            PNUnitTestInfo info = TestInfoReader.ReadTestInfo(testInfoFile);

            if (info == null)
            {
                mLog.Fatal("Cannot execute tests without information; exiting ...");
                Environment.Exit(1);
            }

            ProcessNameSetter.SetProcessName(info.TestName);

            IPNUnitServices services =
                PNUnitServices.GetPNunitServicesProxy(info.PNUnitServicesServer);

            runner.Run(info, services, null);
        }
Пример #2
0
        static void Main(string[] args)
        {
            ProcessNameSetter.SetProcessName("launcher");

            if (args.Length == 0)
            {
                Console.WriteLine(
                    "Usage: launcher configfile [--result=filename] [--failed=filename] " + Environment.NewLine +
                    "\t[--max_barrier_wait_time=number_of_seconds] [--timeout=seconds]" + Environment.NewLine +
                    "\t[-D:var=value] [-val:variable=value] [--retry=number] [--range=from-to] " + Environment.NewLine +
                    "\t[--test=testname] [--shell] [[--buildtype=release|task|private|testrun|...]" + Environment.NewLine +
                    "\t[--buildname=4.1.2.411|SCM12547|...][--cset=changeset][--buildcomment=comment]" + Environment.NewLine +
                    "\t[--suitetype=debug-smoke|debug-gui|release-smoke|...][--suitename=oracle...]" + Environment.NewLine +
                    "\t[--logsuccess=true|false]] [--skipsummarylog] " + Environment.NewLine +
                    "\t[--usefilereport=file] " + Environment.NewLine +
                    "\t[--automated] [--logfolder=<output_log_path_for_launchers>]" + Environment.NewLine +
                    "\t[--port=port_number] " + Environment.NewLine +
                    "\t[--iptobind=launcher_ip_used_by_test_runners] " + Environment.NewLine +
                    "\t[--testslist=<file_with_testname_per_line>]");
                Console.WriteLine();
                Console.WriteLine("Example:");
                Console.WriteLine("launcher smokeldap.conf --iptobind=127.0.0.1 -val:show_cmd_no=true -D:$authmode=LDAPWorkingMode --range=0-0");
                return;
            }

            bool   bIsAutomatedLauncher = args[0] == "--automated";
            string customLogFolder      = GetCustomLogOutputFolder(ref args);

            Configurator.ConfigureLogging(bIsAutomatedLauncher, customLogFolder);

            if (bIsAutomatedLauncher)
            {
                RunAutomatedLauncher(args);
                return;
            }

            RunLauncher(customLogFolder, args);
        }
Пример #3
0
        static void RunOnce(string testInfoFile, string pathToAssemblies)
        {
            PNUnitTestInfo info = TestInfoReader.ReadTestInfo(testInfoFile);

            if (info == null)
            {
                Console.WriteLine("Cannot execute tests without information; exiting ...");
                Environment.Exit(1);
            }

            ProcessNameSetter.SetProcessName(info.TestName);

            IPNUnitServices services =
                PNUnitServices.GetPNunitServicesProxy(info.PNUnitServicesServer);

            if (info.TestName.StartsWith("run-nunit"))
            {
                new NUnitTestRunner(info, pathToAssemblies).Run(services);
                return;
            }

            new PNUnitTestRunner(pathToAssemblies).Run(info, services, null);
        }
Пример #4
0
        static void Main(string[] args)
        {
            ProcessNameSetter.SetProcessName("agent");

            ConfigureLogging();

            AgentConfig config = new AgentConfig();

            // read --daemon
            bool bDaemonMode = ReadFlag(args, "--daemon");

            bool bNoTimeout = ReadFlag(args, "--notimeout");

            string preloadTestRunners = ReadKeyVal(args, "--preloadrunners");

            string configfile = ReadArg(args);

            int port = DEFAULT_PORT;

            string pathtoassemblies = ReadArg(args);

            if (pathtoassemblies != null)
            {
                port       = int.Parse(configfile);
                configfile = null;
            }

            // Load the test configuration file
            if (pathtoassemblies == null && configfile == null)
            {
                Console.WriteLine(
                    "Usage: agent [configfile | port path_to_assemblies]" +
                    " [--daemon] [--noTimeout]");
                return;
            }

            if (configfile != null)
            {
                config = AgentConfigLoader.LoadFromFile(configfile);

                if (config == null)
                {
                    Console.WriteLine("No agent.conf file found");
                }
            }
            else
            {
                config.Port             = port;
                config.PathToAssemblies = pathtoassemblies;
            }

            if (bNoTimeout)
            {
                config.NoTimeout = true;
            }

            InitNUnitServices();

            PNUnitAgent agent = new PNUnitAgent();

            agent.Run(config, bDaemonMode, preloadTestRunners);
        }