コード例 #1
0
ファイル: zoneservice.cs プロジェクト: padilhalino/FrontDesk
        /// <summary>
        /// Synchronize local zone with remote store
        /// </summary>
        public Zone Synchronize(IZoneComponent zcomp)
        {
            bool success;
            Zone zone = new Zone();

            //Check for the existence of the zone
            zone.LocalPath = Path.Combine(TestConfig.LocalZonePath,
                m_prefix+zcomp.GetZoneID().ToString());
            zone.ZoneID = zcomp.GetZoneID();

            if (Directory.Exists(zone.LocalPath))
                success = UpdateZone(zcomp);
            else
                success = CreateZone(zcomp);

            if (success) {
                return zone;
            }
            else {
                m_logger.Log("Zone synchro FAILED", TestLogger.LogType.ERROR);
                return null;
            }
        }
コード例 #2
0
ファイル: zoneservice.cs プロジェクト: padilhalino/FrontDesk
        public void CopyZone(Zone dest, Zone src, string bdir)
        {
            string dpath = dest.LocalPath, spath = src.LocalPath;

            //Copy files
            string[] files = Directory.GetFiles(Path.Combine(src.LocalPath, bdir));
            foreach (string file in files)
                if (Path.GetFileName(file) != ZONE_FILE)
                    File.Copy(file,
                        Path.Combine(dest.LocalPath,
                        Path.Combine(bdir, Path.GetFileName(file))), true);

            //Copy dirs
            string[] dirs = Directory.GetDirectories(Path.Combine(src.LocalPath, bdir));
            foreach (string dir in dirs) {
                string ddirpath =
                    Path.Combine(dest.LocalPath, Path.Combine(bdir, Path.GetFileName(dir)));
                if (!Directory.Exists(ddirpath))
                    Directory.CreateDirectory(ddirpath);

                CopyZone(dest, src, Path.Combine(bdir, Path.GetFileName(dir)));
            }
        }
コード例 #3
0
ファイル: testzonesvc.cs プロジェクト: padilhalino/FrontDesk
        /// <summary>
        /// Synchronize local zone with remote store
        /// </summary>
        public Zone Synchronize(object oeval)
        {
            bool success;
            Zone zone = new Zone();
            AutoEvaluation eval = oeval as AutoEvaluation;

            //Check for the existence of the zone
            zone.LocalPath = Path.Combine(TestConfig.LocalZonePath, eval.ZoneID.ToString());
            zone.ZoneID = eval.ZoneID;

            if (Directory.Exists(zone.LocalPath))
                success = UpdateZone(eval);
            else
                success = CreateZone(eval);

            if (success) {
                m_logger.Log("Zone synchro complete");
                return zone;
            }
            else {
                m_logger.Log("Zone synchro FAILED", TestLogger.LogType.ERROR);
                return null;
            }
        }
コード例 #4
0
ファイル: testcenter.cs プロジェクト: padilhalino/FrontDesk
        protected string RunTest(Zone zone, AutoEvaluation job)
        {
            ExternalToolFactory extfact = ExternalToolFactory.GetInstance();

            //Get interface to external running tool
            IExternalTool exttool = extfact.CreateExternalTool(job.RunTool);
            exttool.Arguments = job.RunToolArgs;

            //Execute the test with the tool
            try {
                if (exttool.Execute(zone.LocalPath, job.TimeLimit*1000) != 0)
                    return FormErrorXml(AutoResult.CRITICALLYFLAWED,
                        exttool.ErrorOutput, job.Points);
                else
                    return ValidateResult(exttool.Output);
            } catch (ToolExecutionException er) {
                m_logger.Log("Error: " + er.Message, TestLogger.LogType.ERROR);
                return FormErrorXml(AutoResult.CRITICALLYFLAWED, er.Message, job.Points);
            } catch (ResultFormatException er) {
                m_logger.Log("Error: " + er.Message, TestLogger.LogType.ERROR);
                return FormErrorXml(AutoResult.CRITICALLYFLAWED, er.Message, job.Points);
            } catch (Exception) {
                string ermsg = "Unexpected tool execution error. Contact administrator";
                m_logger.Log("Error: " + ermsg, TestLogger.LogType.ERROR);
                return FormErrorXml(AutoResult.CRITICALLYFLAWED, ermsg, job.Points);
            }
        }
コード例 #5
0
ファイル: testcenter.cs プロジェクト: padilhalino/FrontDesk
        protected string RunDependencies(Zone tzone, ZoneService testsvc, 
            Evaluations.DependencyGraph dg)
        {
            Evaluation.EvaluationList border = dg.GetBuildOrder();
            bool suc;

            //Copy zones first
            foreach (AutoEvaluation eval in border) {
                Zone ezone = testsvc.Synchronize(eval);
                testsvc.CopyZone(tzone, ezone);
            }

            //Run the deps
            foreach (AutoEvaluation eval in border) {

                m_logger.Log("Running Dep: " + eval.Name);
                if (eval.IsBuild)
                    RunBuildTest(tzone, eval, out suc);
                else {
                    string xmlout = RunTest(tzone, eval);
                    if (eval.ResultType == Result.AUTO_TYPE) {
                        AutoResult res = new AutoResult();
                        res.XmlResult = xmlout;

                        suc = (res.Success != AutoResult.CRITICALLYFLAWED);
                    } else
                        suc = true;
                }

                if (!suc)
                    return eval.Name;
            }

            return null;
        }
コード例 #6
0
ファイル: testcenter.cs プロジェクト: padilhalino/FrontDesk
        protected string RunBuildTest(Zone zone, AutoEvaluation job, out bool suc)
        {
            int retval=-1;
            ExternalToolFactory extfact = ExternalToolFactory.GetInstance();

            IExternalTool exttool = extfact.CreateExternalTool(job.RunTool);
            exttool.Arguments = job.RunToolArgs;

            DateTime begin = DateTime.Now;
            try {
                retval = exttool.Execute(zone.LocalPath, job.TimeLimit*1000);
            } catch (ToolExecutionException er) {
                suc = false;
                m_logger.Log("Error: " + er.Message, TestLogger.LogType.ERROR);
                return FormErrorXml(AutoResult.CRITICALLYFLAWED, er.Message, job.Points);
            } catch (Exception) {
                suc = false;
                string ermsg = "Unexpected tool execution error. Contact administrator";
                m_logger.Log("Error: " + ermsg, TestLogger.LogType.ERROR);
                return FormErrorXml(AutoResult.CRITICALLYFLAWED, ermsg, job.Points);
            }

            DateTime end = DateTime.Now;

            int time = Convert.ToInt32(end.Subtract(begin).TotalSeconds);

            suc = (retval == 0);
            return FormBuildXml(suc, time,
                String.Format("{0}\n\n{1}", exttool.Output, exttool.ErrorOutput),
                job.Points);
        }
コード例 #7
0
ファイル: zoneservice.cs プロジェクト: padilhalino/FrontDesk
 public void CopyZone(Zone dest, Zone src)
 {
     CopyZone(dest, src, "");
 }