mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-30 21:55:31 +02:00
Bug 575018: Add repeatable iteration order for map used in test
The test used to fail on the -100.0 / 3.0 case if that was the first condition tested. This change forces that to not be the first condition tested which reduces the incidence of failures. This does not resolve the unknown underlying issue which appears to be on the GDB side that CDT is exposing. Upgrading GDB version may also resolve the test failures, but for now I am going with this fix so that we stop having UNSTABLE Jenkins CI builds. Change-Id: Ibfa93a8350cfc08adf721723bc07566521bed812
This commit is contained in:
parent
68c67b20a4
commit
871ee590c4
1 changed files with 8 additions and 7 deletions
|
@ -23,7 +23,9 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.cdt.core.IAddress;
|
||||
|
@ -198,7 +200,7 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
|
|||
MIStoppedEvent stoppedEvent = runToTag("testLocals_init");
|
||||
|
||||
// Create a map of expressions and their expected values.
|
||||
Map<String, String[]> tests = new HashMap<>();
|
||||
Map<String, String[]> tests = new LinkedHashMap<>();
|
||||
|
||||
tests.put("3.14159 + 1.1111", new String[] { "0x4", "04", "100", "4", "4.2526", "4.2526" });
|
||||
tests.put("100.0 / 3.0", new String[] { "0x21", "041", "100001", "33", "33.3333", "33.3333" });
|
||||
|
@ -2788,11 +2790,10 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
|
|||
// Now evaluate each of the above expressions and compare the actual
|
||||
// value against
|
||||
// the expected value.
|
||||
for (final String expressionToEvaluate : tests.keySet()) {
|
||||
|
||||
for (final Entry<String, String[]> test : tests.entrySet()) {
|
||||
// Get an IExpressionDMContext object representing the expression to
|
||||
// be evaluated.
|
||||
final IExpressionDMContext exprDMC = SyncUtil.createExpression(dmc, expressionToEvaluate);
|
||||
final IExpressionDMContext exprDMC = SyncUtil.createExpression(dmc, test.getKey());
|
||||
|
||||
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
||||
|
||||
|
@ -2840,7 +2841,7 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
|
|||
// object from the waiter.
|
||||
FormattedValueDMData exprValueDMData = getData();
|
||||
|
||||
final String[] expectedValues = tests.get(expressionToEvaluate);
|
||||
final String[] expectedValues = test.getValue();
|
||||
|
||||
// Check the value of the expression for correctness.
|
||||
String actualValue = exprValueDMData.getFormattedValue();
|
||||
|
@ -2875,8 +2876,8 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
|
|||
wait.waitFinished();
|
||||
} else {
|
||||
String errorMsg = "Failed to correctly evalutate '"
|
||||
+ expressionToEvaluate + "': expected '"
|
||||
+ expectedValue + "', got '" + actualValue + "'";
|
||||
+ test.getKey() + "': expected '" + expectedValue
|
||||
+ "', got '" + actualValue + "'";
|
||||
wait.waitFinished(new Status(IStatus.ERROR,
|
||||
TestsPlugin.PLUGIN_ID, errorMsg, null));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue