Search in sources :

Example 1 with LaunchStapGraph

use of org.eclipse.linuxtools.internal.callgraph.launch.LaunchStapGraph in project linuxtools by eclipse.

the class LaunchShortcutsTest method testLaunchCallGraph.

@Test
public void testLaunchCallGraph() throws CModelException {
    SystemTapUIErrorMessages.setActive(false);
    LaunchStapGraph launch = new LaunchStapGraph();
    launch.setTestMode(true);
    IBinary bin = proj.getBinaryContainer().getBinaries()[0];
    launch.launch(bin, "profile");
    String script = launch.getScript();
    assert (script.contains("probe process(@1).function(\"calledOnce\").call{    callFunction(probefunc())    }    probe process(@1).function(\"calledOnce\").return{        returnFunction(probefunc())    }"));
    assert (script.contains("probe process(@1).function(\"calledTwice\").call{    callFunction(probefunc())    }    probe process(@1).function(\"calledTwice\").return{        returnFunction(probefunc())    }"));
    assert (script.contains("probe process(@1).function(\"main\").call{    callFunction(probefunc())    }    probe process(@1).function(\"main\").return{        returnFunction(probefunc())    }"));
}
Also used : LaunchStapGraph(org.eclipse.linuxtools.internal.callgraph.launch.LaunchStapGraph) IBinary(org.eclipse.cdt.core.model.IBinary) Test(org.junit.Test)

Example 2 with LaunchStapGraph

use of org.eclipse.linuxtools.internal.callgraph.launch.LaunchStapGraph in project linuxtools by eclipse.

the class ConfigurationTest method testConfig.

/**
 * This test checks if the commands sent by SystemTap match exactly the options
 * that are set. Uses the delegate.launch() function.
 *
 * Activates all options!
 * @throws CoreException
 */
@Test
public void testConfig() throws CoreException {
    LaunchStapGraph shortcut = new LaunchStapGraph();
    String testCDirectives = "-DRandomjunk -DMoreJunk";
    String testOutputPath = "/tmp/ThisFileDoesNothingDeleteIt";
    String testBinaryPath = "/path/to/binary";
    String testScriptPath = "/tmp/NotAScriptFile.stp";
    String testArguments = "/path/to/binary";
    int testPid = 413;
    int testBuffer = 100;
    int testPass = 10;
    ILaunchConfiguration config = shortcut.outsideGetLaunchConfigType().newInstance(null, "Temp name");
    ILaunchConfigurationWorkingCopy wc = config.copy("Testing configuration");
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_VERBOSE, 1);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_KEEP_TEMPORARY, true);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_GURU, true);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_PROLOGUE_SEARCH, true);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_NO_CODE_ELISION, true);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_DISABLE_WARNINGS, true);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_BULK_MODE, true);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_TIMING_INFO, true);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_SKIP_BADVARS, true);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_IGNORE_DWARF, true);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_TAPSET_COVERAGE, true);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_LEAVE_RUNNING, true);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_PASS, testPass);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_BUFFER_BYTES, testBuffer);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_TARGET_PID, testPid);
    wc.setAttribute(LaunchConfigurationConstants.COMMAND_C_DIRECTIVES, testCDirectives);
    wc.setAttribute(LaunchConfigurationConstants.BINARY_PATH, testBinaryPath);
    wc.setAttribute(LaunchConfigurationConstants.SCRIPT_PATH, testScriptPath);
    wc.setAttribute(LaunchConfigurationConstants.ARGUMENTS, testArguments);
    wc.setAttribute(LaunchConfigurationConstants.OUTPUT_PATH, testOutputPath);
    config = wc.doSave();
    SystemTapLaunchConfigurationDelegate del = new SystemTapLaunchConfigurationDelegate();
    del.launch(config, "profile", null, null);
    assertEquals("stap -v -p" + testPass + " -k -g -P -u -w -b -t -s" + testBuffer + " -x" + testPid + " " + testCDirectives + " -F --skip-badvars --ignore-dwarf -q " + " -c '" + testBinaryPath + "' " + testScriptPath + " --runtime=dyninst " + testArguments + " >& " + testOutputPath, del.generateCommand());
    killStap();
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) LaunchStapGraph(org.eclipse.linuxtools.internal.callgraph.launch.LaunchStapGraph) SystemTapLaunchConfigurationDelegate(org.eclipse.linuxtools.internal.callgraph.launch.SystemTapLaunchConfigurationDelegate) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) Test(org.junit.Test)

Example 3 with LaunchStapGraph

use of org.eclipse.linuxtools.internal.callgraph.launch.LaunchStapGraph in project linuxtools by eclipse.

the class SystemTapTabTest method testTabs.

@Test
public void testTabs() throws CoreException {
    Shell sh = new Shell();
    Composite cmp = new Composite(sh, SWT.NONE);
    LaunchStapGraph shortCut = new LaunchStapGraph();
    SystemTapOptionsTab stp = new SystemTapOptionsTab();
    stp.createControl(cmp);
    ILaunchConfiguration configuration;
    configuration = shortCut.outsideGetLaunchConfigType().newInstance(null, (DebugPlugin.getDefault().getLaunchManager()).generateLaunchConfigurationName("invalid"));
    ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy();
    stp.setDefaults(wc);
    stp.performApply(wc);
    wc.doSave();
    stp.initializeFrom(configuration);
    sh.open();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) Composite(org.eclipse.swt.widgets.Composite) LaunchStapGraph(org.eclipse.linuxtools.internal.callgraph.launch.LaunchStapGraph) SystemTapOptionsTab(org.eclipse.linuxtools.internal.callgraph.launch.SystemTapOptionsTab) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) Test(org.junit.Test)

Aggregations

LaunchStapGraph (org.eclipse.linuxtools.internal.callgraph.launch.LaunchStapGraph)3 Test (org.junit.Test)3 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)2 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)2 IBinary (org.eclipse.cdt.core.model.IBinary)1 SystemTapLaunchConfigurationDelegate (org.eclipse.linuxtools.internal.callgraph.launch.SystemTapLaunchConfigurationDelegate)1 SystemTapOptionsTab (org.eclipse.linuxtools.internal.callgraph.launch.SystemTapOptionsTab)1 Composite (org.eclipse.swt.widgets.Composite)1 Shell (org.eclipse.swt.widgets.Shell)1