Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferrazzutti2014-07-17 14:56:40 +0000
committerAlexander Kurtakov2014-07-31 16:01:48 +0000
commit4a8b0d59e506175350c5ba59c7cdbbffbff52756 (patch)
tree8b4c931c15eec3cdee565dba472d958703823a39 /systemtap
parent7653d553f085a15d41397fa69fc61689445fa6a0 (diff)
downloadorg.eclipse.linuxtools-4a8b0d59e506175350c5ba59c7cdbbffbff52756.tar.gz
org.eclipse.linuxtools-4a8b0d59e506175350c5ba59c7cdbbffbff52756.tar.xz
org.eclipse.linuxtools-4a8b0d59e506175350c5ba59c7cdbbffbff52756.zip
Systemtap: Allow more simultaneous run scenarios.
EBZ #439834, #439836 Change-Id: Id90c62dd91246a4446181c8ed192deae2e54887c Signed-off-by: Andrew Ferrazzutti <aferrazz@redhat.com> Reviewed-on: https://git.eclipse.org/r/30594 Tested-by: Hudson CI Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'systemtap')
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ScriptConsole.java9
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/Messages.java1
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/RunScriptHandler.java38
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/messages.properties1
4 files changed, 21 insertions, 28 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ScriptConsole.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ScriptConsole.java
index 70a74911d5..88b80aa788 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ScriptConsole.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.consolelog/src/org/eclipse/linuxtools/systemtap/ui/consolelog/structures/ScriptConsole.java
@@ -99,7 +99,7 @@ public class ScriptConsole extends IOConsole {
for (IConsole consoleIterator : ic) {
if (consoleIterator instanceof ScriptConsole) {
ScriptConsole activeConsole = (ScriptConsole) consoleIterator;
- if (activeConsole.getName().endsWith(name) && activeConsole.isRunning()) {
+ if (activeConsole.nameMatchesString(name) && activeConsole.isRunning()) {
return true;
}
}
@@ -127,7 +127,7 @@ public class ScriptConsole extends IOConsole {
for (IConsole consoleIterator : ic) {
if (consoleIterator instanceof ScriptConsole) {
activeConsole = (ScriptConsole) consoleIterator;
- if (activeConsole.getName().endsWith(name)) {
+ if (activeConsole.nameMatchesString(name)) {
//Stop any script currently running.
if (activeConsole.onCmdStopThread != null && activeConsole.onCmdStopThread.isAlive()) {
activeConsole.onCmdStopThread.interrupt();
@@ -160,6 +160,11 @@ public class ScriptConsole extends IOConsole {
return console;
}
+ private boolean nameMatchesString(String name) {
+ return getName().replace(Localization.getString(
+ "ScriptConsole.Terminated"), "").equals(name); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
/**
* This method will check to see if any scripts are currently running.
* @return - boolean indicating whether any scripts are running
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/Messages.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/Messages.java
index 5adb922c70..31ed3731a3 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/Messages.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/Messages.java
@@ -20,6 +20,7 @@ public class Messages extends NLS {
public static String RunScriptHandler_InvalidScriptMessage;
public static String RunScriptHandler_AlreadyRunningDialogTitle;
public static String RunScriptHandler_AlreadyRunningDialogMessage;
+ public static String RunScriptHandler_NonLocalTitle;
public static String RunScriptChartHandler_couldNotSwitchToGraphicPerspective;
public static String DataSetFileExtension;
public static String ExportDataSetAction_DialogTitle;
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/RunScriptHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/RunScriptHandler.java
index fb14ccfcec..74185fd7cf 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/RunScriptHandler.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/RunScriptHandler.java
@@ -18,7 +18,6 @@ import java.net.URI;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.core.commands.AbstractHandler;
@@ -80,7 +79,6 @@ public class RunScriptHandler extends AbstractHandler {
private IEditorPart targetEditor = null;
private String fileName = null;
private String tmpfileName = null;
- private String serverfileName = null;
private IPath path = null;
private IProject project = null;
private SystemTapScriptLaunch launch = null;
@@ -170,7 +168,7 @@ public class RunScriptHandler extends AbstractHandler {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- String name = !local ? serverfileName : fileName;
+ String name = getConsoleName();
if (ScriptConsole.instanceIsRunning(name)) {
MessageDialog dialog = new MessageDialog(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
@@ -197,6 +195,12 @@ public class RunScriptHandler extends AbstractHandler {
});
}
+ private String getConsoleName() {
+ return getRunLocal() ? fileName :
+ MessageFormat.format(Messages.RunScriptHandler_NonLocalTitle,
+ fileName, remoteOptions.userName, remoteOptions.hostName);
+ }
+
/**
* Once a console for running the script has been created this
* function is called so that observers can be added for example
@@ -291,8 +295,7 @@ public class RunScriptHandler extends AbstractHandler {
private void prepareNonLocalScript() throws ExecutionException {
try {
ScpClient scpclient = new ScpClient(remoteOptions);
- serverfileName = getFileName(fileName);
- tmpfileName = new Path("/tmp").append(serverfileName).toOSString(); //$NON-NLS-1$
+ tmpfileName = new Path("/tmp").append(getFileName(fileName)).toOSString(); //$NON-NLS-1$
scpclient.transfer(fileName, tmpfileName);
} catch (final JSchException | IOException e) {
String message = e instanceof JSchException
@@ -393,37 +396,20 @@ public class RunScriptHandler extends AbstractHandler {
* @since 2.0
*/
private String[] finalizeScript() throws ExecutionException {
- boolean local = getRunLocal();
- String modname;
- if (!local) {
- modname = getFileNameWithoutExtension(serverfileName);
- }
- /* We need to remove the directory prefix here because in the case of
- * running the script remotely, this is already done. Not doing so
- * causes a modname error.
- */
- else {
- modname = getFileNameWithoutExtension(getFileName(fileName));
- }
-
// Make sure script name only contains underscores and/or alphanumeric characters.
- Pattern validModName = Pattern.compile("^[a-z0-9_A-Z]+$"); //$NON-NLS-1$
- Matcher modNameMatch = validModName.matcher(modname);
- if (!modNameMatch.matches()) {
+ if (!Pattern.matches("^[a-z0-9_A-Z]+$", //$NON-NLS-1$
+ getFileNameWithoutExtension(getFileName(fileName)))) {
continueRun = false;
throw new ExecutionException(Messages.RunScriptHandler_InvalidScriptMessage);
}
- String[] script = new String[cmdList.size() + 4];
+ String[] script = new String[cmdList.size() + 2];
script[0] = "stap"; //$NON-NLS-1$
- script[script.length - 1] = !local ? tmpfileName : fileName;
+ script[script.length - 1] = !getRunLocal() ? tmpfileName : fileName;
for (int i = 0; i < cmdList.size(); i++) {
script[i + 1] = cmdList.get(i);
}
- script[script.length - 3] = "-m"; //$NON-NLS-1$
-
- script[script.length - 2] = modname;
return script;
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/messages.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/messages.properties
index b5857d3adf..b225486f78 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/messages.properties
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/handlers/messages.properties
@@ -12,6 +12,7 @@
RunScriptHandler_InvalidScriptMessage=Script name must only contain characters 'a'-'z','A'-'Z', '0'-'9' and '_'
RunScriptHandler_AlreadyRunningDialogTitle=Script Already Running
RunScriptHandler_AlreadyRunningDialogMessage=An instance of {0} is already running, and multiple instances cannot be running at the same time. Would you like to terminate it and start a new run?
+RunScriptHandler_NonLocalTitle={0}: on {1}@{2}
RunScriptChartHandler_couldNotSwitchToGraphicPerspective=Could not open the Graph Selector Editor.
DataSetFileExtension=*.set

Back to the top