Пример #1
0
        public void RunTests(SpringPaths paths) {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            isAborted = false;
            var result = new BatchRunResult();
            bool usingOptirun = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("OPTIRUN"));

            foreach (var tr in TestCases) {
                foreach (var b in Benchmarks) {
                    if (isAborted) return;
                    b.ModifyModInfo(tr);
                    string log = null;
                    try {
                        run = new SpringRun();
                        log = run.Start(paths, tr, b);
                    } catch (Exception ex) {
                        Trace.TraceError(ex.ToString());
                    } finally {
                        b.RestoreModInfo();
                    }
                    try {
                        if(usingOptirun) { // leave some time for optimus/primus to rest 
                           Thread.Sleep(5000);
                        }
                        result.AddRun(tr, b, log);
                        RunCompleted(tr, b, log);
                    } catch (Exception ex) {
                        Trace.TraceError(ex.ToString());
                    }
                }
            }
            if (isAborted) return;
            AllCompleted(result);
        }
Пример #2
0
        public void RunTests(SpringPaths paths)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            isAborted = false;
            var  result       = new BatchRunResult();
            bool usingOptirun = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("OPTIRUN"));

            foreach (var tr in TestCases)
            {
                foreach (var b in Benchmarks)
                {
                    if (isAborted)
                    {
                        return;
                    }
                    b.ModifyModInfo(tr);
                    string log = null;
                    try {
                        run = new SpringRun();
                        log = run.Start(paths, tr, b);
                    } catch (Exception ex) {
                        Trace.TraceError(ex.ToString());
                    } finally {
                        b.RestoreModInfo();
                    }
                    try {
                        if (usingOptirun)  // leave some time for optimus/primus to rest
                        {
                            Thread.Sleep(5000);
                        }
                        result.AddRun(tr, b, log);
                        RunCompleted(tr, b, log);
                    } catch (Exception ex) {
                        Trace.TraceError(ex.ToString());
                    }
                }
            }
            if (isAborted)
            {
                return;
            }
            AllCompleted(result);
        }
Пример #3
0
        string GetBisectValue(int engineIndex, int modIndex)
        {
            var springRun = new SpringRun();

            testCaseBase.Engine = engineList[engineIndex];
            testCaseBase.Game   = modList[modIndex];
            var ret = testCaseBase.Validate(downloader, true);

            if (ret != null)
            {
                InvokeIfNeeded(() => { tbBisectLog.AppendText(string.Format("Skipping test {0} - {1}\n", testCaseBase, ret)); });
                Trace.TraceError("Skipping test {0} - {1}", testCaseBase, ret);
                return(null);
            }

            Trace.TraceInformation("Testing: {0}", testCaseBase);

            string retVal = null;

            springRun.LineAdded += s =>
            {
                if (s != null)
                {
                    var match = Regex.Match(s, string.Format("!transmitlobby {0}[ ]*:(.*)", variableName), RegexOptions.IgnoreCase);
                    if (match.Success)
                    {
                        retVal = match.Groups[1].Value;
                        springRun.Abort();
                    }
                }
            };
            springRun.Start(springPaths, testCaseBase, benchmark);

            InvokeIfNeeded(() => { tbBisectLog.AppendText(string.Format("Test:{0}   value:{1}\n", testCaseBase, retVal)); });
            return(retVal);
        }