diff options
author | Andy Ayers <andya@microsoft.com> | 2019-01-09 17:41:39 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-09 17:41:39 -0800 |
commit | 15fbd7d1d118252b2c9077ff56786e071053a2d6 (patch) | |
tree | 32061f5c9152b846db11193ff7e1b015f97d1b30 /tests/src | |
parent | dbf50d82754a894ba53781dbb839198a46605c9f (diff) | |
parent | efde54b27244571ae733c9277b30d2be62e8313b (diff) | |
download | coreclr-15fbd7d1d118252b2c9077ff56786e071053a2d6.tar.gz coreclr-15fbd7d1d118252b2c9077ff56786e071053a2d6.tar.bz2 coreclr-15fbd7d1d118252b2c9077ff56786e071053a2d6.zip |
Merge pull request #21779 from mazong1123/fix-19166-checkproj-opt
Check the optimize settings of JIT test projects.
Diffstat (limited to 'tests/src')
12 files changed, 87 insertions, 36 deletions
diff --git a/tests/src/JIT/CheckProjects/CheckProjects.cs b/tests/src/JIT/CheckProjects/CheckProjects.cs index abc0ff0457..ec87ed9599 100644 --- a/tests/src/JIT/CheckProjects/CheckProjects.cs +++ b/tests/src/JIT/CheckProjects/CheckProjects.cs @@ -122,11 +122,15 @@ internal class ScanProjectFiles bool hasReleaseCondition = false; bool hasDebugCondition = false; string oddness = null; + string optimizeOddness = null; string debugVal = null; + string optimizeVal = null; bool needsFix = false; XElement bestPropertyGroupNode = null; XElement lastPropertyGroupNode = null; List<XElement> debugTypePropertyGroupNodes = new List<XElement>(); + List<XElement> optimizePropertyGroupNodes = new List<XElement>(); + foreach (XElement prop in props) { lastPropertyGroupNode = prop; @@ -185,6 +189,24 @@ internal class ScanProjectFiles } } } + + XElement optimize = prop.Element(nn + "Optimize"); + if (optimize != null) + { + optimizePropertyGroupNodes.Add(optimize); + string newOptimizeVal = optimize.Value; + if (string.IsNullOrWhiteSpace(newOptimizeVal)) + { + newOptimizeVal = "False"; + } + + if (optimizeVal != null && !optimizeVal.Equals(newOptimizeVal, StringComparison.InvariantCultureIgnoreCase)) + { + optimizeOddness = "MultipleConflictValues"; + } + + optimizeVal = newOptimizeVal; + } } if (oddness == null) @@ -200,6 +222,7 @@ internal class ScanProjectFiles } bool hasDebugType = debugTypePropertyGroupNodes.Count > 0; + bool hasOptimize = optimizePropertyGroupNodes.Count > 0; // Analyze suffix convention mismatches string suffixNote = "SuffixNone"; @@ -253,11 +276,6 @@ internal class ScanProjectFiles needsFix = true; } - if (needsFix) - { - s_needsFixCount++; - } - if (needsFix || !s_showNeedsFixOnly) { if (!hasDebugType) @@ -278,6 +296,44 @@ internal class ScanProjectFiles } } + if (optimizeOddness != null) + { + needsFix = true; + } + + if (!needsFix) + { + if (isOptTypeTest) + { + needsFix = DetermineIfOptimizeSettingNeedsFix(true, optimizeVal); + } + else if (isNotOptTypeTest) + { + needsFix = DetermineIfOptimizeSettingNeedsFix(false, optimizeVal); + } + } + + if (needsFix || !s_showNeedsFixOnly) + { + if (!hasOptimize) + { + Console.WriteLine("{0} Optimize-n/a", projFile); + } + else if (optimizeOddness != null) + { + Console.WriteLine("{0} Optimize-Odd-{1}", projFile, optimizeOddness); + } + else + { + Console.WriteLine("{0} Optimize-{1}-Conflict", projFile, optimizeVal); + } + } + + if (needsFix) + { + s_needsFixCount++; + } + // If a fix is needed, give it a shot! if (!needsFix || !tryUpdate) { @@ -419,4 +475,29 @@ internal class ScanProjectFiles return updated; } + + /// <summary> + /// Determines if optimize setting needs to fix. + /// </summary> + /// <param name="isOptType">Whether a optimization is specified. This is the baseline for checking.</param> + /// <param name="optimizeVal">The optimize value in the project file's <Optimize /> property.</param> + /// <returns>True if a fix is needed. Otherwise false.</returns> + private static bool DetermineIfOptimizeSettingNeedsFix(bool isOptType, string optimizeVal) + { + if (isOptType && optimizeVal == null) + { + return true; + } + + if (optimizeVal != null) + { + string expectedOptimizeValue = isOptType.ToString(); + if (!optimizeVal.Equals(expectedOptimizeValue, StringComparison.InvariantCultureIgnoreCase)) + { + return true; + } + } + + return false; + } } diff --git a/tests/src/JIT/Methodical/nonvirtualcall/classic_r.ilproj b/tests/src/JIT/Methodical/nonvirtualcall/classic_r.ilproj index b5f0bdbfae..adf8824efa 100644 --- a/tests/src/JIT/Methodical/nonvirtualcall/classic_r.ilproj +++ b/tests/src/JIT/Methodical/nonvirtualcall/classic_r.ilproj @@ -25,9 +25,6 @@ <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> - <PropertyGroup> - <Optimize>True</Optimize> - </PropertyGroup> <ItemGroup> <Compile Include="classic.il" /> </ItemGroup> diff --git a/tests/src/JIT/Methodical/nonvirtualcall/delegate_r.ilproj b/tests/src/JIT/Methodical/nonvirtualcall/delegate_r.ilproj index 45aaf274fd..5c47a0c4c3 100644 --- a/tests/src/JIT/Methodical/nonvirtualcall/delegate_r.ilproj +++ b/tests/src/JIT/Methodical/nonvirtualcall/delegate_r.ilproj @@ -25,9 +25,6 @@ <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> - <PropertyGroup> - <Optimize>True</Optimize> - </PropertyGroup> <ItemGroup> <Compile Include="delegate.il" /> </ItemGroup> diff --git a/tests/src/JIT/Methodical/nonvirtualcall/generics2_r.ilproj b/tests/src/JIT/Methodical/nonvirtualcall/generics2_r.ilproj index 7e19440a1d..a216e07a6a 100644 --- a/tests/src/JIT/Methodical/nonvirtualcall/generics2_r.ilproj +++ b/tests/src/JIT/Methodical/nonvirtualcall/generics2_r.ilproj @@ -24,9 +24,6 @@ <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> - <PropertyGroup> - <Optimize>True</Optimize> - </PropertyGroup> <ItemGroup> <Compile Include="generics2.il" /> </ItemGroup> diff --git a/tests/src/JIT/Methodical/nonvirtualcall/generics_r.ilproj b/tests/src/JIT/Methodical/nonvirtualcall/generics_r.ilproj index 1ad30cc51e..bf8d45cf7d 100644 --- a/tests/src/JIT/Methodical/nonvirtualcall/generics_r.ilproj +++ b/tests/src/JIT/Methodical/nonvirtualcall/generics_r.ilproj @@ -25,9 +25,6 @@ <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> - <PropertyGroup> - <Optimize>True</Optimize> - </PropertyGroup> <ItemGroup> <Compile Include="generics.il" /> </ItemGroup> diff --git a/tests/src/JIT/Methodical/nonvirtualcall/tailcall_r.ilproj b/tests/src/JIT/Methodical/nonvirtualcall/tailcall_r.ilproj index cb5dd9ea28..c2f94f999f 100644 --- a/tests/src/JIT/Methodical/nonvirtualcall/tailcall_r.ilproj +++ b/tests/src/JIT/Methodical/nonvirtualcall/tailcall_r.ilproj @@ -23,9 +23,6 @@ <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> - <PropertyGroup> - <Optimize>True</Optimize> - </PropertyGroup> <ItemGroup> <Compile Include="tailcall.il" /> </ItemGroup> diff --git a/tests/src/JIT/Methodical/nonvirtualcall/valuetype_r.ilproj b/tests/src/JIT/Methodical/nonvirtualcall/valuetype_r.ilproj index fc6510ff09..6754e067c2 100644 --- a/tests/src/JIT/Methodical/nonvirtualcall/valuetype_r.ilproj +++ b/tests/src/JIT/Methodical/nonvirtualcall/valuetype_r.ilproj @@ -24,9 +24,6 @@ <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> - <PropertyGroup> - <Optimize>True</Optimize> - </PropertyGroup> <ItemGroup> <Compile Include="valuetype.il" /> </ItemGroup> diff --git a/tests/src/JIT/SIMD/Vector3Interop_ro.csproj b/tests/src/JIT/SIMD/Vector3Interop_ro.csproj index a00ad8b6bf..f1ef6348e5 100644 --- a/tests/src/JIT/SIMD/Vector3Interop_ro.csproj +++ b/tests/src/JIT/SIMD/Vector3Interop_ro.csproj @@ -20,7 +20,7 @@ </ItemGroup> <PropertyGroup> <DebugType>None</DebugType> - <Optimize></Optimize> + <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> diff --git a/tests/src/JIT/jit64/mcc/interop/mcc_i10.ilproj b/tests/src/JIT/jit64/mcc/interop/mcc_i10.ilproj index f65d6e0e18..25bea03b87 100644 --- a/tests/src/JIT/jit64/mcc/interop/mcc_i10.ilproj +++ b/tests/src/JIT/jit64/mcc/interop/mcc_i10.ilproj @@ -28,9 +28,6 @@ <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> - <PropertyGroup> - <Optimize>False</Optimize> - </PropertyGroup> <ItemGroup> <Compile Include="mcc_i10.il ..\common\common.il" /> </ItemGroup> diff --git a/tests/src/JIT/jit64/mcc/interop/mcc_i11.ilproj b/tests/src/JIT/jit64/mcc/interop/mcc_i11.ilproj index 053d45dd66..5dcceb9bdd 100644 --- a/tests/src/JIT/jit64/mcc/interop/mcc_i11.ilproj +++ b/tests/src/JIT/jit64/mcc/interop/mcc_i11.ilproj @@ -28,9 +28,6 @@ <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> - <PropertyGroup> - <Optimize>False</Optimize> - </PropertyGroup> <ItemGroup> <Compile Include="mcc_i11.il ..\common\common.il" /> </ItemGroup> diff --git a/tests/src/JIT/jit64/mcc/interop/mcc_i12.ilproj b/tests/src/JIT/jit64/mcc/interop/mcc_i12.ilproj index fae559f903..4316738eb2 100644 --- a/tests/src/JIT/jit64/mcc/interop/mcc_i12.ilproj +++ b/tests/src/JIT/jit64/mcc/interop/mcc_i12.ilproj @@ -28,9 +28,6 @@ <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> - <PropertyGroup> - <Optimize>False</Optimize> - </PropertyGroup> <ItemGroup> <Compile Include="mcc_i12.il ..\common\common.il" /> </ItemGroup> diff --git a/tests/src/JIT/jit64/mcc/interop/mcc_i13.ilproj b/tests/src/JIT/jit64/mcc/interop/mcc_i13.ilproj index aa8d74d31b..77d1a18dbf 100644 --- a/tests/src/JIT/jit64/mcc/interop/mcc_i13.ilproj +++ b/tests/src/JIT/jit64/mcc/interop/mcc_i13.ilproj @@ -28,9 +28,6 @@ <Visible>False</Visible> </CodeAnalysisDependentAssemblyPaths> </ItemGroup> - <PropertyGroup> - <Optimize>False</Optimize> - </PropertyGroup> <ItemGroup> <Compile Include="mcc_i13.il ..\common\common.il" /> </ItemGroup> |