Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceMarkerTest.java')
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceMarkerTest.java83
1 files changed, 0 insertions, 83 deletions
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceMarkerTest.java b/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceMarkerTest.java
deleted file mode 100644
index 620c077f70..0000000000
--- a/valgrind/org.eclipse.linuxtools.valgrind.memcheck.tests/src/org/eclipse/linuxtools/valgrind/memcheck/tests/LinkedResourceMarkerTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Elliott Baron <ebaron@redhat.com> - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.valgrind.memcheck.tests;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.model.ISourceLocator;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.linuxtools.valgrind.core.IValgrindMessage;
-import org.eclipse.linuxtools.valgrind.core.ValgrindError;
-import org.eclipse.linuxtools.valgrind.core.ValgrindStackFrame;
-import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchPlugin;
-import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin;
-import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart;
-
-public class LinkedResourceMarkerTest extends AbstractLinkedResourceMemcheckTest {
-
- public void testLinkedMarkers() throws Exception {
- ILaunchConfiguration config = createConfiguration(proj.getProject());
- doLaunch(config, "testLinkedMarkers"); //$NON-NLS-1$
-
- ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView();
- IValgrindMessage[] errors = view.getMessages();
-
- ArrayList<IMarker> markers = new ArrayList<IMarker>(Arrays.asList(proj
- .getProject().findMarkers(ValgrindLaunchPlugin.MARKER_TYPE,
- true, IResource.DEPTH_INFINITE)));
- assertEquals(4, markers.size());
- for (IValgrindMessage error : errors) {
- findMarker(markers, error);
- }
- assertEquals(0, markers.size());
- }
-
- private void findMarker(ArrayList<IMarker> markers, IValgrindMessage error)
- throws Exception, CoreException {
- ValgrindStackFrame frame = null;
- IValgrindMessage[] children = error.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (frame == null && children[i] instanceof ValgrindStackFrame
- && isWorkspaceFrame((ValgrindStackFrame) children[i])) {
- frame = (ValgrindStackFrame) children[i];
- } else if (children[i] instanceof ValgrindError) {
- findMarker(markers, children[i]);
- }
- }
-
- int ix = -1;
- for (int i = 0; i < markers.size(); i++) {
- IMarker marker = markers.get(i);
- if (marker.getAttribute(IMarker.MESSAGE).equals(error.getText())
- && marker.getResource().getName().equals(frame.getFile())
- && marker.getAttribute(IMarker.LINE_NUMBER).equals(
- frame.getLine())) {
- ix = i;
- }
- }
- if (ix < 0) {
- fail();
- }
- markers.remove(ix);
- }
-
- private boolean isWorkspaceFrame(ValgrindStackFrame frame) throws Exception {
- ISourceLocator locator = frame.getLaunch().getSourceLocator();
- Object result = DebugUITools.lookupSource(frame.getFile(), locator)
- .getSourceElement();
- return result != null && result instanceof IResource;
- }
-}

Back to the top