aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamilo Bernal2013-05-02 10:38:14 (EDT)
committerAlexander Kurtakov2013-05-07 04:05:29 (EDT)
commit4c7fa4cc4764d21ad1cbe77bd6eb15c80ec0b8d2 (patch)
treea5ede9fc832b9e4c7c135b6daf4713ea1cbdd4a5
parent4f8a90c452b0dca690e29a8a2569b7321d47fb2d (diff)
downloadorg.eclipse.linuxtools-4c7fa4cc4764d21ad1cbe77bd6eb15c80ec0b8d2.zip
org.eclipse.linuxtools-4c7fa4cc4764d21ad1cbe77bd6eb15c80ec0b8d2.tar.gz
org.eclipse.linuxtools-4c7fa4cc4764d21ad1cbe77bd6eb15c80ec0b8d2.tar.bz2
Valgrind: Add minimum version check to RUN_VALGRIND tests flag.refs/changes/39/12539/2
Check that the minimum version requirement of Valgrind is met and update the RUN_VALGRIND flag accordingly. Change-Id: Ic1f4bfeae7b5978ac7846d9ce041cf3b0efc5336 Reviewed-on: https://git.eclipse.org/r/12539 Tested-by: Hudson CI Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> IP-Clean: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/tests/AbstractValgrindTest.java2
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/tests/ValgrindTestsPlugin.java28
2 files changed, 28 insertions, 2 deletions
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/tests/AbstractValgrindTest.java b/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/tests/AbstractValgrindTest.java
index 90d470a..4be243a 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/tests/AbstractValgrindTest.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/tests/AbstractValgrindTest.java
@@ -112,7 +112,7 @@ public abstract class AbstractValgrindTest extends AbstractTest {
launches.add(launch);
delegate.launch(config, ILaunchManager.PROFILE_MODE, launch, null);
- if (ValgrindTestsPlugin.GENERATE_FILES) {
+ if (ValgrindTestsPlugin.GENERATE_FILES && ValgrindTestsPlugin.versionSupported()) {
unbindLocation(pathToFiles);
}
return launch;
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/tests/ValgrindTestsPlugin.java b/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/tests/ValgrindTestsPlugin.java
index afd570f..129d8d2 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/tests/ValgrindTestsPlugin.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.tests/src/org/eclipse/linuxtools/internal/valgrind/tests/ValgrindTestsPlugin.java
@@ -10,12 +10,19 @@
*******************************************************************************/
package org.eclipse.linuxtools.internal.valgrind.tests;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.linuxtools.internal.valgrind.launch.ValgrindLaunchPlugin;
+import org.osgi.framework.Version;
+
public class ValgrindTestsPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.linuxtools.valgrind.tests"; //$NON-NLS-1$
+ // The minimum valgrind version supported for testing
+ private static final Version MIN_TEST_VER = new Version(3, 7, 0);
+
// Java Runtime System Properties
/**
* usage: -Declipse.valgrind.tests.generateFiles=<yes|no> [default: no]
@@ -33,9 +40,28 @@ public class ValgrindTestsPlugin {
*/
public static final String SYSTEM_PROPERTY_RUN_VALGRIND = "eclipse.valgrind.tests.runValgrind"; //$NON-NLS-1$
// generateFiles implies runValgrind
- public static final boolean RUN_VALGRIND = GENERATE_FILES || System.getProperty(SYSTEM_PROPERTY_RUN_VALGRIND, "yes").equals("yes"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final boolean RUN_VALGRIND = (GENERATE_FILES || System.getProperty(SYSTEM_PROPERTY_RUN_VALGRIND, "yes").equals("yes")) //$NON-NLS-1$ //$NON-NLS-2$
+ && versionSupported();
// Launch config attribute to mock valgrind's exit code
public static final String ATTR_MOCK_EXIT_CODE = PLUGIN_ID + ".MOCK_EXIT_CODE"; //$NON-NLS-1$
+ /**
+ * Compare currently available Valgrind version against the minimum
+ * supported testing version.
+ *
+ * @return <code>true</code> if the current valgrind version is greater than
+ * or equal to the minimum supported test version, and
+ * <code>false</code> otherwise.
+ */
+ public static boolean versionSupported() {
+ Version valgrindVersion = new Version(0, 0, 0);
+ try {
+ valgrindVersion = ValgrindLaunchPlugin.getDefault()
+ .getValgrindVersion(null);
+ } catch (CoreException e) {
+ return false;
+ }
+ return valgrindVersion.compareTo(MIN_TEST_VER) >= 0;
+ }
}