From: <br...@us...> - 2008-06-06 21:44:36
|
Revision: 224 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=224&view=rev Author: brus07 Date: 2008-06-06 14:44:44 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Logging testing process Modified Paths: -------------- ACMServer/trunk/TesterSolution/Checker/Checker.csproj ACMServer/trunk/TesterSolution/Checker/Class1.cs ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs ACMServer/trunk/TesterSolution/Tester/Form1.cs ACMServer/trunk/TesterSolution/Tester/Tester.csproj Modified: ACMServer/trunk/TesterSolution/Checker/Checker.csproj =================================================================== --- ACMServer/trunk/TesterSolution/Checker/Checker.csproj 2008-06-06 21:38:47 UTC (rev 223) +++ ACMServer/trunk/TesterSolution/Checker/Checker.csproj 2008-06-06 21:44:44 UTC (rev 224) @@ -45,6 +45,12 @@ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Library\LibraryExtention\LibraryExtention.csproj"> + <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project> + <Name>LibraryExtention</Name> + </ProjectReference> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. Modified: ACMServer/trunk/TesterSolution/Checker/Class1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-06 21:38:47 UTC (rev 223) +++ ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-06 21:44:44 UTC (rev 224) @@ -3,6 +3,7 @@ using System.Text; using SourceTest; using System.IO; +using AcmContester.Library.LibraryExtention; namespace Checker { @@ -13,8 +14,20 @@ Console.WriteLine("test number {0}, result: {1}, details: {2}", x, TSource.TestResultToString(res.res), res.Details); } + static void funcWithLog(int x, TResult res) + { + Log log = Log.GetLog(); + log.Loging(" Test #" + x + " Details " + res.Details + "\xA0\n", Log.Priority.INFO); + //Console.WriteLine("test number {0}, result: {1}, details: {2}", x, TSource.TestResultToString(res.res), res.Details); + } + public static string GetResult(string message) { + Log log = Log.GetLog(); + log.Loging(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(), Log.Priority.INFO); + log.Loging(message, Log.Priority.INFO); + log.Loging("", Log.Priority.INFO); + string code = message.Substring(message.IndexOf('$')+1); string id = message.Substring(0, message.IndexOf('$')); TSource c = new TSource(); @@ -32,17 +45,26 @@ //c.Src = s.ReadToEnd(); //s.Close(); c.TempPath = temp; - c.TestHandler += new TTestHandler(func); + c.TestHandler += new TTestHandler(funcWithLog); c.Language = (TLang)1; c.ProcessAll(); c.State = (TSourceState)6; + log.Loging("Compile result: " + TSource.CompileResultToString(c.Summary.compres.res) + "\nCompilation details: " + c.Summary.compres.Details + "\nUsed Time for compile: " + c.Summary.compres.UsedTime, Log.Priority.INFO); //Console.WriteLine("Compile result: {0}\nCompilation details: {1}\nUsed Time for compile: {2}", TSource.CompileResultToString(c.Summary.compres.res), c.Summary.compres.Details, c.Summary.compres.UsedTime); + log.Loging("Test result: " + TSource.TestResultToString(c.Summary.res.res), Log.Priority.INFO); //Console.WriteLine("Test result: {0}", TSource.TestResultToString(c.Summary.res.res)); + log.Loging("Points: " + c.Summary.res.points, Log.Priority.INFO); //Console.WriteLine("Points: {0}", c.Summary.res.points); + log.Loging("Used Time: " + c.Summary.res.UsedTime, Log.Priority.INFO); //Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime); + log.Loging("Used Memory: " + c.Summary.res.UsedMemory, Log.Priority.INFO); //Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory); + log.Loging("Used Real Time: " + c.Summary.res.UsedRealTime, Log.Priority.INFO); //Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime); //Console.ReadKey(); + log.Loging("----------------------------------------------------", Log.Priority.INFO); + log.Loging("", Log.Priority.INFO); + if (c.Summary.compres.res != (TCompRes)0 ) { return TSource.CompileResultToString(c.Summary.compres.res); Modified: ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-06 21:38:47 UTC (rev 223) +++ ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-06 21:44:44 UTC (rev 224) @@ -135,6 +135,7 @@ this.Controls.Add(this.textBox1); this.Name = "Form1"; this.Text = "Tester"; + this.Load += new System.EventHandler(this.Form1_Load); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); Modified: ACMServer/trunk/TesterSolution/Tester/Form1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-06 21:38:47 UTC (rev 223) +++ ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-06 21:44:44 UTC (rev 224) @@ -6,6 +6,8 @@ using System.Text; using System.Windows.Forms; using AcmContester.Library.Connector; +using System.IO; +using AcmContester.Library.LibraryExtention; namespace Tester { @@ -73,5 +75,11 @@ else toolStripStatusLabel1.Text = "null"; } + + private void Form1_Load(object sender, EventArgs e) + { + StreamWriter sw = File.AppendText("testerlog.txt"); + Log log = Log.GetLog(sw, Log.Priority.EMPTY); + } } } \ No newline at end of file Modified: ACMServer/trunk/TesterSolution/Tester/Tester.csproj =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Tester.csproj 2008-06-06 21:38:47 UTC (rev 223) +++ ACMServer/trunk/TesterSolution/Tester/Tester.csproj 2008-06-06 21:44:44 UTC (rev 224) @@ -76,6 +76,10 @@ <Project>{211DD6A5-2D73-439E-8722-ED2C89ED1DDB}</Project> <Name>Connector</Name> </ProjectReference> + <ProjectReference Include="..\Library\LibraryExtention\LibraryExtention.csproj"> + <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project> + <Name>LibraryExtention</Name> + </ProjectReference> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |