use of org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.StapErrorParser in project linuxtools by eclipse.
the class RunScriptHandler method executeAction.
private void executeAction(ExecutionEvent event) throws ExecutionException {
final boolean local = getRunLocal();
findTargetEditor(event);
findFilePath();
tryEditorSave(event);
if (!local) {
prepareNonLocalScript();
}
final String[] script = buildStandardScript();
final String[] envVars = EnvironmentVariablesPreferencePage.getEnvironmentVariables();
Display.getDefault().asyncExec(() -> {
String name = getConsoleName();
if (ScriptConsole.instanceIsRunning(name)) {
MessageDialog dialog = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.RunScriptHandler_AlreadyRunningDialogTitle, null, MessageFormat.format(Messages.RunScriptHandler_AlreadyRunningDialogMessage, fileName), MessageDialog.QUESTION, new String[] { "Yes", "No" }, // $NON-NLS-1$ //$NON-NLS-2$
0);
if (dialog.open() != Window.OK) {
if (launch != null) {
launch.forceRemove();
}
return;
}
}
final ScriptConsole console = ScriptConsole.getInstance(name);
if (!local) {
console.run(script, envVars, remoteOptions, new StapErrorParser());
} else {
console.runLocally(script, envVars, new StapErrorParser(), getProject());
}
scriptConsoleInitialized(console);
});
}
use of org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.StapErrorParser in project linuxtools by eclipse.
the class StapErrorParserTest method testStapErrorParser.
@Test
public void testStapErrorParser() {
String[][] output;
StapErrorParser parser = new StapErrorParser();
output = parser.parseOutput(null);
assertNull(output);
output = parser.parseOutput("");
assertNotNull(output);
assertEquals(0, output.length);
output = parser.parseOutput("this shouldn't have anything");
assertNotNull(output);
assertEquals(0, output.length);
output = parser.parseOutput("parse error: expected identifier or '*' \n" + "saw: operator '{' at /home/morser/test.stp:14:7 \n" + "1 parse error(s). \n" + "Pass 1: parse failed. Try again with more '-v' (verbose) options.");
assertNotNull(output);
assertEquals(1, output.length);
assertTrue("parse error:".equals(output[0][0]));
assertTrue(output[0][3].startsWith("14"));
output = parser.parseOutput("semantic error: probe_615 with type mismatch for identifier 'flags' at /home/morser/test.stp:22:6: string vs. long \n" + "semantic error: probe_615 with type mismatch for identifier 'mode' at /home/morser/test.stp:23:6: string vs. long \n" + "semantic error: probe_615 with type mismatch for identifier 'f' at /home/morser/test.stp:25:6: string vs. long \n" + "Pass 2: analysis failed. Try again with more '-v' (verbose) options.");
assertNotNull(output);
assertEquals(3, output.length);
assertTrue("semantic error:".equals(output[0][0]));
assertTrue(output[0][3].startsWith("22:6"));
}
Aggregations