Search in sources :

Example 1 with MassifOutput

use of org.eclipse.linuxtools.internal.valgrind.massif.MassifOutput in project linuxtools by eclipse.

the class MultiProcessTest method testExec.

@Test
public void testExec() throws CoreException, URISyntaxException, IOException {
    ILaunchConfigurationWorkingCopy config = createConfiguration(proj.getProject()).getWorkingCopy();
    config.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, true);
    config.doSave();
    // $NON-NLS-1$
    doLaunch(config, "testExec");
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    MassifOutput output = view.getOutput();
    Integer[] pids = output.getPids();
    assertEquals(2, pids.length);
    // child not necessarily higher PID than parent
    MassifSnapshot[] snapshots1 = output.getSnapshots(pids[0]);
    assertTrue(snapshots1.length == 8 || snapshots1.length == 14);
    MassifSnapshot[] snapshots2 = output.getSnapshots(pids[1]);
    assertTrue(snapshots2.length == 8 || snapshots2.length == 14);
    assertNotEquals(snapshots1.length, snapshots2.length);
    if (snapshots1.length == 8) {
        checkSnapshots(snapshots1, 400, 8);
        checkSnapshots(snapshots2, 40, 16);
    } else {
        checkSnapshots(snapshots1, 40, 16);
        checkSnapshots(snapshots2, 400, 8);
    }
}
Also used : MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) MassifOutput(org.eclipse.linuxtools.internal.valgrind.massif.MassifOutput) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Example 2 with MassifOutput

use of org.eclipse.linuxtools.internal.valgrind.massif.MassifOutput in project linuxtools by eclipse.

the class MultiProcessTest method testExecPidMenu.

@Test
public void testExecPidMenu() throws CoreException, URISyntaxException, IOException {
    ILaunchConfigurationWorkingCopy config = createConfiguration(proj.getProject()).getWorkingCopy();
    config.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, true);
    config.doSave();
    // $NON-NLS-1$
    doLaunch(config, "testExec");
    ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView();
    MassifViewPart dynamicView = (MassifViewPart) view.getDynamicView();
    MassifOutput output = dynamicView.getOutput();
    MassifPidMenuAction menuAction = null;
    IToolBarManager manager = view.getViewSite().getActionBars().getToolBarManager();
    for (IContributionItem item : manager.getItems()) {
        if (item instanceof ActionContributionItem && ((ActionContributionItem) item).getAction() instanceof MassifPidMenuAction) {
            menuAction = (MassifPidMenuAction) ((ActionContributionItem) item).getAction();
        }
    }
    assertNotNull(menuAction);
    Integer[] pids = dynamicView.getOutput().getPids();
    Shell shell = new Shell(Display.getCurrent());
    Menu pidMenu = menuAction.getMenu(shell);
    assertEquals(2, pidMenu.getItemCount());
    ActionContributionItem firstPid = (ActionContributionItem) pidMenu.getItem(0).getData();
    ActionContributionItem secondPid = (ActionContributionItem) pidMenu.getItem(1).getData();
    // check initial state
    assertTrue(firstPid.getAction().isChecked());
    assertFalse(secondPid.getAction().isChecked());
    assertArrayEquals(output.getSnapshots(pids[0]), dynamicView.getSnapshots());
    // select second pid
    selectItem(pidMenu, 1);
    assertFalse(firstPid.getAction().isChecked());
    assertTrue(secondPid.getAction().isChecked());
    assertArrayEquals(output.getSnapshots(pids[1]), dynamicView.getSnapshots());
    // select second pid again
    selectItem(pidMenu, 1);
    assertFalse(firstPid.getAction().isChecked());
    assertTrue(secondPid.getAction().isChecked());
    assertArrayEquals(output.getSnapshots(pids[1]), dynamicView.getSnapshots());
    // select first pid
    selectItem(pidMenu, 0);
    assertTrue(firstPid.getAction().isChecked());
    assertFalse(secondPid.getAction().isChecked());
    assertArrayEquals(output.getSnapshots(pids[0]), dynamicView.getSnapshots());
}
Also used : ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) Shell(org.eclipse.swt.widgets.Shell) ValgrindViewPart(org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart) IToolBarManager(org.eclipse.jface.action.IToolBarManager) IContributionItem(org.eclipse.jface.action.IContributionItem) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) Menu(org.eclipse.swt.widgets.Menu) MassifOutput(org.eclipse.linuxtools.internal.valgrind.massif.MassifOutput) MassifPidMenuAction(org.eclipse.linuxtools.internal.valgrind.massif.MassifPidMenuAction) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Example 3 with MassifOutput

use of org.eclipse.linuxtools.internal.valgrind.massif.MassifOutput in project linuxtools by eclipse.

the class MultiProcessTest method testNoExec.

@Test
public void testNoExec() throws CoreException, URISyntaxException, IOException {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testNoExec");
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    MassifOutput output = view.getOutput();
    assertEquals(1, output.getPids().length);
    MassifSnapshot[] snapshots = view.getSnapshots();
    assertEquals(8, snapshots.length);
    checkSnapshots(snapshots, 400, 8);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot) MassifOutput(org.eclipse.linuxtools.internal.valgrind.massif.MassifOutput) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Aggregations

MassifOutput (org.eclipse.linuxtools.internal.valgrind.massif.MassifOutput)3 MassifViewPart (org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart)3 Test (org.junit.Test)3 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)2 MassifSnapshot (org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot)2 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)1 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)1 IContributionItem (org.eclipse.jface.action.IContributionItem)1 IToolBarManager (org.eclipse.jface.action.IToolBarManager)1 MassifPidMenuAction (org.eclipse.linuxtools.internal.valgrind.massif.MassifPidMenuAction)1 ValgrindViewPart (org.eclipse.linuxtools.internal.valgrind.ui.ValgrindViewPart)1 Menu (org.eclipse.swt.widgets.Menu)1 Shell (org.eclipse.swt.widgets.Shell)1