mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 00:24:29 +08:00
Merge remote-tracking branch 'origin/GP-0-dragonmacher-screenshot-fix-1-24-25'
This commit is contained in:
+4
-4
@@ -4,9 +4,9 @@
|
|||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -21,7 +21,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.junit.BeforeClass;
|
import org.junit.AfterClass;
|
||||||
|
|
||||||
import docking.test.AbstractDockingTest;
|
import docking.test.AbstractDockingTest;
|
||||||
import ghidra.GhidraTestApplicationLayout;
|
import ghidra.GhidraTestApplicationLayout;
|
||||||
@@ -93,7 +93,7 @@ public abstract class AbstractGhidraHeadlessIntegrationTest extends AbstractDock
|
|||||||
System.setProperty(GhidraScriptConstants.USER_SCRIPTS_DIR_PROPERTY, getTestDirectoryPath());
|
System.setProperty(GhidraScriptConstants.USER_SCRIPTS_DIR_PROPERTY, getTestDirectoryPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@AfterClass
|
||||||
public static void cleanDbTestDir() {
|
public static void cleanDbTestDir() {
|
||||||
// keep files around in batch mode to allow tests to run faster; assume batch mode performs
|
// keep files around in batch mode to allow tests to run faster; assume batch mode performs
|
||||||
// its own cleanup; only run once per class to allow subsequent tests to be faster
|
// its own cleanup; only run once per class to allow subsequent tests to be faster
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ import resources.ResourceManager;
|
|||||||
|
|
||||||
public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIntegrationTest {
|
public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
|
private static final String SCREENSHOT_USER_NAME = "User-1";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.setProperty("user.name", "User-1");
|
System.setProperty("user.name", "User-1");
|
||||||
}
|
}
|
||||||
@@ -122,6 +124,13 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
||||||
|
// sanity check to ensure out user name override above is still working
|
||||||
|
String path = getTestDirectoryPath();
|
||||||
|
assertTrue("Seeing this failure means that some call has initialized the temporary test " +
|
||||||
|
"directory before out static call to change user.name above",
|
||||||
|
path.contains(SCREENSHOT_USER_NAME));
|
||||||
|
|
||||||
env = newTestEnv();
|
env = newTestEnv();
|
||||||
|
|
||||||
prepareTool();
|
prepareTool();
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ public abstract class AbstractGTest {
|
|||||||
// 10x longer than normal
|
// 10x longer than normal
|
||||||
// private static final int PRIVATE_MAX_WAIT_TIMEOUT = DEFAULT_WAIT_TIMEOUT * 10;
|
// private static final int PRIVATE_MAX_WAIT_TIMEOUT = DEFAULT_WAIT_TIMEOUT * 10;
|
||||||
|
|
||||||
private static String testDirectoryPath = createTestDirectoryPath();
|
// let this get created lazily so that subclasses can change system state first
|
||||||
|
private static String testDirectoryPath; // = createTestDirectoryPath();
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public TestName testName = new TestName();
|
public TestName testName = new TestName();
|
||||||
@@ -95,14 +96,11 @@ public abstract class AbstractGTest {
|
|||||||
public TestRule ignoreUnfinishedRule = new IgnoreUnfinishedRule();
|
public TestRule ignoreUnfinishedRule = new IgnoreUnfinishedRule();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the directory path within which all temporary test data files should be created.
|
* Get the directory path within which all temporary test data files should be created. This
|
||||||
*
|
* method will only initialize the test directory path one time.
|
||||||
* @return test directory path ending with a File.separator character
|
|
||||||
*/
|
*/
|
||||||
private static String createTestDirectoryPath() {
|
private static void initializeTestDirectoryPath() {
|
||||||
|
|
||||||
if (testDirectoryPath == null) {
|
if (testDirectoryPath == null) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Build unique test data directory. Note that we can't make any calls which
|
// Build unique test data directory. Note that we can't make any calls which
|
||||||
// depend upon Application initialization, so we have to create directories using
|
// depend upon Application initialization, so we have to create directories using
|
||||||
@@ -123,8 +121,6 @@ public abstract class AbstractGTest {
|
|||||||
}
|
}
|
||||||
System.out.println("Created test directory: " + testDir);
|
System.out.println("Created test directory: " + testDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
return testDirectoryPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String buildBatchDirectoryPath() {
|
private static String buildBatchDirectoryPath() {
|
||||||
@@ -150,6 +146,7 @@ public abstract class AbstractGTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getTestDirectoryPath() {
|
public static String getTestDirectoryPath() {
|
||||||
|
initializeTestDirectoryPath();
|
||||||
return testDirectoryPath;
|
return testDirectoryPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@@ -21,7 +21,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import ghidra.util.Msg;
|
|
||||||
import ghidra.util.SystemUtilities;
|
import ghidra.util.SystemUtilities;
|
||||||
import ghidra.util.exception.AssertException;
|
import ghidra.util.exception.AssertException;
|
||||||
import utilities.util.FileUtilities;
|
import utilities.util.FileUtilities;
|
||||||
@@ -107,10 +106,6 @@ public class TestApplicationUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Assumption - in an installation the current user dir is /.../<Ghidra Install Dir>/Ghidra
|
// Assumption - in an installation the current user dir is /.../<Ghidra Install Dir>/Ghidra
|
||||||
|
|
||||||
String currentDir = System.getProperty("user.dir");
|
|
||||||
Msg.debug(null, "user.dir: " + currentDir);
|
|
||||||
|
|
||||||
// Assume that core library files are bundled in a jar file. Find the installation
|
// Assume that core library files are bundled in a jar file. Find the installation
|
||||||
// directory by using the distributed jar file.
|
// directory by using the distributed jar file.
|
||||||
File jarFile = SystemUtilities.getSourceLocationForClass(SystemUtilities.class);
|
File jarFile = SystemUtilities.getSourceLocationForClass(SystemUtilities.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user