diff --git a/Ghidra/Features/GraphServices/src/test/java/ghidra/graph/export/AttributedGraphExportersTest.java b/Ghidra/Features/GraphServices/src/test/java/ghidra/graph/export/AttributedGraphExportersTest.java index 289d2285d0..9370112e26 100644 --- a/Ghidra/Features/GraphServices/src/test/java/ghidra/graph/export/AttributedGraphExportersTest.java +++ b/Ghidra/Features/GraphServices/src/test/java/ghidra/graph/export/AttributedGraphExportersTest.java @@ -181,20 +181,47 @@ public class AttributedGraphExportersTest extends AbstractGenericTest { GraphMlGraphExporter exporter = new GraphMlGraphExporter(); List lines = doExport(exporter, graph); assertOutput(lines, - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", + "", + " ", + " ", + " ", + " ", + " ", + " ", + " X", + " true", + " A", + " ", + " ", + " Y", " B", + " ", + " ", + " Y", " C", + " ", + " ", + " Y", " D", + " ", + " ", + " Z", " E", + " ", " ", + " T", " F", + " ", + " ", + " Fall", + " ", + " ", + " JMP", + " ", + " ", + " Fall", + " ", + " ", + " Fall", + " ", + " ", + " Call", + " ", + " ", ""); } diff --git a/Ghidra/Features/GraphServices/src/test/java/ghidra/graph/export/GraphExportTest.java b/Ghidra/Features/GraphServices/src/test/java/ghidra/graph/export/GraphExportTest.java index 70d400b19e..f71b6d8f41 100644 --- a/Ghidra/Features/GraphServices/src/test/java/ghidra/graph/export/GraphExportTest.java +++ b/Ghidra/Features/GraphServices/src/test/java/ghidra/graph/export/GraphExportTest.java @@ -193,22 +193,53 @@ public class GraphExportTest extends AbstractGhidraHeadedIntegrationTest { @Test public void testGRAPHML() throws Exception { List lines = processDialog(new GraphMlGraphExporter()); + // @formatter:off assertOutput(lines, - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", + "", + " ", + " ", + " ", + " ", + " ", + " ", + " X", + " true", + " A", + " ", + " ", + " Y", + " B", + " ", + " ", + " Y", + " C", + " ", + " ", + " Y", + " D", + " ", + " ", + " Z", + " E", + " ", + " ", + " Fall", + " ", + " ", + " JMP", + " ", + " ", + " Fall", + " ", + " ", + " Fall", + " ", + " ", + " Call", + " ", + " ", ""); - + // @formatter:on } @Test diff --git a/Ghidra/Features/ProgramGraph/build.gradle b/Ghidra/Features/ProgramGraph/build.gradle index 50ed64f25b..58757b5c2d 100644 --- a/Ghidra/Features/ProgramGraph/build.gradle +++ b/Ghidra/Features/ProgramGraph/build.gradle @@ -25,10 +25,7 @@ eclipse.project.name = 'Features Graph ProgramGraph' dependencies { api project(":Base") - - // some tests use classes in SoftwareModeling - testImplementation project(path: ':SoftwareModeling', configuration: 'testArtifacts') - + helpPath project(path: ":Base", configuration: 'helpPath') helpPath project(path: ":GraphServices", configuration: 'helpPath') diff --git a/Ghidra/Features/ProgramGraph/src/main/java/ghidra/graph/program/DataReferenceGraph.java b/Ghidra/Features/ProgramGraph/src/main/java/ghidra/graph/program/DataReferenceGraph.java index b3c9bac058..57c4f602e1 100644 --- a/Ghidra/Features/ProgramGraph/src/main/java/ghidra/graph/program/DataReferenceGraph.java +++ b/Ghidra/Features/ProgramGraph/src/main/java/ghidra/graph/program/DataReferenceGraph.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,9 +31,11 @@ import ghidra.util.task.TaskMonitor; */ public class DataReferenceGraph extends AttributedGraph { public static final String REF_SOURCE_ATTRIBUTE = "Source"; + // TODO: ref/flow type attribute should be consistent with other program graphs + // so that they can be mixed (waiting for standardization) public static final String REF_TYPE_ATTRIBUTE = "Type"; public static final String REF_SYMBOL_ATTRIBUTE = "Symbol"; - public static final String DATA_ATTRIBUTE = "Data Type"; + public static final String DATA_ATTRIBUTE = "DataType"; public static final String ADDRESS_ATTRIBUTE = "Address"; public static final String LABEL_ATTRIBUTE = "Label"; diff --git a/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/GraphActionTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/graph/GraphActionTest.java similarity index 100% rename from Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/GraphActionTest.java rename to Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/graph/GraphActionTest.java diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/graph/export/GraphExportTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/graph/export/GraphExportTest.java deleted file mode 100644 index 88493f86c4..0000000000 --- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/graph/export/GraphExportTest.java +++ /dev/null @@ -1,348 +0,0 @@ -/* ### - * IP: GHIDRA - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ghidra.graph.export; - -import static org.junit.Assert.*; - -import java.io.File; -import java.io.IOException; -import java.util.List; - -import org.junit.*; - -import ghidra.app.plugin.core.blockmodel.BlockModelServicePlugin; -import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin; -import ghidra.app.plugin.core.graph.GraphDisplayBrokerPlugin; -import ghidra.app.services.BlockModelService; -import ghidra.app.services.GraphDisplayBroker; -import ghidra.framework.plugintool.PluginTool; -import ghidra.framework.plugintool.util.PluginException; -import ghidra.graph.exporter.*; -import ghidra.program.database.ProgramDB; -import ghidra.service.graph.*; -import ghidra.test.AbstractGhidraHeadedIntegrationTest; -import ghidra.test.TestEnv; -import ghidra.util.Msg; -import ghidra.util.exception.CancelledException; -import ghidra.util.task.TaskMonitor; -import utilities.util.FileUtilities; - -public class GraphExportTest extends AbstractGhidraHeadedIntegrationTest { - protected PluginTool tool; - protected ProgramDB program; - protected TestEnv env; - protected BlockModelService blockModelService; - protected CodeBrowserPlugin codeBrowser; - private GraphExporterDialog dialog; - - @Before - public void setUp() throws Exception { - - setErrorGUIEnabled(false); - - env = new TestEnv(); - tool = env.getTool(); - - initializeTool(); - GraphDisplayBroker broker = tool.getService(GraphDisplayBroker.class); - GraphDisplayProvider exportProvider = broker.getGraphDisplayProvider("Graph Export"); - - AttributedGraph graph = createGraph(); - GraphDisplay exporter = exportProvider.getGraphDisplay(false, TaskMonitor.DUMMY); - // run in swing so the test is not blocked when we mess with the dialog. - runSwing(() -> setGraph(graph, exporter), false); - waitForSwing(); - } - - private void setGraph(AttributedGraph graph, GraphDisplay exporter) { - try { - exporter.setGraph(graph, "Test", false, TaskMonitor.DUMMY); - } - catch (CancelledException e) { - // can't happen with dummy - } - } - - @After - public void tearDown() { - env.dispose(); - } - - @Test - public void testCSV() throws Exception { - List lines = processDialog(new CsvEdgeListGraphExporter()); - - assertOutput(lines, - "A,B", - "B,C", - "B,D", - "C,E", - "D,E"); - } - - @Test - public void testDIMACS() throws Exception { - List lines = processDialog(new DimacsGraphExporter()); - assertOutput(lines, - "c", - "c SOURCE: Generated using the JGraphT library", - "c", - "p edge 5 5", - "e A B", - "e B C", - "e B D", - "e C E", - "e D E"); - } - - @Test - public void testDOT() throws Exception { - List lines = processDialog(new DotGraphExporter()); - - assertOutput(lines, - - "digraph Ghidra {", - " \"A\" [ Type=\"X\" Inverted=\"true\" Name=\"A\" ];", - " \"B\" [ Type=\"Y\" Name=\"B\" ];", - " \"C\" [ Type=\"Y\" Name=\"C\" ];", - " \"D\" [ Type=\"Y\" Name=\"D\" ];", - " \"E\" [ Type=\"Z\" Name=\"E\" ];", - " \"A\" -> \"B\" [ EType=\"Fall\" ];", - " \"B\" -> \"C\" [ EType=\"JMP\" ];", - " \"B\" -> \"D\" [ EType=\"Fall\" ];", - " \"C\" -> \"E\" [ EType=\"Fall\" ];", - " \"D\" -> \"E\" [ EType=\"Call\" ];", - "}"); - } - - @Test - public void testGML() throws Exception { - List lines = processDialog(new GmlGraphExporter()); - assertOutput(lines, - "Creator \"JGraphT GML Exporter\"", - "Version 1", - "graph", - "[", - " label \"\"", - " directed 1", - " node", - " [", - " id A", - " ]", - " node", - " [", - " id B", - " ]", - " node", - " [", - " id C", - " ]", - " node", - " [", - " id D", - " ]", - " node", - " [", - " id E", - " ]", - " edge", - " [", - " id 1", - " source A", - " target B", - " ]", - " edge", - " [", - " id 2", - " source B", - " target C", - " ]", - " edge", - " [", - " id 3", - " source B", - " target D", - " ]", - " edge", - " [", - " id 4", - " source C", - " target E", - " ]", - " edge", - " [", - " id 5", - " source D", - " target E", - " ]", - "]"); - } - - @Test - public void testGRAPHML() throws Exception { - List lines = processDialog(new GraphMlGraphExporter()); - assertOutput(lines, - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - ""); - - } - - @Test - public void testJSON() throws Exception { - List lines = processDialog(new JsonGraphExporter()); - assertOutput(lines, - "{\"creator\":\"JGraphT JSON Exporter\",\"version\":\"1\",\"nodes\":" + - "[{\"id\":\"A\",\"Type\":\"X\",\"Inverted\":\"true\",\"Name\":\"A\"}," + - "{\"id\":\"B\",\"Type\":\"Y\",\"Name\":\"B\"}," + - "{\"id\":\"C\",\"Type\":\"Y\",\"Name\":\"C\"}," + - "{\"id\":\"D\",\"Type\":\"Y\",\"Name\":\"D\"}," + - "{\"id\":\"E\",\"Type\":\"Z\",\"Name\":\"E\"}]," + - "\"edges\":[{\"id\":\"1\",\"source\":\"A\",\"target\":\"B\",\"EType\":\"Fall\"}," + - "{\"id\":\"2\",\"source\":\"B\",\"target\":\"C\",\"EType\":\"JMP\"}," + - "{\"id\":\"3\",\"source\":\"B\",\"target\":\"D\",\"EType\":\"Fall\"}," + - "{\"id\":\"4\",\"source\":\"C\",\"target\":\"E\",\"EType\":\"Fall\"}," + - "{\"id\":\"5\",\"source\":\"D\",\"target\":\"E\",\"EType\":\"Call\"}]}"); - - } - - - @Test - public void testMATRIX() throws Exception { - List lines = processDialog(new MatrixGraphExporter()); - assertOutput(lines, - "A B 1", - "B C 1", - "B D 1", - "C E 1", - "D E 1"); - } - - @Test - public void testVISIO() throws Exception { - List lines = processDialog(new VisioGraphExporter()); - assertOutput(lines, - "Shape,A,,A", - "Shape,B,,B", - "Shape,C,,C", - "Shape,D,,D", - "Shape,E,,E", - "Link,A-->B,,,A,B", - "Link,B-->C,,,B,C", - "Link,B-->D,,,B,D", - "Link,C-->E,,,C,E", - "Link,D-->E,,,D,E"); - } - - protected void initializeTool() throws Exception { - installPlugins(); - - showTool(tool); - } - - protected void installPlugins() throws PluginException { - tool.addPlugin(BlockModelServicePlugin.class.getName()); - tool.addPlugin(GraphDisplayBrokerPlugin.class.getName()); - } - - private List processDialog(AttributedGraphExporter exporter) throws IOException { - dialog = getDialogComponent(GraphExporterDialog.class); - String filePath = - createTempFilePath("GraphExportTest", "." + exporter.getFileExtension()); - runSwing(() -> dialog.setOutputFile(filePath)); - dialog.setExporter(exporter); - pressButtonByText(dialog, "OK"); - List lines = FileUtilities.getLines(new File(filePath)); - return lines; - - } - - private AttributedGraph createGraph() { - AttributedGraph graph = new AttributedGraph(); - AttributedVertex vA = graph.addVertex("A"); - AttributedVertex vB = graph.addVertex("B"); - AttributedVertex vC = graph.addVertex("C"); - AttributedVertex vD = graph.addVertex("D"); - AttributedVertex vE = graph.addVertex("E"); - - // A - // | - // B - // / \ - // C D - // \ / - // E - - AttributedEdge e1 = graph.addEdge(vA, vB); - AttributedEdge e2 = graph.addEdge(vB, vC); - AttributedEdge e3 = graph.addEdge(vB, vD); - AttributedEdge e4 = graph.addEdge(vC, vE); - AttributedEdge e5 = graph.addEdge(vD, vE); - - vA.setAttribute("Type", "X"); - vB.setAttribute("Type", "Y"); - vC.setAttribute("Type", "Y"); - vD.setAttribute("Type", "Y"); - vE.setAttribute("Type", "Z"); - - e1.setAttribute("EType", "Fall"); - e2.setAttribute("EType", "JMP"); - e3.setAttribute("EType", "Fall"); - e4.setAttribute("EType", "Fall"); - e5.setAttribute("EType", "Call"); - - vA.setAttribute("Inverted", "true"); - return graph; - } - - private void printLines(List lines) { - Msg.debug(this, "\n" + testName.getMethodName()); - for (String line : lines) { - Msg.debug(this, "\"" + line + "\","); - } - } - - private void assertOutput(List actual, String... expected) { - try { - for (int i = 0; i < expected.length; i++) { - if (i >= actual.size()) { - fail(testName.getMethodName() + ": output line " + (i + 1) + ": expected :\"" + - expected[i] + - "\", got: EOF"); - } - assertEquals(testName.getMethodName() + ": output line " + (i + 1) + ": ", - expected[i], - actual.get(i)); - } - } - catch (Throwable e) { - printLines(actual); - throw e; - } - } - -} diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/plugin/core/datamgr/actions/TypeGraphTaskTest.java b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/app/plugin/core/datamgr/actions/TypeGraphTaskTest.java similarity index 98% rename from Ghidra/Features/Base/src/test/java/ghidra/app/plugin/core/datamgr/actions/TypeGraphTaskTest.java rename to Ghidra/Test/IntegrationTest/src/test/java/ghidra/app/plugin/core/datamgr/actions/TypeGraphTaskTest.java index 73d626bded..81afe862bf 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/plugin/core/datamgr/actions/TypeGraphTaskTest.java +++ b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/app/plugin/core/datamgr/actions/TypeGraphTaskTest.java @@ -20,8 +20,8 @@ import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; -import ghidra.graph.program.TestGraphDisplay; -import ghidra.graph.program.TestGraphService; +import ghidra.graph.TestGraphDisplay; +import ghidra.graph.TestGraphService; import ghidra.program.model.data.*; import ghidra.service.graph.*; import ghidra.test.AbstractGhidraHeadedIntegrationTest; diff --git a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/graph/program/TestGraphDisplay.java b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/TestGraphDisplay.java similarity index 79% rename from Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/graph/program/TestGraphDisplay.java rename to Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/TestGraphDisplay.java index 61c2d279c0..bbe79bcad0 100644 --- a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/graph/program/TestGraphDisplay.java +++ b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/TestGraphDisplay.java @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.graph.program; +package ghidra.graph; -import java.util.HashSet; -import java.util.Set; +import java.util.*; import docking.action.DockingActionIf; import docking.widgets.EventTrigger; @@ -84,7 +83,12 @@ public class TestGraphDisplay implements GraphDisplay { public void setGraph(AttributedGraph graph, String title, boolean append, TaskMonitor monitor) throws CancelledException { - this.graph = graph; + if (append) { + this.graph = mergeGraphs(graph, this.graph); + } + else { + this.graph = graph; + } this.title = title; } @@ -120,4 +124,20 @@ public class TestGraphDisplay implements GraphDisplay { public void addAction(DockingActionIf action) { // do nothing, actions are not supported by this display } + + private AttributedGraph mergeGraphs(AttributedGraph newGraph, AttributedGraph oldGraph) { + for (AttributedVertex vertex : oldGraph.vertexSet()) { + newGraph.addVertex(vertex); + } + for (AttributedEdge edge : oldGraph.edgeSet()) { + AttributedVertex from = oldGraph.getEdgeSource(edge); + AttributedVertex to = oldGraph.getEdgeTarget(edge); + AttributedEdge newEdge = newGraph.addEdge(from, to); + Map attributeMap = edge.getAttributeMap(); + for (String key : attributeMap.keySet()) { + newEdge.setAttribute(key, edge.getAttribute(key)); + } + } + return newGraph; + } } diff --git a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/graph/program/TestGraphService.java b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/TestGraphService.java similarity index 98% rename from Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/graph/program/TestGraphService.java rename to Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/TestGraphService.java index 4e463b5c26..79354004ba 100644 --- a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/graph/program/TestGraphService.java +++ b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/TestGraphService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.graph.program; +package ghidra.graph; import ghidra.framework.options.Options; import ghidra.framework.plugintool.PluginTool; diff --git a/Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/AbstractBlockGraphTest.java b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/AbstractBlockGraphTest.java similarity index 100% rename from Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/AbstractBlockGraphTest.java rename to Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/AbstractBlockGraphTest.java diff --git a/Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/AbstractDataReferenceGraphTest.java b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/AbstractDataReferenceGraphTest.java similarity index 100% rename from Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/AbstractDataReferenceGraphTest.java rename to Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/AbstractDataReferenceGraphTest.java diff --git a/Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/BlockGraphEventTest.java b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/BlockGraphEventTest.java similarity index 98% rename from Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/BlockGraphEventTest.java rename to Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/BlockGraphEventTest.java index c7c73dde05..ed4c444f5a 100644 --- a/Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/BlockGraphEventTest.java +++ b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/BlockGraphEventTest.java @@ -23,6 +23,8 @@ import java.util.Set; import org.junit.Test; import ghidra.app.events.ProgramSelectionPluginEvent; +import ghidra.graph.TestGraphDisplay; +import ghidra.graph.TestGraphService; import ghidra.program.model.address.AddressSet; import ghidra.program.model.block.CodeBlockModel; import ghidra.program.util.ProgramLocation; diff --git a/Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/BlockGraphTaskTest.java b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/BlockGraphTaskTest.java similarity index 99% rename from Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/BlockGraphTaskTest.java rename to Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/BlockGraphTaskTest.java index 4130370ad1..ec15405540 100644 --- a/Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/BlockGraphTaskTest.java +++ b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/BlockGraphTaskTest.java @@ -21,6 +21,8 @@ import java.util.Map; import org.junit.Test; +import ghidra.graph.TestGraphDisplay; +import ghidra.graph.TestGraphService; import ghidra.program.model.block.CodeBlockModel; import ghidra.program.util.ProgramSelection; import ghidra.service.graph.*; diff --git a/Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/DataReferenceGraphEventTest.java b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/DataReferenceGraphEventTest.java similarity index 97% rename from Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/DataReferenceGraphEventTest.java rename to Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/DataReferenceGraphEventTest.java index 99b1f36f20..fc1bb1b921 100644 --- a/Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/DataReferenceGraphEventTest.java +++ b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/DataReferenceGraphEventTest.java @@ -22,6 +22,8 @@ import java.util.Set; import org.junit.Test; +import ghidra.graph.TestGraphDisplay; +import ghidra.graph.TestGraphService; import ghidra.program.model.address.AddressSet; import ghidra.program.util.ProgramLocation; import ghidra.program.util.ProgramSelection; @@ -38,6 +40,9 @@ public class DataReferenceGraphEventTest extends AbstractDataReferenceGraphTest super.setUp(); TestGraphService graphService = new TestGraphService(); ProgramLocation location = new ProgramLocation(program, addr(0x01000000)); + + // env.showTool(program); + DataReferenceGraphTask task = new DataReferenceGraphTask(false, false, tool, null, location, graphService, 0, 10, DataReferenceGraph.Directions.BOTH_WAYS); diff --git a/Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/DataReferenceGraphTaskTest.java b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/DataReferenceGraphTaskTest.java similarity index 97% rename from Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/DataReferenceGraphTaskTest.java rename to Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/DataReferenceGraphTaskTest.java index d65b60abc9..1cafee22b6 100644 --- a/Ghidra/Features/ProgramGraph/src/test/java/ghidra/graph/program/DataReferenceGraphTaskTest.java +++ b/Ghidra/Test/IntegrationTest/src/test/java/ghidra/graph/program/DataReferenceGraphTaskTest.java @@ -19,6 +19,8 @@ import static org.junit.Assert.*; import org.junit.Test; +import ghidra.graph.TestGraphDisplay; +import ghidra.graph.TestGraphService; import ghidra.program.util.ProgramLocation; import ghidra.program.util.ProgramSelection; import ghidra.service.graph.AttributedEdge; @@ -202,8 +204,8 @@ public class DataReferenceGraphTaskTest extends AbstractDataReferenceGraphTest { AttributedVertex vertex = graph.getVertex(graph.makeName(addr(0x0100001d))); assertEquals("pointer_thing", vertex.getAttribute(DataReferenceGraph.DATA_ATTRIBUTE)); - assertEquals("0100001d\npointer_thing", - vertex.getAttribute(DataReferenceGraph.LABEL_ATTRIBUTE)); + assertEquals("0100001d", vertex.getAttribute(DataReferenceGraph.ADDRESS_ATTRIBUTE)); + assertNull(vertex.getAttribute(DataReferenceGraph.LABEL_ATTRIBUTE)); // no label at address } @Test