summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJingyu <jingm@microsoft.com>2018-12-30 12:56:11 +0800
committerJingyu <jingm@microsoft.com>2019-01-03 14:51:45 +0800
commit1435bdf6ed0498a7ea1013bcf48c7fbf23360197 (patch)
tree77e540c733f6e75d6bdabc37f09f4b083022c92b /tests
parent6ea2fd92b0e0ab2b9fcc006e06987e7558c4f933 (diff)
downloadcoreclr-1435bdf6ed0498a7ea1013bcf48c7fbf23360197.tar.gz
coreclr-1435bdf6ed0498a7ea1013bcf48c7fbf23360197.tar.bz2
coreclr-1435bdf6ed0498a7ea1013bcf48c7fbf23360197.zip
Check the optimize settings of JIT test projects.
This PR will output the projects that have mismatched optimize settings but won't fix them. This is part of tasks in #19166
Diffstat (limited to 'tests')
-rw-r--r--tests/src/JIT/CheckProjects/CheckProjects.cs91
1 files changed, 86 insertions, 5 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;
+ }
}