Skip to content

Commit

Permalink
tests: add test for x86_32
Browse files Browse the repository at this point in the history
This patch adds a simple x86_32 test that covers
pt and pt -ss. The Kolibri OS was chosen since I
had a local floppy image and the OS is fairly
small.

For issue #11
  • Loading branch information
martinradev committed Dec 24, 2023
1 parent 070c683 commit cba5e00
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/integration_tests/run_integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,31 @@ def test_pt_walk_golden_images(request, arch_name, image_name):

assert(expected_data == generated_data)

def test_pt_x86_32():
vm = VM_X86_64(ImageContainer().get_kolibri_x86_32(), fda_name = "kolibri.img")
vm.start()

time.sleep(15)

gdb = GdbCommandExecutor(vm)
res = gdb.run_cmd("pt")
ranges = parse_va_ranges("x86_64", res.output)
assert(len(ranges) > 0)

monitor = QemuMonitorExecutor(vm)

for r in ranges:
addr = r.va_start
data = monitor.read_virt_memory(addr, 4)
assert(len(data) == 4)

res = gdb.run_cmd(f"pt -walk {hex(ranges[0].va_start)}")
assert("Last stage faulted" not in res.output)

res = gdb.run_cmd("pt -ss Kolibri")
occs = parse_occurrences("x86_64", res.output)
assert(len(occs) > 1)

if __name__ == "__main__":
print("This code should be invoked via 'pytest':", file=sys.stderr)
print("")
Expand Down
3 changes: 3 additions & 0 deletions tests/integration_tests/vm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def __init__(self):
def get_linux_x86_64(self):
return os.path.join(self.images_dir, "linux_x86_64")

def get_kolibri_x86_32(self):
return os.path.join(self.images_dir, "kolibri_x86_32")

def get_linux_arm_64(self):
return os.path.join(self.images_dir, "linux_arm_64")

Expand Down

0 comments on commit cba5e00

Please sign in to comment.