mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GT-3064 fixing importing to be cancellable
This commit is contained in:
parent
70757b658e
commit
33c5feac44
22 changed files with 279 additions and 252 deletions
|
@ -47,7 +47,7 @@ public class FileBytesTest extends AbstractGenericTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStoreAndRetrieveFileBytes() throws IOException {
|
||||
public void testStoreAndRetrieveFileBytes() throws Exception {
|
||||
int dataSize = MAX_BUFFER_SIZE_FOR_TESTING / 2;
|
||||
FileBytes fileBytes = createFileBytes("testFile", dataSize);
|
||||
|
||||
|
@ -186,13 +186,13 @@ public class FileBytesTest extends AbstractGenericTest {
|
|||
}
|
||||
}
|
||||
|
||||
private FileBytes createFileBytes(String name, int size) throws IOException {
|
||||
private FileBytes createFileBytes(String name, int size) throws Exception {
|
||||
byte[] bytes = new byte[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
bytes[i] = (byte) i;
|
||||
}
|
||||
try (ByteArrayInputStream is = new ByteArrayInputStream(bytes)) {
|
||||
return mem.createFileBytes(name, 0, size, is);
|
||||
return mem.createFileBytes(name, 0, size, is, TaskMonitor.DUMMY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ package ghidra.program.database.mem;
|
|||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.*;
|
||||
|
@ -282,7 +281,8 @@ public class MemBlockDBTest extends AbstractGenericTest {
|
|||
@Test
|
||||
public void testCreateFileBytesBlockOutSideRange() throws Exception {
|
||||
byte[] bytes = new byte[256];
|
||||
FileBytes fileBytes = mem.createFileBytes("test", 0, 100, new ByteArrayInputStream(bytes));
|
||||
FileBytes fileBytes =
|
||||
mem.createFileBytes("test", 0, 100, new ByteArrayInputStream(bytes), TaskMonitor.DUMMY);
|
||||
try {
|
||||
mem.createInitializedBlock("test", addr(100), fileBytes, 10, 100, false);
|
||||
fail(
|
||||
|
@ -379,7 +379,6 @@ public class MemBlockDBTest extends AbstractGenericTest {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testJoinFileBytesBlockAndBufferBlock() throws Exception {
|
||||
FileBytes fileBytes = createFileBytes();
|
||||
|
@ -695,7 +694,6 @@ public class MemBlockDBTest extends AbstractGenericTest {
|
|||
assertEquals(2, ranges.getRangeCount()); // we have two sublocks so two distinct ranges
|
||||
assertEquals(10, ranges.get(0).getSize() + ranges.get(1).getSize());
|
||||
|
||||
|
||||
ByteSourceRange range = ranges.get(0);
|
||||
assertEquals(10, range.getStart().getOffset());
|
||||
assertEquals(15, range.getEnd().getOffset());
|
||||
|
@ -857,7 +855,7 @@ public class MemBlockDBTest extends AbstractGenericTest {
|
|||
assertEquals(0, range.getOffset());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test
|
||||
public void testAddressSourceInfoForFileBytesBlock() throws Exception {
|
||||
FileBytes fileBytes = createFileBytes();
|
||||
mem.createInitializedBlock("block", addr(100), fileBytes, 10, 50, false);
|
||||
|
@ -919,12 +917,13 @@ public class MemBlockDBTest extends AbstractGenericTest {
|
|||
false);
|
||||
}
|
||||
|
||||
private FileBytes createFileBytes() throws IOException {
|
||||
private FileBytes createFileBytes() throws Exception {
|
||||
byte[] bytes = new byte[256];
|
||||
for (int i = 0; i < 256; i++) {
|
||||
bytes[i] = (byte) i;
|
||||
}
|
||||
FileBytes fileBytes = mem.createFileBytes("test", 0, 100, new ByteArrayInputStream(bytes));
|
||||
FileBytes fileBytes =
|
||||
mem.createFileBytes("test", 0, 100, new ByteArrayInputStream(bytes), TaskMonitor.DUMMY);
|
||||
return fileBytes;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue