diff options
author | David Wrighton <davidwr@microsoft.com> | 2019-05-01 15:29:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-01 15:29:34 -0700 |
commit | 4d820df4437139275b7c05330dd98631db708802 (patch) | |
tree | 1fd8c1b6c43880f5dace1ef33952139ea010779f /tests/src/readytorun | |
parent | 75fd45860789ad54223e223ed04a24b2f2d2a8d5 (diff) | |
download | coreclr-4d820df4437139275b7c05330dd98631db708802.tar.gz coreclr-4d820df4437139275b7c05330dd98631db708802.tar.bz2 coreclr-4d820df4437139275b7c05330dd98631db708802.zip |
Copy all win32 resources (#24308)
- Add crossgen test to verify file version is preserved
- Add support for general win32 resource copying to ReadyToRun
- Copy all resources
Diffstat (limited to 'tests/src/readytorun')
3 files changed, 90 insertions, 0 deletions
diff --git a/tests/src/readytorun/tests/fileversionpreservation/Properties/AssemblyInfo.cs b/tests/src/readytorun/tests/fileversionpreservation/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..2cef16eca4 --- /dev/null +++ b/tests/src/readytorun/tests/fileversionpreservation/Properties/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System.Reflection; + +[assembly: AssemblyFileVersion("2.0.1.9")] +[assembly: AssemblyVersion("2.0.1.10")] + diff --git a/tests/src/readytorun/tests/fileversionpreservation/fileversionpreservation.cs b/tests/src/readytorun/tests/fileversionpreservation/fileversionpreservation.cs new file mode 100644 index 0000000000..5839087f88 --- /dev/null +++ b/tests/src/readytorun/tests/fileversionpreservation/fileversionpreservation.cs @@ -0,0 +1,39 @@ +using System; +using System.IO; +using System.Runtime.CompilerServices; +using System.Diagnostics; + +public class Program +{ + public static int Main() + { + return RunTest(); + } + + public static bool CheckVersionResourceUsingApi(string filename) + { + FileVersionInfo fileVer = FileVersionInfo.GetVersionInfo(filename); + + bool success = fileVer.FileVersion == "2.0.1.9"; + if (!success) + Console.WriteLine($"{filename} has version \"{fileVer.FileVersion}\""); + + return success; + } + + public static int RunTest() + { + string ilfilename = typeof(Program).Assembly.Location; + string nifilename = ilfilename.Replace(".exe", ".ni.exe"); + + bool success = true; + + if (!CheckVersionResourceUsingApi(ilfilename)) + success = false; + + if (!CheckVersionResourceUsingApi(nifilename)) + success = false; + + return success ? 100 : -1; + } +} diff --git a/tests/src/readytorun/tests/fileversionpreservation/fileversionpreservation.csproj b/tests/src/readytorun/tests/fileversionpreservation/fileversionpreservation.csproj new file mode 100644 index 0000000000..48a10eda2b --- /dev/null +++ b/tests/src/readytorun/tests/fileversionpreservation/fileversionpreservation.csproj @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{7DECC55A-B584-4456-83BA-6C42A5B3B3CB}</ProjectGuid> + <OutputType>exe</OutputType> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <CLRTestKind>BuildAndRun</CLRTestKind> + <DefineConstants>$(DefineConstants);STATIC;CORECLR</DefineConstants> + <CLRTestPriority>0</CLRTestPriority> + <DebugType>PdbOnly</DebugType> + <Optimize>True</Optimize> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <ItemGroup> + <Compile Include="fileversionpreservation.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <CLRTestBatchPreCommands><![CDATA[ +$(CLRTestBatchPreCommands) +%Core_Root%\crossgen /readytorun /platform_assemblies_paths %Core_Root%%3B%25CD% /out fileversionpreservation.ni.exe fileversionpreservation.exe +]]></CLRTestBatchPreCommands> + <BashCLRTestPreCommands><![CDATA[ +$(BashCLRTestPreCommands) +$CORE_ROOT/crossgen -readytorun -platform_assemblies_paths $CORE_ROOT:`pwd` -out fileversionpreservation.ni.exe fileversionpreservation.exe +]]></BashCLRTestPreCommands> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project>
\ No newline at end of file |