|
From: <br...@us...> - 2008-09-22 11:52:17
|
Revision: 369
http://acmcontester.svn.sourceforge.net/acmcontester/?rev=369&view=rev
Author: brus07
Date: 2008-09-22 11:52:05 +0000 (Mon, 22 Sep 2008)
Log Message:
-----------
Connected new (2.0) SharpTester version.
But now, *.dll files copy to Runner directory and included to project.
Modified Paths:
--------------
ACMServer/trunk/ACMServer/Runner/Class1.cs
ACMServer/trunk/ACMServer/Runner/InData.txt
ACMServer/trunk/ACMServer/Runner/Runner.csproj
ACMServer/trunk/ACMServer/Tester/Library/SocketClientGate.cs
Added Paths:
-----------
ACMServer/trunk/ACMServer/Runner/AllowedFunc.txt
ACMServer/trunk/ACMServer/Runner/Checker.dll
ACMServer/trunk/ACMServer/Runner/Load.dll
ACMServer/trunk/ACMServer/Runner/Main.dll
ACMServer/trunk/ACMServer/Runner/MutanticFramework.dll
ACMServer/trunk/ACMServer/Runner/Plugin.dll
ACMServer/trunk/ACMServer/Runner/ScriptDotNet.dll
ACMServer/trunk/ACMServer/Runner/Test.dll
ACMServer/trunk/ACMServer/Runner/TesterInData.txt
ACMServer/trunk/ACMServer/Runner/VirtualPlugin.dll
ACMServer/trunk/ACMServer/Runner/scriptExample.txt
Removed Paths:
-------------
ACMServer/trunk/ACMServer/Runner/SourceTest.dll
Property Changed:
----------------
ACMServer/trunk/ACMServer/Runner/
Property changes on: ACMServer/trunk/ACMServer/Runner
___________________________________________________________________
Modified: svn:ignore
- bin
obj
+ bin
obj
*.user
Added: ACMServer/trunk/ACMServer/Runner/AllowedFunc.txt
===================================================================
--- ACMServer/trunk/ACMServer/Runner/AllowedFunc.txt (rev 0)
+++ ACMServer/trunk/ACMServer/Runner/AllowedFunc.txt 2008-09-22 11:52:05 UTC (rev 369)
@@ -0,0 +1,57 @@
+kernel32.dll DeleteCriticalSection
+kernel32.dll LeaveCriticalSection
+kernel32.dll EnterCriticalSection
+kernel32.dll InitializeCriticalSection
+kernel32.dll VirtualFree
+kernel32.dll VirtualAlloc
+kernel32.dll LocalFree
+kernel32.dll LocalAlloc
+kernel32.dll GetVersion
+kernel32.dll GetCurrentThreadId
+kernel32.dll GetThreadLocale
+kernel32.dll GetStartupInfoA
+kernel32.dll GetLocaleInfoA
+kernel32.dll GetCommandLineA
+kernel32.dll FreeLibrary
+kernel32.dll ExitProcess
+kernel32.dll WriteFile
+kernel32.dll UnhandledExceptionFilter
+kernel32.dll RtlUnwind
+kernel32.dll RaiseException
+kernel32.dll GetStdHandle
+user32.dll GetKeyboardType
+user32.dll MessageBoxA
+advapi32.dll RegQueryValueExA
+advapi32.dll RegOpenKeyExA
+advapi32.dll RegCloseKey
+kernel32.dll TlsSetValue
+kernel32.dll TlsGetValue
+kernel32.dll GetModuleHandleA
+kernel32.dll WideCharToMultiByte
+kernel32.dll lstrlenA
+kernel32.dll lstrcpynA
+kernel32.dll LoadLibraryExA
+kernel32.dll GetProcAddress
+kernel32.dll GetModuleFileNameA
+kernel32.dll FindFirstFileA
+kernel32.dll FindClose
+user32.dll LoadStringA
+user32.dll CharNextA
+oleaut32.dll SysFreeString
+kernel32.dll VirtualQuery
+kernel32.dll GetVersionExA
+kernel32.dll GetStringTypeExA
+kernel32.dll GetDiskFreeSpaceA
+kernel32.dll GetCPInfo
+kernel32.dll GetACP
+kernel32.dll EnumCalendarInfoA
+user32.dll GetSystemMetrics
+user32.dll CharToOemA
+kernel32.dll GetLastError
+kernel32.dll SetFilePointer
+kernel32.dll SetEndOfFile
+kernel32.dll ReadFile
+kernel32.dll GetFileSize
+kernel32.dll GetFileType
+kernel32.dll CreateFileA
+kernel32.dll CloseHandle
\ No newline at end of file
Property changes on: ACMServer/trunk/ACMServer/Runner/Checker.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: ACMServer/trunk/ACMServer/Runner/Class1.cs
===================================================================
--- ACMServer/trunk/ACMServer/Runner/Class1.cs 2008-09-21 08:13:45 UTC (rev 368)
+++ ACMServer/trunk/ACMServer/Runner/Class1.cs 2008-09-22 11:52:05 UTC (rev 369)
@@ -1,27 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
-using SourceTest;
using System.IO;
using AcmContester.Library.LibraryExtention;
using AcmContester.Library.LibraryExtention.Data;
+using Main;
+using Test;
namespace Checker
{
public class Checker
{
- static void func(int x, TResult res)
- {
- 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();
@@ -34,52 +23,77 @@
string code = submit.sourceCode;
string id = submit.id.ToString();
- 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(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);
+ Result result = new Result(submit);
- if (c.Summary.compres.res != (TCompRes)0 )
+ try
{
- Result resulta = new Result(submit);
- resulta.res = TSource.CompileResultToString(c.Summary.compres.res);
- return resulta.ToStringX();
+ //Console.SetOut(File.CreateText("logout.txt"));
+ string[] data = File.ReadAllLines("InData.txt");
+
+ string src = code;
+ TestEnv test = new TestEnv(src, data[0], data[1], data[2]);
+ test.Compile();
+
+ log.Loging("------------------BEGIN SOURCE--------------------------", Log.Priority.INFO);
+ Console.WriteLine("------------------BEGIN SOURCE--------------------------");
+
+ log.Loging(src, Log.Priority.INFO);
+ Console.WriteLine(src);
+
+ log.Loging("-------------------END SOURCE---------------------------", Log.Priority.INFO);
+ Console.WriteLine("-------------------END SOURCE---------------------------");
+
+ log.Loging(String.Format("Compile result: {0}, details: {1}, usedtime:{2}", test.comp.Result.ToString(), test.comp.Details, test.comp.UsedTime), Log.Priority.INFO);
+ Console.WriteLine("Compile result: {0}, details: {1}, usedtime:{2}", test.comp.Result.ToString(), test.comp.Details, test.comp.UsedTime);
+
+ log.Loging(String.Format("Comp Output: {0}", test.comp.CompilerOutput), Log.Priority.INFO);
+ Console.WriteLine("Comp Output: {0}", test.comp.CompilerOutput);
+
+ if (test.comp.Result == Test.CompRes.OK)
+ {
+ test.RunAllTests(SecureType.Double);
+
+ for (int i = 0; i < test.run.results.Length; i++)
+ {
+ log.Loging(String.Format("Test #{0} result: {1}, details: {2}, usedtime:{3}, usedRealTime: {4}, usedmemory: {5}", i + 1,
+ test.run.results[i].res, test.run.results[i].Details, test.run.results[i].UsedTime, test.run.results[i].UsedRealTime, test.run.results[i].UsedMemory), Log.Priority.INFO);
+ Console.WriteLine("Test #{0} result: {1}, details: {2}, usedtime:{3}, usedRealTime: {4}, usedmemory: {5}", i + 1,
+ test.run.results[i].res, test.run.results[i].Details, test.run.results[i].UsedTime, test.run.results[i].UsedRealTime, test.run.results[i].UsedMemory);
+ }
+ }
+
+
+ //TODO:
+ result.res = test.comp.Result.ToString();
+ if (test.comp.Result == Test.CompRes.OK)
+ {
+ int usedTime = -1;
+ int usedMemory = -1;
+ for (int i = 0; i < test.run.results.Length; i++)
+ {
+ if (test.run.results[i].res == TestResult.Accepted)
+ {
+ usedTime = Math.Max(usedTime, test.run.results[i].UsedTime);
+ usedMemory = Math.Max(usedMemory, test.run.results[i].UsedMemory);
+ result.res = test.run.results[i].res.ToString();
+ }
+ else
+ {
+ result.res = test.run.results[i].res.ToString();
+ break;
+ }
+ }
+ if (result.res == TestResult.Accepted.ToString())
+ {
+ result.usedMemory = usedTime;
+ result.usedTime = usedMemory;
+ }
+ }
}
- //TODO:
- Result result = new Result(submit);
- result.res = TSource.TestResultToString(c.Summary.res.res);
- result.usedMemory = c.Summary.res.UsedMemory;
- result.usedTime = c.Summary.res.UsedTime;
+ catch (Exception tex)
+ {
+ result.res = "Exception";
+ }
return result.ToStringX();
}
}
Modified: ACMServer/trunk/ACMServer/Runner/InData.txt
===================================================================
--- ACMServer/trunk/ACMServer/Runner/InData.txt 2008-09-21 08:13:45 UTC (rev 368)
+++ ACMServer/trunk/ACMServer/Runner/InData.txt 2008-09-22 11:52:05 UTC (rev 369)
@@ -1,4 +1,3 @@
-d:\SAMPLE\Compillers\D7.bat
-d:\SAMPLE\Test\
-d:\SAMPLE\Temp\
-d:\SAMPLE\source.txt
+d:\Sample\Compiler\D7.bat
+d:\Sample\Temp\
+d:\Sample\Problem\
\ No newline at end of file
Property changes on: ACMServer/trunk/ACMServer/Runner/Load.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: ACMServer/trunk/ACMServer/Runner/Main.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: ACMServer/trunk/ACMServer/Runner/MutanticFramework.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: ACMServer/trunk/ACMServer/Runner/Plugin.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: ACMServer/trunk/ACMServer/Runner/Runner.csproj
===================================================================
--- ACMServer/trunk/ACMServer/Runner/Runner.csproj 2008-09-21 08:13:45 UTC (rev 368)
+++ ACMServer/trunk/ACMServer/Runner/Runner.csproj 2008-09-22 11:52:05 UTC (rev 369)
@@ -28,24 +28,17 @@
<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="Main, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
+ <Reference Include="Test, Version=1.0.3187.73, Culture=neutral, processorArchitecture=x86" />
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
- <Content Include="InData.txt">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
- <ItemGroup>
<ProjectReference Include="..\Library\Data\Data.csproj">
<Project>{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}</Project>
<Name>Data</Name>
@@ -55,6 +48,44 @@
<Name>LibraryExtention</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Content Include="AllowedFunc.txt">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Checker.dll">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="InData.txt">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Load.dll">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Main.dll">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="MutanticFramework.dll">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Plugin.dll">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="ScriptDotNet.dll">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="scriptExample.txt">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Test.dll">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="TesterInData.txt">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="VirtualPlugin.dll">
+ <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.
Property changes on: ACMServer/trunk/ACMServer/Runner/ScriptDotNet.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: ACMServer/trunk/ACMServer/Runner/Test.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: ACMServer/trunk/ACMServer/Runner/TesterInData.txt
===================================================================
--- ACMServer/trunk/ACMServer/Runner/TesterInData.txt (rev 0)
+++ ACMServer/trunk/ACMServer/Runner/TesterInData.txt 2008-09-22 11:52:05 UTC (rev 369)
@@ -0,0 +1,3 @@
+100
+TestingUser
+USER12345
\ No newline at end of file
Property changes on: ACMServer/trunk/ACMServer/Runner/VirtualPlugin.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: ACMServer/trunk/ACMServer/Runner/scriptExample.txt
===================================================================
--- ACMServer/trunk/ACMServer/Runner/scriptExample.txt (rev 0)
+++ ACMServer/trunk/ACMServer/Runner/scriptExample.txt 2008-09-22 11:52:05 UTC (rev 369)
@@ -0,0 +1,3 @@
+if (output==correctOutput)
+result='AC';
+else result='WA';
\ No newline at end of file
Modified: ACMServer/trunk/ACMServer/Tester/Library/SocketClientGate.cs
===================================================================
--- ACMServer/trunk/ACMServer/Tester/Library/SocketClientGate.cs 2008-09-21 08:13:45 UTC (rev 368)
+++ ACMServer/trunk/ACMServer/Tester/Library/SocketClientGate.cs 2008-09-22 11:52:05 UTC (rev 369)
@@ -10,8 +10,8 @@
{
private string descriptionMessage = "";
- public delegate void DataArrivedDelegate(SystemMessage s);
- public event DataArrivedDelegate onDataArrived;
+ public new delegate void DataArrivedDelegate(SystemMessage s);
+ public new event DataArrivedDelegate onDataArrived;
public SocketClientGate(string IP)
: base(IP)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|