Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
af82a715
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
af82a715
编写于
10月 06, 2018
作者:
J
Jared Parsons
提交者:
GitHub
10月 06, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #30311 from jaredpar/fix-cl
Enable C# CommandLine and WinRT tests on Linux
上级
87018e59
dac095e7
变更
20
展开全部
隐藏空白更改
内联
并排
Showing
20 changed file
with
909 addition
and
1081 deletion
+909
-1081
build/scripts/tests.sh
build/scripts/tests.sh
+0
-5
src/Compilers/CSharp/Test/CommandLine/CommandLineTestBase.cs
src/Compilers/CSharp/Test/CommandLine/CommandLineTestBase.cs
+63
-0
src/Compilers/CSharp/Test/CommandLine/CommandLineTestResources.Designer.cs
...arp/Test/CommandLine/CommandLineTestResources.Designer.cs
+0
-73
src/Compilers/CSharp/Test/CommandLine/CommandLineTestResources.resx
...ers/CSharp/Test/CommandLine/CommandLineTestResources.resx
+0
-124
src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
+779
-793
src/Compilers/CSharp/Test/CommandLine/ErrorLoggerTests.cs
src/Compilers/CSharp/Test/CommandLine/ErrorLoggerTests.cs
+11
-14
src/Compilers/CSharp/Test/CommandLine/Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj
...icrosoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj
+7
-22
src/Compilers/CSharp/Test/CommandLine/TouchedFileLoggingTests.cs
...pilers/CSharp/Test/CommandLine/TouchedFileLoggingTests.cs
+5
-6
src/Compilers/CSharp/Test/Emit/Resources.Designer.cs
src/Compilers/CSharp/Test/Emit/Resources.Designer.cs
+2
-2
src/Compilers/CSharp/Test/WinRT/Metadata/WinMdMetadataTests.cs
...ompilers/CSharp/Test/WinRT/Metadata/WinMdMetadataTests.cs
+1
-1
src/Compilers/CSharp/Test/WinRT/Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests.csproj
...inRT/Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests.csproj
+3
-7
src/Compilers/CSharp/Test/WinRT/PEParameterSymbolTests.cs
src/Compilers/CSharp/Test/WinRT/PEParameterSymbolTests.cs
+3
-2
src/Compilers/CSharp/Test/WinRT/PdbTests.cs
src/Compilers/CSharp/Test/WinRT/PdbTests.cs
+1
-1
src/Compilers/Test/Resources/Core/ResourceLoader.cs
src/Compilers/Test/Resources/Core/ResourceLoader.cs
+13
-8
src/Compilers/Test/Utilities/CSharp/MockCSharpCompiler.cs
src/Compilers/Test/Utilities/CSharp/MockCSharpCompiler.cs
+6
-16
src/Compilers/Test/Utilities/VisualBasic/MockVisualBasicCompiler.vb
...ers/Test/Utilities/VisualBasic/MockVisualBasicCompiler.vb
+1
-1
src/Test/Utilities/Portable/Compilation/RuntimeUtilities.cs
src/Test/Utilities/Portable/Compilation/RuntimeUtilities.cs
+8
-4
src/Test/Utilities/Portable/Roslyn.Test.Utilities.csproj
src/Test/Utilities/Portable/Roslyn.Test.Utilities.csproj
+1
-0
src/Tools/BuildBoss/Program.cs
src/Tools/BuildBoss/Program.cs
+3
-1
src/Tools/BuildBoss/ProjectCheckerUtil.cs
src/Tools/BuildBoss/ProjectCheckerUtil.cs
+2
-1
未找到文件。
build/scripts/tests.sh
浏览文件 @
af82a715
...
...
@@ -51,14 +51,9 @@ elif [[ "${runtime}" =~ ^(mono|mono-debug)$ ]]; then
'Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests.dll'
# PortablePdb and lots of other problems
'Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests.dll'
# GetSystemInfo is missing, and other problems
# See https://github.com/mono/mono/issues/10678
'Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests.dll'
# Many test failures
'Microsoft.CodeAnalysis.UnitTests.dll'
# Multiple test failures
'Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.dll'
# Multiple test failures
'Microsoft.Build.Tasks.CodeAnalysis.UnitTests.dll'
# Disabling on assumption
'Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests.dll'
...
...
src/Compilers/CSharp/Test/CommandLine/CommandLineTestBase.cs
0 → 100644
浏览文件 @
af82a715
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Immutable
;
using
System.IO
;
using
System.Linq
;
using
System.Runtime.InteropServices
;
using
System.Text
;
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis.CSharp.Test.Utilities
;
using
Microsoft.CodeAnalysis.Diagnostics
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
Roslyn.Test.Utilities
;
using
Xunit
;
namespace
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests
{
public
abstract
class
CommandLineTestBase
:
CSharpTestBase
{
public
string
WorkingDirectory
{
get
;
}
public
string
SdkDirectory
{
get
;
}
public
string
MscorlibFullPath
{
get
;
}
public
CommandLineTestBase
()
{
WorkingDirectory
=
TempRoot
.
Root
;
SdkDirectory
=
getSdkDirectory
(
Temp
);
MscorlibFullPath
=
Path
.
Combine
(
SdkDirectory
,
"mscorlib.dll"
);
// This will return a directory which contains mscorlib for use in the compiler instances created for
// this set of tests
string
getSdkDirectory
(
TempRoot
temp
)
{
if
(
ExecutionConditionUtil
.
IsCoreClr
)
{
var
dir
=
temp
.
CreateDirectory
();
File
.
WriteAllBytes
(
Path
.
Combine
(
dir
.
Path
,
"mscorlib.dll"
),
TestResources
.
NetFX
.
net461
.
mscorlib
);
return
dir
.
Path
;
}
return
RuntimeEnvironment
.
GetRuntimeDirectory
();
}
}
internal
CSharpCommandLineArguments
DefaultParse
(
IEnumerable
<
string
>
args
,
string
baseDirectory
,
string
sdkDirectory
=
null
,
string
additionalReferenceDirectories
=
null
)
{
sdkDirectory
=
sdkDirectory
??
SdkDirectory
;
return
CSharpCommandLineParser
.
Default
.
Parse
(
args
,
baseDirectory
,
sdkDirectory
,
additionalReferenceDirectories
);
}
internal
MockCSharpCompiler
CreateCSharpCompiler
(
string
[]
args
,
ImmutableArray
<
DiagnosticAnalyzer
>
analyzers
=
default
,
AnalyzerAssemblyLoader
loader
=
null
)
{
return
CreateCSharpCompiler
(
null
,
WorkingDirectory
,
args
,
analyzers
,
loader
);
}
internal
MockCSharpCompiler
CreateCSharpCompiler
(
string
responseFile
,
string
workingDirectory
,
string
[]
args
,
ImmutableArray
<
DiagnosticAnalyzer
>
analyzers
=
default
,
AnalyzerAssemblyLoader
loader
=
null
)
{
var
buildPaths
=
RuntimeUtilities
.
CreateBuildPaths
(
workingDirectory
,
sdkDirectory
:
SdkDirectory
);
return
new
MockCSharpCompiler
(
responseFile
,
buildPaths
,
args
,
analyzers
,
loader
);
}
}
}
src/Compilers/CSharp/Test/CommandLine/CommandLineTestResources.Designer.cs
已删除
100644 → 0
浏览文件 @
87018e59
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests
{
using
System
;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"System.Resources.Tools.StronglyTypedResourceBuilder"
,
"4.0.0.0"
)]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
internal
class
CommandLineTestResources
{
private
static
global
::
System
.
Resources
.
ResourceManager
resourceMan
;
private
static
global
::
System
.
Globalization
.
CultureInfo
resourceCulture
;
[
global
::
System
.
Diagnostics
.
CodeAnalysis
.
SuppressMessageAttribute
(
"Microsoft.Performance"
,
"CA1811:AvoidUncalledPrivateCode"
)]
internal
CommandLineTestResources
()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[
global
::
System
.
ComponentModel
.
EditorBrowsableAttribute
(
global
::
System
.
ComponentModel
.
EditorBrowsableState
.
Advanced
)]
internal
static
global
::
System
.
Resources
.
ResourceManager
ResourceManager
{
get
{
if
(
object
.
ReferenceEquals
(
resourceMan
,
null
))
{
global
::
System
.
Resources
.
ResourceManager
temp
=
new
global
::
System
.
Resources
.
ResourceManager
(
"Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.CommandLineTestResources"
,
typeof
(
CommandLineTestResources
).
Assembly
);
resourceMan
=
temp
;
}
return
resourceMan
;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[
global
::
System
.
ComponentModel
.
EditorBrowsableAttribute
(
global
::
System
.
ComponentModel
.
EditorBrowsableState
.
Advanced
)]
internal
static
global
::
System
.
Globalization
.
CultureInfo
Culture
{
get
{
return
resourceCulture
;
}
set
{
resourceCulture
=
value
;
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal
static
byte
[]
csc_rsp
{
get
{
object
obj
=
ResourceManager
.
GetObject
(
"csc_rsp"
,
resourceCulture
);
return
((
byte
[])(
obj
));
}
}
}
}
src/Compilers/CSharp/Test/CommandLine/CommandLineTestResources.resx
已删除
100644 → 0
浏览文件 @
87018e59
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema
id=
"root"
xmlns=
""
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:msdata=
"urn:schemas-microsoft-com:xml-msdata"
>
<xsd:import
namespace=
"http://www.w3.org/XML/1998/namespace"
/>
<xsd:element
name=
"root"
msdata:IsDataSet=
"true"
>
<xsd:complexType>
<xsd:choice
maxOccurs=
"unbounded"
>
<xsd:element
name=
"metadata"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
use=
"required"
type=
"xsd:string"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
/>
<xsd:attribute
ref=
"xml:space"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"assembly"
>
<xsd:complexType>
<xsd:attribute
name=
"alias"
type=
"xsd:string"
/>
<xsd:attribute
name=
"name"
type=
"xsd:string"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"data"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
<xsd:element
name=
"comment"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"2"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
use=
"required"
msdata:Ordinal=
"1"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
msdata:Ordinal=
"3"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
msdata:Ordinal=
"4"
/>
<xsd:attribute
ref=
"xml:space"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"resheader"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
use=
"required"
/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader
name=
"resmimetype"
>
<value>
text/microsoft-resx
</value>
</resheader>
<resheader
name=
"version"
>
<value>
2.0
</value>
</resheader>
<resheader
name=
"reader"
>
<value>
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader
name=
"writer"
>
<value>
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<assembly
alias=
"System.Windows.Forms"
name=
"System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
/>
<data
name=
"csc_rsp"
type=
"System.Resources.ResXFileRef, System.Windows.Forms"
>
<value>
../../csc/csc.rsp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</data>
</root>
src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
浏览文件 @
af82a715
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Test/CommandLine/ErrorLoggerTests.cs
浏览文件 @
af82a715
...
...
@@ -8,6 +8,7 @@
using
Microsoft.CodeAnalysis.CSharp.Test.Utilities
;
using
Microsoft.CodeAnalysis.Diagnostics
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
Roslyn.Test.Utilities
;
using
Xunit
;
using
static
Microsoft
.
CodeAnalysis
.
CommonDiagnosticAnalyzers
;
...
...
@@ -16,11 +17,9 @@
namespace
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests
{
public
class
ErrorLoggerTests
:
C
Sharp
TestBase
public
class
ErrorLoggerTests
:
C
ommandLine
TestBase
{
private
readonly
string
_baseDirectory
=
TempRoot
.
Root
;
[
Fact
]
[
ConditionalFact
(
typeof
(
WindowsOnly
),
Reason
=
"https://github.com/dotnet/roslyn/issues/30289"
)]
public
void
NoDiagnostics
()
{
var
helloWorldCS
=
@"using System;
...
...
@@ -36,8 +35,7 @@ public static void Main(string[] args)
var
errorLogDir
=
Temp
.
CreateDirectory
();
var
errorLogFile
=
Path
.
Combine
(
errorLogDir
.
Path
,
"ErrorLog.txt"
);
var
cmd
=
new
MockCSharpCompiler
(
null
,
_baseDirectory
,
new
[]
{
"/nologo"
,
hello
,
$"/errorlog:
{
errorLogFile
}
"
});
var
cmd
=
CreateCSharpCompiler
(
new
[]
{
"/nologo"
,
hello
,
$"/errorlog:
{
errorLogFile
}
"
});
var
outWriter
=
new
StringWriter
(
CultureInfo
.
InvariantCulture
);
var
exitCode
=
cmd
.
Run
(
outWriter
);
...
...
@@ -61,7 +59,7 @@ public static void Main(string[] args)
CleanupAllGeneratedFiles
(
errorLogFile
);
}
[
Fact
]
[
ConditionalFact
(
typeof
(
WindowsOnly
),
Reason
=
"https://github.com/dotnet/roslyn/issues/30289"
)
]
public
void
SimpleCompilerDiagnostics
()
{
var
source
=
@"
...
...
@@ -73,7 +71,7 @@ public class C
var
errorLogDir
=
Temp
.
CreateDirectory
();
var
errorLogFile
=
Path
.
Combine
(
errorLogDir
.
Path
,
"ErrorLog.txt"
);
var
cmd
=
new
MockCSharpCompiler
(
null
,
_base
Directory
,
new
[]
{
var
cmd
=
CreateCSharpCompiler
(
null
,
Working
Directory
,
new
[]
{
"/nologo"
,
sourceFile
,
"/preferreduilang:en"
,
$"/errorlog:
{
errorLogFile
}
"
});
var
outWriter
=
new
StringWriter
(
CultureInfo
.
InvariantCulture
);
...
...
@@ -155,7 +153,7 @@ public class C
CleanupAllGeneratedFiles
(
errorLogFile
);
}
[
Fact
]
[
ConditionalFact
(
typeof
(
WindowsOnly
),
Reason
=
"https://github.com/dotnet/roslyn/issues/30289"
)
]
public
void
SimpleCompilerDiagnostics_Suppressed
()
{
var
source
=
@"
...
...
@@ -169,7 +167,7 @@ public class C
var
errorLogDir
=
Temp
.
CreateDirectory
();
var
errorLogFile
=
Path
.
Combine
(
errorLogDir
.
Path
,
"ErrorLog.txt"
);
var
cmd
=
new
MockCSharpCompiler
(
null
,
_base
Directory
,
new
[]
{
var
cmd
=
CreateCSharpCompiler
(
null
,
Working
Directory
,
new
[]
{
"/nologo"
,
sourceFile
,
"/preferreduilang:en"
,
$"/errorlog:
{
errorLogFile
}
"
});
var
outWriter
=
new
StringWriter
(
CultureInfo
.
InvariantCulture
);
...
...
@@ -255,7 +253,7 @@ public class C
CleanupAllGeneratedFiles
(
errorLogFile
);
}
[
Fact
]
[
ConditionalFact
(
typeof
(
WindowsOnly
),
Reason
=
"https://github.com/dotnet/roslyn/issues/30289"
)
]
public
void
AnalyzerDiagnosticsWithAndWithoutLocation
()
{
var
source
=
@"
...
...
@@ -267,10 +265,9 @@ public class C
var
errorLogFile
=
Path
.
Combine
(
outputDir
.
Path
,
"ErrorLog.txt"
);
var
outputFilePath
=
Path
.
Combine
(
outputDir
.
Path
,
"test.dll"
);
var
cmd
=
new
MockCSharpCompiler
(
null
,
_base
Directory
,
new
[]
{
var
cmd
=
CreateCSharpCompiler
(
null
,
Working
Directory
,
new
[]
{
"/nologo"
,
"/t:library"
,
$"/out:
{
outputFilePath
}
"
,
sourceFile
,
"/preferreduilang:en"
,
$"/errorlog:
{
errorLogFile
}
"
},
analyzers
:
ImmutableArray
.
Create
<
DiagnosticAnalyzer
>(
new
AnalyzerForErrorLogTest
()),
loader
:
new
DesktopAnalyzerAssemblyLoader
());
analyzers
:
ImmutableArray
.
Create
<
DiagnosticAnalyzer
>(
new
AnalyzerForErrorLogTest
()));
var
outWriter
=
new
StringWriter
(
CultureInfo
.
InvariantCulture
);
...
...
src/Compilers/CSharp/Test/CommandLine/Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj
浏览文件 @
af82a715
...
...
@@ -6,11 +6,13 @@
<PlatformTarget>
AnyCPU
</PlatformTarget>
<OutputType>
Library
</OutputType>
<RootNamespace>
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests
</RootNamespace>
<TargetFramework>
net46
</TargetFramework>
<RuntimeIdentifier>
$(RoslynDesktopRuntimeIdentifier)
</RuntimeIdentifier>
<RoslynProjectType>
UnitTest
</RoslynProjectType>
<TargetFrameworks>
$(RoslynPortableTargetFrameworks)
</TargetFrameworks>
<RoslynProjectType>
UnitTestPortable
</RoslynProjectType>
<GenerateMicrosoftCodeAnalysisCommitHashAttribute>
true
</GenerateMicrosoftCodeAnalysisCommitHashAttribute>
</PropertyGroup>
<ItemGroup>
<Compile
Include=
"..\..\..\Test\Resources\Core\ResourceLoader.cs"
Link=
"ResourceLoader.cs"
/>
</ItemGroup>
<ItemGroup
Label=
"Project References"
>
<ProjectReference
Include=
"..\..\..\..\Test\Utilities\Portable\Roslyn.Test.Utilities.csproj"
/>
<ProjectReference
Include=
"..\..\..\Test\Utilities\CSharp\Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj"
/>
...
...
@@ -24,26 +26,9 @@
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"
/>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"
/>
<ItemGroup>
<Reference
Include=
"Microsoft.CSharp"
/>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Configuration"
/>
<Reference
Include=
"System.Xml"
/>
<Reference
Include=
"System.Xml.Linq"
/>
</ItemGroup>
<ItemGroup>
<Compile
Update=
"CommandLineTestResources.Designer.cs"
>
<AutoGen>
True
</AutoGen>
<DesignTime>
True
</DesignTime>
<DependentUpon>
CommandLineTestResources.resx
</DependentUpon>
</Compile>
<EmbeddedResource
Include=
"..\..\csc\csc.rsp"
LogicalName=
"csc.rsp"
/>
</ItemGroup>
<ItemGroup>
<Service
Include=
"{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}"
/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource
Update=
"CommandLineTestResources.resx"
>
<Generator>
ResXFileCodeGenerator
</Generator>
<LastGenOutput>
CommandLineTestResources.Designer.cs
</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>
\ No newline at end of file
</Project>
src/Compilers/CSharp/Test/CommandLine/TouchedFileLoggingTests.cs
浏览文件 @
af82a715
...
...
@@ -15,10 +15,9 @@
namespace
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests
{
public
class
TouchedFileLoggingTests
:
C
Sharp
TestBase
public
class
TouchedFileLoggingTests
:
C
ommandLine
TestBase
{
private
static
readonly
string
s_libDirectory
=
Environment
.
GetEnvironmentVariable
(
"LIB"
);
private
readonly
string
_baseDirectory
=
TempRoot
.
Root
;
private
const
string
helloWorldCS
=
@"using System;
class C
...
...
@@ -36,7 +35,7 @@ public void TrivialSourceFileOnlyCsc()
var
touchedDir
=
Temp
.
CreateDirectory
();
var
touchedBase
=
Path
.
Combine
(
touchedDir
.
Path
,
"touched"
);
var
cmd
=
new
MockCSharpCompiler
(
null
,
_baseDirectory
,
new
[]
{
"/nologo"
,
hello
,
var
cmd
=
CreateCSharpCompiler
(
new
[]
{
"/nologo"
,
hello
,
string
.
Format
(
@"/touchedfiles:""{0}"""
,
touchedBase
)
});
var
outWriter
=
new
StringWriter
(
CultureInfo
.
InvariantCulture
);
...
...
@@ -77,7 +76,7 @@ public void AppConfigCsc()
var
net4_0dll
=
Temp
.
CreateFile
().
WriteAllBytes
(
TestResources
.
NetFX
.
v4_0_30319
.
System
).
Path
;
var
outWriter
=
new
StringWriter
(
CultureInfo
.
InvariantCulture
);
var
cmd
=
new
MockCSharpCompiler
(
null
,
_baseDirectory
,
var
cmd
=
CreateCSharpCompiler
(
new
[]
{
"/nologo"
,
"/r:"
+
silverlight
,
"/r:"
+
net4_0dll
,
...
...
@@ -112,7 +111,7 @@ public void StrongNameKeyCsc()
var
touchedBase
=
Path
.
Combine
(
touchedDir
.
Path
,
"touched"
);
var
outWriter
=
new
StringWriter
(
CultureInfo
.
InvariantCulture
);
var
cmd
=
new
MockCSharpCompiler
(
null
,
_baseDirectory
,
var
cmd
=
CreateCSharpCompiler
(
new
[]
{
"/nologo"
,
"/touchedfiles:"
+
touchedBase
,
"/keyfile:"
+
snkPath
,
...
...
@@ -150,7 +149,7 @@ public class C { }").Path;
var
touchedDir
=
Temp
.
CreateDirectory
();
var
touchedBase
=
Path
.
Combine
(
touchedDir
.
Path
,
"touched"
);
var
cmd
=
new
MockCSharpCompiler
(
null
,
_baseDirectory
,
new
[]
var
cmd
=
CreateCSharpCompiler
(
new
[]
{
"/nologo"
,
"/target:library"
,
...
...
src/Compilers/CSharp/Test/Emit/Resources.Designer.cs
浏览文件 @
af82a715
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.
1801
0
// Runtime Version:4.0.30319.
4200
0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
...
...
@@ -19,7 +19,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"System.Resources.Tools.StronglyTypedResourceBuilder"
,
"
4
.0.0.0"
)]
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"System.Resources.Tools.StronglyTypedResourceBuilder"
,
"
15
.0.0.0"
)]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
internal
class
Resources
{
...
...
src/Compilers/CSharp/Test/WinRT/Metadata/WinMdMetadataTests.cs
浏览文件 @
af82a715
...
...
@@ -140,7 +140,7 @@ public void WinMdColorType()
/// Ensure that a simple program that uses projected types can compile
/// and run.
/// </summary>
[
ConditionalFact
(
typeof
(
OSVersionWin8
)
)]
[
ConditionalFact
(
typeof
(
WindowsDesktopOnly
),
Reason
=
ConditionalSkipReason
.
TestExecutionNeedsDesktopTypes
)]
public
void
WinMdColorTest
()
{
var
text
=
@"using Windows.UI;
...
...
src/Compilers/CSharp/Test/WinRT/Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests.csproj
浏览文件 @
af82a715
...
...
@@ -6,9 +6,8 @@
<PlatformTarget>
AnyCPU
</PlatformTarget>
<OutputType>
Library
</OutputType>
<RootNamespace>
Microsoft.CodeAnalysis.CSharp.UnitTests.CodeGen
</RootNamespace>
<TargetFramework>
net46
</TargetFramework>
<RuntimeIdentifier>
$(RoslynDesktopRuntimeIdentifier)
</RuntimeIdentifier>
<RoslynProjectType>
UnitTest
</RoslynProjectType>
<TargetFrameworks>
$(RoslynPortableTargetFrameworks)
</TargetFrameworks>
<RoslynProjectType>
UnitTestPortable
</RoslynProjectType>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"
/>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"
/>
...
...
@@ -21,10 +20,7 @@
<ProjectReference
Include=
"..\..\..\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.vbproj"
/>
<ProjectReference
Include=
"..\..\..\..\Test\PdbUtilities\Roslyn.Test.PdbUtilities.csproj"
/>
</ItemGroup>
<ItemGroup>
<Reference
Include=
"System.Xml.Linq"
/>
</ItemGroup>
<ItemGroup>
<Service
Include=
"{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}"
/>
</ItemGroup>
</Project>
\ No newline at end of file
</Project>
src/Compilers/CSharp/Test/WinRT/PEParameterSymbolTests.cs
浏览文件 @
af82a715
...
...
@@ -6,13 +6,13 @@
using
Microsoft.CodeAnalysis.CSharp.Test.Utilities
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
Roslyn.Test.Utilities
;
using
Roslyn.Test.Utilities.Desktop
;
using
Xunit
;
namespace
Microsoft.CodeAnalysis.CSharp.UnitTests.Symbols
{
public
class
PEParameterSymbolTests
:
CSharpTestBase
{
#if !NETCOREAPP2_1
[
Fact
]
public
void
NoParameterNames
()
{
...
...
@@ -21,7 +21,7 @@ public void NoParameterNames()
// {
// void M(object, object);
// }
var
reference
=
DesktopRuntimeUtil
.
CreateReflectionEmitAssembly
(
moduleBuilder
=>
var
reference
=
Roslyn
.
Test
.
Utilities
.
Desktop
.
DesktopRuntimeUtil
.
CreateReflectionEmitAssembly
(
moduleBuilder
=>
{
var
typeBuilder
=
moduleBuilder
.
DefineType
(
"I"
,
...
...
@@ -48,6 +48,7 @@ static void M(I o)
// (5,16): error CS1744: Named argument 'value' specifies a parameter for which a positional argument has already been given
Diagnostic
(
ErrorCode
.
ERR_NamedArgumentUsedInPositional
,
"value"
).
WithArguments
(
"value"
).
WithLocation
(
5
,
16
));
}
#endif
[
Fact
]
[
WorkItem
(
8018
,
"https://github.com/dotnet/roslyn/issues/8018"
)]
...
...
src/Compilers/CSharp/Test/WinRT/PdbTests.cs
浏览文件 @
af82a715
...
...
@@ -74,7 +74,7 @@ public void EmitToBoundedStreams()
r
.
Diagnostics
.
Verify
();
}
[
C
lrOnlyFact
(
ClrOnlyReason
.
Pdb
)]
[
C
onditionalFact
(
typeof
(
WindowsOnly
),
Reason
=
ConditionalSkipReason
.
NativePdbRequiresDesktop
)]
public
void
EmitToStreamWithNonZeroPosition
()
{
var
pdbStream
=
new
MemoryStream
();
...
...
src/Compilers/Test/Resources/Core/ResourceLoader.cs
浏览文件 @
af82a715
...
...
@@ -22,7 +22,7 @@ private static Stream GetResourceStream(string name)
return
stream
;
}
p
rivate
static
byte
[]
GetResourceBlob
(
string
name
)
p
ublic
static
byte
[]
GetResourceBlob
(
string
name
)
{
using
(
var
stream
=
GetResourceStream
(
name
))
{
...
...
@@ -50,16 +50,21 @@ public static string GetOrCreateResource(ref string resource, string name)
{
if
(
resource
==
null
)
{
using
(
var
stream
=
GetResourceStream
(
name
))
{
using
(
var
streamReader
=
new
StreamReader
(
stream
,
Encoding
.
UTF8
,
detectEncodingFromByteOrderMarks
:
true
))
{
resource
=
streamReader
.
ReadToEnd
();
}
}
resource
=
GetResource
(
name
);
}
return
resource
;
}
public
static
string
GetResource
(
string
name
)
{
using
(
var
stream
=
GetResourceStream
(
name
))
{
using
(
var
streamReader
=
new
StreamReader
(
stream
,
Encoding
.
UTF8
,
detectEncodingFromByteOrderMarks
:
true
))
{
return
streamReader
.
ReadToEnd
();
}
}
}
}
}
src/Compilers/Test/Utilities/CSharp/MockCSharpCompiler.cs
浏览文件 @
af82a715
...
...
@@ -12,31 +12,21 @@ namespace Microsoft.CodeAnalysis.CSharp.Test.Utilities
{
internal
class
MockCSharpCompiler
:
CSharpCompiler
{
pr
otected
readonly
ImmutableArray
<
DiagnosticAnalyzer
>
_analyzers
;
pr
ivate
readonly
ImmutableArray
<
DiagnosticAnalyzer
>
_analyzers
;
internal
Compilation
Compilation
;
public
MockCSharpCompiler
(
string
responseFile
,
string
baseDirectory
,
string
[]
args
)
:
this
(
responseFile
,
baseDirectory
,
args
,
ImmutableArray
<
DiagnosticAnalyzer
>.
Empty
,
RuntimeUtilities
.
CreateAnalyzerAssemblyLoader
())
{
}
public
MockCSharpCompiler
(
string
responseFile
,
BuildPaths
buildPaths
,
string
[]
args
)
:
this
(
responseFile
,
buildPaths
,
args
,
ImmutableArray
<
DiagnosticAnalyzer
>.
Empty
,
RuntimeUtilities
.
CreateAnalyzerAssemblyLoader
())
{
}
public
MockCSharpCompiler
(
string
responseFile
,
string
workingDirectory
,
string
[]
args
,
ImmutableArray
<
DiagnosticAnalyzer
>
analyzers
,
AnalyzerAssemblyLoader
loader
)
public
MockCSharpCompiler
(
string
responseFile
,
string
workingDirectory
,
string
[]
args
,
ImmutableArray
<
DiagnosticAnalyzer
>
analyzers
=
default
,
AnalyzerAssemblyLoader
loader
=
null
)
:
this
(
responseFile
,
CreateBuildPaths
(
workingDirectory
),
args
,
analyzers
,
loader
)
{
}
public
MockCSharpCompiler
(
string
responseFile
,
BuildPaths
buildPaths
,
string
[]
args
,
ImmutableArray
<
DiagnosticAnalyzer
>
analyzers
,
AnalyzerAssemblyLoader
loader
)
:
base
(
CSharpCommandLineParser
.
Default
,
responseFile
,
args
,
buildPaths
,
Environment
.
GetEnvironmentVariable
(
"LIB"
),
loader
)
public
MockCSharpCompiler
(
string
responseFile
,
BuildPaths
buildPaths
,
string
[]
args
,
ImmutableArray
<
DiagnosticAnalyzer
>
analyzers
=
default
,
AnalyzerAssemblyLoader
loader
=
null
)
:
base
(
CSharpCommandLineParser
.
Default
,
responseFile
,
args
,
buildPaths
,
Environment
.
GetEnvironmentVariable
(
"LIB"
),
loader
??
RuntimeUtilities
.
CreateAnalyzerAssemblyLoader
()
)
{
_analyzers
=
analyzers
;
_analyzers
=
analyzers
.
NullToEmpty
()
;
}
private
static
BuildPaths
CreateBuildPaths
(
string
workingDirectory
)
=>
RuntimeUtilities
.
CreateBuildPaths
(
working
Directory
);
private
static
BuildPaths
CreateBuildPaths
(
string
workingDirectory
,
string
sdkDirectory
=
null
)
=>
RuntimeUtilities
.
CreateBuildPaths
(
workingDirectory
,
sdk
Directory
);
protected
override
ImmutableArray
<
DiagnosticAnalyzer
>
ResolveAnalyzersFromArguments
(
List
<
DiagnosticInfo
>
diagnostics
,
...
...
src/Compilers/Test/Utilities/VisualBasic/MockVisualBasicCompiler.vb
浏览文件 @
af82a715
...
...
@@ -35,7 +35,7 @@ Friend Class MockVisualBasicCompiler
End
Sub
Private
Shared
Function
CreateBuildPaths
(
workingDirectory
As
String
,
tempDirectory
As
String
)
As
BuildPaths
Return
RuntimeUtilities
.
CreateBuildPaths
(
workingDirectory
,
tempDirectory
)
Return
RuntimeUtilities
.
CreateBuildPaths
(
workingDirectory
,
tempDirectory
:
=
tempDirectory
)
End
Function
Protected
Overrides
Function
ResolveAnalyzersFromArguments
(
...
...
src/Test/Utilities/Portable/Compilation/RuntimeUtilities.cs
浏览文件 @
af82a715
...
...
@@ -13,20 +13,20 @@ namespace Microsoft.CodeAnalysis.Test.Utilities
/// </summary>
public
static
partial
class
RuntimeUtilities
{
internal
static
BuildPaths
CreateBuildPaths
(
string
workingDirectory
,
string
tempDirectory
=
null
)
internal
static
BuildPaths
CreateBuildPaths
(
string
workingDirectory
,
string
sdkDirectory
=
null
,
string
tempDirectory
=
null
)
{
tempDirectory
=
tempDirectory
??
Path
.
GetTempPath
();
#if NET46
return
new
BuildPaths
(
clientDir
:
Path
.
GetDirectoryName
(
typeof
(
BuildPathsUtil
).
Assembly
.
Location
),
workingDir
:
workingDirectory
,
sdkDir
:
RuntimeEnvironment
.
GetRuntimeDirectory
(),
sdkDir
:
sdkDirectory
??
RuntimeEnvironment
.
GetRuntimeDirectory
(),
tempDir
:
tempDirectory
);
#else
return
new
BuildPaths
(
clientDir
:
AppContext
.
BaseDirectory
,
workingDir
:
workingDirectory
,
sdkDir
:
null
,
sdkDir
:
sdkDirectory
,
tempDir
:
tempDirectory
);
#endif
}
...
...
@@ -48,8 +48,12 @@ internal static AnalyzerAssemblyLoader CreateAnalyzerAssemblyLoader()
{
#if NET46
return
new
DesktopAnalyzerAssemblyLoader
();
#else
#elif NETCOREAPP2_1
return
new
CoreClrAnalyzerAssemblyLoader
();
#elif NETSTANDARD1_3
return
new
ThrowingAnalyzerAssemblyLoader
();
#else
#error Unsupported configuration
#endif
}
...
...
src/Test/Utilities/Portable/Roslyn.Test.Utilities.csproj
浏览文件 @
af82a715
...
...
@@ -72,6 +72,7 @@
<InternalsVisibleTo
Include=
"Microsoft.CodeAnalysis.Workspaces.UnitTests"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"..\..\..\Compilers\Shared\CoreClrAnalyzerAssemblyLoader.cs"
Link=
"CoreClrAnalyzerAssemblyLoader.cs"
/>
<Compile
Include=
"..\..\..\Compilers\Shared\DesktopAnalyzerAssemblyLoader.cs"
>
<Link>
DesktopAnalyzerAssemblyLoader.cs
</Link>
</Compile>
...
...
src/Tools/BuildBoss/Program.cs
浏览文件 @
af82a715
...
...
@@ -51,7 +51,9 @@ private static bool MainCore(string[] args)
if
(
string
.
IsNullOrEmpty
(
repositoryDirectory
))
{
repositoryDirectory
=
AppContext
.
BaseDirectory
;
repositoryDirectory
=
solutionFiles
.
Count
>
0
?
Path
.
GetDirectoryName
(
solutionFiles
[
0
])
:
AppContext
.
BaseDirectory
;
}
return
Go
(
repositoryDirectory
,
isRelease
,
solutionFiles
);
...
...
src/Tools/BuildBoss/ProjectCheckerUtil.cs
浏览文件 @
af82a715
...
...
@@ -110,8 +110,9 @@ private bool ParseRoslynProjectData(TextWriter textWriter, out RoslynProjectData
}
catch
(
Exception
ex
)
{
data
=
default
(
RoslynProjectData
);
textWriter
.
WriteLine
(
"Unable to parse Roslyn project properties"
);
textWriter
.
WriteLine
(
ex
.
Message
);
data
=
default
;
return
false
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录