Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5f206cd

Browse files
authored
Enable more cambridge tests for coreclr (dotnet#2071)
* Add more tests* indent* Enable more cambridge tests for coreclr* Fix typo* really fix the typo* system.runtime reference was incompatible with desktop
1 parenteb8d0cf commit5f206cd

File tree

11 files changed

+152
-55
lines changed

11 files changed

+152
-55
lines changed

‎tests/fsharp/FSharp.Tests.FSharpSuite.DrivingCoreCLR/project.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"Microsoft.NETCore.App": {
2323
"type":"platform",
2424
"version":"1.0.1"
25-
}
25+
},
26+
"System.Reflection.Emit.Lightweight":"4.3.0",
2627
},
2728
"imports": ["netstandard1.1","netstandard1.6","portable-net45+win8+wp8+wpa81" ]
2829
}

‎tests/fsharp/core/attributes/test.fsx‎

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ open System.Diagnostics
2828

2929
(* ATTRIBUTES*)
3030

31+
#if!TESTS_AS_APP&&!FX_PORTABLE_OR_NETSTANDARD
3132
[<LoaderOptimization(LoaderOptimization.MultiDomainHost)>]
33+
#endif
3234

3335
letmain=()
3436

@@ -88,23 +90,6 @@ end;;
8890
(* attribute on a return type*)
8991
(* NOT YET: let [<return: Ignore("ignore")>] myMethod3 x = x + 1*)
9092

91-
#if!FX_NO_CRYPTO
92-
(* BUG 428 - compile time error - on obsolete attributes*)
93-
letf(cert:System.Security.Cryptography.X509Certificates.X509Certificate)=
94-
letx= cert.GetName()in
95-
()
96-
97-
98-
openSystem.Threading
99-
lettest32498()=
100-
letguiTH=new Thread(new ThreadStart(fun()->()))in
101-
guiTH.ApartmentState<- ApartmentState.STA
102-
103-
//let [<System.Runtime.CompilerServices.CompilerGlobalScope>] id x = x
104-
105-
//[<System.Runtime.CompilerServices.CompilerGlobalScope>] let id2 x = x
106-
#endif
107-
10893

10994
typeA=
11095
class

‎tests/fsharp/core/control/test.fsx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Core_control
44
#endif
55
#light
66

7-
#if!FX_PORTABLE_OR_NETSTANDARD
7+
#if FX_PORTABLE_OR_NETSTANDARD
88
openSystem.Threading.Tasks
99
#endif
1010

@@ -666,7 +666,7 @@ module AsBeginEndTests =
666666
(sprintf"cvew0-9rn7")
667667
(letreq= AsyncRequest(async{return2087})
668668
letiar= req.BeginAsync(null,null)
669-
iar.AsyncWaitHandle.WaitOne(100,true)|> ignore
669+
iar.AsyncWaitHandle.WaitOne(100)|> ignore
670670
req.EndAsync(iar))
671671
2087
672672

@@ -675,7 +675,7 @@ module AsBeginEndTests =
675675
(letreq= AsyncRequest(async{return2087})
676676
let mutablecalled=0
677677
letiar= req.BeginAsync(System.AsyncCallback(fun _-> called<-10),null)
678-
iar.AsyncWaitHandle.WaitOne(100,true)|> ignore
678+
iar.AsyncWaitHandle.WaitOne(100)|> ignore
679679
letv= req.EndAsync(iar)
680680
v+ called)
681681
2097
@@ -686,7 +686,7 @@ module AsBeginEndTests =
686686
let mutablecalled=0
687687
letiar= req.BeginAsync(System.AsyncCallback(fun iar-> called<- req.EndAsync(iar)),null)
688688
whilenot iar.IsCompleteddo
689-
iar.AsyncWaitHandle.WaitOne(100,true)|> ignore
689+
iar.AsyncWaitHandle.WaitOne(100)|> ignore
690690

691691
called)
692692
2087
@@ -701,7 +701,7 @@ module AsBeginEndTests =
701701
return10})
702702
letiar= req.BeginAsync(null,null)
703703
printfn"waiting"
704-
iar.AsyncWaitHandle.WaitOne(100,true)|> ignore
704+
iar.AsyncWaitHandle.WaitOne(100)|> ignore
705705
printfn"cancelling"
706706
req.CancelAsync(iar)
707707
(try req.EndAsync(iar)with:? System.OperationCanceledExceptionas e->100))

‎tests/fsharp/core/patterns/test.fsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ module RegExp =
776776
check"fwhin3op9"((|Match|_|)"^.*.ml$""abc.ml")(Some[])
777777

778778
lettestFun()=
779-
File.WriteAllLines("test.fs",seq{for(IsMatch"(.*).fs" f)in allFiles System.Environment.CurrentDirectorydoyield!"-------------------------------"::"\n"::"\n"::("// FILE:"+f)::""::"module"+(f|> Path.GetDirectoryName|> Path.GetFileName|>(fun s-> s.ToUpper()))+" ="::[for linein Array.toList(File.ReadAllLines(f))->""+line]}|> Seq.toArray)
779+
File.WriteAllLines("test.fs",seq{for(IsMatch"(.*).fs" f)in allFiles(System.IO.Directory.GetCurrentDirectory())doyield!"-------------------------------"::"\n"::"\n"::("// FILE:"+f)::""::"module"+(f|> Path.GetDirectoryName|> Path.GetFileName|>(fun s-> s.ToUpper()))+" ="::[for linein Array.toList(File.ReadAllLines(f))->""+line]}|> Seq.toArray)
780780

781781
moduleRandomWalk=
782782
letran=new System.Random()

‎tests/fsharp/coreclr_utilities.fs‎

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ module CoreClrUtilities
4242
cl.Split(' ')
4343
#endif
4444

45+
letcommit(results:_[])=
46+
match resultswith
47+
|[||]->null
48+
|[| m|]-> m
49+
|_-> raise(AmbiguousMatchException())
50+
4551
[<Flags>]
4652
typeBindingFlags=
4753
| DeclaredOnly=2
@@ -76,17 +82,45 @@ module CoreClrUtilities
7682
|:? System.Reflection.TypeInfoas c->if c.IsNestedthen MemberType.NestedTypeelse MemberType.TypeInfo
7783
|_-> MemberType.None
7884
mapIsMethodOrConstructor||| mapIsEvent||| mapIsField||| mapIsProperty||| mapIsTypeInfoOrNested
85+
7986

87+
let inlinehasFlag(flag:BindingFlags)f=(f&&& flag)= flag
88+
letisDeclaredFlag f= hasFlag BindingFlags.DeclaredOnly f
89+
letisPublicFlag f= hasFlag BindingFlags.Public f
90+
letisStaticFlag f= hasFlag BindingFlags.Static f
91+
letisInstanceFlag f= hasFlag BindingFlags.Instance f
92+
letisNonPublicFlag f= hasFlag BindingFlags.NonPublic f
93+
94+
letisAcceptable bindingFlags isStatic isPublic=
95+
// 1. check if member kind (static\instance) was specified in flags
96+
((isStaticFlag bindingFlags&& isStatic)||(isInstanceFlag bindingFlags&&not isStatic))&&
97+
// 2. check if member accessibility was specified in flags
98+
((isPublicFlag bindingFlags&& isPublic)||(isNonPublicFlag bindingFlags&&not isPublic))
99+
100+
letpublicFlags= BindingFlags.Public||| BindingFlags.Instance||| BindingFlags.Static
101+
102+
80103
typeSystem.Reflection.MemberInfowith
104+
memberthis.GetCustomAttributes(inherits:bool):obj[]=downcast box(CustomAttributeExtensions.GetCustomAttributes(this, inherits)|> Seq.toArray)
105+
memberthis.GetCustomAttributes(attrTy:Type):obj[]=downcast box(CustomAttributeExtensions.GetCustomAttributes(this, attrTy)|> Seq.toArray)
106+
memberthis.GetCustomAttributes(attrTy,inherits):obj[]=downcast box(CustomAttributeExtensions.GetCustomAttributes(this, attrTy, inherits)|> Seq.toArray)
81107
memberthis.MemberType= mapMemberType this
82108

83109
typeSystem.Reflection.MethodInfowith
110+
memberthis.GetCustomAttributes(inherits:bool):obj[]=downcast box(CustomAttributeExtensions.GetCustomAttributes(this, inherits)|> Seq.toArray)
111+
memberthis.GetCustomAttributes(attrTy:Type):obj[]=downcast box(CustomAttributeExtensions.GetCustomAttributes(this, attrTy)|> Seq.toArray)
112+
memberthis.GetCustomAttributes(attrTy,inherits):obj[]=downcast box(CustomAttributeExtensions.GetCustomAttributes(this, attrTy, inherits)|> Seq.toArray)
84113
memberthis.MemberType= mapMemberType this
85114

86115
typeSystem.Reflection.PropertyInfowith
116+
memberthis.GetCustomAttributes(inherits:bool):obj[]=downcast box(CustomAttributeExtensions.GetCustomAttributes(this, inherits)|> Seq.toArray)
117+
memberthis.GetCustomAttributes(attrTy:Type):obj[]=downcast box(CustomAttributeExtensions.GetCustomAttributes(this, attrTy)|> Seq.toArray)
118+
memberthis.GetCustomAttributes(attrTy,inherits):obj[]=downcast box(CustomAttributeExtensions.GetCustomAttributes(this, attrTy, inherits)|> Seq.toArray)
87119
memberthis.MemberType= mapMemberType this
88120

89121
typeSystem.Reflection.Assemblywith
122+
memberthis.GetCustomAttributes():obj[]=downcast box(CustomAttributeExtensions.GetCustomAttributes(this)|> Seq.toArray)
123+
memberthis.GetCustomAttributes(attrTy,_inherits):obj[]=downcast box(CustomAttributeExtensions.GetCustomAttributes(this, attrTy)|> Seq.toArray)
90124
memberthis.GetTypes()=
91125
this.DefinedTypes
92126
|> Seq.map(fun ti-> ti.AsType())
@@ -97,3 +131,50 @@ module CoreClrUtilities
97131
with get()= System.Globalization.CultureInfo.CurrentCulture
98132
andset culture= System.Globalization.CultureInfo.CurrentCulture<- culture
99133

134+
typeSystem.Typewith
135+
136+
memberthis.Assembly= this.GetTypeInfo().Assembly
137+
// use different sources based on Declared flag
138+
memberthis.GetConstructor(_bindingFlags,_binder,argsT:Type[],_parameterModifiers)= this.GetConstructor(argsT)
139+
memberthis.GetConstructor(parameterTypes:Type[])=
140+
this.GetTypeInfo().DeclaredConstructors
141+
|> Seq.filter(fun ci->
142+
not ci.IsStatic&&//exclude type initializer
143+
(
144+
letparameters= ci.GetParameters()
145+
(parameters.Length= parameterTypes.Length)&&
146+
(parameterTypes, parameters)||> Array.forall2(fun ty pi-> pi.ParameterType.Equals ty)
147+
)
148+
)
149+
|> Seq.toArray
150+
|> commit
151+
memberthis.GetCustomAttributes(attrTy,inherits):obj[]=downcast box(CustomAttributeExtensions.GetCustomAttributes(this.GetTypeInfo(), attrTy, inherits)|> Seq.toArray)
152+
memberthis.GetGenericParameterConstraints()= this.GetTypeInfo().GetGenericParameterConstraints()
153+
memberthis.GetMethods(bindingFlags)=
154+
(if isDeclaredFlag bindingFlagsthen this.GetTypeInfo().DeclaredMethodselse this.GetRuntimeMethods())
155+
|> Seq.filter(fun m-> isAcceptable bindingFlags m.IsStatic m.IsPublic)
156+
|> Seq.toArray
157+
memberthis.GetMethods()= this.GetMethods(publicFlags)
158+
memberthis.GetMethod(name,?bindingFlags)=
159+
letbindingFlags= defaultArg bindingFlags publicFlags
160+
this.GetMethods(bindingFlags)
161+
|> Array.filter(fun m-> m.Name= name)
162+
|> commit
163+
memberthis.GetMethod(name,_bindingFlags,_binder,argsT:Type[],_parameterModifiers)=
164+
this.GetMethod(name, argsT)
165+
memberthis.GetProperties(?bindingFlags)=
166+
letbindingFlags= defaultArg bindingFlags publicFlags
167+
(if isDeclaredFlag bindingFlagsthen this.GetTypeInfo().DeclaredPropertieselse this.GetRuntimeProperties())
168+
|> Seq.filter(fun pi->
169+
letmi=match pi.GetMethodwith|null-> pi.SetMethod|_-> pi.GetMethod
170+
if mi=nullthenfalse
171+
else isAcceptable bindingFlags mi.IsStatic mi.IsPublic
172+
)
173+
|> Seq.toArray
174+
memberthis.GetProperty(name,?bindingFlags)=
175+
letbindingFlags= defaultArg bindingFlags publicFlags
176+
this.GetProperties(bindingFlags)
177+
|> Array.filter(fun pi-> pi.Name= name)
178+
|> commit
179+
memberthis.IsGenericType= this.GetTypeInfo().IsGenericType
180+
memberthis.IsValueType= this.GetTypeInfo().IsValueType

‎tests/fsharp/single-test.fs‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ type Permutation =
1919
| AS_DLL
2020
#endif
2121

22-
letsingleTestBuildAndRunAux cfg p=
22+
letsingleTestBuildAndRunCore cfg(copyFiles:string)p=
23+
2324
//remove FSharp.Core.dll from the target directory to ensure that compiler uses the correct FSharp.Core.dll
2425
doif fileExists cfg"FSharp.Core.dll"then rm cfg"FSharp.Core.dll"
2526

@@ -36,12 +37,12 @@ let singleTestBuildAndRunAux cfg p =
3637

3738
makeDirectory(getDirectoryName outFile)
3839
letfscArgs=
39-
sprintf"""--debug:portable --debug+ --out:%s --target:exe -g --define:FX_RESHAPED_REFLECTION --define:NETSTANDARD1_6 --define:FSCORE_PORTABLE_NEW --define:FX_PORTABLE_OR_NETSTANDARD "%s"%s"""
40+
sprintf"""--debug:portable --debug+ --out:%s --target:exe -g --define:FX_RESHAPED_REFLECTION --define:NETSTANDARD1_6 --define:FSCORE_PORTABLE_NEW --define:FX_PORTABLE_OR_NETSTANDARD--define:FX_RESHAPED_REFLECTION"%s"%s"""
4041
outFile
4142
extraSource
4243
(String.concat"" sources)
4344

44-
letfsccArgs= sprintf"""--OutputDir:%s%s""" outDir fscArgs
45+
letfsccArgs= sprintf"""--OutputDir:%s--CopyDlls:%s%s""" outDir copyFiles fscArgs
4546

4647
fsi cfg"--exec%s%s%s"
4748
cfg.fsi_flags
@@ -146,6 +147,12 @@ let singleTestBuildAndRunAux cfg p =
146147
testOkFile.CheckExists()
147148
#endif
148149

150+
letsingleTestBuildAndRunAux cfg p=
151+
singleTestBuildAndRunCore cfg"" p
152+
153+
letsingleTestBuildAndRunWithCopyDlls cfg copyFiles p=
154+
singleTestBuildAndRunCore cfg copyFiles p
155+
149156
letsingleTestBuildAndRun dir p=
150157
letcfg= testConfig dir
151158
singleTestBuildAndRunAux cfg p

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp