diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java index 5d79edeb42a..eb05cfd9f31 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java @@ -217,16 +217,29 @@ public abstract class BaseParametrizedTestCase extends BaseTestCase { String[] expectedParts = expected.split("\\."); //$NON-NLS-1$ String[] actualParts = actual.split("\\."); //$NON-NLS-1$ - String comparableActualString = actual; - if (expectedParts.length == 2 // If the expected version does not care about the maintenance number - && actualParts.length > 2) { // and the actual version has a maintenance number (and possibly more) - // We should ignore the maintenance number. - // For example, if we expect 7.12, then the actual - // version we should accept can be 7.12 or 7.12.1 or 7.12.2, 7.12.50.20170214, etc. - int firstDot = actual.indexOf('.'); - int secondDot = actual.indexOf('.', firstDot + 1); - comparableActualString = actual.substring(0, secondDot); + + // Starting in GDB 9 the versions are MAJOR.PATCH so we only care about first number + int majorVersion = Integer.parseInt(expectedParts[0]); + if (majorVersion >= 9) { + if (expectedParts.length == 1 // If the expected version does not care about the maintenance number + && actualParts.length > 1) { // and the actual version has a maintenance number (and possibly more) + // We should ignore the maintenance number. + // For example, if we expect 11, then the actual + // version we should accept can be 11.1 or 11.0.50 or 11.0.50.20210303-git, etc. + int firstDot = actual.indexOf('.'); + comparableActualString = actual.substring(0, firstDot); + } + } else { + if (expectedParts.length == 2 // If the expected version does not care about the maintenance number + && actualParts.length > 2) { // and the actual version has a maintenance number (and possibly more) + // We should ignore the maintenance number. + // For example, if we expect 7.12, then the actual + // version we should accept can be 7.12 or 7.12.1 or 7.12.2, 7.12.50.20170214, etc. + int firstDot = actual.indexOf('.'); + int secondDot = actual.indexOf('.', firstDot + 1); + comparableActualString = actual.substring(0, secondDot); + } } assertTrue("Unexpected GDB version. Expected " + expected + " actual " + actual, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/ITestConstants.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/ITestConstants.java index 26a9ffb4160..5b36f90e9a4 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/ITestConstants.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/ITestConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 Ericsson and others. + * Copyright (c) 2010, 2021 Ericsson and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -36,9 +36,14 @@ public class ITestConstants { public static final String SUFFIX_GDB_8_0 = "8.0"; public static final String SUFFIX_GDB_8_1 = "8.1"; public static final String SUFFIX_GDB_8_2 = "8.2"; + public static final String SUFFIX_GDB_8_3 = "8.3"; + // From GDB 9 the number scheme changed to MAJOR.PATCH so 9.2 is a patch for 9.1 release + public static final String SUFFIX_GDB_9 = "9"; + public static final String SUFFIX_GDB_10 = "10"; public static String[] ALL_SUPPORTED_VERSIONS = new String[] { // add new versions here + ITestConstants.SUFFIX_GDB_10, ITestConstants.SUFFIX_GDB_9, ITestConstants.SUFFIX_GDB_8_3, ITestConstants.SUFFIX_GDB_8_2, ITestConstants.SUFFIX_GDB_8_1, ITestConstants.SUFFIX_GDB_8_0, ITestConstants.SUFFIX_GDB_7_12, ITestConstants.SUFFIX_GDB_7_11, ITestConstants.SUFFIX_GDB_7_10, ITestConstants.SUFFIX_GDB_7_9, ITestConstants.SUFFIX_GDB_7_8, ITestConstants.SUFFIX_GDB_7_7,