Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.

namespace FSharp.Compiler.ComponentTests.CompilerOptions

open System

open Xunit
open FSharp.Test.Compiler


//# Sanity check - simply check that the option is valid
module crossoptimize =

// SOURCE=crossoptimize.fs SCFLAGS="--crossoptimize"
[<InlineData("--crossoptimize")>]
[<InlineData("--crossoptimize+")>]
[<InlineData("--crossoptimize-")>]
[<Theory>]
let ``crossoptimize_flag_fs`` option =
Fs """printfn "Hello, World!!!" """
|> asExe
|> withOptions (if String.IsNullOrWhiteSpace option then [] else [option])
|> compile
|> shouldSucceed

[<InlineData("--crossoptimize")>]
[<InlineData("--crossoptimize+")>]
[<InlineData("--crossoptimize-")>]
[<Theory>]
let ``crossoptimize_flag_fsx`` option =
Fsx """printfn "Hello, World!!!" """
|> asExe
|> withOptions (if String.IsNullOrWhiteSpace option then [] else [option])
|> compile
|> shouldSucceed
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.

namespace FSharp.Compiler.ComponentTests.CompilerOptions

open System
open System.Reflection.PortableExecutable

open Xunit
open FSharp.Test.Compiler


module highentropyva =

let shouldHaveFlag (expected: DllCharacteristics) (result: DllCharacteristics) =
if not (result.HasFlag expected) then
raise (new Exception $"CoffHeader.Characteristics does not contain expected flag:\nFound: {result}\n Expected: {expected}")

let shouldNotHaveFlag (notexpected: DllCharacteristics) (result: DllCharacteristics) =
if result.HasFlag notexpected then
raise (new Exception $"DllCharacteristics contains the unexpected flag:\nFound: {result}\nNot expected: {notexpected}")

[<InlineData(ExecutionPlatform.X64, null)>]
[<InlineData(ExecutionPlatform.X86, null)>]
[<InlineData(ExecutionPlatform.Arm64, null)>]
[<InlineData(ExecutionPlatform.Arm, null)>]
[<InlineData(ExecutionPlatform.X64, "--highentropyva-")>]
[<InlineData(ExecutionPlatform.X86, "--highentropyva-")>]
[<InlineData(ExecutionPlatform.Arm64, "--highentropyva-")>]
[<InlineData(ExecutionPlatform.Arm, "--highentropyva-")>]
[<Theory>]
let shouldNotGenerateHighEntropyVirtualAddressSpace platform option =
Fs """printfn "Hello, World!!!" """
|> asExe
|> withPlatform platform
|> withOptions (if String.IsNullOrWhiteSpace option then [] else [option])
|> compile
|> shouldSucceed
|> withPeReader(fun rdr -> rdr.PEHeaders.PEHeader.DllCharacteristics)
|> shouldNotHaveFlag DllCharacteristics.HighEntropyVirtualAddressSpace

[<InlineData(ExecutionPlatform.X64, "--highentropyva")>]
[<InlineData(ExecutionPlatform.X64, "--highentropyva+")>]
[<InlineData(ExecutionPlatform.X86, "--highentropyva")>]
[<InlineData(ExecutionPlatform.X86, "--highentropyva+")>]
[<InlineData(ExecutionPlatform.Arm64, "--highentropyva+")>]
[<InlineData(ExecutionPlatform.Arm64, "--highentropyva")>]
[<InlineData(ExecutionPlatform.Arm, "--highentropyva")>]
[<InlineData(ExecutionPlatform.Arm, "--highentropyva+")>]
[<Theory>]
let shouldGenerateHighEntropyVirtualAddressSpace platform option =
Fs """printfn "Hello, World!!!" """
|> asExe
|> withPlatform platform
|> withOptions (if String.IsNullOrWhiteSpace option then [] else [option])
|> compile
|> shouldSucceed
|> withPeReader(fun rdr -> rdr.PEHeaders.PEHeader.DllCharacteristics)
|> shouldHaveFlag DllCharacteristics.HighEntropyVirtualAddressSpace
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@
<Compile Include="CompilerOptions\fsc\checked\checked.fs" />
<Compile Include="CompilerOptions\fsc\cliversion.fs" />
<Compile Include="CompilerOptions\fsc\codepage\codepage.fs" />
<Compile Include="CompilerOptions\fsc\crossoptimize.fs" />
<Compile Include="CompilerOptions\fsc\debug.fs" />
<Compile Include="CompilerOptions\fsc\highentropyva.fs" />
<Compile Include="CompilerOptions\fsc\langversion.fs" />
<Compile Include="CompilerOptions\fsc\misc\misc.fs" />
<Compile Include="CompilerOptions\fsc\noframework\noframework.fs" />
Expand All @@ -221,7 +223,7 @@
<Compile Include="CompilerOptions\fsc\reference.fs" />
<Compile Include="CompilerOptions\fsc\reflectionfree.fs" />
<Compile Include="CompilerOptions\fsc\refonlyrefout.fs" />
<Compile Include="CompilerOptions\fsc\sourceFiles.fs" />
<Compile Include="CompilerOptions\fsc\sourceFiles.fs" />
<Compile Include="CompilerService\RangeModule.fs" />
<Compile Include="Debugger\PortablePdbs.fs" />
<Compile Include="Diagnostics\async.fs" />
Expand Down
1 change: 0 additions & 1 deletion tests/FSharp.Test.Utilities/Compiler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ open System.Reflection.PortableExecutable

open FSharp.Test.CompilerAssertHelpers
open TestFramework
open System.Reflection.Metadata

module rec Compiler =
type BaselineFile =
Expand Down

This file was deleted.

10 changes: 0 additions & 10 deletions tests/fsharpqa/Source/CompilerOptions/fsc/crossoptimize/env.lst

This file was deleted.

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions tests/fsharpqa/Source/CompilerOptions/fsc/highentropyva/env.lst

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.