Add crossgen tests
Simple tests which does static analysis of managed assemblies metadata to make sure that they are crossgened. Currently it verifies that all the assemblies in CLI SDK and SharedFx directroty are crossgened.
This commit is contained in:
parent
4f1dbeba0e
commit
b567bc82c3
5 changed files with 141 additions and 0 deletions
|
@ -11,6 +11,19 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
{
|
||||
public static class PeReaderUtils
|
||||
{
|
||||
public static bool IsCrossgened(this PEReader peReader)
|
||||
{
|
||||
bool isCrossgened = false;
|
||||
|
||||
if (peReader.HasMetadata)
|
||||
{
|
||||
// 4 is the magic numbers that is set in the CLR header's flags when crossgened.
|
||||
isCrossgened = (int)peReader.PEHeaders.CorHeader.Flags == 4;
|
||||
}
|
||||
|
||||
return isCrossgened;
|
||||
}
|
||||
|
||||
public static string GetAssemblyAttributeValue(string assemblyPath, string attributeName)
|
||||
{
|
||||
if (!File.Exists(assemblyPath))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue