Speeding up PPC tests significantly.

This commit is contained in:
Ben Vanik 2015-12-27 12:03:30 -08:00
parent 6c59881eee
commit ca8d658ffe
3 changed files with 16 additions and 5 deletions

View File

@ -176,10 +176,6 @@ class TestRunner {
memory_size = 64 * 1024 * 1024;
memory.reset(new Memory());
memory->Initialize();
processor.reset(new Processor(memory.get(), nullptr, nullptr));
processor->Setup();
processor->set_debug_info_flags(DebugInfoFlags::kDebugInfoAll);
}
~TestRunner() {
@ -189,6 +185,14 @@ class TestRunner {
}
bool Setup(TestSuite& suite) {
// Reset memory.
memory->Reset();
// Setup a fresh processor.
processor.reset(new Processor(memory.get(), nullptr, nullptr));
processor->Setup();
processor->set_debug_info_flags(DebugInfoFlags::kDebugInfoAll);
// Load the binary module.
auto module = std::make_unique<xe::cpu::RawModule>(processor.get());
if (!module->LoadFile(START_ADDRESS, suite.bin_file_path)) {
@ -417,12 +421,12 @@ bool RunTests(const std::wstring& test_name) {
return false;
}
TestRunner runner;
for (auto& test_suite : test_suites) {
XELOGI("%ls.s:", test_suite.name.c_str());
for (auto& test_case : test_suite.test_cases) {
XELOGI(" - %s", test_case.name.c_str());
TestRunner runner;
ProtectedRunTest(test_suite, runner, test_case, failed_count,
passed_count);
}

View File

@ -270,6 +270,10 @@ void Memory::UnmapViews() {
}
}
void Memory::Reset() {
// TODO(benvanik): zero memory, free all heap page tables, etc.
}
BaseHeap* Memory::LookupHeap(uint32_t address) {
if (address < 0x40000000) {
return &heaps_.v00000000;

View File

@ -226,6 +226,9 @@ class Memory {
// mapping to the file system fails.
bool Initialize();
// Resets all memory to zero and resets all allocations.
void Reset();
// Full file name and path of the memory-mapped file backing all memory.
const std::wstring& file_name() const { return file_name_; }