GP-930: Tests, diagnostics, attempted MWE, OTE fixes

This commit is contained in:
Dan 2021-05-12 14:40:11 +00:00
parent 10674175bb
commit 73ba6b28d0
17 changed files with 755 additions and 262 deletions

View file

@ -80,15 +80,17 @@ public abstract class AbstractTargetObject<P extends TargetObject> implements Sp
this.path = PathUtils.extend(parent.getPath(), key);
}
model.removeExisting(path);
synchronized (model.lock) {
model.removeExisting(path);
this.hash = computeHashCode();
this.typeHint = typeHint;
this.hash = computeHashCode();
this.typeHint = typeHint;
this.schema = schema;
this.proxy = proxyFactory.createProxy(this, proxyInfo);
this.schema = schema;
this.proxy = proxyFactory.createProxy(this, proxyInfo);
fireCreated();
fireCreated();
}
}
public AbstractTargetObject(AbstractDebuggerObjectModel model, P parent, String key,

View file

@ -28,6 +28,20 @@ import ghidra.dbg.util.ConfigurableFactory.Property;
import ghidra.dbg.util.PathUtils.PathComparator;
public abstract class AbstractModelHost implements ModelHost, DebuggerModelTestUtils {
public class WithoutThreadValidationImpl implements WithoutThreadValidation {
public WithoutThreadValidationImpl() {
withoutThreadValCount++;
}
@Override
public void close() throws Exception {
withoutThreadValCount--;
}
}
private int withoutThreadValCount = 0;
protected DebuggerObjectModel model;
public CallbackValidator callbackValidator;
public EventValidator eventValidator;
@ -74,7 +88,7 @@ public abstract class AbstractModelHost implements ModelHost, DebuggerModelTestU
@Override
public void validateCompletionThread() {
if (callbackValidator != null) {
if (callbackValidator != null && withoutThreadValCount == 0) {
callbackValidator.validateCompletionThread();
}
}
@ -169,6 +183,11 @@ public abstract class AbstractModelHost implements ModelHost, DebuggerModelTestU
return true;
}
@Override
public WithoutThreadValidation withoutThreadValidation() {
return new WithoutThreadValidationImpl();
}
@Override
public TargetObjectAddedWaiter getAddedWaiter() {
return waiter;

View file

@ -276,7 +276,7 @@ public class CallbackValidator implements DebuggerModelListener, AutoCloseable {
fail("created twice (same object): " + object.getJoinedPath("."));
}
else {
fail("replaced before invalidation. old= " + exists + ", new=" + object);
fail("replaced before invalidation. old=" + exists.object + ", new=" + object);
}
}
validateCallbackThread("created");

View file

@ -23,6 +23,9 @@ import ghidra.dbg.target.TargetObject;
public interface TestDebuggerModelProvider {
interface ModelHost extends AutoCloseable {
interface WithoutThreadValidation extends AutoCloseable {
}
Map<String, Object> getFactoryOptions();
ModelHost build() throws Throwable;
@ -57,6 +60,8 @@ public interface TestDebuggerModelProvider {
boolean hasProcessContainer();
WithoutThreadValidation withoutThreadValidation();
<T extends TargetObject> T find(Class<T> cls, List<String> seedPath) throws Throwable;
/**