Search in sources :

Example 6 with MassifViewPart

use of org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart 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 7 with MassifViewPart

use of org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart 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)

Example 8 with MassifViewPart

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

the class SortTest method checkSortColumn.

@Test
public void checkSortColumn() {
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    TableViewer viewer = view.getTableViewer();
    TableColumn control = viewer.getTable().getColumn(column);
    // Test ascending
    control.notifyListeners(SWT.Selection, null);
    assertEquals(SWT.UP, viewer.getTable().getSortDirection());
    assertEquals(control, viewer.getTable().getSortColumn());
    checkOrder(viewer, column, true);
    // Test descending
    control.notifyListeners(SWT.Selection, null);
    assertEquals(SWT.DOWN, viewer.getTable().getSortDirection());
    assertEquals(control, viewer.getTable().getSortColumn());
    checkOrder(viewer, column, false);
}
Also used : TableViewer(org.eclipse.jface.viewers.TableViewer) TableColumn(org.eclipse.swt.widgets.TableColumn) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Example 9 with MassifViewPart

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

the class TreeTest method testNoDetailed.

@Test
public void testNoDetailed() throws CoreException, URISyntaxException, IOException {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
    // >
    wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 12);
    // #snapshots
    wc.doSave();
    // $NON-NLS-1$
    doLaunch(config, "testNoDetailed");
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    TreeViewer treeViewer = view.getTreeViewer().getViewer();
    MassifHeapTreeNode[] nodes = (MassifHeapTreeNode[]) treeViewer.getInput();
    assertNotNull(nodes);
    // should always contain peak
    assertEquals(1, nodes.length);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) MassifHeapTreeNode(org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Example 10 with MassifViewPart

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

the class TreeTest method testTreeNodes.

@Test
public void testTreeNodes() throws CoreException, URISyntaxException, IOException {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
    wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 2);
    wc.doSave();
    // $NON-NLS-1$
    doLaunch(config, "testTreeNodes");
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    TreeViewer treeViewer = view.getTreeViewer().getViewer();
    MassifSnapshot[] snapshots = view.getSnapshots();
    MassifHeapTreeNode[] nodes = (MassifHeapTreeNode[]) treeViewer.getInput();
    for (int i = 0; i < nodes.length; i++) {
        // every odd snapshot should be detailed with --detailed-freq=2
        // and thus in the tree
        assertEquals(snapshots[2 * i + 1].getRoot(), nodes[i]);
    }
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) MassifHeapTreeNode(org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode) TreeViewer(org.eclipse.jface.viewers.TreeViewer) MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Aggregations

MassifViewPart (org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart)10 Test (org.junit.Test)9 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)6 MassifSnapshot (org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot)6 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)4 MassifHeapTreeNode (org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode)4 MassifOutput (org.eclipse.linuxtools.internal.valgrind.massif.MassifOutput)3 TreePath (org.eclipse.jface.viewers.TreePath)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 Shell (org.eclipse.swt.widgets.Shell)2 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)1 IContributionItem (org.eclipse.jface.action.IContributionItem)1 IToolBarManager (org.eclipse.jface.action.IToolBarManager)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 MassifPidMenuAction (org.eclipse.linuxtools.internal.valgrind.massif.MassifPidMenuAction)1 MassifTreeViewer (org.eclipse.linuxtools.internal.valgrind.massif.MassifTreeViewer)1