From: <br...@us...> - 2008-06-04 21:24:37
|
Revision: 214 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=214&view=rev Author: brus07 Date: 2008-06-04 14:24:40 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Work with real Tester. Modification of logging. 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 Added Paths: ----------- ACMServer/trunk/TesterSolution/Checker/InData.txt ACMServer/trunk/TesterSolution/Checker/SourceTest.dll Modified: ACMServer/trunk/TesterSolution/Checker/Checker.csproj =================================================================== --- ACMServer/trunk/TesterSolution/Checker/Checker.csproj 2008-06-04 16:42:41 UTC (rev 213) +++ ACMServer/trunk/TesterSolution/Checker/Checker.csproj 2008-06-04 21:24:40 UTC (rev 214) @@ -28,6 +28,10 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="SourceTest, Version=1.0.3077.22878, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>.\SourceTest.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> @@ -36,6 +40,11 @@ <Compile Include="Class1.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> + <ItemGroup> + <Content Include="InData.txt"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + </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-04 16:42:41 UTC (rev 213) +++ ACMServer/trunk/TesterSolution/Checker/Class1.cs 2008-06-04 21:24:40 UTC (rev 214) @@ -1,13 +1,50 @@ using System; using System.Collections.Generic; using System.Text; +using SourceTest; +using System.IO; namespace Checker { public class Checker { - public static int GetResult(string code) + static void func(int x, TResult res) { + Console.WriteLine("test number {0}, result: {1}, details: {2}", x, TSource.TestResultToString(res.res), res.Details); + } + + public static string GetResult(string message) + { + string code = message.Substring(message.IndexOf('$')+1); + string id = message.Substring(0,message.IndexOf('$')); + TSource c = new TSource(); + StreamReader s = new StreamReader("InData.txt", Encoding.Default); + String compiler = s.ReadLine(); + String problem = s.ReadLine(); + String temp = s.ReadLine(); + String source = s.ReadLine(); + s.Close(); + //s = File.OpenText(source); + c.CompPath = compiler; + c.ProblemPath = problem; + c.LoadLimits(); + c.Src = code; + //c.Src = s.ReadToEnd(); + //s.Close(); + c.TempPath = temp; + c.TestHandler += new TTestHandler(func); + c.Language = (TLang)1; + c.ProcessAll(); + 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); + Console.WriteLine("Test result: {0}", TSource.TestResultToString(c.Summary.res.res)); + Console.WriteLine("Points: {0}", c.Summary.res.points); + Console.WriteLine("Used Time: {0}", c.Summary.res.UsedTime); + Console.WriteLine("Used Memory: {0}", c.Summary.res.UsedMemory); + Console.WriteLine("Used Real Time: {0}", c.Summary.res.UsedRealTime); + return TSource.TestResultToString(c.Summary.res.res); + } + public static int GetResult1(string code) + { code = (code.Split(' '))[1]; int res = 0; for (int i = 0; i < code.Length; i++) Added: ACMServer/trunk/TesterSolution/Checker/InData.txt =================================================================== --- ACMServer/trunk/TesterSolution/Checker/InData.txt (rev 0) +++ ACMServer/trunk/TesterSolution/Checker/InData.txt 2008-06-04 21:24:40 UTC (rev 214) @@ -0,0 +1,4 @@ +d:\SAMPLE\D7.bat +d:\SAMPLE\Test\ +d:\SAMPLE\Temp\ +d:\SAMPLE\source.txt Added: ACMServer/trunk/TesterSolution/Checker/SourceTest.dll =================================================================== (Binary files differ) Property changes on: ACMServer/trunk/TesterSolution/Checker/SourceTest.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-04 16:42:41 UTC (rev 213) +++ ACMServer/trunk/TesterSolution/Tester/Form1.Designer.cs 2008-06-04 21:24:40 UTC (rev 214) @@ -36,16 +36,20 @@ this.button3 = new System.Windows.Forms.Button(); this.textBox3 = new System.Windows.Forms.TextBox(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); - this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // // textBox1 // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.textBox1.Location = new System.Drawing.Point(12, 90); this.textBox1.Multiline = true; this.textBox1.Name = "textBox1"; + this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBox1.Size = new System.Drawing.Size(268, 158); this.textBox1.TabIndex = 0; // @@ -104,17 +108,17 @@ this.statusStrip1.TabIndex = 6; this.statusStrip1.Text = "statusStrip1"; // - // timer1 - // - this.timer1.Enabled = true; - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); - // // toolStripStatusLabel1 // this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; this.toolStripStatusLabel1.Size = new System.Drawing.Size(109, 17); this.toolStripStatusLabel1.Text = "toolStripStatusLabel1"; // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); Modified: ACMServer/trunk/TesterSolution/Tester/Form1.cs =================================================================== --- ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-04 16:42:41 UTC (rev 213) +++ ACMServer/trunk/TesterSolution/Tester/Form1.cs 2008-06-04 21:24:40 UTC (rev 214) @@ -51,8 +51,9 @@ private void DataArrived(string message) { textBox1.Text += "\r\n" + message; - int result = Checker.Checker.GetResult(message); - socket.Send(result.ToString() + " " + message); + string result = Checker.Checker.GetResult(message); + textBox1.Text += "\r\n\t-> " + result; + socket.Send(result.ToString() + "$" + message); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |