Skip to content

Commit d4c637d

Browse files
authored
re-enable FSharp.Core unit tests (#3014)
* add library-only build and test * fix tests * Fix tests
1 parent 45f6878 commit d4c637d

8 files changed

Lines changed: 69 additions & 5 deletions

File tree

build-everything.proj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33

44
<!-- +++++++++++++++++++++++ Project selection for building +++++++++++++++++++++++++++++++ -->
55

6-
<ItemGroup Condition="'$(BUILD_NET40)'=='1'">
6+
<ItemGroup Condition="'$(BUILD_NET40_FSHARP_CORE)'=='1'">
77
<ProjectsWithNet40 Include="src/fsharp/FSharp.Core/FSharp.Core.fsproj" />
8+
</ItemGroup>
9+
10+
<ItemGroup Condition="'$(BUILD_NET40)'=='1'">
811
<ProjectsWithNet40 Include="src/fsharp/FSharp.Build/FSharp.Build.fsproj" />
912
<ProjectsWithNet40 Include="src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj" />
1013
<ProjectsWithNet40 Include="src/fsharp/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj"/>

build.cmd

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ if "%BUILD_PROTO_WITH_CORECLR_LKG%" =="" (set BUILD_PROTO_WITH_CORECLR_LKG=0)
5757
set BUILD_PROTO=0
5858
set BUILD_PHASE=1
5959
set BUILD_NET40=0
60+
set BUILD_NET40_FSHARP_CORE=0
6061
set BUILD_CORECLR=0
6162
set BUILD_PORTABLE=0
6263
set BUILD_VS=0
@@ -94,10 +95,15 @@ for %%i in (%BUILD_FSC_DEFAULT%) do ( call :PROCESS_ARG %%i )
9495
REM apply defaults
9596

9697
if /i "%_autoselect%" == "1" (
98+
set BUILD_NET40_FSHARP_CORE=1
9799
set BUILD_NET40=1
98100
)
99101

100102
if /i "%_autoselect_tests%" == "1" (
103+
if /i "%BUILD_NET40_FSHARP_CORE%" == "1" (
104+
set TEST_NET40_COREUNIT_SUITE=1
105+
)
106+
101107
if /i "%BUILD_NET40%" == "1" (
102108
set TEST_NET40_COMPILERUNIT_SUITE=1
103109
set TEST_NET40_COREUNIT_SUITE=1
@@ -129,8 +135,14 @@ set ARG2=%~2
129135
if "%ARG%" == "1" if "%2" == "" (set ARG=default)
130136
if "%2" == "" if not "%ARG%" == "default" goto :EOF
131137

138+
if /i "%ARG%" == "net40-lib" (
139+
set _autoselect=0
140+
set BUILD_NET40_FSHARP_CORE=1
141+
)
142+
132143
if /i "%ARG%" == "net40" (
133144
set _autoselect=0
145+
set BUILD_NET40_FSHARP_CORE=1
134146
set BUILD_NET40=1
135147
)
136148

@@ -174,6 +186,7 @@ if /i "%ARG%" == "microbuild" (
174186
set _autoselect=0
175187
set BUILD_PROTO=1
176188
set BUILD_NET40=1
189+
set BUILD_NET40_FSHARP_CORE=1
177190
set BUILD_PROTO_WITH_CORECLR_LKG=1
178191
set BUILD_CORECLR=1
179192
set BUILD_PORTABLE=1
@@ -203,6 +216,7 @@ if /i "%ARG%" == "ci_part1" (
203216
REM what we do
204217
set BUILD_PROTO=1
205218
set BUILD_NET40=1
219+
set BUILD_NET40_FSHARP_CORE=1
206220
set BUILD_PORTABLE=1
207221
set BUILD_VS=1
208222
set BUILD_SETUP=%FSC_BUILD_SETUP%
@@ -216,6 +230,7 @@ if /i "%ARG%" == "ci_part2" (
216230
REM what we do
217231
set BUILD_PROTO=1
218232
set BUILD_NET40=1
233+
set BUILD_NET40_FSHARP_CORE=1
219234

220235
set TEST_NET40_COREUNIT_SUITE=1
221236
set TEST_NET40_FSHARP_SUITE=1
@@ -241,6 +256,7 @@ if /i "%ARG%" == "ci_part4" (
241256
REM what we do
242257
set BUILD_PROTO=1
243258
set BUILD_NET40=1
259+
set BUILD_NET40_FSHARP_CORE=1
244260
set BUILD_PORTABLE=1
245261

246262
set TEST_NET40_COMPILERUNIT_SUITE=1
@@ -282,6 +298,7 @@ if /i "%ARG%" == "test-all" (
282298
set BUILD_PROTO=1
283299
set BUILD_PROTO_WITH_CORECLR_LKG=1
284300
set BUILD_NET40=1
301+
set BUILD_NET40_FSHARP_CORE=1
285302
set BUILD_CORECLR=1
286303
set BUILD_PORTABLE=1
287304
set BUILD_VS=1
@@ -297,47 +314,60 @@ if /i "%ARG%" == "test-all" (
297314
)
298315

299316
if /i "%ARG%" == "test-net40-fsharpqa" (
317+
set _autoselect=0
300318
set BUILD_NET40=1
319+
set BUILD_NET40_FSHARP_CORE=1
301320
set BUILD_PORTABLE=1
302321
set TEST_NET40_FSHARPQA_SUITE=1
303322
)
304323

305324
if /i "%ARG%" == "test-compiler-unit" (
325+
set _autoselect=0
306326
set BUILD_NET40=1
327+
set BUILD_NET40_FSHARP_CORE=1
307328
set TEST_NET40_COMPILERUNIT_SUITE=1
308329
)
309330

310331
if /i "%ARG%" == "test-net40-ideunit" (
332+
set _autoselect=0
311333
set BUILD_NET40=1
334+
set BUILD_NET40_FSHARP_CORE=1
312335
set BUILD_VS=1
313336
set BUILD_PORTABLE=1
314337
set TEST_VS_IDEUNIT_SUITE=1
315338
)
316339

317340
if /i "%ARG%" == "test-net40-coreunit" (
318-
set BUILD_NET40=1
341+
set _autoselect=0
342+
set BUILD_NET40_FSHARP_CORE=1
319343
set TEST_NET40_COREUNIT_SUITE=1
320344
)
321345

322346
if /i "%ARG%" == "test-coreclr-coreunit" (
347+
set _autoselect=0
323348
set BUILD_PROTO_WITH_CORECLR_LKG=1
324349
set BUILD_CORECLR=1
325350
set TEST_CORECLR_COREUNIT_SUITE=1
326351
)
327352

328353
if /i "%ARG%" == "test-pcl-coreunit" (
354+
set _autoselect=0
329355
set BUILD_PORTABLE=1
330356
set TEST_PORTABLE_COREUNIT_SUITE=1
331357
)
332358

333359
if /i "%ARG%" == "test-net40-fsharp" (
360+
set _autoselect=0
334361
set BUILD_NET40=1
362+
set BUILD_NET40_FSHARP_CORE=1
335363
set BUILD_PORTABLE=1
336364
set TEST_NET40_FSHARP_SUITE=1
337365
)
338366

339367
if /i "%ARG%" == "test-coreclr-fsharp" (
368+
set _autoselect=0
340369
set BUILD_NET40=1
370+
set BUILD_NET40_FSHARP_CORE=1
341371
set BUILD_PROTO_WITH_CORECLR_LKG=1
342372
set BUILD_CORECLR=1
343373
set TEST_CORECLR_FSHARP_SUITE=1
@@ -370,6 +400,7 @@ echo.
370400
echo BUILD_PROTO=%BUILD_PROTO%
371401
echo BUILD_PROTO_WITH_CORECLR_LKG=%BUILD_PROTO_WITH_CORECLR_LKG%
372402
echo BUILD_NET40=%BUILD_NET40%
403+
echo BUILD_NET40_FSHARP_CORE=%BUILD_NET40_FSHARP_CORE%
373404
echo BUILD_CORECLR=%BUILD_CORECLR%
374405
echo BUILD_PORTABLE=%BUILD_PORTABLE%
375406
echo BUILD_VS=%BUILD_VS%
@@ -595,7 +626,7 @@ if "%BUILD_PHASE%" == "1" (
595626

596627
echo ---------------- Done with build, starting update/prepare ---------------
597628

598-
if "%BUILD_NET40%" == "1" (
629+
if "%BUILD_NET40_FSHARP_CORE%" == "1" (
599630
call src\update.cmd %BUILD_CONFIG% -ngen
600631
)
601632

@@ -646,7 +677,7 @@ echo SNEXE64: %SNEXE64%
646677
echo ILDASM: %ILDASM%
647678
echo
648679

649-
if "%TEST_NET40_COMPILERUNIT_SUITE%" == "0" if "%TEST_PORTABLE_COREUNIT_SUITE%" == "0" if "%TEST_CORECLR_COREUNIT_SUITE%" == "0" if "%TEST_VS_IDEUNIT_SUITE%" == "0" if "%TEST_NET40_FSHARP_SUITE%" == "0" if "%TEST_NET40_FSHARPQA_SUITE%" == "0" goto :success
680+
if "%TEST_NET40_COMPILERUNIT_SUITE%" == "0" if "%TEST_NET40_COREUNIT_SUITE%" == "0" if "%TEST_PORTABLE_COREUNIT_SUITE%" == "0" if "%TEST_CORECLR_COREUNIT_SUITE%" == "0" if "%TEST_VS_IDEUNIT_SUITE%" == "0" if "%TEST_NET40_FSHARP_SUITE%" == "0" if "%TEST_NET40_FSHARPQA_SUITE%" == "0" goto :success
650681

651682
echo ---------------- Done with update, starting tests -----------------------
652683

build.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ fi
8181

8282
export BUILD_PROTO=0
8383
export BUILD_PHASE=1
84+
export BUILD_NET40_FSHARP_CORE=0
8485
export BUILD_NET40=0
8586
export BUILD_CORECLR=0
8687
export BUILD_PORTABLE=0
@@ -114,6 +115,7 @@ do
114115
"net40")
115116
_autoselect=0
116117
export BUILD_NET40=1
118+
export BUILD_NET40_FSHARP_CORE=1
117119
;;
118120
"coreclr")
119121
_autoselect=0
@@ -127,6 +129,7 @@ do
127129
"vs")
128130
_autoselect=0
129131
export BUILD_NET40=1
132+
export BUILD_NET40_FSHARP_CORE=1
130133
export BUILD_VS=1
131134
;;
132135
"vstest")
@@ -140,6 +143,7 @@ do
140143
export BUILD_PROTO=1
141144
export BUILD_PROTO_WITH_CORECLR_LKG=1
142145
export BUILD_NET40=1
146+
export BUILD_NET40_FSHARP_CORE=1
143147
export BUILD_CORECLR=1
144148
export BUILD_PORTABLE=1
145149
export BUILD_VS=1
@@ -150,6 +154,7 @@ do
150154
_autoselect=0
151155
export BUILD_PROTO=1
152156
export BUILD_NET40=1
157+
export BUILD_NET40_FSHARP_CORE=1
153158
export BUILD_PROTO_WITH_CORECLR_LKG=1
154159
export BUILD_CORECLR=1
155160
export BUILD_PORTABLE=1
@@ -174,6 +179,7 @@ do
174179
# what we do
175180
export BUILD_PROTO=1
176181
export BUILD_NET40=1
182+
export BUILD_NET40_FSHARP_CORE=1
177183
export BUILD_PORTABLE=1
178184
export BUILD_VS=1
179185
export BUILD_SETUP=$FSC_BUILD_SETUP
@@ -189,6 +195,7 @@ do
189195
export BUILD_PROTO_WITH_CORECLR_LKG=1
190196
export BUILD_PROTO=1
191197
export BUILD_NET40=1
198+
export BUILD_NET40_FSHARP_CORE=1
192199
export BUILD_PORTABLE=1
193200

194201
export TEST_NET40_COREUNIT_SUITE=1
@@ -203,6 +210,7 @@ do
203210
export BUILD_PROTO_WITH_CORECLR_LKG=1
204211
export BUILD_PROTO=1
205212
export BUILD_NET40=1
213+
export BUILD_NET40_FSHARP_CORE=1
206214
export BUILD_CORECLR=1
207215

208216
export TEST_CORECLR_FSHARP_SUITE=1
@@ -248,6 +256,7 @@ do
248256
export BUILD_PROTO=1
249257
export BUILD_PROTO_WITH_CORECLR_LKG=1
250258
export BUILD_NET40=1
259+
export BUILD_NET40_FSHARP_CORE=1
251260
export BUILD_CORECLR=1
252261
export BUILD_PORTABLE=1
253262
export BUILD_VS=1
@@ -263,15 +272,17 @@ do
263272
;;
264273
"test-net40-fsharpqa")
265274
export BUILD_NET40=1
275+
export BUILD_NET40_FSHARP_CORE=1
266276
export BUILD_PORTABLE=1
267277
export TEST_NET40_FSHARPQA_SUITE=1
268278
;;
269279
"test-compiler-unit")
270280
export BUILD_NET40=1
281+
export BUILD_NET40_FSHARP_CORE=1
271282
export TEST_NET40_COMPILERUNIT_SUITE=1
272283
;;
273284
"test-net40-coreunit")
274-
export BUILD_NET40=1
285+
export BUILD_NET40_FSHARP_CORE=1
275286
export TEST_NET40_COREUNIT_SUITE=1
276287
;;
277288
"test-coreclr-coreunit")
@@ -285,11 +296,13 @@ do
285296
;;
286297
"test-net40-fsharp")
287298
export BUILD_NET40=1
299+
export BUILD_NET40_FSHARP_CORE=1
288300
export BUILD_PORTABLE=1
289301
export TEST_NET40_FSHARP_SUITE=1
290302
;;
291303
"test-coreclr-fsharp")
292304
export BUILD_NET40=1
305+
export BUILD_NET40_FSHARP_CORE=1
293306
export BUILD_PROTO_WITH_CORECLR_LKG=1
294307
export BUILD_CORECLR=1
295308
export TEST_CORECLR_FSHARP_SUITE=1
@@ -310,6 +323,7 @@ done
310323
# Apply defaults, if necessary.
311324
if [ $_autoselect -eq 1 ]; then
312325
export BUILD_NET40=1
326+
export BUILD_NET40_FSHARP_CORE=1
313327
fi
314328

315329
if [ $_autoselect_tests -eq 1 ]; then
@@ -322,6 +336,7 @@ if [ $_autoselect_tests -eq 1 ]; then
322336

323337
if [ $BUILD_CORECLR -eq 1 ]; then
324338
export BUILD_NET40=1
339+
export BUILD_NET40_FSHARP_CORE=1
325340
export TEST_CORECLR_FSHARP_SUITE=1
326341
export TEST_CORECLR_COREUNIT_SUITE=1
327342
fi
@@ -344,6 +359,7 @@ printf "\n"
344359
printf "BUILD_PROTO=%s\n" "$BUILD_PROTO"
345360
printf "BUILD_PROTO_WITH_CORECLR_LKG=%s\n" "$BUILD_PROTO_WITH_CORECLR_LKG"
346361
printf "BUILD_NET40=%s\n" "$BUILD_NET40"
362+
printf "BUILD_NET40_FSHARP_CORE=%s\n" "$BUILD_NET40_FSHARP_CORE"
347363
printf "BUILD_CORECLR=%s\n" "$BUILD_CORECLR"
348364
printf "BUILD_PORTABLE=%s\n" "$BUILD_PORTABLE"
349365
printf "BUILD_VS=%s\n" "$BUILD_VS"

mono/build.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ if not exist %_ngenexe% echo Note: Could not find ngen.exe.
2121
%_ngenexe% install packages\FSharp.Compiler.Tools.4.0.1.21\tools\fsc.exe
2222

2323
set BUILD_NET40=1
24+
set BUILD_NET40_FSHARP_CORE=1
2425
set BUILD_PORTABLE=1
2526
set TEST_NET40_COREUNIT_SUITE=1
2627
set TEST_PORTABLE_COREUNIT_SUITE=1

src/FSharpSource.targets

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@
2626
<Choose>
2727
<When Condition="'$(ProjectLanguage)' == 'FSharp'">
2828
<Choose>
29+
<!-- Some unit test assemblies must not have strong names since they reference other assemblies that don't have strong names -->
30+
<!-- These unit test assemblies can't use InternalsVisibleTo into assemblies with strong names. -->
31+
<When Condition="'$(StrongNames)' == 'false'" >
32+
<PropertyGroup>
33+
<SkipSigning>true</SkipSigning>
34+
<UseOpenSourceSign>false</UseOpenSourceSign>
35+
<MicroBuildAssemblyVersion>$(FSCoreVersion)</MicroBuildAssemblyVersion>
36+
<MicroBuildAssemblyFileLanguage>fs</MicroBuildAssemblyFileLanguage>
37+
</PropertyGroup>
38+
</When>
2939
<!-- In the open source "Mono" build we always fully sign the binaries with the public test.snk, apart from FSharp.Core, which gets the MSFT key -->
3040
<When Condition="'$(MonoPackaging)' == 'true' AND '$(AssemblyName)'!='FSharp.Core'" >
3141
<PropertyGroup>

src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<AllowCrossTargeting>true</AllowCrossTargeting>
1616
<ReferenceVsAssemblies>true</ReferenceVsAssemblies>
1717
<OutputType>Library</OutputType>
18+
<StrongNames>false</StrongNames>
1819
<AssemblyName>FSharp.Core.Unittests</AssemblyName>
1920
<!-- Prevent compiler from inlining calls to FSharp.Core to improve code coverage accuracy -->
2021
<Optimize>false</Optimize>

src/fsharp/FSharp.Core.Unittests/StructTuples.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,4 @@ type StructTuplesCSharpInterop() =
141141
Assert.IsTrue( (one=1) && (two=2) && (three=3) && (four=4) && (five = 5) && (six=6) && (seven=7) && (eight=8) && (nine=9) && (ten=10) && (eleven=11) && (twelve=12) && (thirteen=13) && (fourteen=14) && (fifteen=15) && (sixteen=16) )
142142
()
143143
#endif
144+

src/fsharp/FSharp.Core/array2.fsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,4 @@ namespace Microsoft.FSharp.Collections
226226
[<CompiledName("Get")>]
227227
val get: array:'T[,] -> index1:int -> index2:int -> 'T
228228

229+

0 commit comments

Comments
 (0)