summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorCamilo Bernal2013-04-08 17:29:32 (EDT)
committer Sami Wagiaalla2013-04-10 13:01:23 (EDT)
commit0b2d9a5e9cc49dedcd00b1504f97ecd536140c8f (patch)
tree7489b8f7d066017e390f921fcf16728f2c0e7263
parent1634aa95b7e7d6c1644bd6c1abcb25fb1b4606e6 (diff)
downloadorg.eclipse.linuxtools-0b2d9a5e9cc49dedcd00b1504f97ecd536140c8f.zip
org.eclipse.linuxtools-0b2d9a5e9cc49dedcd00b1504f97ecd536140c8f.tar.gz
org.eclipse.linuxtools-0b2d9a5e9cc49dedcd00b1504f97ecd536140c8f.tar.bz2
Assume stap is installed in tests dealing with stap processes.refs/changes/37/11737/5
* Skip tests that depend on stap when the tool is unavailable. * Move stap installation check to o.e.l.systemtap.ui.tests. * Remove plugin.xml and activator from o.e.l.systemtap.ui.tests. Change-Id: I18ba65d8f903dd6018bb669750f415902b27629a Reviewed-on: https://git.eclipse.org/r/11737 Tested-by: Hudson CI Reviewed-by: Sami Wagiaalla <swagiaal@redhat.com> IP-Clean: Sami Wagiaalla <swagiaal@redhat.com> Tested-by: Sami Wagiaalla <swagiaal@redhat.com>
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/META-INF/MANIFEST.MF3
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/runnable/CommandTest.java7
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/META-INF/MANIFEST.MF1
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/editors/stp/STPCompletionProcessorTest.java26
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.tests/META-INF/MANIFEST.MF8
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.tests/build.properties3
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.tests/plugin.xml16
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.tests/src/org/eclipse/linuxtools/systemtap/ui/tests/SystemtapGuiTestsPlugin.java85
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.tests/src/org/eclipse/linuxtools/systemtap/ui/tests/SystemtapTest.java34
9 files changed, 56 insertions, 127 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.structures.tests/META-INF/MANIFEST.MF b/systemtap/org.eclipse.linuxtools.systemtap.structures.tests/META-INF/MANIFEST.MF
index 54fdcb7..f168023 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.structures.tests/META-INF/MANIFEST.MF
+++ b/systemtap/org.eclipse.linuxtools.systemtap.structures.tests/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: %bundleProvider
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
-Import-Package: org.junit,
+Import-Package: org.eclipse.linuxtools.systemtap.ui.tests,
+ org.junit,
org.junit.runner;version="4.10.0",
org.junit.runners;version="4.10.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/runnable/CommandTest.java b/systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/runnable/CommandTest.java
index 5ff72a6..d3aea93 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/runnable/CommandTest.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.structures.tests/src/org/eclipse/linuxtools/systemtap/structures/runnable/CommandTest.java
@@ -15,13 +15,15 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
import org.eclipse.linuxtools.systemtap.structures.runnable.Command;
+import org.eclipse.linuxtools.systemtap.ui.tests.SystemtapTest;
import org.junit.Before;
import org.junit.Test;
-public class CommandTest {
+public class CommandTest extends SystemtapTest{
@Before
public void setUp() {
@@ -50,6 +52,7 @@ public class CommandTest {
@Test
public void testIsFinished() {
+ assumeTrue(stapInstalled);
assertTrue("Not finished", tc.isRunning());
tc.stop();
assertFalse("Finished", tc.isRunning());
@@ -69,6 +72,7 @@ public class CommandTest {
@Test
public void testLoggedCommand() {
+ assumeTrue(stapInstalled);
tc.dispose();
tc = new Command(new String[] {"stap", "-v", "-p1", "-e", "probe nosuchfunc{}"}, null);
@@ -92,6 +96,7 @@ public class CommandTest {
@Test
public void testStop() {
+ assumeTrue(stapInstalled);
tc.start();
assertTrue(tc.isRunning());
tc.stop();
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/META-INF/MANIFEST.MF b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/META-INF/MANIFEST.MF
index 6e3923e..df5ae19 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/META-INF/MANIFEST.MF
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/META-INF/MANIFEST.MF
@@ -18,6 +18,7 @@ Require-Bundle: org.junit;bundle-version="4.10.0",
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Fragment-Host: org.eclipse.linuxtools.systemtap.ui.ide
Import-Package: org.apache.log4j,
+ org.eclipse.linuxtools.systemtap.ui.tests,
org.eclipse.swtbot.eclipse.finder,
org.eclipse.swtbot.forms.finder,
org.eclipse.swtbot.swt.finder,
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/editors/stp/STPCompletionProcessorTest.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/editors/stp/STPCompletionProcessorTest.java
index c2d8de2..5f8f458 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/editors/stp/STPCompletionProcessorTest.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/editors/stp/STPCompletionProcessorTest.java
@@ -15,8 +15,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
-import java.io.IOException;
-
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
@@ -24,10 +22,10 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp.STPCompletionProcessor;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp.STPDocumentProvider;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp.STPEditor;
-import org.eclipse.linuxtools.tools.launch.core.factory.RuntimeProcessFactory;
+import org.eclipse.linuxtools.systemtap.ui.tests.SystemtapTest;
import org.junit.Test;
-public class STPCompletionProcessorTest {
+public class STPCompletionProcessorTest extends SystemtapTest{
private static String TEST_STP_SCRIPT = ""+
"\n"+
@@ -104,7 +102,7 @@ public class STPCompletionProcessorTest {
@Test
public void testProbeCompletion() throws BadLocationException {
- assumeTrue(stapInstalled());
+ assumeTrue(stapInstalled);
String prefix = "probe ";
ICompletionProposal[] proposals = getCompletionsForPrefix(prefix);
assertTrue(proposalsContain(proposals, "syscall"));
@@ -113,7 +111,7 @@ public class STPCompletionProcessorTest {
@Test
public void testMultiProbeCompletion() throws BadLocationException {
- assumeTrue(stapInstalled());
+ assumeTrue(stapInstalled);
String prefix = "probe begin,e";
ICompletionProposal[] proposals = getCompletionsForPrefix(prefix);
assertTrue(proposalsContain(proposals, "end"));
@@ -139,7 +137,7 @@ public class STPCompletionProcessorTest {
@Test
public void testEndProbeCompletion() throws BadLocationException {
- assumeTrue(stapInstalled());
+ assumeTrue(stapInstalled);
Document testDocument = new Document(TEST_STP_SCRIPT);
@SuppressWarnings("unused")
@@ -163,7 +161,7 @@ public class STPCompletionProcessorTest {
@Test
public void testProbeVariableCompletion() throws BadLocationException {
- assumeTrue(stapInstalled());
+ assumeTrue(stapInstalled);
Document testDocument = new Document(TEST_STP_SCRIPT);
@SuppressWarnings("unused")
@@ -217,19 +215,9 @@ public class STPCompletionProcessorTest {
return proposals;
}
- private boolean stapInstalled(){
- try {
- Process process = RuntimeProcessFactory.getFactory().exec(new String[]{"stap", "-V"}, null);
- return (process != null);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return false;
- }
-
@Test
public void testFunctionCompletion() throws BadLocationException {
- assumeTrue(stapInstalled());
+ assumeTrue(stapInstalled);
Document testDocument = new Document(TEST_STP_SCRIPT);
@SuppressWarnings("unused")
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/META-INF/MANIFEST.MF b/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/META-INF/MANIFEST.MF
index 4184558..9d7512b 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/META-INF/MANIFEST.MF
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/META-INF/MANIFEST.MF
@@ -1,13 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
-Bundle-SymbolicName: org.eclipse.linuxtools.systemtap.ui.tests;singleton:=true
+Bundle-SymbolicName: org.eclipse.linuxtools.systemtap.ui.tests
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
-Bundle-Activator: org.eclipse.linuxtools.systemtap.ui.tests.SystemTapGuiTestsPlugin
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.linuxtools.systemtap.ui.tests
+Import-Package: org.eclipse.linuxtools.tools.launch.core.factory,
+ org.junit;version="4.10.0"
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/build.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/build.properties
index 3d29bf7..1c8ddd3 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/build.properties
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/build.properties
@@ -1,8 +1,7 @@
bin.includes = META-INF/,\
about.html,\
plugin.properties,\
- .,\
- plugin.xml
+ .
jars.compile.order = .
source.. = src/
output.. = bin/
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/plugin.xml b/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/plugin.xml
deleted file mode 100644
index a8be151..0000000
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/plugin.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension
- point="org.eclipse.debug.core.launchDelegates">
- <launchDelegate
- delegate="org.eclipse.linuxtools.systemtap.ui.tests.SystemtapGuiTestLaunchDelegate"
- id="org.eclipse.linuxtools.systemtap.ui.tests.launchDelegate"
- modes="profile"
- sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
- sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
- type="org.eclipse.linuxtools.systemtap.ui.launch.systemtapguiLaunch">
- </launchDelegate>
- </extension>
-
-</plugin>
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/src/org/eclipse/linuxtools/systemtap/ui/tests/SystemtapGuiTestsPlugin.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/src/org/eclipse/linuxtools/systemtap/ui/tests/SystemtapGuiTestsPlugin.java
deleted file mode 100644
index 47651af..0000000
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/src/org/eclipse/linuxtools/systemtap/ui/tests/SystemtapGuiTestsPlugin.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Elliott Baron <ebaron@redhat.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.systemtap.ui.tests;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-public class SystemtapGuiTestsPlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.linuxtools.systemtap.ui.tests"; //$NON-NLS-1$
-
- // Test Launch Delegate ID
- public static final String DELEGATE_ID = PLUGIN_ID + ".launchDelegate"; //$NON-NLS-1$
-
- // Java Runtime System Properties
-
- /**
- * usage: -Declipse.valgrind.tests.generateFiles=<yes|no> [default: no]
- * if yes, will run Valgrind and store its output files for each test under
- * <plugin root>/valgrindFiles
- * no, will use default output directory for valgrind's output
- */
- public static final String SYSTEM_PROPERTY_GENERATE_FILES = "eclipse.valgrind.tests.generateFiles"; //$NON-NLS-1$
- public static final boolean GENERATE_FILES = System.getProperty(SYSTEM_PROPERTY_GENERATE_FILES, "no").equals("yes"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * usage: -Declipse.valgrind.tests.runValgrind=<yes|no> [default: yes]
- * if yes, will run Valgrind as in a normal launch
- * no, will simulate Valgrind execution with pregenerated log files
- */
- 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$
-
- // 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$
-
- // The shared instance
- private static SystemtapGuiTestsPlugin plugin;
-
- /**
- * The constructor
- */
- public SystemtapGuiTestsPlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static SystemtapGuiTestsPlugin getDefault() {
- return plugin;
- }
-
-}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/src/org/eclipse/linuxtools/systemtap/ui/tests/SystemtapTest.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/src/org/eclipse/linuxtools/systemtap/ui/tests/SystemtapTest.java
new file mode 100644
index 0000000..e159299
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.tests/src/org/eclipse/linuxtools/systemtap/ui/tests/SystemtapTest.java
@@ -0,0 +1,34 @@
+package org.eclipse.linuxtools.systemtap.ui.tests;
+
+import java.io.IOException;
+
+import org.eclipse.linuxtools.tools.launch.core.factory.RuntimeProcessFactory;
+import org.junit.BeforeClass;
+
+/**
+ * Generic utilities for systemtap tests.
+ */
+public class SystemtapTest {
+ public static boolean stapInstalled;
+
+ @BeforeClass
+ public static void checkStapInstalled() {
+ stapInstalled = SystemtapTest.stapInstalled();
+ }
+
+ /**
+ * Check that stap is installed
+ *
+ * @return true if stap is installed, false otherwise.
+ */
+ public static boolean stapInstalled() {
+ try {
+ Process process = RuntimeProcessFactory.getFactory().exec(
+ new String[] { "stap", "-V" }, null);
+ return (process != null);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+}