Fix a couple absolute paths and remove CoreCLRTestLibrary
TestLibrary is available in test drops under Common\Desktop.Coreclr.TestWrapper so use that and remove the TestLibrary source from our branch.
This commit is contained in:
Родитель
6daef3b026
Коммит
d55d5dee5c
|
@ -8,7 +8,7 @@
|
|||
<IntermediateOutputPath>$(MSBuildProjectDirectory)\</IntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="C:\git\corert\tests\Test.Common.targets" />
|
||||
<Import Project="$(CoreRT_TestRoot)\Test.Common.targets" />
|
||||
|
||||
<!-- Since tests are already compiled, override Compile target to prevent CSC running -->
|
||||
<Target Name="Compile" />
|
||||
|
|
|
@ -34,7 +34,7 @@ set CORE_ROOT=
|
|||
:: so override if we're doing a 64-bit test run
|
||||
::
|
||||
if "%CoreRT_BuildArch%" == "x64" (
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
|
||||
call "%VS140COMNTOOLS%\..\..\VC\bin\amd64\vcvars64.bat"
|
||||
)
|
||||
|
||||
echo msbuild /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%CoreRT_ToolchainDir%" "/p:Configuration=%CoreRT_BuildType%" %TestFolder%\Test.csproj
|
||||
|
|
|
@ -90,6 +90,7 @@ $(_XunitEpilog)
|
|||
<IsTestProject>true</IsTestProject>
|
||||
<ProjectJson>%24(TestWrappersPackagesConfigFileDirectory)project.json</ProjectJson>
|
||||
<ProjectLockJson>%24(TestWrappersPackagesConfigFileDirectory)project.lock.json</ProjectLockJson>
|
||||
<ReferencePath>$(ReferencePath);$(XunitTestBinBase)\Common\Desktop.Coreclr.TestWrapper\Desktop.Coreclr.TestWrapper</ReferencePath>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the configurations -->
|
||||
<PropertyGroup Condition=" '%24(Configuration)|%24(Platform)' == 'Debug|AnyCPU' ">
|
||||
|
@ -102,17 +103,12 @@ $(_XunitEpilog)
|
|||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(SourceDir)Common\Desktop.Coreclr.TestWrapper\Desktop.Coreclr.TestWrapper.csproj">
|
||||
<Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
|
||||
<Name>coreclr</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="$(XunitTestBinBase)\Common\Desktop.Coreclr.TestWrapper\Desktop.Coreclr.TestWrapper\Coreclr.TestWrapper.dll" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<ProjectJson>%24(TestWrappersPackagesConfigFileDirectory)project.json</ProjectJson>
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
public static class CalendarGet
|
||||
{
|
||||
public static Calendar GregorianCalendar(GregorianCalendarTypes Type)
|
||||
{
|
||||
CultureInfo ci = null;
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case GregorianCalendarTypes.Arabic:
|
||||
ci = new CultureInfo("ar-SA");
|
||||
return ci.OptionalCalendars[4];
|
||||
case GregorianCalendarTypes.Localized:
|
||||
ci = new CultureInfo("ar-IQ");
|
||||
return ci.OptionalCalendars[0];
|
||||
case GregorianCalendarTypes.MiddleEastFrench:
|
||||
ci = new CultureInfo("ar-IQ");
|
||||
return ci.OptionalCalendars[4];
|
||||
case GregorianCalendarTypes.TransliteratedEnglish:
|
||||
ci = new CultureInfo("ar-IQ");
|
||||
return ci.OptionalCalendars[5];
|
||||
case GregorianCalendarTypes.TransliteratedFrench:
|
||||
ci = new CultureInfo("ar-IQ");
|
||||
return ci.OptionalCalendars[6];
|
||||
case GregorianCalendarTypes.USEnglish:
|
||||
ci = new CultureInfo("ar-IQ");
|
||||
return ci.OptionalCalendars[3];
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public static Calendar JapaneseCalendar()
|
||||
{
|
||||
var ci = new CultureInfo("ja-JP");
|
||||
return ci.OptionalCalendars[1];
|
||||
}
|
||||
|
||||
public static Calendar ThaiBuddhistCalendar()
|
||||
{
|
||||
var ci = new CultureInfo("th-TH");
|
||||
return ci.Calendar;
|
||||
}
|
||||
|
||||
public static Calendar KoreanCalendar()
|
||||
{
|
||||
var ci = new System.Globalization.CultureInfo("ko-KR");
|
||||
return ci.OptionalCalendars[1];
|
||||
}
|
||||
|
||||
public static Calendar GregorianCalendar()
|
||||
{
|
||||
var ci = new System.Globalization.CultureInfo("en-US");
|
||||
return ci.Calendar;
|
||||
}
|
||||
|
||||
public static Calendar TaiwanCalendar()
|
||||
{
|
||||
var ci = new System.Globalization.CultureInfo("zh-TW");
|
||||
return ci.OptionalCalendars[1];
|
||||
}
|
||||
|
||||
public static Calendar HebrewCalendar()
|
||||
{
|
||||
var ci = new System.Globalization.CultureInfo("he-IL");
|
||||
return ci.OptionalCalendars[1];
|
||||
}
|
||||
|
||||
public static Calendar HijriCalendar()
|
||||
{
|
||||
var ci = new System.Globalization.CultureInfo("ar-SA");
|
||||
return ci.OptionalCalendars[1];
|
||||
}
|
||||
}
|
||||
|
||||
public enum GregorianCalendarTypes
|
||||
{
|
||||
Arabic,
|
||||
USEnglish,
|
||||
Localized,
|
||||
MiddleEastFrench,
|
||||
TransliteratedEnglish,
|
||||
TransliteratedFrench,
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
<?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>
|
||||
<AssemblyName>TestLibrary</AssemblyName>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{C8C0DC74-FAC4-45B1-81FE-70C4808366E0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
||||
<CLRTestKind>BuildOnly</CLRTestKind>
|
||||
<NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
|
||||
<DefineConstants>$(DefineConstants);WINCORESYS;$([System.String]::Copy('$(BuildArch)').ToUpper())</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GenerateRunScript>false</GenerateRunScript>
|
||||
</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="CalendarHelpers.cs" />
|
||||
<Compile Include="EndianessChecker.cs" />
|
||||
<Compile Include="Generator.cs" />
|
||||
<Compile Include="GlobLocHelper.cs" />
|
||||
<Compile Include="Logging.cs" />
|
||||
<Compile Include="TestFramework.cs" />
|
||||
<Compile Include="Utilities.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
|
@ -1,34 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
//
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace TestLibrary
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct EndianessChecker
|
||||
{
|
||||
[FieldOffset(3)]
|
||||
byte myByte;
|
||||
[FieldOffset(0)]
|
||||
int myInt;
|
||||
|
||||
public static bool IsBigEndian()
|
||||
{
|
||||
EndianessChecker check = new EndianessChecker();
|
||||
|
||||
check.myByte = 1;
|
||||
return (check.myInt == 1);
|
||||
}
|
||||
|
||||
public static bool IsLittleEndian()
|
||||
{
|
||||
EndianessChecker check = new EndianessChecker();
|
||||
|
||||
check.myByte = 1;
|
||||
return (check.myInt == 16777216);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,466 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
|
||||
namespace TestLibrary
|
||||
{
|
||||
public static class Generator
|
||||
{
|
||||
internal static Random m_rand = new Random();
|
||||
internal static int? seed = null;
|
||||
|
||||
public static int? Seed
|
||||
{
|
||||
get
|
||||
{
|
||||
if (seed.HasValue)
|
||||
{
|
||||
return seed.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!(seed.HasValue))
|
||||
{
|
||||
seed = value;
|
||||
if (seed.HasValue)
|
||||
{
|
||||
TestFramework.LogVerbose("Seeding Random with: " + seed.Value.ToString());
|
||||
m_rand = new Random(seed.Value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TestFramework.LogVerbose("Attempt to seed Random to " + value.ToString() + " rejected it was already seeded to: " + seed.Value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// returns a byte array of random data
|
||||
public static void GetBytes(int new_seed, byte[] buffer)
|
||||
{
|
||||
Seed = new_seed;
|
||||
GetBytes(buffer);
|
||||
}
|
||||
public static void GetBytes(byte[] buffer)
|
||||
{
|
||||
m_rand.NextBytes(buffer);
|
||||
TestFramework.LogVerbose("Random Byte[] produced: " + Utilities.ByteArrayToString(buffer));
|
||||
}
|
||||
|
||||
// returns a non-negative Int64 between 0 and Int64.MaxValue
|
||||
public static Int64 GetInt64(Int32 new_seed)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetInt64();
|
||||
}
|
||||
public static Int64 GetInt64()
|
||||
{
|
||||
byte[] buffer = new byte[8];
|
||||
Int64 iVal;
|
||||
|
||||
GetBytes(buffer);
|
||||
|
||||
// convert to Int64
|
||||
iVal = 0;
|
||||
for (int i = 0; i < buffer.Length; i++)
|
||||
{
|
||||
iVal |= ((Int64)buffer[i] << (i * 8));
|
||||
}
|
||||
|
||||
if (0 > iVal) iVal *= -1;
|
||||
|
||||
TestFramework.LogVerbose("Random Int64 produced: " + iVal.ToString());
|
||||
return iVal;
|
||||
}
|
||||
|
||||
// returns a non-negative Int32 between 0 and Int32.MaxValue
|
||||
public static Int32 GetInt32(Int32 new_seed)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetInt32();
|
||||
}
|
||||
public static Int32 GetInt32()
|
||||
{
|
||||
Int32 i = m_rand.Next();
|
||||
TestFramework.LogVerbose("Random Int32 produced: " + i.ToString());
|
||||
return i;
|
||||
}
|
||||
|
||||
// returns a non-negative Int16 between 0 and Int16.MaxValue
|
||||
public static Int16 GetInt16(Int32 new_seed)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetInt16();
|
||||
}
|
||||
public static Int16 GetInt16()
|
||||
{
|
||||
Int16 i = Convert.ToInt16(m_rand.Next() % (1 + Int16.MaxValue));
|
||||
TestFramework.LogVerbose("Random Int16 produced: " + i.ToString());
|
||||
return i;
|
||||
}
|
||||
|
||||
// returns a non-negative Byte between 0 and Byte.MaxValue
|
||||
public static Byte GetByte(Int32 new_seed)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetByte();
|
||||
}
|
||||
public static Byte GetByte()
|
||||
{
|
||||
Byte i = Convert.ToByte(m_rand.Next() % (1 + Byte.MaxValue));
|
||||
TestFramework.LogVerbose("Random Byte produced: " + i.ToString());
|
||||
return i;
|
||||
}
|
||||
|
||||
// returns a non-negative Double between 0.0 and 1.0
|
||||
public static Double GetDouble(Int32 new_seed)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetDouble();
|
||||
}
|
||||
public static Double GetDouble()
|
||||
{
|
||||
Double i = m_rand.NextDouble();
|
||||
TestFramework.LogVerbose("Random Double produced: " + i.ToString());
|
||||
return i;
|
||||
}
|
||||
|
||||
// returns a non-negative Single between 0.0 and 1.0
|
||||
public static Single GetSingle(Int32 new_seed)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetSingle();
|
||||
}
|
||||
public static Single GetSingle()
|
||||
{
|
||||
Single i = Convert.ToSingle(m_rand.NextDouble());
|
||||
TestFramework.LogVerbose("Random Single produced: " + i.ToString());
|
||||
return i;
|
||||
}
|
||||
|
||||
// returns a valid char that is a letter
|
||||
public static Char GetCharLetter(Int32 new_seed)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetCharLetter();
|
||||
}
|
||||
public static Char GetCharLetter()
|
||||
{
|
||||
return GetCharLetter(true);
|
||||
}
|
||||
//returns a valid char that is a letter
|
||||
//if allowsurrogate is true then surrogates are valid return values
|
||||
public static Char GetCharLetter(Int32 new_seed, bool allowsurrogate)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetCharLetter(allowsurrogate);
|
||||
}
|
||||
public static Char GetCharLetter(bool allowsurrogate)
|
||||
{
|
||||
return GetCharLetter(allowsurrogate, true);
|
||||
}
|
||||
|
||||
//returns a valid char that is a letter
|
||||
//if allowsurrogate is true then surrogates are valid return values
|
||||
//if allownoweight is true, then no-weight characters are valid return values
|
||||
public static Char GetCharLetter(Int32 new_seed, bool allowsurrogate, bool allownoweight)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetCharLetter(allowsurrogate, allownoweight);
|
||||
}
|
||||
public static Char GetCharLetter(bool allowsurrogate, bool allownoweight)
|
||||
{
|
||||
Int16 iVal;
|
||||
Char c = 'a'; //this value is never used
|
||||
Int32 counter;
|
||||
bool loopCondition = true;
|
||||
|
||||
// attempt to randomly find a letter
|
||||
counter = 100;
|
||||
do
|
||||
{
|
||||
counter--;
|
||||
iVal = GetInt16();
|
||||
TestFramework.LogVerbose("Random CharLetter produced: " + Convert.ToChar(iVal).ToString());
|
||||
|
||||
if (false == allownoweight)
|
||||
{
|
||||
throw new NotSupportedException("allownoweight = false is not supported in TestLibrary with FEATURE_NOPINVOKES");
|
||||
}
|
||||
|
||||
c = Convert.ToChar(iVal);
|
||||
loopCondition = allowsurrogate ? (!Char.IsLetter(c)) : (!Char.IsLetter(c) || Char.IsSurrogate(c));
|
||||
}
|
||||
while (loopCondition && 0 < counter);
|
||||
|
||||
|
||||
if (!Char.IsLetter(c))
|
||||
{
|
||||
// we tried and failed to get a letter
|
||||
// Grab an ASCII letter
|
||||
c = Convert.ToChar(GetInt16() % 26 + 'A');
|
||||
}
|
||||
|
||||
TestFramework.LogVerbose("Random Char produced: " + c.ToString());
|
||||
return c;
|
||||
}
|
||||
|
||||
// returns a valid char that is a number
|
||||
public static char GetCharNumber(Int32 new_seed)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetCharNumber();
|
||||
}
|
||||
public static char GetCharNumber()
|
||||
{
|
||||
return GetCharNumber(true);
|
||||
}
|
||||
|
||||
// returns a valid char that is a number
|
||||
//if allownoweight is true, then no-weight characters are valid return values
|
||||
public static char GetCharNumber(Int32 new_seed, bool allownoweight)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetCharNumber(allownoweight);
|
||||
}
|
||||
public static char GetCharNumber(bool allownoweight)
|
||||
{
|
||||
Char c = '0'; //this value is never used
|
||||
Int32 counter;
|
||||
Int16 iVal;
|
||||
bool loopCondition = true;
|
||||
|
||||
// attempt to randomly find a number
|
||||
counter = 100;
|
||||
do
|
||||
{
|
||||
counter--;
|
||||
iVal = GetInt16();
|
||||
TestFramework.LogVerbose("Random Char produced: " + Convert.ToChar(iVal).ToString());
|
||||
|
||||
if (false == allownoweight)
|
||||
{
|
||||
throw new InvalidOperationException("allownoweight = false is not supported in TestLibrary with FEATURE_NOPINVOKES");
|
||||
}
|
||||
|
||||
c = Convert.ToChar(iVal);
|
||||
loopCondition = !Char.IsNumber(c);
|
||||
}
|
||||
while (loopCondition && 0 < counter);
|
||||
|
||||
if (!Char.IsNumber(c))
|
||||
{
|
||||
// we tried and failed to get a letter
|
||||
// Grab an ASCII number
|
||||
c = Convert.ToChar(GetInt16() % 10 + '0');
|
||||
}
|
||||
|
||||
TestFramework.LogVerbose("Random Char produced: " + c.ToString());
|
||||
return c;
|
||||
}
|
||||
|
||||
// returns a valid char
|
||||
public static Char GetChar(Int32 new_seed)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetChar();
|
||||
}
|
||||
public static Char GetChar()
|
||||
{
|
||||
return GetChar(true);
|
||||
}
|
||||
|
||||
// returns a valid char
|
||||
//if allowsurrogate is true then surrogates are valid return values
|
||||
public static Char GetChar(Int32 new_seed, bool allowsurrogate)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetChar(allowsurrogate);
|
||||
}
|
||||
public static Char GetChar(bool allowsurrogate)
|
||||
{
|
||||
return GetChar(allowsurrogate, true);
|
||||
}
|
||||
|
||||
// returns a valid char
|
||||
// if allowsurrogate is true then surrogates are valid return values
|
||||
// if allownoweight characters then noweight characters are valid return values
|
||||
public static Char GetChar(Int32 new_seed, bool allowsurrogate, bool allownoweight)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetChar(allowsurrogate, allownoweight);
|
||||
}
|
||||
public static Char GetChar(bool allowsurrogate, bool allownoweight)
|
||||
{
|
||||
Int16 iVal = GetInt16();
|
||||
|
||||
Char c = (char)(iVal);
|
||||
|
||||
if (!Char.IsLetter(c))
|
||||
{
|
||||
// we tried and failed to get a letter
|
||||
// Just grab an ASCII letter
|
||||
// This is a hack but will work for now
|
||||
c = (char)(GetInt16() % 26 + 'A');
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
// if value is no-weight char, return true
|
||||
public static bool NoWeightChar(int value)
|
||||
{
|
||||
if ((int)'a' == value) // 'a' = 97
|
||||
return false;
|
||||
|
||||
String strA = "a" + Convert.ToChar(value);
|
||||
String strB = "a";
|
||||
|
||||
if (0 == GlobLocHelper.OSCompare(CultureInfo.CurrentCulture, strA, 0, 2, strB, 0, 1, CompareOptions.None))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// returns a string. If "validPath" is set, only valid path characters
|
||||
// will be included
|
||||
public static string GetString(Int32 new_seed, Boolean validPath, Int32 minLength, Int32 maxLength)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetString(validPath, minLength, maxLength);
|
||||
}
|
||||
public static string GetString(Boolean validPath, Int32 minLength, Int32 maxLength)
|
||||
{
|
||||
return GetString(validPath, true, true, minLength, maxLength);
|
||||
}
|
||||
|
||||
// several string APIs don't like nulls in them, so this generates a string without nulls
|
||||
public static string GetString(Int32 new_seed, Boolean validPath, Boolean allowNulls, Int32 minLength, Int32 maxLength)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetString(validPath, allowNulls, minLength, maxLength);
|
||||
}
|
||||
public static string GetString(Boolean validPath, Boolean allowNulls, Int32 minLength, Int32 maxLength)
|
||||
{
|
||||
return GetString(validPath, allowNulls, true, minLength, maxLength);
|
||||
}
|
||||
|
||||
// some string operations don't like no-weight characters
|
||||
public static string GetString(Int32 new_seed, Boolean validPath, Boolean allowNulls, Boolean allowNoWeight, Int32 minLength, Int32 maxLength)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetString(validPath, allowNulls, allowNoWeight, minLength, maxLength);
|
||||
}
|
||||
public static string GetString(Boolean validPath, Boolean allowNulls, Boolean allowNoWeight, Int32 minLength, Int32 maxLength)
|
||||
{
|
||||
StringBuilder sVal = new StringBuilder();
|
||||
Char c;
|
||||
Int32 length;
|
||||
|
||||
if (0 == minLength && 0 == maxLength) return String.Empty;
|
||||
if (minLength > maxLength) return null;
|
||||
|
||||
length = minLength;
|
||||
|
||||
if (minLength != maxLength)
|
||||
{
|
||||
length = (GetInt32() % (maxLength - minLength)) + minLength;
|
||||
}
|
||||
|
||||
for (int i = 0; length > i; i++)
|
||||
{
|
||||
if (validPath)
|
||||
{
|
||||
// TODO: Make this smarter
|
||||
if (0 == (GetByte() % 2))
|
||||
{
|
||||
c = GetCharLetter(true, allowNoWeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
c = GetCharNumber(allowNoWeight);
|
||||
}
|
||||
}
|
||||
else if (!allowNulls)
|
||||
{
|
||||
do
|
||||
{
|
||||
c = GetChar(true, allowNoWeight);
|
||||
} while (c == '\u0000');
|
||||
}
|
||||
else
|
||||
{
|
||||
c = GetChar(true, allowNoWeight);
|
||||
}
|
||||
|
||||
sVal.Append(c);
|
||||
}
|
||||
string s = sVal.ToString();
|
||||
|
||||
TestFramework.LogVerbose("Random String produced: " + s);
|
||||
return s;
|
||||
}
|
||||
|
||||
public static string[] GetStrings(Int32 new_seed, Boolean validPath, Int32 minLength, Int32 maxLength)
|
||||
{
|
||||
Seed = new_seed;
|
||||
return GetStrings(validPath, minLength, maxLength);
|
||||
}
|
||||
public static string[] GetStrings(Boolean validPath, Int32 minLength, Int32 maxLength)
|
||||
{
|
||||
string validString;
|
||||
const char c_LATIN_A = '\u0100';
|
||||
const char c_LOWER_A = 'a';
|
||||
const char c_UPPER_A = 'A';
|
||||
const char c_ZERO_WEIGHT = '\uFEFF';
|
||||
const char c_DOUBLE_WIDE_A = '\uFF21';
|
||||
const string c_SURROGATE_UPPER = "\uD801\uDC00";
|
||||
const string c_SURROGATE_LOWER = "\uD801\uDC28";
|
||||
const char c_LOWER_SIGMA1 = (char)0x03C2;
|
||||
const char c_LOWER_SIGMA2 = (char)0x03C3;
|
||||
const char c_UPPER_SIGMA = (char)0x03A3;
|
||||
const char c_SPACE = ' ';
|
||||
int numConsts = 12;
|
||||
string[] retStrings;
|
||||
|
||||
if (2 >= minLength && 2 >= maxLength || minLength > maxLength) return null;
|
||||
|
||||
retStrings = new string[numConsts];
|
||||
|
||||
validString = TestLibrary.Generator.GetString(validPath, minLength - 1, maxLength - 1);
|
||||
retStrings[0] = TestLibrary.Generator.GetString(validPath, minLength, maxLength);
|
||||
retStrings[1] = validString + c_LATIN_A;
|
||||
retStrings[2] = validString + c_LOWER_A;
|
||||
retStrings[3] = validString + c_UPPER_A;
|
||||
retStrings[4] = validString + c_ZERO_WEIGHT;
|
||||
retStrings[5] = validString + c_DOUBLE_WIDE_A;
|
||||
retStrings[6] = TestLibrary.Generator.GetString(validPath, minLength - 2, maxLength - 2) + c_SURROGATE_UPPER;
|
||||
retStrings[7] = TestLibrary.Generator.GetString(validPath, minLength - 2, maxLength - 2) + c_SURROGATE_LOWER;
|
||||
retStrings[8] = validString + c_LOWER_SIGMA1;
|
||||
retStrings[9] = validString + c_LOWER_SIGMA2;
|
||||
retStrings[10] = validString + c_UPPER_SIGMA;
|
||||
retStrings[11] = validString + c_SPACE;
|
||||
|
||||
return retStrings;
|
||||
}
|
||||
|
||||
[SecuritySafeCritical]
|
||||
public static object GetType(Type t)
|
||||
{
|
||||
return Activator.CreateInstance(t);
|
||||
}
|
||||
}
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,131 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
|
||||
namespace TestLibrary
|
||||
{
|
||||
[SecuritySafeCritical]
|
||||
public static class Logging
|
||||
{
|
||||
public static void WriteLine()
|
||||
{
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
public static void WriteLine(bool value)
|
||||
{
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
|
||||
public static void WriteLine(char value)
|
||||
{
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
|
||||
public static void WriteLine(char[] buffer)
|
||||
{
|
||||
Console.WriteLine(buffer);
|
||||
}
|
||||
|
||||
public static void WriteLine(char[] buffer, int index, int count)
|
||||
{
|
||||
Console.WriteLine(new string(buffer, index, count));
|
||||
}
|
||||
|
||||
public static void WriteLine(decimal value)
|
||||
{
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
|
||||
public static void WriteLine(double value)
|
||||
{
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
|
||||
public static void WriteLine(float value)
|
||||
{
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
|
||||
public static void WriteLine(int value)
|
||||
{
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
|
||||
public static void WriteLine(uint value)
|
||||
{
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
|
||||
public static void WriteLine(long value)
|
||||
{
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
|
||||
public static void WriteLine(ulong value)
|
||||
{
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
|
||||
public static void WriteLine(Object value)
|
||||
{
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
|
||||
public static void WriteLine(String value)
|
||||
{
|
||||
Console.WriteLine(value);
|
||||
}
|
||||
|
||||
public static void WriteLine(String format, Object arg0)
|
||||
{
|
||||
Console.WriteLine(format, arg0);
|
||||
}
|
||||
|
||||
public static void WriteLine(String format, Object arg0, Object arg1)
|
||||
{
|
||||
Console.WriteLine(format, arg0, arg1);
|
||||
}
|
||||
|
||||
public static void WriteLine(String format, Object arg0, Object arg1, Object arg2)
|
||||
{
|
||||
Console.WriteLine(format, arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
public static void WriteLine(String format, params Object[] arg)
|
||||
{
|
||||
Console.WriteLine(format, arg);
|
||||
}
|
||||
|
||||
public static void Write(bool value)
|
||||
{
|
||||
Console.Write(value.ToString());
|
||||
}
|
||||
|
||||
public static void Write(char value)
|
||||
{
|
||||
Console.Write(value.ToString());
|
||||
}
|
||||
|
||||
public static void Write(char[] buffer)
|
||||
{
|
||||
Console.Write(buffer.ToString());
|
||||
}
|
||||
|
||||
public static void Write(String value)
|
||||
{
|
||||
Console.Write(value);
|
||||
}
|
||||
|
||||
public static void Write(Object value)
|
||||
{
|
||||
Console.Write(String.Format("{0}", value));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace TestLibrary
|
||||
{
|
||||
public static class TestFramework
|
||||
{
|
||||
public static void LogInformation(string str)
|
||||
{
|
||||
Logging.WriteLine(str);
|
||||
}
|
||||
public static void LogVerbose(string str)
|
||||
{
|
||||
if (Utilities.Verbose) Logging.WriteLine(str);
|
||||
}
|
||||
public static void LogError(string id, string msg)
|
||||
{
|
||||
Logging.WriteLine("ERROR!!!-" + id + ": " + msg);
|
||||
}
|
||||
|
||||
public static void BeginTestCase(string title)
|
||||
{
|
||||
int seed;
|
||||
#if WINCORESYS
|
||||
seed = 20010415;
|
||||
#else
|
||||
Random rand = new Random();
|
||||
|
||||
if (Environment.GetEnvironmentVariable("CORECLR_SEED") != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
seed = int.Parse(Environment.GetEnvironmentVariable("CORECLR_SEED"));
|
||||
}
|
||||
catch (FormatException) { seed = rand.Next(); }
|
||||
}
|
||||
else
|
||||
{
|
||||
seed = rand.Next();
|
||||
}
|
||||
#endif
|
||||
|
||||
Generator.m_rand = new Random(seed);
|
||||
|
||||
Logging.WriteLine("Beginning test case " + title + " at " + DateTime.Now);
|
||||
Logging.WriteLine("Random seed: " + seed + "; set environment variable CORECLR_SEED to this value to repro");
|
||||
Logging.WriteLine();
|
||||
}
|
||||
|
||||
public static bool EndTestCase()
|
||||
{
|
||||
Logging.WriteLine();
|
||||
Logging.WriteLine("Ending test case at " + DateTime.Now);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void BeginScenario(string name)
|
||||
{
|
||||
Logging.WriteLine("Beginning scenario: " + name);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,287 +0,0 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace TestLibrary
|
||||
{
|
||||
public static partial class Utilities
|
||||
{
|
||||
|
||||
static volatile bool verbose;
|
||||
static volatile bool verboseSet = false;
|
||||
const char HIGH_SURROGATE_START = '\ud800';
|
||||
const char HIGH_SURROGATE_END = '\udbff';
|
||||
const char LOW_SURROGATE_START = '\udc00';
|
||||
const char LOW_SURROGATE_END = '\udfff';
|
||||
|
||||
static string sTestDirectory = string.Empty;
|
||||
|
||||
public static string TestDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
return sTestDirectory;
|
||||
}
|
||||
set
|
||||
{
|
||||
sTestDirectory = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Verbose
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!verboseSet)
|
||||
{
|
||||
verboseSet = true;
|
||||
verbose = false;
|
||||
}
|
||||
return (bool)verbose;
|
||||
}
|
||||
set
|
||||
{
|
||||
verbose = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsBigEndian
|
||||
{
|
||||
get
|
||||
{
|
||||
return EndianessChecker.IsBigEndian();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsLittleEndian
|
||||
{
|
||||
get
|
||||
{
|
||||
return EndianessChecker.IsLittleEndian();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsWindows
|
||||
{
|
||||
[SecuritySafeCritical]
|
||||
get
|
||||
{
|
||||
return Path.DirectorySeparatorChar == '\\';
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsVista
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsVistaOrLater
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsWin2K
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsWin7
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsWin7OrLater
|
||||
{
|
||||
get
|
||||
{
|
||||
return true; //Win8P is always win8+
|
||||
}
|
||||
}
|
||||
|
||||
public static bool PlatformSpecificComparer(object Actual, object XPExpected, object VistaExpected, object MACPPCExpected, object MACX86Expected)
|
||||
{
|
||||
if (!IsWindows) return (Actual.Equals(IsBigEndian ? MACPPCExpected : MACX86Expected));
|
||||
if (IsVista) return (Actual.Equals(VistaExpected));
|
||||
return Actual.Equals(XPExpected);
|
||||
}
|
||||
|
||||
// return whether or not the OS is a 64 bit OS
|
||||
public static bool Is64
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IntPtr.Size == 8);
|
||||
}
|
||||
}
|
||||
|
||||
public static string ByteArrayToString(byte[] bytes)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach (byte b in bytes)
|
||||
{
|
||||
sb.Append(b.ToString("x2"));
|
||||
sb.Append(", ");
|
||||
}
|
||||
if (bytes.Length > 0)
|
||||
sb.Remove(sb.Length - 2, 2);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static byte[] TrimBytes(byte[] input)
|
||||
{
|
||||
int outputLength = input.Length;
|
||||
int pos = 0;
|
||||
while (pos < input.Length && input[pos] == 0) { outputLength--; pos++; }
|
||||
int newStart = pos;
|
||||
pos = input.Length - 1;
|
||||
while (input[pos] == 0) { outputLength--; pos--; }
|
||||
|
||||
byte[] output = new byte[outputLength];
|
||||
for (int i = 0; i < outputLength; i++)
|
||||
{
|
||||
output[i] = input[i + newStart];
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public static bool CompareBytes(byte[] arr1, byte[] arr2)
|
||||
{
|
||||
if (arr1 == null) return (arr2 == null);
|
||||
if (arr2 == null) return false;
|
||||
|
||||
if (arr1.Length != arr2.Length) return false;
|
||||
|
||||
for (int i = 0; i < arr1.Length; i++) if (arr1[i] != arr2[i]) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CompareChars(char[] arr1, char[] arr2)
|
||||
{
|
||||
if (arr1 == null) return (arr2 == null);
|
||||
if (arr2 == null) return false;
|
||||
|
||||
if (arr1.Length != arr2.Length) return false;
|
||||
|
||||
for (int i = 0; i < arr1.Length; i++) if (arr1[i] != arr2[i]) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Given a string, display the unicode characters in hex format, optionally displaying each
|
||||
// characters unicode category
|
||||
public static string FormatHexStringFromUnicodeString(string string1, bool includeUnicodeCategory)
|
||||
{
|
||||
string returnString = "";
|
||||
if (null == string1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (char x in string1)
|
||||
{
|
||||
string tempString = FormatHexStringFromUnicodeChar(x, includeUnicodeCategory);
|
||||
if (!returnString.Equals("") && !includeUnicodeCategory)
|
||||
{
|
||||
returnString = returnString + " " + tempString;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnString += tempString;
|
||||
}
|
||||
}
|
||||
|
||||
return returnString;
|
||||
}
|
||||
|
||||
// Given a character, display its unicode value in hex format. ProjectN doens't support
|
||||
// unicode category as a Property on Char.
|
||||
public static string FormatHexStringFromUnicodeChar(char char1, bool includeUnicodeCategory)
|
||||
{
|
||||
if (includeUnicodeCategory)
|
||||
throw new Exception("Win8P does not support Char.UnicodeCategory");
|
||||
|
||||
return ((int)char1).ToString("X4");
|
||||
}
|
||||
|
||||
public static bool IsHighSurrogate(char c)
|
||||
{
|
||||
return ((c >= HIGH_SURROGATE_START) && (c <= HIGH_SURROGATE_END));
|
||||
}
|
||||
public static bool IsLowSurrogate(char c)
|
||||
{
|
||||
return ((c >= LOW_SURROGATE_START) && (c <= LOW_SURROGATE_END));
|
||||
}
|
||||
|
||||
public static bool CompareCurrentCulture(String culture)
|
||||
{
|
||||
return (String.Compare(System.Globalization.CultureInfo.CurrentCulture.Name, culture, StringComparison.CurrentCultureIgnoreCase) == 0);
|
||||
}
|
||||
public static CultureInfo CurrentCulture
|
||||
{
|
||||
get { return System.Globalization.CultureInfo.CurrentCulture; }
|
||||
set
|
||||
{
|
||||
System.Globalization.CultureInfo.DefaultThreadCurrentCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class HelperExtensions {
|
||||
public static bool IsAssignableFrom(this Type t1, Type t2) {
|
||||
return t1.GetTypeInfo().IsAssignableFrom(t2.GetTypeInfo());
|
||||
}
|
||||
|
||||
public static String ToLongDateString(this DateTime dt)
|
||||
{
|
||||
return String.Format("{0:D}", dt);
|
||||
}
|
||||
|
||||
public static String ToLongTimeString(this DateTime dt)
|
||||
{
|
||||
return String.Format("{0:T}", dt);
|
||||
}
|
||||
|
||||
|
||||
public static String ToShortDateString(this DateTime dt)
|
||||
{
|
||||
return String.Format("{0:d}", dt);
|
||||
}
|
||||
|
||||
public static String ToShortTimeString(this DateTime dt)
|
||||
{
|
||||
return String.Format("{0:t}", dt);
|
||||
}
|
||||
|
||||
public static UnicodeCategory GetUnicodeCategory(this Char c)
|
||||
{
|
||||
return CharUnicodeInfo.GetUnicodeCategory(c);
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<!-- dir.common.props was deliberately created so that Desktop and .Net Core can share most of the properties do not change it to dir.props-->
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.common.props))\dir.common.props" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{5259DD45-EA34-4EE7-B5C5-430B80384544}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Coreclr.TestWrapper</RootNamespace>
|
||||
<AssemblyName>Coreclr.TestWrapper</AssemblyName>
|
||||
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<SkipSigning>true</SkipSigning>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<CLRTestKind>BuildOnly</CLRTestKind>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>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>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ProjectJson></ProjectJson>
|
||||
<ProjectLockJson></ProjectLockJson>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="mscorlib" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Coreclr.TestWrapper\CoreclrTestWrapperLib.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
Загрузка…
Ссылка в новой задаче