Beispiel #1
0
        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);
        }
		private void lstTests_SelectedIndexChanged(object sender, System.EventArgs e) {
			
			ArrayList evals = GetTests();
			Evaluations aevals = new Evaluations(Globals.CurrentIdentity);

			lstOrder.Items.Clear();
			foreach (int evalID in evals) {
				Evaluation eval = aevals.GetInfo(evalID);
				Evaluations.DependencyGraph dg = 
					new Evaluations.DependencyGraph(eval, Globals.CurrentIdentity);
				
				Evaluation.EvaluationList order = dg.GetBuildOrder();
				foreach (Evaluation oeval in order) 
					lstOrder.Items.Add(oeval.Name);
			
				lstOrder.Items.Add(eval.Name);
			}
		}
Beispiel #3
0
        /// <summary>
        /// Main worker thread for the testing center
        /// </summary>
        public void TestWorker()
        {
            AutoJobTest job;
            bool        bsuc;
            Evaluations evals   = new Evaluations(m_ident);
            AutoJobs    jobs    = new AutoJobs(m_ident);
            ZoneService testsvc = new ZoneService("auto", m_ident, m_logger);
            ZoneService stusvc  = new ZoneService("stu", m_ident, m_logger);
            Submissions subs    = new Submissions(m_ident);

            while (!m_shutdown)
            {
                //Get job
                try {
                    job = jobs.Claim(m_ipaddress, m_desc);
                    if (job != null)
                    {
                        m_status = Status.RUNNING;

                        Submission sub = subs.GetInfo(job.SubmissionID);
                        m_logger.Log(String.Format("Claimed job: JOB: {0} EVAL: {1} SUB: {2}",
                                                   job.JobName, job.AutoEval.Name, new Principals(m_ident).GetInfo(sub.PrincipalID).Name));

                        m_logger.Log("Synchronizing eval and student zones");
                        //Sync test zone
                        Zone tzone = testsvc.Synchronize(job.AutoEval);

                        //Sync stu zone
                        Zone szone = stusvc.Synchronize(sub);

                        //Copy stu zone into test zone
                        testsvc.CopyZone(tzone, szone);

                        //Create dep graph and run deps
                        m_logger.Log("Beginning dependency running");
                        Evaluations.DependencyGraph dg =
                            new Evaluations.DependencyGraph(job.AutoEval, m_ident);
                        string faildep, xmloutput = "";
                        if (null != (faildep = RunDependencies(tzone, testsvc, dg)))
                        {
                            xmloutput = FormErrorXml(AutoResult.DEPFAIL,
                                                     "Test unable to run, dependency: " +
                                                     faildep + " failed to complete successfully!",
                                                     job.AutoEval.Points);
                            m_logger.Log("Dependency fail (" + faildep + "), not running main test",
                                         TestLogger.LogType.WARNING);
                        }
                        else
                        {
                            //Run test and gather result
                            m_logger.Log("Starting run of test");
                            if (job.AutoEval.IsBuild)
                            {
                                xmloutput = RunBuildTest(tzone, job.AutoEval, out bsuc);
                            }
                            else
                            {
                                xmloutput = RunTest(tzone, job.AutoEval);
                            }
                        }

                        //Post result
                        xmloutput = Globals.PurifyZeroes(xmloutput);
                        if (!PostResult(job, xmloutput))
                        {
                            m_logger.Log("Error logging result", TestLogger.LogType.ERROR);
                        }
                        else
                        {
                            m_logger.Log("Test completed, result stored");
                        }

                        //Clear the job out
                        jobs.FinishTest(job);
                    }
                } catch (Exception er) {
                    m_logger.Log("Unexpected and fatal error during testing: MESSAGE: " + er.Message, TestLogger.LogType.ERROR);
                }

                m_status = Status.QUEUED;
                Thread.Sleep(TimeSpan.FromSeconds(5));
            }
        }