mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-01-10 06:27:59 -05:00
moved config specs to external resource file
This commit is contained in:
@@ -18,6 +18,7 @@ root/prepDev.gradle||GHIDRA||||END|
|
||||
root/svg.gradle||GHIDRA||||END|
|
||||
root/test.gradle||GHIDRA||||END|
|
||||
root/usage.gradle||GHIDRA||||END|
|
||||
support/app_config_breakout.txt||GHIDRA||||END|
|
||||
support/distributionCommon.gradle||GHIDRA||||END|
|
||||
support/eclipseLauncher.gradle||GHIDRA||||END|
|
||||
support/extensionCommon.gradle||GHIDRA||||END|
|
||||
|
||||
@@ -354,15 +354,16 @@ task integrationTestReport(type: TestReport) { t ->
|
||||
*
|
||||
* @param subproject
|
||||
* @param testType - Either 'test' or 'integrationTest'. The sourceSets defined in setupJava.gradle
|
||||
* @param bucketName - the test category (appConfig, dockingConfig, integrationConfig, etc...)
|
||||
* @param taskNameCounter - Number to append to task name.
|
||||
* @param classesList - List of classes for this subproject.testType. Sorted by duration.
|
||||
* @param classesListPosition - Start position in 'classesList'
|
||||
* @param numMaxParallelForks - Number of concurrent tests to run.
|
||||
*********************************************************************************/
|
||||
def createTestTask(Project subproject, String testType, int taskNameCounter, ArrayList classesList,
|
||||
def createTestTask(Project subproject, String testType, String bucketName, int taskNameCounter, ArrayList classesList,
|
||||
int classesListPosition, int numMaxParallelForks) {
|
||||
|
||||
subproject.task(testType+"_$taskNameCounter", type: Test) { t ->
|
||||
subproject.task(testType+"_$taskNameCounter"+"_$bucketName", type: Test) { t ->
|
||||
group "test"
|
||||
testClassesDirs = files subproject.sourceSets["$testType"].output.classesDirs
|
||||
classpath = subproject.sourceSets["$testType"].runtimeClasspath
|
||||
@@ -392,10 +393,10 @@ def createTestTask(Project subproject, String testType, int taskNameCounter, Arr
|
||||
|
||||
// Current task mustRunAfter previous task (test_1 before test_2,etc.)
|
||||
if (taskNameCounter > 1) {
|
||||
def prevTaskName = "$testType" + "_" + (taskNameCounter -1)
|
||||
def prevTaskName = "$testType" + "_" + (taskNameCounter -1) + "_$bucketName"
|
||||
mustRunAfter prevTaskName
|
||||
}
|
||||
logger.info("createTestTask: Created $subproject.name" + ":$testType" + "_$taskNameCounter"
|
||||
logger.info("createTestTask: Created $subproject.name" + ":$testType" + "_$taskNameCounter" + "_$bucketName"
|
||||
+ "\n\tincludes = \n" + t.getIncludes() + "\n\tinheriting excludes (overrides any 'includes') = \n"
|
||||
+ t.excludes)
|
||||
} // end task
|
||||
@@ -422,6 +423,8 @@ configure(subprojects.findAll {parallelMode == true}) { subproject ->
|
||||
|
||||
for (Map.Entry<String,Map> classMap : testMap.entrySet()) {
|
||||
|
||||
String bucketName = classMap.getKey();
|
||||
|
||||
int classesListPosition = 0 // current position in classesList
|
||||
int taskNameCounter = 1 // task suffix
|
||||
int numMaxParallelForks = 40 // unit tests are fast; 40 seems to be a reasonable number
|
||||
@@ -431,9 +434,9 @@ configure(subprojects.findAll {parallelMode == true}) { subproject ->
|
||||
List<String> classesList = new ArrayList(sorted.keySet());
|
||||
|
||||
while (classesListPosition < classesList.size()) {
|
||||
createTestTask(subproject, "test", taskNameCounter, classesList, classesListPosition, numMaxParallelForks)
|
||||
createTestTask(subproject, "test", bucketName, taskNameCounter, classesList, classesListPosition, numMaxParallelForks)
|
||||
classesListPosition+=numMaxParallelForks
|
||||
taskNameCounter+=1; // "test_1", "test_2, etc.
|
||||
taskNameCounter+=1; // "test_1_appConfig", "test_2_appConfig, etc.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -458,9 +461,9 @@ configure(subprojects.findAll {parallelMode == true}) { subproject ->
|
||||
List<String> classesList = new ArrayList(sorted.keySet());
|
||||
|
||||
while (classesListPosition < classesList.size()) {
|
||||
createTestTask(subproject, "integrationTest", taskNameCounter, classesList, classesListPosition, numMaxParallelForks)
|
||||
createTestTask(subproject, "integrationTest", bucketName, taskNameCounter, classesList, classesListPosition, numMaxParallelForks)
|
||||
classesListPosition+=numMaxParallelForks
|
||||
taskNameCounter+=1; // "integrationTest_1", "integrationTest_2, etc.
|
||||
taskNameCounter+=1; // "integrationTest_1_appConfig", "integrationTest_2_appConfig, etc.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
90
gradle/support/app_config_breakout.txt
Normal file
90
gradle/support/app_config_breakout.txt
Normal file
@@ -0,0 +1,90 @@
|
||||
###HeadlessGhidraApplicationConfig^
|
||||
AbstractGhidraHeadlessIntegrationTest
|
||||
ProcessorEmulatorTestAdapter
|
||||
SaveAsOutboundTest
|
||||
AbstractDbgTest
|
||||
AbstractGProtocolTest
|
||||
GProtocolClientServerTestBase
|
||||
AbstractHeadlessAnalyzerTest
|
||||
SuperListingTest
|
||||
EmulatorTest
|
||||
|
||||
###DockingApplicationConfiguration^
|
||||
AbstractDockingTest;
|
||||
AbstractCRIntegrationTest
|
||||
AbstractDropDownTextFieldTest<T>
|
||||
AbstractFcgTest
|
||||
AbstractTaskTest
|
||||
AbstractThreadedTableTest
|
||||
DefaultThreadedTableFilterTest
|
||||
ThreadedTableTest
|
||||
AbstractVisualGraphTest
|
||||
AbstractSimpleVisualGraphTest
|
||||
|
||||
###ApplicationConfiguration^
|
||||
AbstractGenericTest
|
||||
SolverTest
|
||||
TestClassFileCreator
|
||||
AbstractAssemblyTest
|
||||
AbstractChainedBufferTest
|
||||
AbstractCreateDataTypeModelTest
|
||||
AbstractGraphAlgorithmsTest
|
||||
AbstractHelpModuleLocationTest
|
||||
AbstractHelpTest
|
||||
AbstractLocalFileSystemTest
|
||||
AbstractOpBehaviorTest
|
||||
MDMangBaseTest
|
||||
StorageEditorModelTest
|
||||
VTBaseTestCase
|
||||
AbstractEHTest
|
||||
AbstractRttiTest
|
||||
|
||||
###GhidraAppConfiguration^
|
||||
DataTypeSelectionTextFieldTest
|
||||
AbstractGhidraHeadedIntegrationTest
|
||||
AbstractAddressMapDBTestClass
|
||||
AbstractCodeBrowserNavigationTest
|
||||
AbstractCorrelatorTest
|
||||
AbstractCreateArchiveTest
|
||||
AbstractDataActionTest
|
||||
AbstractEditorTest
|
||||
AbstractFileFormatsTest
|
||||
AbstractFollowFlowTest
|
||||
AbstractFunctionGraphTest
|
||||
AbstractFunctionSignatureMarkupTest
|
||||
AbstractGFileSystemBaseTest
|
||||
AbstractGhidraScriptMgrPluginTest
|
||||
AbstractMergeTest
|
||||
AbstractProgramBasedTest
|
||||
AbstractProgramDiffTest
|
||||
AbstractProgramTreePluginTest
|
||||
AbstractScreenShotGenerator
|
||||
AbstractSelectByFlowPluginTest
|
||||
AbstractSymbolTreePluginExternalsTest
|
||||
AbstractToolSavingTest
|
||||
AbstractVersionControlActionTest
|
||||
AbstractVTCorrelatorTest
|
||||
AbstractVTMarkupItemTest
|
||||
DiffTestAdapter
|
||||
DWARFTestBase
|
||||
AbstractSelfSimilarCorrelatorTest
|
||||
AbstractStackEditorTest
|
||||
AbstractStructureEditorTest
|
||||
AbstractUnionEditorTest
|
||||
AbstractStackEditorProviderTest
|
||||
AbstractStructureEditorLockedActionsTest
|
||||
AbstractStructureEditorUnlockedActionsTest
|
||||
AbstractStructureEditorUnlockedCellEditTest
|
||||
AbstractDataTypeMergeTest
|
||||
AbstractProgramTreeMergeManagerTest
|
||||
AbstractListingMergeManagerTest
|
||||
AbstractExternalMergerTest
|
||||
AbstractDecompilerTest
|
||||
AbstractEquatePluginTest
|
||||
AbstractLocationReferencesTest
|
||||
AbstractMemSearchTest
|
||||
AbstractDecompilerFindReferencesActionTest
|
||||
GhidraScreenShotGenerator
|
||||
TutorialScreenShotGenerator
|
||||
AbstractSearchScreenShots
|
||||
DiffApplyTestAdapter
|
||||
@@ -77,6 +77,49 @@ def Map<String, Map<String, Long>> getTestReport() {
|
||||
int totalHtmlFiles = 0
|
||||
String excludedHtmlFileNames = "" // for log.info summary message
|
||||
|
||||
// Read in the config settings and allocate test files to
|
||||
// the appropriate buckets
|
||||
|
||||
List<String> integrationConfigs = new ArrayList<>();
|
||||
List<String> dockingConfigs = new ArrayList<>();
|
||||
List<String> appConfigs = new ArrayList<>();
|
||||
List<String> ghidraConfigs = new ArrayList<>();
|
||||
|
||||
File f = new File(rootProject.projectDir, "gradle/support/app_config_breakout.txt");
|
||||
String configLines = f.text;
|
||||
String[] splitLines = configLines.split("###");
|
||||
for (int i=0; i<splitLines.size(); i++) {
|
||||
String grop = splitLines[i];
|
||||
if (grop.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Grab the header (and remove it from the main string)
|
||||
String header = grop.substring(0,grop.indexOf("^"));
|
||||
grop = grop.substring(header + 1);
|
||||
String[] classes = grop.split("\n");
|
||||
if (header.equals("HeadlessGhidraApplicationConfig")) {
|
||||
for (String class : classes) {
|
||||
integrationConfigs.add(class);
|
||||
}
|
||||
}
|
||||
else if (header.equals("DockingApplicationConfiguration")) {
|
||||
for (String class : classes) {
|
||||
dockingConfigs.add(class);
|
||||
}
|
||||
}
|
||||
else if (header.equals("ApplicationConfiguration")) {
|
||||
for (String class : classes) {
|
||||
appConfigs.add(class);
|
||||
}
|
||||
}
|
||||
else if (header.equals("GhidraAppConfiguration")) {
|
||||
for (String class : classes) {
|
||||
ghidraConfigs.add(class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
classesReportDir.eachFileRecurse (FileType.FILES) { file ->
|
||||
|
||||
totalHtmlFiles++
|
||||
@@ -108,11 +151,12 @@ def Map<String, Map<String, Long>> getTestReport() {
|
||||
|
||||
String javaFileContents = foundFile.text;
|
||||
|
||||
/**
|
||||
List<String> integrationConfigs = new ArrayList<>();
|
||||
List<String> dockingConfigs = new ArrayList<>();
|
||||
List<String> appConfigs = new ArrayList<>();
|
||||
List<String> ghidraConfigs = new ArrayList<>();
|
||||
|
||||
|
||||
// Creates HeadlessGhidraApplicationConfig
|
||||
integrationConfigs.add("AbstractGhidraHeadlessIntegrationTest");
|
||||
integrationConfigs.add("ProcessorEmulatorTestAdapter");
|
||||
@@ -218,7 +262,7 @@ def Map<String, Map<String, Long>> getTestReport() {
|
||||
ghidraConfigs.add("TutorialScreenShotGenerator");
|
||||
ghidraConfigs.add("AbstractSearchScreenShots");
|
||||
ghidraConfigs.add("DiffApplyTestAdapter");
|
||||
|
||||
*/
|
||||
//-------------------------------------------------
|
||||
|
||||
if (javaFileContents.contains(shortName)) {
|
||||
@@ -278,7 +322,6 @@ def Map<String, Map<String, Long>> getTestReport() {
|
||||
Map<String,Long> testMap = entry.getValue();
|
||||
processedFiles += testMap.size();
|
||||
}
|
||||
logger.info("====processed: " + processedFiles + "::" + totalHtmlFiles);
|
||||
assert totalHtmlFiles != 0 : "getTestReport: Did not parse any valid html files in $testTimeParserInputDir. Directory might be empty"
|
||||
assert totalHtmlFiles == (processedFiles + excludedHtmlFiles) : "Not all html files processed."
|
||||
|
||||
@@ -421,13 +464,14 @@ def Map<String, Map> getTestsForSubProject(SourceDirectorySet sourceDirectorySet
|
||||
testMap.sort { a, b -> b.value <=> a.value }
|
||||
}
|
||||
|
||||
logger.info ("getTestsForSubProject:\n"
|
||||
/* logger.info ("getTestsForSubProject:\n"
|
||||
+ "\tIncluding " + includedClassFilesInTestReport + " test classes for this sourceSet because they are in the test report.\n"
|
||||
+ "\tIncluding/bumping " + includedClassFilesNotInTestReport + " not in test report.\n"
|
||||
+ "\tExcluding "+ excludedClassFilesBadName +" based on name not ending in 'Test' or contains 'Abstract' or 'Suite', " + excludedClassFilesCategory
|
||||
+ " based on '@Category, " + excludedClassAllTestsIgnored + " because duration = 0ms.\n"
|
||||
+ "\tReturning sorted list of size "+ sorted.size() + " out of " + sourceDirectorySet.files.size()
|
||||
+ " total files found in sourceSet.")
|
||||
*/
|
||||
|
||||
int filesProcessed = includedClassFilesNotInTestReport + includedClassFilesInTestReport +
|
||||
excludedClassFilesBadName + excludedClassFilesCategory + excludedClassAllTestsIgnored
|
||||
|
||||
Reference in New Issue
Block a user