diff --git a/build/scripts/build.ps1 b/build/scripts/build.ps1
index 5741c0d23ac786cd9dcd3334efce64dd5d6e95fc..ea62d53fc09eaae58061a9d3189c4d1a6d1824ed 100644
--- a/build/scripts/build.ps1
+++ b/build/scripts/build.ps1
@@ -67,7 +67,7 @@ function Print-Usage() {
Write-Host " -testCoreClr Run CoreClr unit tests"
Write-Host " -testVsi Run all integration tests"
Write-Host " -testVsiNetCore Run just dotnet core integration tests"
- Write-Host " -testIOperation Run extra checks to validate IOperations"
+ Write-Host " -testIOperation Run extra checks to validate IOperations"
Write-Host ""
Write-Host "Special Test options"
Write-Host " -testBuildCorrectness Run build correctness tests"
diff --git a/src/Compilers/Test/Utilities/CSharp/CSharpCompilerTestUtilities.csproj b/src/Compilers/Test/Utilities/CSharp/CSharpCompilerTestUtilities.csproj
index ef9c1be18a7b1e5e4d3dc4554f8b32851ac58b29..c83edbc63811a2a15f41adeef4fa226f33c103aa 100644
--- a/src/Compilers/Test/Utilities/CSharp/CSharpCompilerTestUtilities.csproj
+++ b/src/Compilers/Test/Utilities/CSharp/CSharpCompilerTestUtilities.csproj
@@ -17,9 +17,6 @@
-
- $(DefineConstants);TEST_IOPERATION_INTERFACE
-
diff --git a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs
index 7003f5e3c089d95b8e563bf94c498d5a08628abc..071ff745e1e1b7610326a96b8dcaa6ecd310abfa 100644
--- a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs
+++ b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs
@@ -582,7 +582,7 @@ public static SyntaxTree ParseWithRoundTripCheck(string text, CSharpParseOptions
trees,
references,
options);
- ValidateIOperations(createCompilationLambda);
+ CompilationExtensions.ValidateIOperations(createCompilationLambda);
return createCompilationLambda();
}
@@ -596,7 +596,7 @@ public static SyntaxTree ParseWithRoundTripCheck(string text, CSharpParseOptions
var trees = (sources == null) ? null : sources.Select(s => Parse(s, options: parseOptions)).ToArray();
Func createCompilationLambda = () => CSharpCompilation.Create(identity.Name, options: options ?? TestOptions.ReleaseDll, references: references, syntaxTrees: trees);
- ValidateIOperations(createCompilationLambda);
+ CompilationExtensions.ValidateIOperations(createCompilationLambda);
var c = createCompilationLambda();
Assert.NotNull(c.Assembly); // force creation of SourceAssemblySymbol
@@ -621,7 +621,7 @@ public static SyntaxTree ParseWithRoundTripCheck(string text, CSharpParseOptions
previousScriptCompilation: previous,
returnType: returnType,
globalsType: hostObjectType);
- ValidateIOperations(createCompilationLambda);
+ CompilationExtensions.ValidateIOperations(createCompilationLambda);
return createCompilationLambda();
}
@@ -644,7 +644,7 @@ public static SyntaxTree ParseWithRoundTripCheck(string text, CSharpParseOptions
previousScriptCompilation: previous,
returnType: returnType,
globalsType: hostObjectType);
- ValidateIOperations(createCompilationLambda);
+ CompilationExtensions.ValidateIOperations(createCompilationLambda);
return createCompilationLambda();
}
@@ -1253,13 +1253,6 @@ protected static void VerifyOperationTreeForTest(CSharpCompilation
return ilReference;
}
- private static void ValidateIOperations(Func createCompilation)
- {
-#if TEST_IOPERATION_INTERFACE
- var compilation = createCompilation();
- compilation.CheckOperations();
-#endif
- }
#endregion
#region Span
diff --git a/src/Compilers/Test/Utilities/VisualBasic/BasicCompilerTestUtilities.vbproj b/src/Compilers/Test/Utilities/VisualBasic/BasicCompilerTestUtilities.vbproj
index 10f831ed723090b957f7f8dfc234ac4d09e9aca4..4fb1d3998215f1b1047a537793513392458335e9 100644
--- a/src/Compilers/Test/Utilities/VisualBasic/BasicCompilerTestUtilities.vbproj
+++ b/src/Compilers/Test/Utilities/VisualBasic/BasicCompilerTestUtilities.vbproj
@@ -22,9 +22,6 @@
-
- $(DefineConstants),TEST_IOPERATION_INTERFACE
-
diff --git a/src/Compilers/Test/Utilities/VisualBasic/CompilationTestUtils.vb b/src/Compilers/Test/Utilities/VisualBasic/CompilationTestUtils.vb
index 3c411e56bce4f97123487a6f0ed0cdec40652e3b..443de354bc524b6b781bdc1410f12b80eef3783e 100644
--- a/src/Compilers/Test/Utilities/VisualBasic/CompilationTestUtils.vb
+++ b/src/Compilers/Test/Utilities/VisualBasic/CompilationTestUtils.vb
@@ -41,7 +41,7 @@ Friend Module CompilationUtils
references,
options)
End Function
- ValidateIOperations(createCompilationLambda)
+ CompilationExtensions.ValidateIOperations(createCompilationLambda)
Return createCompilationLambda()
End Function
@@ -76,7 +76,7 @@ Friend Module CompilationUtils
Return VisualBasicCompilation.Create(assemblyName, sourceTrees, metadataReferences, options)
End Function
- ValidateIOperations(createCompilationLambda)
+ CompilationExtensions.ValidateIOperations(createCompilationLambda)
Return createCompilationLambda()
End Function
@@ -106,7 +106,7 @@ Friend Module CompilationUtils
Dim createCompilationLambda = Function()
Return VisualBasicCompilation.Create(If(assemblyName, GetUniqueName()), sourceTrees, If(references Is Nothing, additionalRefs, additionalRefs.Concat(references)), options)
End Function
- ValidateIOperations(createCompilationLambda)
+ CompilationExtensions.ValidateIOperations(createCompilationLambda)
Return createCompilationLambda()
End Function
@@ -120,7 +120,7 @@ Friend Module CompilationUtils
Dim createCompilationLambda = Function()
Return VisualBasicCompilation.Create(If(assemblyName, GetUniqueName()), {Parse(source, parseOptions)}, If(references Is Nothing, additionalRefs, additionalRefs.Concat(references)), options)
End Function
- ValidateIOperations(createCompilationLambda)
+ CompilationExtensions.ValidateIOperations(createCompilationLambda)
Return createCompilationLambda()
End Function
@@ -131,7 +131,7 @@ Friend Module CompilationUtils
Dim createCompilationLambda = Function()
Return VisualBasicCompilation.Create(GetUniqueName(), sourceTrees, If(references Is Nothing, additionalRefs, additionalRefs.Concat(references)), options)
End Function
- ValidateIOperations(createCompilationLambda)
+ CompilationExtensions.ValidateIOperations(createCompilationLambda)
Return createCompilationLambda()
End Function
@@ -141,7 +141,7 @@ Friend Module CompilationUtils
Dim createCompilationLambda = Function()
Return VisualBasicCompilation.Create(GetUniqueName(), {sourceTree}, If(references Is Nothing, {MscorlibRef}, {MscorlibRef}.Concat(references)), options)
End Function
- ValidateIOperations(createCompilationLambda)
+ CompilationExtensions.ValidateIOperations(createCompilationLambda)
Return createCompilationLambda()
End Function
@@ -333,7 +333,7 @@ Friend Module CompilationUtils
Dim createCompilationLambda = Function()
Return VisualBasicCompilation.Create(If(assemblyName, GetUniqueName()), sourceTrees, references, options)
End Function
- ValidateIOperations(createCompilationLambda)
+ CompilationExtensions.ValidateIOperations(createCompilationLambda)
Return createCompilationLambda()
End Function
@@ -360,7 +360,7 @@ Friend Module CompilationUtils
Dim createCompilationLambda = Function()
Return VisualBasicCompilation.Create(identity.Name, trees, references, options)
End Function
- ValidateIOperations(createCompilationLambda)
+ CompilationExtensions.ValidateIOperations(createCompilationLambda)
Dim c = createCompilationLambda()
Assert.NotNull(c.Assembly) ' force creation of SourceAssemblySymbol
@@ -1289,11 +1289,4 @@ Friend Module CompilationUtils
Dim result = If(namespacesAndTypesOnly, model.LookupNamespacesAndTypes(position, container), model.LookupSymbols(position, container))
Return result.Select(Function(s) s.Name).Distinct().ToList()
End Function
-
- Private Sub ValidateIOperations(createCompilation As Func(Of Compilation))
-#If TEST_IOPERATION_INTERFACE Then
- Dim compilation = createCompilation()
- compilation.CheckOperations()
-#End If
- End Sub
End Module
diff --git a/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs b/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs
index c4328cae503ea892601b5cdcbcdfe15346aa903b..cd69843d2e6a408b54d4c6a407ccfa39d4dc09e3 100644
--- a/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs
+++ b/src/Test/Utilities/Portable/Compilation/CompilationExtensions.cs
@@ -251,8 +251,11 @@ internal static bool CanHaveExecutableCodeBlock(ISymbol symbol)
}
}
- public static void CheckOperations(this Compilation compilation)
+ public static void ValidateIOperations(Func createCompilation)
{
+#if TEST_IOPERATION_INTERFACE
+ var compilation = createCompilation();
+
foreach (var tree in compilation.SyntaxTrees)
{
var semanticModel = compilation.GetSemanticModel(tree);
@@ -268,6 +271,7 @@ public static void CheckOperations(this Compilation compilation)
}
}
}
+#endif
}
}
}
diff --git a/src/Test/Utilities/Portable/TestUtilities.csproj b/src/Test/Utilities/Portable/TestUtilities.csproj
index 5f34942b904514b6a5c2e0fbe4c48a316bd6ed40..82bb32e51fe6391f1ed1a0a7c7092d401543ac9e 100644
--- a/src/Test/Utilities/Portable/TestUtilities.csproj
+++ b/src/Test/Utilities/Portable/TestUtilities.csproj
@@ -23,6 +23,9 @@
+
+ $(DefineConstants);TEST_IOPERATION_INTERFACE
+