Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
952f3897
F
fsharp
项目概览
dotNET Platform
/
fsharp
12 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
952f3897
编写于
12月 03, 2020
作者:
K
Kevin Ransom (msft)
提交者:
GitHub
12月 03, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10611 from dotnet/merges/release/dev16.8-to-release/fcs
Merge release/dev16.8 to release/fcs
上级
f3a37b6a
35f543ec
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
8 deletion
+38
-8
tests/FSharp.Test.Utilities/CompilerAssert.fs
tests/FSharp.Test.Utilities/CompilerAssert.fs
+30
-4
tests/fsharp/single-test.fs
tests/fsharp/single-test.fs
+8
-4
未找到文件。
tests/FSharp.Test.Utilities/CompilerAssert.fs
浏览文件 @
952f3897
...
...
@@ -117,6 +117,16 @@ type CompilerAssert private () =
</Project>"""
static
let
directoryBuildProps
=
"""
<Project>
<PropertyGroup>
<DisableCompilerRedirection>true</DisableCompilerRedirection>
</PropertyGroup>
<Import Project="
$([
MSBuild
]::
GetPathOfFileAbove
(
'
Directory
.
Build
.
props'
,
'
$(
MSBuildThisFileDirectory
)../
'
))
" />
</Project>
"""
static
let
programFs
=
"""
open System
...
...
@@ -127,13 +137,17 @@ let main argv = 0"""
let
mutable
output
=
""
let
mutable
errors
=
""
let
mutable
cleanUp
=
true
let
projectDirectory
=
Path
.
Combine
(
Path
.
GetTempPath
()
,
"CompilerAssert"
,
Path
.
GetRandomFileName
()
)
let
pathToArtifacts
=
Path
.
GetFullPath
(
Path
.
Combine
(
Path
.
GetDirectoryName
(
Assembly
.
GetExecutingAssembly
()
.
Location
),
"../../../.."
))
if
Path
.
GetFileName
(
pathToArtifacts
)
<>
"artifacts"
then
failwith
"CompilerAssert did not find artifacts directory --- has the location changed????"
let
pathToTemp
=
Path
.
Combine
(
pathToArtifacts
,
"Temp"
)
let
projectDirectory
=
Path
.
Combine
(
pathToTemp
,
"CompilerAssert"
,
Path
.
GetRandomFileName
()
)
let
pathToFSharpCore
=
typeof
<
RequireQualifiedAccessAttribute
>.
Assembly
.
Location
try
try
Directory
.
CreateDirectory
(
projectDirectory
)
|>
ignore
let
projectFileName
=
Path
.
Combine
(
projectDirectory
,
"ProjectFile.fsproj"
)
let
programFsFileName
=
Path
.
Combine
(
projectDirectory
,
"Program.fs"
)
let
directoryBuildPropsFileName
=
Path
.
Combine
(
projectDirectory
,
"Directory.Build.props"
)
let
frameworkReferencesFileName
=
Path
.
Combine
(
projectDirectory
,
"FrameworkReferences.txt"
)
#
if
NETCOREAPP
File
.
WriteAllText
(
projectFileName
,
projectFile
.
Replace
(
"$TARGETFRAMEWORK"
,
"netcoreapp3.1"
).
Replace
(
"$FSHARPCORELOCATION"
,
pathToFSharpCore
))
...
...
@@ -141,6 +155,7 @@ let main argv = 0"""
File
.
WriteAllText
(
projectFileName
,
projectFile
.
Replace
(
"$TARGETFRAMEWORK"
,
"net472"
).
Replace
(
"$FSHARPCORELOCATION"
,
pathToFSharpCore
))
#
endif
File
.
WriteAllText
(
programFsFileName
,
programFs
)
File
.
WriteAllText
(
directoryBuildPropsFileName
,
directoryBuildProps
)
let
pInfo
=
ProcessStartInfo
()
pInfo
.
FileName
<-
config
.
DotNetExe
...
...
@@ -157,16 +172,27 @@ let main argv = 0"""
output
<-
p
.
StandardOutput
.
ReadToEnd
()
errors
<-
p
.
StandardError
.
ReadToEnd
()
if
not
(
String
.
IsNullOrWhiteSpace
errors
)
then
Assert
.
Fail
errors
if
p
.
ExitCode
<>
0
then
Assert
.
Fail
(
sprintf
"Program exited with exit code %d"
p
.
ExitCode
)
if
not
succeeded
then
Assert
.
Fail
(
sprintf
"Program timed out after %d ms"
timeout
)
if
not
(
String
.
IsNullOrWhiteSpace
errors
)
then
printfn
"Output:
\n
=======
\n
%s
\n
"
output
printfn
"Errors:
\n
=======
\n
%s
\n
"
errors
Assert
.
Fail
errors
if
p
.
ExitCode
<>
0
then
printfn
"Output:
\n
=======
\n
%s
\n
"
output
printfn
"Errors:
\n
=======
\n
%s
\n
"
errors
Assert
.
Fail
(
sprintf
"Program exited with exit code %d"
p
.
ExitCode
)
if
not
succeeded
then
printfn
"Output:
\n
=======
\n
%s
\n
"
output
printfn
"Errors:
\n
=======
\n
%s
\n
"
errors
Assert
.
Fail
(
sprintf
"Program timed out after %d ms"
timeout
)
File
.
ReadLines
(
frameworkReferencesFileName
)
|>
Seq
.
toArray
with
|
e
->
cleanUp
<-
false
printfn
"Project directory: %s"
projectDirectory
printfn
"STDOUT: %s"
output
File
.
WriteAllText
(
Path
.
Combine
(
projectDirectory
,
"project.stdout"
),
output
)
printfn
"STDERR: %s"
errors
File
.
WriteAllText
(
Path
.
Combine
(
projectDirectory
,
"project.stderror"
),
errors
)
raise
(
new
Exception
(
sprintf
"An error occurred getting netcoreapp references: %A"
e
))
finally
if
cleanUp
then
...
...
tests/fsharp/single-test.fs
浏览文件 @
952f3897
...
...
@@ -3,6 +3,7 @@
open
System
open
System
.
IO
open
System
.
Diagnostics
open
System
.
Reflection
open
NUnit
.
Framework
open
TestFramework
open
HandleExpects
...
...
@@ -222,12 +223,15 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion =
let
mutable
result
=
""
lock
lockObj
<|
(
fun
()
->
let
rec
loop
()
=
let
dir
=
Path
.
Combine
(
Path
.
GetTempPath
()
,
"FSharp.Cambridge"
,
Path
.
GetRandomFileName
()
)
if
Directory
.
Exists
(
dir
)
then
let
pathToArtifacts
=
Path
.
GetFullPath
(
Path
.
Combine
(
Path
.
GetDirectoryName
(
Assembly
.
GetExecutingAssembly
()
.
Location
),
"../../../.."
))
if
Path
.
GetFileName
(
pathToArtifacts
)
<>
"artifacts"
then
failwith
"FSharp.Cambridge did not find artifacts directory --- has the location changed????"
let
pathToTemp
=
Path
.
Combine
(
pathToArtifacts
,
"Temp"
)
let
projectDirectory
=
Path
.
Combine
(
pathToTemp
,
"FSharp.Cambridge"
,
Path
.
GetRandomFileName
()
)
if
Directory
.
Exists
(
projectDirectory
)
then
loop
()
else
Directory
.
CreateDirectory
(
dir
)
|>
ignore
dir
Directory
.
CreateDirectory
(
projectDirectory
)
|>
ignore
projectDirectory
result
<-
loop
()
)
result
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录