From: <br...@us...> - 2009-07-25 20:56:10
|
Revision: 544 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=544&view=rev Author: brus07 Date: 2009-07-25 20:56:01 +0000 (Sat, 25 Jul 2009) Log Message: ----------- Change Component Sources to new structure of build script. Move source file to new structure of folders. Create new solution file. Modified Paths: -------------- nera/projects/nera.tester.runner/trunk/go.bat Added Paths: ----------- nera/projects/nera.tester.runner/trunk/Build.dependencies nera/projects/nera.tester.runner/trunk/Build.version nera/projects/nera.tester.runner/trunk/Component Sources.csproj nera/projects/nera.tester.runner/trunk/Reference.targets nera/projects/nera.tester.runner/trunk/nera.tester.runner VS 2005.sln nera/projects/nera.tester.runner/trunk/src/csharp/ nera/projects/nera.tester.runner/trunk/src/csharp/main/ nera/projects/nera.tester.runner/trunk/src/csharp/main/Nera/ nera/projects/nera.tester.runner/trunk/src/csharp/main/Nera/Tester/ nera/projects/nera.tester.runner/trunk/src/csharp/main/Nera/Tester/Runner/ nera/projects/nera.tester.runner/trunk/src/csharp/main/Nera/Tester/Runner/AssemblyInfo.cs nera/projects/nera.tester.runner/trunk/src/csharp/main/Nera/Tester/Runner/Class1.cs Removed Paths: ------------- nera/projects/nera.tester.runner/trunk/nera.tester.runner.csproj nera/projects/nera.tester.runner/trunk/src/Class1.cs nera/projects/nera.tester.runner/trunk/src/Properties/ Added: nera/projects/nera.tester.runner/trunk/Build.dependencies =================================================================== --- nera/projects/nera.tester.runner/trunk/Build.dependencies (rev 0) +++ nera/projects/nera.tester.runner/trunk/Build.dependencies 2009-07-25 20:56:01 UTC (rev 544) @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <!--Directory structure of the component.--> + <BuildDir>build</BuildDir> + <BuildClassDir>$(BuildDir)\classes</BuildClassDir> + <SrcDir>src</SrcDir> + <TestFilesDir>test_files</TestFilesDir> + <BuildObjDir>obj</BuildObjDir> + <!--Src directory structure.--> + <DotNetSrc>$(SrcDir)\csharp</DotNetSrc> + <DotNetMain>$(DotNetSrc)\main</DotNetMain> + <OutputPath>$(BuildClassDir)</OutputPath> + <OutputType>Library</OutputType> + <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> + </PropertyGroup> + + <ItemGroup> + <Reference Include="AcmLibraryExtention, Version=1.0.3482.26401, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>lib\AcmLibraryExtention.dll</HintPath> + </Reference> + <Reference Include="Data, Version=1.0.3482.26403, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>lib\Data.dll</HintPath> + </Reference> + <Reference Include="Load, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>lib\Load.dll</HintPath> + </Reference> + <Reference Include="Main, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>lib\Main.dll</HintPath> + </Reference> + <Reference Include="Test, Version=1.0.3320.28735, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>lib\Test.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + + <!--Component sources and referenced assemblies--> + <PropertyGroup> + <AssemblyName>$(ComponentPackage)</AssemblyName> + <RootNamespace>$(ComponentPackage)</RootNamespace> + <DocumentationFile>$(BuildClassDir)\$(ComponentPackage).xml</DocumentationFile> + </PropertyGroup> + <ItemGroup> + <Compile Include="$(DotNetMain)\**\*.cs"> + <Visible>true</Visible> + </Compile> + </ItemGroup> +</Project> Added: nera/projects/nera.tester.runner/trunk/Build.version =================================================================== --- nera/projects/nera.tester.runner/trunk/Build.version (rev 0) +++ nera/projects/nera.tester.runner/trunk/Build.version 2009-07-25 20:56:01 UTC (rev 544) @@ -0,0 +1,12 @@ +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<PropertyGroup> + <!-- Component Name and Version Information --> + <ComponentName>Nera.Tester.Runner</ComponentName> + <ComponentDistFileName>nera.tester.runner</ComponentDistFileName> + <ComponentPackage>Nera.Tester.Runner</ComponentPackage> + <ComponentVersionMajor>1</ComponentVersionMajor> + <ComponentVersionMinor>0</ComponentVersionMinor> + <ComponentVersionMicro>99</ComponentVersionMicro> + <ComponentVersionBuild>99</ComponentVersionBuild> + </PropertyGroup> +</Project> Copied: nera/projects/nera.tester.runner/trunk/Component Sources.csproj (from rev 538, nera/projects/nera.tester.runner/trunk/nera.tester.runner.csproj) =================================================================== --- nera/projects/nera.tester.runner/trunk/Component Sources.csproj (rev 0) +++ nera/projects/nera.tester.runner/trunk/Component Sources.csproj 2009-07-25 20:56:01 UTC (rev 544) @@ -0,0 +1,33 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{052D9F77-17AF-42F3-BFBF-975A19383496}</ProjectGuid> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <!-- Added for making the difference in Build.dependencies file between sources & tests projects --> + <ProjectKind>ComponentSources</ProjectKind> + </PropertyGroup> + + <Import Project="Reference.targets" /> + + <ItemGroup> + <Content Include="resources\AllowedFunc.txt"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="resources\TesterInData.txt"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="resources\scriptExample.txt"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="resources\InData.txt"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + </ItemGroup> +</Project> \ No newline at end of file Added: nera/projects/nera.tester.runner/trunk/Reference.targets =================================================================== --- nera/projects/nera.tester.runner/trunk/Reference.targets (rev 0) +++ nera/projects/nera.tester.runner/trunk/Reference.targets 2009-07-25 20:56:01 UTC (rev 544) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="Build.version" /> + <Import Project="Build.dependencies" Condition="!Exists('Bamboo.Build.Dependencies')" /> + <PropertyGroup> + <GlobalTargetsPath>..\..\..\Targets\Global.targets</GlobalTargetsPath> + <CommonTargetsFile>..\..\..\Targets\Common.targets</CommonTargetsFile> + </PropertyGroup> + <Import Project="$(GlobalTargetsPath)" Condition="Exists($(GlobalTargetsPath))" /> + <Import Project="$(DistributionTargetsFile)" Condition="Exists($(DistributionTargetsFile))" /> + <Import Project="$(CommonTargetsFile)" Condition="Exists($(CommonTargetsFile))" /> +</Project> Modified: nera/projects/nera.tester.runner/trunk/go.bat =================================================================== --- nera/projects/nera.tester.runner/trunk/go.bat 2009-07-25 11:22:00 UTC (rev 543) +++ nera/projects/nera.tester.runner/trunk/go.bat 2009-07-25 20:56:01 UTC (rev 544) @@ -1,14 +1 @@ -@echo off -if "%1" == "" goto Usage -goto NoBuildResults - -:Usage -echo usage: build [target] -echo where: target = one of "Clean", "Build", "Test" -goto End - -:NoBuildResults -%windir%\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe xunit.msbuild /p:Configuration=Debug /t:%* -goto End - -:End +%windir%\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe %* \ No newline at end of file Added: nera/projects/nera.tester.runner/trunk/nera.tester.runner VS 2005.sln =================================================================== --- nera/projects/nera.tester.runner/trunk/nera.tester.runner VS 2005.sln (rev 0) +++ nera/projects/nera.tester.runner/trunk/nera.tester.runner VS 2005.sln 2009-07-25 20:56:01 UTC (rev 544) @@ -0,0 +1,17 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Component Sources", "Component Sources.csproj", "{052D9F77-17AF-42F3-BFBF-975A19383496}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {052D9F77-17AF-42F3-BFBF-975A19383496}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {052D9F77-17AF-42F3-BFBF-975A19383496}.Debug|Any CPU.Build.0 = Debug|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Deleted: nera/projects/nera.tester.runner/trunk/nera.tester.runner.csproj =================================================================== --- nera/projects/nera.tester.runner/trunk/nera.tester.runner.csproj 2009-07-25 11:22:00 UTC (rev 543) +++ nera/projects/nera.tester.runner/trunk/nera.tester.runner.csproj 2009-07-25 20:56:01 UTC (rev 544) @@ -1,85 +0,0 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>8.0.50727</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{052D9F77-17AF-42F3-BFBF-975A19383496}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>Nera.Tester.Runner</RootNamespace> - <AssemblyName>nera.tester.runner</AssemblyName> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>build\bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>build\bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="AcmLibraryExtention, Version=1.0.3482.26401, Culture=neutral, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>lib\AcmLibraryExtention.dll</HintPath> - </Reference> - <Reference Include="Data, Version=1.0.3482.26403, Culture=neutral, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>lib\Data.dll</HintPath> - </Reference> - <Reference Include="Load, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>lib\Load.dll</HintPath> - </Reference> - <Reference Include="Main, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>lib\Main.dll</HintPath> - </Reference> - <Reference Include="Test, Version=1.0.3320.28735, Culture=neutral, processorArchitecture=x86"> - <SpecificVersion>False</SpecificVersion> - <HintPath>lib\Test.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="src\Class1.cs" /> - <Compile Include="src\Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <Content Include="resources\AllowedFunc.txt"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - <Content Include="resources\TesterInData.txt"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - <Content Include="resources\scriptExample.txt"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - <Content Include="resources\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. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> - <PropertyGroup> - <PostBuildEvent> - </PostBuildEvent> - </PropertyGroup> -</Project> \ No newline at end of file Deleted: nera/projects/nera.tester.runner/trunk/src/Class1.cs =================================================================== --- nera/projects/nera.tester.runner/trunk/src/Class1.cs 2009-07-25 11:22:00 UTC (rev 543) +++ nera/projects/nera.tester.runner/trunk/src/Class1.cs 2009-07-25 20:56:01 UTC (rev 544) @@ -1,247 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using AcmContester.Library.LibraryExtention; -using AcmContester.Library.LibraryExtention.Data; -using Main; -using Test; - -namespace Nera.Tester.Runner -{ - public class Checker - { - private static List<KeyValuePair<string, string>> htmlEntityList; - - private static string HtmlEntityDecode(string str) - { - InitHtmlEntityList(); - for (int i = 0; i < htmlEntityList.Count; i++) - { - str = str.Replace(htmlEntityList[i].Value, htmlEntityList[i].Key); - } - return str; - } - - 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); - - IniFile iniFile = new IniFile("RealTesterConfig.ini"); - string secureLever = iniFile.GetString("MainConfig", "SecureLevel", "Double"); - - //TODO: - Submit submit = Submit.CreateFromXml(message); - string code = submit.sourceCode; - code = HtmlEntityDecode(code); - int language = submit.language; - Result result = new Result(submit); - - try - { - //Console.SetOut(File.CreateText("logout.txt")); - string[] data = File.ReadAllLines("InData.txt"); - data[2] = data[2] + submit.pbolemID + "\\"; - string src = code; - TestEnv test = new TestEnv(src, language, 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, test.comp.Details, test.comp.UsedTime), Log.Priority.INFO); - Console.WriteLine("Compile result: {0}, details: {1}, usedtime:{2}", test.comp.Result, 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 == CompRes.OK) - { - SecureType secureType = SecureType.Double; - try - { - secureType = (SecureType)Enum.Parse(typeof(SecureType), secureLever, true); - } - catch (ArgumentException) - { - } - if (secureLever == "None") - secureType = SecureType.None; - test.RunAllTests(secureType); - - 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.compOutput = test.comp.CompilerOutput; - result.res = test.comp.Result.ToString(); - if (test.comp.Result == 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(); - usedTime = test.run.results[i].UsedTime; - usedMemory = test.run.results[i].UsedMemory; - break; - } - } - result.usedMemory = usedTime; - result.usedTime = usedMemory; - } - } - catch (Exception tex) - { - log.Loging("Runner:GetResult - Exception (" + tex + ": " + tex.Message, Log.Priority.INFO); - log.Loging(tex.StackTrace, Log.Priority.INFO); - result.res = "Exception"; - } - return result.ToStringX(); - } - - - private static void InitHtmlEntityList() - { - if (htmlEntityList != null) - return; - htmlEntityList = new List<KeyValuePair<string,string>>(); - AddElementToHtmlEntityList("\"", """); - AddElementToHtmlEntityList("<", "<"); - AddElementToHtmlEntityList("&", "&"); - } - - private static void AddElementToHtmlEntityList(string p, string p_2) - { - htmlEntityList.Add(new KeyValuePair<string, string>(p, p_2)); - } - - public static string GetResultIoi(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); - - IniFile iniFile = new IniFile("RealTesterConfig.ini"); - string secureLever = iniFile.GetString("MainConfig", "SecureLevel", "Double"); - - SubmitIoi submit = SubmitIoi.CreateFromXml(message); - - //TODO: - string code = submit.submit.sourceCode; - code = HtmlEntityDecode(code); - int language = submit.submit.language; - ResultIoi result = new ResultIoi(submit); - try - { - //Console.SetOut(File.CreateText("logout.txt")); - string[] data = File.ReadAllLines("InData.txt"); - data[2] = data[2] + submit.submit.pbolemID + "\\"; - string src = code; - TestEnv test = new TestEnv(src, language, 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, test.comp.Details, test.comp.UsedTime), Log.Priority.INFO); - Console.WriteLine("Compile result: {0}, details: {1}, usedtime:{2}", test.comp.Result, 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 == CompRes.OK) - { - SecureType secureType = SecureType.Double; - try - { - secureType = (SecureType)Enum.Parse(typeof(SecureType), secureLever, true); - } - catch (ArgumentException) - { - } - if (secureLever == "None") - secureType = SecureType.None; - test.RunAllTests(secureType); - - 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.compOutput = test.comp.CompilerOutput; - result.res = test.comp.Result.ToString(); - if (test.comp.Result == CompRes.OK) - { - int usedTime = -1; - int usedMemory = -1; - result.testResults = new TestResIoi[test.run.results.Length]; - result.res = TestResult.Accepted.ToString(); - for (int i = 0; i < test.run.results.Length; i++) - { - result.testResults[i] = new TestResIoi(); - - usedTime = Math.Max(usedTime, test.run.results[i].UsedTime); - usedMemory = Math.Max(usedMemory, test.run.results[i].UsedMemory); - if (test.run.results[i].res != TestResult.Accepted) - result.res = test.run.results[i].res.ToString(); - - result.testResults[i].input = test.run.test.tests[i].input; - result.testResults[i].output = test.run.test.tests[i].output; - result.testResults[i].points = test.run.test.tests[i].points; - result.testResults[i].contestantOutput = test.run.results[i].UserOutput; - result.testResults[i].usedMemory = test.run.results[i].UsedMemory; - result.testResults[i].usedTime = test.run.results[i].UsedTime; - result.testResults[i].id = i; - result.testResults[i].res = test.run.results[i].res.ToString(); - } - result.usedMemory = usedTime; - result.usedTime = usedMemory; - } - } - catch (Exception tex) - { - log.Loging("Runner:GetResult - Exception (" + tex + ": " + tex.Message, Log.Priority.INFO); - log.Loging(tex.StackTrace, Log.Priority.INFO); - result.res = "Exception"; - } - return result.ToStringX(); - } - } -} Copied: nera/projects/nera.tester.runner/trunk/src/csharp/main/Nera/Tester/Runner/AssemblyInfo.cs (from rev 536, nera/projects/nera.tester.runner/trunk/src/Properties/AssemblyInfo.cs) =================================================================== --- nera/projects/nera.tester.runner/trunk/src/csharp/main/Nera/Tester/Runner/AssemblyInfo.cs (rev 0) +++ nera/projects/nera.tester.runner/trunk/src/csharp/main/Nera/Tester/Runner/AssemblyInfo.cs 2009-07-25 20:56:01 UTC (rev 544) @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("nera.tester.runner")] +[assembly: AssemblyDescription("http://acm.lviv.ua")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("nera.tester.runner")] +[assembly: AssemblyCopyright("Copyright © AcmContester 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("80d03fd6-3218-46cc-8dcc-1de5f7c7fbf5")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] Copied: nera/projects/nera.tester.runner/trunk/src/csharp/main/Nera/Tester/Runner/Class1.cs (from rev 536, nera/projects/nera.tester.runner/trunk/src/Class1.cs) =================================================================== --- nera/projects/nera.tester.runner/trunk/src/csharp/main/Nera/Tester/Runner/Class1.cs (rev 0) +++ nera/projects/nera.tester.runner/trunk/src/csharp/main/Nera/Tester/Runner/Class1.cs 2009-07-25 20:56:01 UTC (rev 544) @@ -0,0 +1,247 @@ +using System; +using System.Collections.Generic; +using System.IO; +using AcmContester.Library.LibraryExtention; +using AcmContester.Library.LibraryExtention.Data; +using Main; +using Test; + +namespace Nera.Tester.Runner +{ + public class Checker + { + private static List<KeyValuePair<string, string>> htmlEntityList; + + private static string HtmlEntityDecode(string str) + { + InitHtmlEntityList(); + for (int i = 0; i < htmlEntityList.Count; i++) + { + str = str.Replace(htmlEntityList[i].Value, htmlEntityList[i].Key); + } + return str; + } + + 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); + + IniFile iniFile = new IniFile("RealTesterConfig.ini"); + string secureLever = iniFile.GetString("MainConfig", "SecureLevel", "Double"); + + //TODO: + Submit submit = Submit.CreateFromXml(message); + string code = submit.sourceCode; + code = HtmlEntityDecode(code); + int language = submit.language; + Result result = new Result(submit); + + try + { + //Console.SetOut(File.CreateText("logout.txt")); + string[] data = File.ReadAllLines("InData.txt"); + data[2] = data[2] + submit.pbolemID + "\\"; + string src = code; + TestEnv test = new TestEnv(src, language, 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, test.comp.Details, test.comp.UsedTime), Log.Priority.INFO); + Console.WriteLine("Compile result: {0}, details: {1}, usedtime:{2}", test.comp.Result, 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 == CompRes.OK) + { + SecureType secureType = SecureType.Double; + try + { + secureType = (SecureType)Enum.Parse(typeof(SecureType), secureLever, true); + } + catch (ArgumentException) + { + } + if (secureLever == "None") + secureType = SecureType.None; + test.RunAllTests(secureType); + + 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.compOutput = test.comp.CompilerOutput; + result.res = test.comp.Result.ToString(); + if (test.comp.Result == 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(); + usedTime = test.run.results[i].UsedTime; + usedMemory = test.run.results[i].UsedMemory; + break; + } + } + result.usedMemory = usedTime; + result.usedTime = usedMemory; + } + } + catch (Exception tex) + { + log.Loging("Runner:GetResult - Exception (" + tex + ": " + tex.Message, Log.Priority.INFO); + log.Loging(tex.StackTrace, Log.Priority.INFO); + result.res = "Exception"; + } + return result.ToStringX(); + } + + + private static void InitHtmlEntityList() + { + if (htmlEntityList != null) + return; + htmlEntityList = new List<KeyValuePair<string,string>>(); + AddElementToHtmlEntityList("\"", """); + AddElementToHtmlEntityList("<", "<"); + AddElementToHtmlEntityList("&", "&"); + } + + private static void AddElementToHtmlEntityList(string p, string p_2) + { + htmlEntityList.Add(new KeyValuePair<string, string>(p, p_2)); + } + + public static string GetResultIoi(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); + + IniFile iniFile = new IniFile("RealTesterConfig.ini"); + string secureLever = iniFile.GetString("MainConfig", "SecureLevel", "Double"); + + SubmitIoi submit = SubmitIoi.CreateFromXml(message); + + //TODO: + string code = submit.submit.sourceCode; + code = HtmlEntityDecode(code); + int language = submit.submit.language; + ResultIoi result = new ResultIoi(submit); + try + { + //Console.SetOut(File.CreateText("logout.txt")); + string[] data = File.ReadAllLines("InData.txt"); + data[2] = data[2] + submit.submit.pbolemID + "\\"; + string src = code; + TestEnv test = new TestEnv(src, language, 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, test.comp.Details, test.comp.UsedTime), Log.Priority.INFO); + Console.WriteLine("Compile result: {0}, details: {1}, usedtime:{2}", test.comp.Result, 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 == CompRes.OK) + { + SecureType secureType = SecureType.Double; + try + { + secureType = (SecureType)Enum.Parse(typeof(SecureType), secureLever, true); + } + catch (ArgumentException) + { + } + if (secureLever == "None") + secureType = SecureType.None; + test.RunAllTests(secureType); + + 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.compOutput = test.comp.CompilerOutput; + result.res = test.comp.Result.ToString(); + if (test.comp.Result == CompRes.OK) + { + int usedTime = -1; + int usedMemory = -1; + result.testResults = new TestResIoi[test.run.results.Length]; + result.res = TestResult.Accepted.ToString(); + for (int i = 0; i < test.run.results.Length; i++) + { + result.testResults[i] = new TestResIoi(); + + usedTime = Math.Max(usedTime, test.run.results[i].UsedTime); + usedMemory = Math.Max(usedMemory, test.run.results[i].UsedMemory); + if (test.run.results[i].res != TestResult.Accepted) + result.res = test.run.results[i].res.ToString(); + + result.testResults[i].input = test.run.test.tests[i].input; + result.testResults[i].output = test.run.test.tests[i].output; + result.testResults[i].points = test.run.test.tests[i].points; + result.testResults[i].contestantOutput = test.run.results[i].UserOutput; + result.testResults[i].usedMemory = test.run.results[i].UsedMemory; + result.testResults[i].usedTime = test.run.results[i].UsedTime; + result.testResults[i].id = i; + result.testResults[i].res = test.run.results[i].res.ToString(); + } + result.usedMemory = usedTime; + result.usedTime = usedMemory; + } + } + catch (Exception tex) + { + log.Loging("Runner:GetResult - Exception (" + tex + ": " + tex.Message, Log.Priority.INFO); + log.Loging(tex.StackTrace, Log.Priority.INFO); + result.res = "Exception"; + } + return result.ToStringX(); + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |