mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-12-06 11:01:53 +00:00
GP-1448 Updated broken testd due to new references in language and lowered autoVT score threshold to get more solid matches.
This commit is contained in:
parent
0139720224
commit
c91b5236fd
@ -64,11 +64,11 @@ public class AutoVersionTrackingAction extends DockingAction {
|
||||
// correlators is changed to make more sense to the user - currently the confidence has
|
||||
// to be entered as the value before the log 10 is computed but the table shows log 10 value
|
||||
|
||||
// The current passed values for score and confidence (1.0 and 10.0)
|
||||
// get you accepted matches with similarity scores >= 1.0 and
|
||||
// The current passed values for score and confidence (.95 and 10.0)
|
||||
// get you accepted matches with similarity scores >= .95 and
|
||||
// confidence (log 10) scores 2.0 and up
|
||||
AutoVersionTrackingCommand command =
|
||||
new AutoVersionTrackingCommand(controller, session, 1.0, 10.0);
|
||||
new AutoVersionTrackingCommand(controller, session, 0.95, 10.0);
|
||||
|
||||
controller.getTool().executeBackgroundCommand(command, session);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package ghidra.feature.vt.api;
|
||||
|
||||
import static ghidra.feature.vt.db.VTTestUtils.addr;
|
||||
import static ghidra.feature.vt.db.VTTestUtils.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.*;
|
||||
@ -47,7 +47,8 @@ import ghidra.util.task.TaskMonitor;
|
||||
public class VTAutoVersionTrackingTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
private static final String TEST_SOURCE_PROGRAM_NAME = "VersionTracking/WallaceSrc";
|
||||
private static final String TEST_DESTINATION_PROGRAM_NAME = "VersionTracking/WallaceVersion2";
|
||||
private static final String TEST_DESTINATION_PROGRAM_NAME =
|
||||
"VersionTracking/WallaceVersion2";
|
||||
|
||||
private VTTestEnv env;
|
||||
private VTController controller;
|
||||
@ -87,13 +88,13 @@ public class VTAutoVersionTrackingTest extends AbstractGhidraHeadedIntegrationTe
|
||||
env.showTool();
|
||||
controller = env.getVTController();
|
||||
|
||||
// Score 1.0 and confidence 10.0 (log10 confidence 2.0) and up
|
||||
boolean success = runAutoVTCommand(1.0, 10.0);
|
||||
// Score .999999 and confidence 10.0 (log10 confidence 2.0) and up
|
||||
boolean success = runAutoVTCommand(0.999999999, 10.0);
|
||||
assertTrue("Auto Version Tracking Command failed to run", success);
|
||||
|
||||
// verify that the default options are what we expect
|
||||
// if this assert fails then the follow-on tests will probably fail
|
||||
assertCorrectOptionValues(session, "1.0", "10.0");
|
||||
assertCorrectOptionValues(session, "0.999999999", "10.0");
|
||||
|
||||
// verify that given the above verified conditions the
|
||||
// exact unique correlators (which have their own tests to verify which matches are
|
||||
@ -121,14 +122,15 @@ public class VTAutoVersionTrackingTest extends AbstractGhidraHeadedIntegrationTe
|
||||
// because when a 10.0 is passed into the combined correlator as the confidence value, all
|
||||
// the confidences are returned as log10 values which would be 2.0 or less
|
||||
assertCorrectScoreAndConfidenceValues(session, "Combined Function and Data Reference Match",
|
||||
1.0, 2.0);
|
||||
// Keep these numbers so I can do more testing later
|
||||
0.999999999, 2.0);
|
||||
|
||||
// With the higher score/confidence thresholds, there are less accepted matches
|
||||
// if this fails after previous check passes it means more are accepted than expected
|
||||
assertCorrectMatchCountAndAcceptedMatchCount(session,
|
||||
"Combined Function and Data Reference Match", 13, 13);
|
||||
"Combined Function and Data Reference Match", 21, 21);
|
||||
|
||||
// Check that all the matches have the correct statuses
|
||||
assertCombinedReferenceMatchStatusesHigherScoreAndConfidence(session);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -992,24 +994,33 @@ public class VTAutoVersionTrackingTest extends AbstractGhidraHeadedIntegrationTe
|
||||
assertBlockedMatch(vtSession, correlator, "0x412330", "0x4122e0");
|
||||
}
|
||||
|
||||
// These are the matches when score is 1.0 and log 10 conf threshold is 2.0
|
||||
// These are the matches when score is .999999999 and log 10 conf threshold is 2.0
|
||||
private void assertCombinedReferenceMatchStatusesHigherScoreAndConfidence(VTSession vtSession) {
|
||||
|
||||
String correlator = "Combined Function and Data Reference Match";
|
||||
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00411700", "0x004116f0");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00411860", "0x00411830");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x004118f0", "0x004118c0");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00411ab0", "0x00411a90");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00411b80", "0x00411b60");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00411bb0", "0x00411b90");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00411c70", "0x00411c50");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00411dc0", "0x00411da0");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00411ee0", "0x00411ec0");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x0412380", "0x00412360");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x04123f0", "0x004123d0");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x0412950", "0x00412930");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x04130d0", "0x004130b0");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x04134e0", "0x004134c0");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x0413520", "0x00413500");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x004122b0", "0x00412290");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00412380", "0x00412360");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x004123f0", "0x004123d0");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00412950", "0x00412930");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00412ad0", "0x00412ab0");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00412df0", "0x00412dd0");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00412e90", "0x00412e70");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00412ee0", "0x00412ec0");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00413073", "0x00413053");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x004130d0", "0x004130b0");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x00413370", "0x00413350");
|
||||
assertAcceptedMatch(vtSession, correlator, "0x004134e0", "0x004134c0");
|
||||
|
||||
}
|
||||
|
||||
// These are the matches when score is 0.5 and conf is 1.0
|
||||
|
@ -15,8 +15,8 @@
|
||||
*/
|
||||
package ghidra.feature.vt.gui.provider;
|
||||
|
||||
import static ghidra.feature.vt.api.main.VTAssociationType.DATA;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static ghidra.feature.vt.api.main.VTAssociationType.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -133,7 +133,9 @@ public class VTCombinedFunctionDataReferenceCorrelator_x86_Test extends Abstract
|
||||
expectedMatchPairs.add(associate(addr(srcProg, "00411bb0"), addr(destProg, "00411b90"))); // src:@_RTC_CheckStackVars@8 dst: @_RTC_CheckStackVars@8
|
||||
expectedMatchPairs.add(associate(addr(srcProg, "00411c70"), addr(destProg, "00411c50"))); // src:@_RTC_CheckStackVars2@12 dst: @_RTC_CheckStackVars2@12
|
||||
expectedMatchPairs.add(associate(addr(srcProg, "00411dc0"), addr(destProg, "00411da0"))); // src:FUN_00411dc0 dst: FUN_00411da0
|
||||
// expectedMatchPairs.add(associate(addr(srcProg, "00411e70"), addr(destProg, "00411e50"))); // src:FUN_00411e70 dst: FUN_00411e50 -- similarity score < 0.5
|
||||
|
||||
//expectedMatchPairs.add(associate(addr(srcProg, "00411e70"), addr(destProg, "00411e50"))); // src:FUN_00411e70 dst: FUN_00411e50 -- similarity score < 0.5
|
||||
|
||||
expectedMatchPairs.add(associate(addr(srcProg, "00411ee0"), addr(destProg, "00411ec0"))); // src:_mainCRTStartup dst: _mainCRTStartup
|
||||
|
||||
// expectedMatchPairs.add(associate(addr(srcProg, "00411f00"), addr(destProg, "00411ee0"))); // src:___tmainCRTStartup dst: ___tmainCRTStartup -- similarity score < 0.5
|
||||
@ -152,7 +154,6 @@ public class VTCombinedFunctionDataReferenceCorrelator_x86_Test extends Abstract
|
||||
expectedMatchPairs.add(associate(addr(srcProg, "004130d0"), addr(destProg, "004130b0"))); // src:_atexit dst: _atexit
|
||||
expectedMatchPairs.add(associate(addr(srcProg, "00413370"), addr(destProg, "00413350"))); // src:__IsNonwritableInCurrentImage dst: __IsNonwritableInCurrentImage
|
||||
expectedMatchPairs.add(associate(addr(srcProg, "004134e0"), addr(destProg, "004134c0"))); // src: FUN_004134e0 dst: FUN_004134c0
|
||||
expectedMatchPairs.add(associate(addr(srcProg, "00413520"), addr(destProg, "00413500"))); // src:_RTC_GetSrcLine dst: _RTC_GetSrcLine
|
||||
expectedMatchPairs.add(associate(addr(srcProg, "00413890"), addr(destProg, "00413870"))); // src:GetPdbDll dst: GetPdbDll
|
||||
|
||||
assertMatchPairs(expectedMatchPairs, testMatchPairs);
|
||||
|
@ -66,7 +66,7 @@ public class VTImpliedMatchCorrelatorTest extends AbstractVTCorrelatorTest {
|
||||
*/
|
||||
|
||||
// first test the number of implied matches
|
||||
assertEquals(17, testMatchSet.getMatchCount());
|
||||
assertEquals(18, testMatchSet.getMatchCount());
|
||||
|
||||
// now test the expected matches which are real functions or data, not thunks
|
||||
// if all are in set and we tested the size then no thunks are in the set
|
||||
@ -104,6 +104,9 @@ public class VTImpliedMatchCorrelatorTest extends AbstractVTCorrelatorTest {
|
||||
isMatchInMatchSet(addr(srcProg, "00418168"), addr(destProg, "00418168"), testMatchSet));
|
||||
assertTrue(
|
||||
isMatchInMatchSet(addr(srcProg, "0041816c"), addr(destProg, "0041816c"), testMatchSet));
|
||||
|
||||
assertTrue(
|
||||
isMatchInMatchSet(addr(srcProg, "00418174"), addr(destProg, "00418174"), testMatchSet));
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user