mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-6808:Continued clean up of System.out/.err usage.
This commit is contained in:
@@ -15,9 +15,8 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.terminal;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assume.assumeFalse;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
@@ -122,7 +121,6 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
|
||||
term.addTerminalListener(new TerminalListener() {
|
||||
@Override
|
||||
public void resized(short cols, short rows) {
|
||||
// System.err.println("resized: " + cols + "x" + rows);
|
||||
child.setWindowSize(cols, rows);
|
||||
}
|
||||
});
|
||||
@@ -157,7 +155,6 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
|
||||
term.addTerminalListener(new TerminalListener() {
|
||||
@Override
|
||||
public void resized(short cols, short rows) {
|
||||
// System.err.println("resized: " + cols + "x" + rows);
|
||||
child.setWindowSize(cols, rows);
|
||||
}
|
||||
});
|
||||
@@ -189,7 +186,6 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {
|
||||
term.addTerminalListener(new TerminalListener() {
|
||||
@Override
|
||||
public void resized(short cols, short rows) {
|
||||
// System.err.println("resized: " + cols + "x" + rows);
|
||||
child.setWindowSize(cols, rows);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -38,6 +38,7 @@ import ghidra.program.database.ProgramBuilder;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
|
||||
import ghidra.test.TestEnv;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
@@ -81,7 +82,7 @@ public class ProjectInfoDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
RepositoryAdapter rep = null;
|
||||
try {
|
||||
// this can throw a NotConnectedException
|
||||
System.err.println(getClass().getName() + "\tstarting server...");
|
||||
Msg.info(this, getClass().getName() + "\tstarting server...");
|
||||
rep = SharedProjectUtil.startServer();
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -99,9 +100,9 @@ public class ProjectInfoDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
try {
|
||||
DockingActionIf saveAction = getAction("Save Project");
|
||||
System.err.println("\tsaving project");
|
||||
Msg.info(this, "\tsaving project");
|
||||
performAction(saveAction, true);
|
||||
System.err.println("\tclosing project");
|
||||
Msg.info(this, "\tclosing project");
|
||||
DockingActionIf action = getAction("Close Project");
|
||||
performAction(action, true);
|
||||
}
|
||||
@@ -112,21 +113,21 @@ public class ProjectInfoDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
}
|
||||
|
||||
private void cleanupResources() throws Exception {
|
||||
System.err.println(getClass().getName() + ".cleanupResources()...");
|
||||
Msg.info(this, getClass().getName() + ".cleanupResources()...");
|
||||
try {
|
||||
System.err.println(getClass().getName() + "\tdisposing...");
|
||||
Msg.info(this, getClass().getName() + "\tdisposing...");
|
||||
env.dispose();
|
||||
System.err.println(getClass().getName() + "\tstoring preferences...");
|
||||
Msg.info(this, getClass().getName() + "\tstoring preferences...");
|
||||
Preferences.setProperty("ServerInfo", null);
|
||||
Preferences.store();
|
||||
}
|
||||
finally {
|
||||
System.err.println(getClass().getName() + "\tdeleting server root...");
|
||||
Msg.info(this, getClass().getName() + "\tdeleting server root...");
|
||||
SharedProjectUtil.deleteServerRoot();
|
||||
System.err.println(getClass().getName() + "\tdeleting test project...");
|
||||
Msg.info(this, getClass().getName() + "\tdeleting test project...");
|
||||
SharedProjectUtil.deleteTestProject("TestProject");
|
||||
}
|
||||
System.err.println(getClass().getName() + ".cleanupResources() done!s");
|
||||
Msg.info(this, getClass().getName() + ".cleanupResources() done!s");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -377,7 +378,7 @@ public class ProjectInfoDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
}
|
||||
|
||||
private void stepThroughWizard(boolean doFinish, final String repositoryName) throws Exception {
|
||||
System.err.println(getClass().getName() + ".stepThroughWizard()...");
|
||||
Msg.info(this, getClass().getName() + ".stepThroughWizard()...");
|
||||
windowForComponent(dialog.getComponent());
|
||||
WizardDialog wm = waitForDialogComponent(WizardDialog.class);
|
||||
assertNotNull(wm);
|
||||
@@ -397,13 +398,13 @@ public class ProjectInfoDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
portNumberField.setText(Integer.toString(SharedProjectUtil.SERVER_PORT));
|
||||
});
|
||||
|
||||
System.err.println(getClass().getName() + ".stepThroughWizard()\tpressing next button...");
|
||||
Msg.info(this, getClass().getName() + ".stepThroughWizard()\tpressing next button...");
|
||||
pressButton(nextButton);
|
||||
|
||||
// next panel should be the repository panel
|
||||
RepositoryPanel repPanel = findComponent(wm, RepositoryPanel.class);
|
||||
|
||||
System.err.println(
|
||||
Msg.info(this,
|
||||
getClass().getName() + ".stepThroughWizard()\tfound repPanel: " + repPanel);
|
||||
final JList<?> repList = findComponent(repPanel, JList.class);
|
||||
ListModel<?> model = repList.getModel();
|
||||
@@ -429,6 +430,6 @@ public class ProjectInfoDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
assertTrue("The wizard panel is not closed for some reason", !wm.isShowing());
|
||||
|
||||
System.err.println(getClass().getName() + ".stepThroughWizard() done!");
|
||||
Msg.info(this, getClass().getName() + ".stepThroughWizard() done!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import ghidra.framework.main.wizard.project.*;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.server.remote.ServerTestUtil;
|
||||
import ghidra.test.AbstractGhidraHeadlessIntegrationTest;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
import ghidra.util.exception.UserAccessException;
|
||||
import utilities.util.FileUtilities;
|
||||
@@ -63,7 +64,8 @@ public class SharedProjectUtil {
|
||||
public static boolean createSharedProject(FrontEndTool frontEndTool, final String projectName)
|
||||
throws Exception {
|
||||
// create shared project against existing repository
|
||||
System.err.println("SharedProjectUtil.createSharedProject(): " + projectName);
|
||||
Msg.info(SharedProjectUtil.class,
|
||||
"SharedProjectUtil.createSharedProject(): " + projectName);
|
||||
|
||||
UtilProjectListener projectListener = new UtilProjectListener();
|
||||
frontEndTool.addProjectListener(projectListener);
|
||||
@@ -130,7 +132,7 @@ public class SharedProjectUtil {
|
||||
AbstractGuiTest.pressButton(finishButton, true);
|
||||
AbstractGuiTest.waitForSwing();
|
||||
boolean didOpen = waitForProjectToOpen(projectName, projectListener);
|
||||
System.err.println("\tdid the project get opened?: " + didOpen);
|
||||
Msg.info(SharedProjectUtil.class, "\tdid the project get opened?: " + didOpen);
|
||||
return didOpen;
|
||||
}
|
||||
|
||||
@@ -148,7 +150,8 @@ public class SharedProjectUtil {
|
||||
AbstractGuiTest.waitForSwing();
|
||||
boolean success = desiredProjectName.equals(lastOpenedProjectName);
|
||||
if (!success) {
|
||||
System.err.println("\tOpen windows: " + AbstractDockingTest.getOpenWindowsAsString());
|
||||
Msg.info(SharedProjectUtil.class,
|
||||
"\tOpen windows: " + AbstractDockingTest.getOpenWindowsAsString());
|
||||
}
|
||||
|
||||
return success;
|
||||
@@ -167,14 +170,14 @@ public class SharedProjectUtil {
|
||||
Thread.sleep(50);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
Msg.error(SharedProjectUtil.class, e, e);
|
||||
}
|
||||
|
||||
AbstractGhidraHeadlessIntegrationTest.deleteProject(projectDirectory.getAbsolutePath(),
|
||||
projectName);
|
||||
}
|
||||
if (count > 500) {
|
||||
System.err.println("Could not delete " + projectName);
|
||||
Msg.warn(SharedProjectUtil.class, "Could not delete " + projectName);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -192,7 +195,7 @@ public class SharedProjectUtil {
|
||||
* @throws Exception if there are any exceptions starting the server
|
||||
*/
|
||||
public static RepositoryAdapter startServer() throws Exception {
|
||||
System.err.println("SharedProjectUtil.startServer()...");
|
||||
Msg.info(SharedProjectUtil.class, "SharedProjectUtil.startServer()...");
|
||||
repositoryServer = null;
|
||||
File parent = new File(AbstractGTest.getTestDirectoryPath());
|
||||
|
||||
@@ -200,16 +203,19 @@ public class SharedProjectUtil {
|
||||
serverRoot = new File(parent, "My_Server");
|
||||
FileUtilities.deleteDir(serverRoot);
|
||||
|
||||
System.err.println("SharedProjectUtil.startServer()\tgetting server adapter...");
|
||||
Msg.info(SharedProjectUtil.class,
|
||||
"SharedProjectUtil.startServer()\tgetting server adapter...");
|
||||
repositoryServer = ServerTestUtil.getServerAdapter(serverRoot, new String[] { USER });
|
||||
|
||||
System.err.println("SharedProjectUtil.startServer()\tchecking connection...");
|
||||
Msg.info(SharedProjectUtil.class,
|
||||
"SharedProjectUtil.startServer()\tchecking connection...");
|
||||
if (repositoryServer == null || !repositoryServer.isConnected()) {
|
||||
deleteServerRoot();
|
||||
fail("Server connect failed");
|
||||
}
|
||||
|
||||
System.err.println("SharedProjectUtil.startServer()\tcreating repository...");
|
||||
Msg.info(SharedProjectUtil.class,
|
||||
"SharedProjectUtil.startServer()\tcreating repository...");
|
||||
return repositoryServer.createRepository("My_Repository");
|
||||
}
|
||||
|
||||
@@ -243,12 +249,14 @@ public class SharedProjectUtil {
|
||||
|
||||
@Override
|
||||
public void projectClosed(Project project) {
|
||||
System.err.println(getClass().getSimpleName() + ".projectClosed(): " + project);
|
||||
Msg.info(UtilProjectListener.class,
|
||||
getClass().getSimpleName() + ".projectClosed(): " + project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void projectOpened(Project project) {
|
||||
System.err.println(getClass().getSimpleName() + ".projectOpened(): " + project);
|
||||
Msg.info(UtilProjectListener.class,
|
||||
getClass().getSimpleName() + ".projectOpened(): " + project);
|
||||
lastOpenedProjectName = project.getName();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import org.junit.*;
|
||||
@@ -273,20 +274,6 @@ public class FrontEndPluginOpenProgramActionsTest extends AbstractGhidraHeadedIn
|
||||
// make sure that the tool is loaded and processes all of the tasks it launches
|
||||
Window window = waitForToolLaunch();
|
||||
|
||||
// DEBUG:
|
||||
if (window == null) {
|
||||
// see if any tools have been launched
|
||||
PluginTool[] runningTools = frontEndTool.getToolServices().getRunningTools();
|
||||
for (PluginTool tool : runningTools) {
|
||||
System.err.println("\t\"" + tool.getName() + "\"");
|
||||
JFrame toolFrame = tool.getToolFrame();
|
||||
System.err.println("\t\twith window: " + toolFrame.getTitle());
|
||||
}
|
||||
|
||||
System.err.println("Open Windows: ");
|
||||
System.err.println(getOpenWindowsAsString());
|
||||
}
|
||||
|
||||
assertNotNull(window);
|
||||
waitForBusyTool(env.getProject().getToolManager().getRunningTools()[0]);
|
||||
waitForTasks();
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package ghidra.pcode.emu.jit.gen;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
@@ -52,8 +51,7 @@ import ghidra.program.model.lang.*;
|
||||
import ghidra.program.model.pcode.PcodeOp;
|
||||
import ghidra.program.model.pcode.Varnode;
|
||||
import ghidra.program.util.DefaultLanguageService;
|
||||
import ghidra.util.NumericUtilities;
|
||||
import ghidra.util.SystemUtilities;
|
||||
import ghidra.util.*;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public abstract class AbstractJitCodeGeneratorTest extends AbstractJitTest {
|
||||
@@ -69,7 +67,7 @@ public abstract class AbstractJitCodeGeneratorTest extends AbstractJitTest {
|
||||
if (!DEBUG_ENABLED) {
|
||||
return;
|
||||
}
|
||||
System.out.println(program);
|
||||
Msg.debug(AbstractJitCodeGeneratorTest.class, program);
|
||||
}
|
||||
|
||||
public static void dumpClass(byte[] classbytes) throws Exception {
|
||||
@@ -287,7 +285,6 @@ public abstract class AbstractJitCodeGeneratorTest extends AbstractJitTest {
|
||||
|
||||
@PcodeUserop(functional = true)
|
||||
public int tap_int(int a) {
|
||||
System.err.println("tap: %x".formatted(a));
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package ghidra.util.task;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.util.Random;
|
||||
@@ -412,7 +411,7 @@ public class RunManagerTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
}
|
||||
|
||||
private void trace(String message) {
|
||||
System.err.println(message);
|
||||
Msg.debug(this, message);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
@@ -442,8 +441,7 @@ public class RunManagerTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
startBarrier.await();
|
||||
}
|
||||
catch (Exception e1) {
|
||||
System.err.println("Interrupted while waiting to begin: " + getName());
|
||||
e1.printStackTrace();
|
||||
Msg.error(this, "Interrupted while waiting to begin: " + getName(), e1);
|
||||
}
|
||||
|
||||
int runnableCount = random.nextInt(MAX_RUNNABLES_FROM_THREAD);
|
||||
@@ -534,9 +532,8 @@ public class RunManagerTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
delayLatch.await();
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.err.println(
|
||||
"Interrupted while waiting to begin: " + testName.getMethodName());
|
||||
e.printStackTrace();
|
||||
Msg.error(this,
|
||||
"Interrupted while waiting to begin: " + testName.getMethodName(), e);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user