From e63d289b9576569a5eb1dba20acb549e0508aedc Mon Sep 17 00:00:00 2001 From: Gulshan Singh Date: Tue, 18 Oct 2022 08:08:41 -0700 Subject: [PATCH] Move tests/ to tests/gdb-tests/ --- .gitignore | 1 + tests.sh | 95 +----------------- tests/{ => gdb-tests}/conftest.py | 0 .../gdb-tests/pytests_collect.py | 0 .../gdb-tests/pytests_launcher.py | 0 tests/gdb-tests/tests.sh | 94 +++++++++++++++++ tests/{ => gdb-tests/tests}/__init__.py | 0 .../tests}/binaries/__init__.py | 0 .../binaries/crash_simple.asm.nocompile | 0 .../binaries/crash_simple.out.hardcoded | Bin .../tests}/binaries/div_zero_binary/Makefile | 0 .../binaries/div_zero_binary/__init__.py | 0 .../tests}/binaries/div_zero_binary/binary.c | 0 .../tests}/binaries/emulate_disasm.asm | 0 .../tests}/binaries/emulate_disasm_loop.asm | 0 .../binaries/glibcs/2.33/.debug/libc-2.33.so | Bin .../tests}/binaries/glibcs/2.33/ld-2.33.so | Bin .../binaries/glibcs/2.33/ld-linux-x86-64.so.2 | 0 .../tests}/binaries/glibcs/2.33/libc-2.33.so | Bin .../tests}/binaries/glibcs/2.33/libc.so.6 | 0 .../tests}/binaries/glibcs/README.md | 0 .../tests}/binaries/gosample.x64.go | 0 .../tests}/binaries/gosample.x86.go | 0 .../tests}/binaries/heap_bins.c | 0 .../tests}/binaries/heap_bugs.c | 0 .../tests}/binaries/heap_find_fake_fast.c | 0 .../tests}/binaries/heap_malloc_chunk.c | 0 .../{ => gdb-tests/tests}/binaries/heap_vis.c | 0 tests/{ => gdb-tests/tests}/binaries/makefile | 0 .../{ => gdb-tests/tests}/binaries/memory.asm | 0 .../tests}/binaries/reference-binary.c | 0 .../tests}/binaries/telescope_binary.c | 0 .../{ => gdb-tests/tests}/binaries/use-fds.c | 0 .../tests}/heap/test_find_fake_fast.py | 0 tests/{ => gdb-tests/tests}/heap/test_heap.py | 0 .../tests}/heap/test_heap_bins.py | 0 .../tests}/heap/test_try_free.py | 0 .../tests}/heap/test_vis_heap_chunks.py | 0 tests/{ => gdb-tests/tests}/test_attachp.py | 0 .../tests}/test_command_distance.py | 0 .../tests}/test_command_errno.py | 0 .../tests}/test_command_ignore.py | 0 .../tests}/test_command_procinfo.py | 0 .../tests}/test_command_telescope.py | 0 .../tests}/test_command_vmmap.py | 6 +- .../{ => gdb-tests/tests}/test_command_xor.py | 0 tests/{ => gdb-tests/tests}/test_commands.py | 0 .../tests}/test_commands_next.py | 0 .../tests}/test_context_commands.py | 4 +- tests/{ => gdb-tests/tests}/test_emulate.py | 0 tests/{ => gdb-tests/tests}/test_go.py | 0 tests/{ => gdb-tests/tests}/test_hexdump.py | 0 tests/{ => gdb-tests/tests}/test_loads.py | 0 tests/{ => gdb-tests/tests}/test_memory.py | 0 tests/{ => gdb-tests/tests}/test_misc.py | 0 tests/{ => gdb-tests/tests}/test_mprotect.py | 0 tests/{ => gdb-tests/tests}/test_triggers.py | 0 tests/{ => gdb-tests/tests}/test_windbg.py | 0 tests/{ => gdb-tests/tests}/utils.py | 2 +- 59 files changed, 104 insertions(+), 98 deletions(-) rename tests/{ => gdb-tests}/conftest.py (100%) rename pytests_collect.py => tests/gdb-tests/pytests_collect.py (100%) rename pytests_launcher.py => tests/gdb-tests/pytests_launcher.py (100%) create mode 100755 tests/gdb-tests/tests.sh rename tests/{ => gdb-tests/tests}/__init__.py (100%) rename tests/{ => gdb-tests/tests}/binaries/__init__.py (100%) rename tests/{ => gdb-tests/tests}/binaries/crash_simple.asm.nocompile (100%) rename tests/{ => gdb-tests/tests}/binaries/crash_simple.out.hardcoded (100%) rename tests/{ => gdb-tests/tests}/binaries/div_zero_binary/Makefile (100%) rename tests/{ => gdb-tests/tests}/binaries/div_zero_binary/__init__.py (100%) rename tests/{ => gdb-tests/tests}/binaries/div_zero_binary/binary.c (100%) rename tests/{ => gdb-tests/tests}/binaries/emulate_disasm.asm (100%) rename tests/{ => gdb-tests/tests}/binaries/emulate_disasm_loop.asm (100%) rename tests/{ => gdb-tests/tests}/binaries/glibcs/2.33/.debug/libc-2.33.so (100%) rename tests/{ => gdb-tests/tests}/binaries/glibcs/2.33/ld-2.33.so (100%) rename tests/{ => gdb-tests/tests}/binaries/glibcs/2.33/ld-linux-x86-64.so.2 (100%) rename tests/{ => gdb-tests/tests}/binaries/glibcs/2.33/libc-2.33.so (100%) rename tests/{ => gdb-tests/tests}/binaries/glibcs/2.33/libc.so.6 (100%) rename tests/{ => gdb-tests/tests}/binaries/glibcs/README.md (100%) rename tests/{ => gdb-tests/tests}/binaries/gosample.x64.go (100%) rename tests/{ => gdb-tests/tests}/binaries/gosample.x86.go (100%) rename tests/{ => gdb-tests/tests}/binaries/heap_bins.c (100%) rename tests/{ => gdb-tests/tests}/binaries/heap_bugs.c (100%) rename tests/{ => gdb-tests/tests}/binaries/heap_find_fake_fast.c (100%) rename tests/{ => gdb-tests/tests}/binaries/heap_malloc_chunk.c (100%) rename tests/{ => gdb-tests/tests}/binaries/heap_vis.c (100%) rename tests/{ => gdb-tests/tests}/binaries/makefile (100%) rename tests/{ => gdb-tests/tests}/binaries/memory.asm (100%) rename tests/{ => gdb-tests/tests}/binaries/reference-binary.c (100%) rename tests/{ => gdb-tests/tests}/binaries/telescope_binary.c (100%) rename tests/{ => gdb-tests/tests}/binaries/use-fds.c (100%) rename tests/{ => gdb-tests/tests}/heap/test_find_fake_fast.py (100%) rename tests/{ => gdb-tests/tests}/heap/test_heap.py (100%) rename tests/{ => gdb-tests/tests}/heap/test_heap_bins.py (100%) rename tests/{ => gdb-tests/tests}/heap/test_try_free.py (100%) rename tests/{ => gdb-tests/tests}/heap/test_vis_heap_chunks.py (100%) rename tests/{ => gdb-tests/tests}/test_attachp.py (100%) rename tests/{ => gdb-tests/tests}/test_command_distance.py (100%) rename tests/{ => gdb-tests/tests}/test_command_errno.py (100%) rename tests/{ => gdb-tests/tests}/test_command_ignore.py (100%) rename tests/{ => gdb-tests/tests}/test_command_procinfo.py (100%) rename tests/{ => gdb-tests/tests}/test_command_telescope.py (100%) rename tests/{ => gdb-tests/tests}/test_command_vmmap.py (96%) rename tests/{ => gdb-tests/tests}/test_command_xor.py (100%) rename tests/{ => gdb-tests/tests}/test_commands.py (100%) rename tests/{ => gdb-tests/tests}/test_commands_next.py (100%) rename tests/{ => gdb-tests/tests}/test_context_commands.py (94%) rename tests/{ => gdb-tests/tests}/test_emulate.py (100%) rename tests/{ => gdb-tests/tests}/test_go.py (100%) rename tests/{ => gdb-tests/tests}/test_hexdump.py (100%) rename tests/{ => gdb-tests/tests}/test_loads.py (100%) rename tests/{ => gdb-tests/tests}/test_memory.py (100%) rename tests/{ => gdb-tests/tests}/test_misc.py (100%) rename tests/{ => gdb-tests/tests}/test_mprotect.py (100%) rename tests/{ => gdb-tests/tests}/test_triggers.py (100%) rename tests/{ => gdb-tests/tests}/test_windbg.py (100%) rename tests/{ => gdb-tests/tests}/utils.py (96%) diff --git a/.gitignore b/.gitignore index 526015485..2842f2159 100644 --- a/.gitignore +++ b/.gitignore @@ -73,6 +73,7 @@ tests/**/binaries/*.out tests/**/binaries/gosample.x* tests/**/binaries/div_zero_binary/core tests/**/binaries/div_zero_binary/binary +!tests/**/binaries/*.go # VS Code files .vscode/ diff --git a/tests.sh b/tests.sh index 0b2e75514..9ed039419 100755 --- a/tests.sh +++ b/tests.sh @@ -1,95 +1,4 @@ #!/bin/bash -ROOT_DIR="$(pwd)" -GDB_INIT_PATH="$ROOT_DIR/gdbinit.py" - -help_and_exit() { - echo "Usage: ./tests.sh [-p|--pdb] []" - echo " -p, --pdb enable pdb (Python debugger) post mortem debugger on failed tests" - echo " run only tests that match the regex" - exit 1 -} - -if [[ $# -gt 2 ]]; then - help_and_exit -fi - -USE_PDB=0 -TEST_NAME_FILTER="" - -while [[ $# -gt 0 ]]; do - case $1 in - -p | --pdb) - USE_PDB=1 - echo "Will run tests with Python debugger" - shift - ;; - -h | --help) - help_and_exit - ;; - *) - if [[ ! -z "${TEST_NAME_FILTER}" ]]; then - help_and_exit - fi - TEST_NAME_FILTER="$1" - shift - ;; - esac -done - -if [[ -z "$ZIGPATH" ]]; then - # If ZIGPATH is not set, set it to $pwd/.zig - # In Docker environment this should by default be set to /opt/zig - export ZIGPATH="$ROOT_DIR/.zig" -fi -echo "ZIGPATH set to $ZIGPATH" - -cd ./tests/binaries || exit 1 -make clean && make all || exit 2 -cd ../../ - -run_gdb() { - gdb --silent --nx --nh "$@" --eval-command quit -} - -# NOTE: We run tests under GDB sessions and because of some cleanup/tests dependencies problems -# we decided to run each test in a separate GDB session -gdb_args=(--command $GDB_INIT_PATH --command pytests_collect.py) -TESTS_COLLECT_OUTPUT=$(run_gdb "${gdb_args[@]}") - -if [ $? -eq 1 ]; then - echo -E "$TESTS_COLLECT_OUTPUT" - exit 1 -fi - -TESTS_LIST=$(echo -E "$TESTS_COLLECT_OUTPUT" | grep -o "tests/.*::.*" | grep "${TEST_NAME_FILTER}") - -tests_passed_or_skipped=0 -tests_failed=0 - -for test_case in ${TESTS_LIST}; do - gdb_args=(-ex 'py import coverage;coverage.process_startup()' --command $GDB_INIT_PATH --command pytests_launcher.py) - COVERAGE_PROCESS_START=.coveragerc \ - USE_PDB="${USE_PDB}" \ - PWNDBG_LAUNCH_TEST="${test_case}" \ - PWNDBG_DISABLE_COLORS=1 \ - run_gdb "${gdb_args[@]}" - - exit_status=$? - if [ ${exit_status} -eq 0 ]; then - ((++tests_passed_or_skipped)) - else - ((++tests_failed)) - fi -done - -echo "" -echo "*********************************" -echo "********* TESTS SUMMARY *********" -echo "*********************************" -echo "Tests passed or skipped: ${tests_passed_or_skipped}" -echo "Tests failed: ${tests_failed}" - -if [ "${tests_failed}" -ne 0 ]; then - exit 1 -fi +cd tests/gdb-tests +./tests.sh $@ diff --git a/tests/conftest.py b/tests/gdb-tests/conftest.py similarity index 100% rename from tests/conftest.py rename to tests/gdb-tests/conftest.py diff --git a/pytests_collect.py b/tests/gdb-tests/pytests_collect.py similarity index 100% rename from pytests_collect.py rename to tests/gdb-tests/pytests_collect.py diff --git a/pytests_launcher.py b/tests/gdb-tests/pytests_launcher.py similarity index 100% rename from pytests_launcher.py rename to tests/gdb-tests/pytests_launcher.py diff --git a/tests/gdb-tests/tests.sh b/tests/gdb-tests/tests.sh new file mode 100755 index 000000000..5e789343c --- /dev/null +++ b/tests/gdb-tests/tests.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +ROOT_DIR="$(readlink -f ../../)" +GDB_INIT_PATH="$ROOT_DIR/gdbinit.py" +COVERAGERC_PATH="$ROOT_DIR/.coveragerc" + +help_and_exit() { + echo "Usage: ./tests.sh [-p|--pdb] []" + echo " -p, --pdb enable pdb (Python debugger) post mortem debugger on failed tests" + echo " run only tests that match the regex" + exit 1 +} + +if [[ $# -gt 2 ]]; then + help_and_exit +fi + +USE_PDB=0 +TEST_NAME_FILTER="" + +while [[ $# -gt 0 ]]; do + case $1 in + -p | --pdb) + USE_PDB=1 + echo "Will run tests with Python debugger" + shift + ;; + -h | --help) + help_and_exit + ;; + *) + if [[ ! -z "${TEST_NAME_FILTER}" ]]; then + help_and_exit + fi + TEST_NAME_FILTER="$1" + shift + ;; + esac +done + +if [[ -z "$ZIGPATH" ]]; then + # If ZIGPATH is not set, set it to $pwd/.zig + # In Docker environment this should by default be set to /opt/zig + export ZIGPATH="$ROOT_DIR/.zig" +fi +echo "ZIGPATH set to $ZIGPATH" + +(cd ./tests/binaries && make clean && make all) || exit 1 + +run_gdb() { + gdb --silent --nx --nh "$@" --eval-command quit +} + +# NOTE: We run tests under GDB sessions and because of some cleanup/tests dependencies problems +# we decided to run each test in a separate GDB session +gdb_args=(--command $GDB_INIT_PATH --command pytests_collect.py) +TESTS_COLLECT_OUTPUT=$(run_gdb "${gdb_args[@]}") + +if [ $? -eq 1 ]; then + echo -E "$TESTS_COLLECT_OUTPUT" + exit 1 +fi + +TESTS_LIST=$(echo -E "$TESTS_COLLECT_OUTPUT" | grep -o "tests/.*::.*" | grep "${TEST_NAME_FILTER}") + +tests_passed_or_skipped=0 +tests_failed=0 + +for test_case in ${TESTS_LIST}; do + gdb_args=(-ex 'py import coverage;coverage.process_startup()' --command $GDB_INIT_PATH --command pytests_launcher.py) + COVERAGE_PROCESS_START=$COVERAGERC_PATH \ + USE_PDB="${USE_PDB}" \ + PWNDBG_LAUNCH_TEST="${test_case}" \ + PWNDBG_DISABLE_COLORS=1 \ + run_gdb "${gdb_args[@]}" + + exit_status=$? + if [ ${exit_status} -eq 0 ]; then + ((++tests_passed_or_skipped)) + else + ((++tests_failed)) + fi +done + +echo "" +echo "*********************************" +echo "********* TESTS SUMMARY *********" +echo "*********************************" +echo "Tests passed or skipped: ${tests_passed_or_skipped}" +echo "Tests failed: ${tests_failed}" + +if [ "${tests_failed}" -ne 0 ]; then + exit 1 +fi diff --git a/tests/__init__.py b/tests/gdb-tests/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to tests/gdb-tests/tests/__init__.py diff --git a/tests/binaries/__init__.py b/tests/gdb-tests/tests/binaries/__init__.py similarity index 100% rename from tests/binaries/__init__.py rename to tests/gdb-tests/tests/binaries/__init__.py diff --git a/tests/binaries/crash_simple.asm.nocompile b/tests/gdb-tests/tests/binaries/crash_simple.asm.nocompile similarity index 100% rename from tests/binaries/crash_simple.asm.nocompile rename to tests/gdb-tests/tests/binaries/crash_simple.asm.nocompile diff --git a/tests/binaries/crash_simple.out.hardcoded b/tests/gdb-tests/tests/binaries/crash_simple.out.hardcoded similarity index 100% rename from tests/binaries/crash_simple.out.hardcoded rename to tests/gdb-tests/tests/binaries/crash_simple.out.hardcoded diff --git a/tests/binaries/div_zero_binary/Makefile b/tests/gdb-tests/tests/binaries/div_zero_binary/Makefile similarity index 100% rename from tests/binaries/div_zero_binary/Makefile rename to tests/gdb-tests/tests/binaries/div_zero_binary/Makefile diff --git a/tests/binaries/div_zero_binary/__init__.py b/tests/gdb-tests/tests/binaries/div_zero_binary/__init__.py similarity index 100% rename from tests/binaries/div_zero_binary/__init__.py rename to tests/gdb-tests/tests/binaries/div_zero_binary/__init__.py diff --git a/tests/binaries/div_zero_binary/binary.c b/tests/gdb-tests/tests/binaries/div_zero_binary/binary.c similarity index 100% rename from tests/binaries/div_zero_binary/binary.c rename to tests/gdb-tests/tests/binaries/div_zero_binary/binary.c diff --git a/tests/binaries/emulate_disasm.asm b/tests/gdb-tests/tests/binaries/emulate_disasm.asm similarity index 100% rename from tests/binaries/emulate_disasm.asm rename to tests/gdb-tests/tests/binaries/emulate_disasm.asm diff --git a/tests/binaries/emulate_disasm_loop.asm b/tests/gdb-tests/tests/binaries/emulate_disasm_loop.asm similarity index 100% rename from tests/binaries/emulate_disasm_loop.asm rename to tests/gdb-tests/tests/binaries/emulate_disasm_loop.asm diff --git a/tests/binaries/glibcs/2.33/.debug/libc-2.33.so b/tests/gdb-tests/tests/binaries/glibcs/2.33/.debug/libc-2.33.so similarity index 100% rename from tests/binaries/glibcs/2.33/.debug/libc-2.33.so rename to tests/gdb-tests/tests/binaries/glibcs/2.33/.debug/libc-2.33.so diff --git a/tests/binaries/glibcs/2.33/ld-2.33.so b/tests/gdb-tests/tests/binaries/glibcs/2.33/ld-2.33.so similarity index 100% rename from tests/binaries/glibcs/2.33/ld-2.33.so rename to tests/gdb-tests/tests/binaries/glibcs/2.33/ld-2.33.so diff --git a/tests/binaries/glibcs/2.33/ld-linux-x86-64.so.2 b/tests/gdb-tests/tests/binaries/glibcs/2.33/ld-linux-x86-64.so.2 similarity index 100% rename from tests/binaries/glibcs/2.33/ld-linux-x86-64.so.2 rename to tests/gdb-tests/tests/binaries/glibcs/2.33/ld-linux-x86-64.so.2 diff --git a/tests/binaries/glibcs/2.33/libc-2.33.so b/tests/gdb-tests/tests/binaries/glibcs/2.33/libc-2.33.so similarity index 100% rename from tests/binaries/glibcs/2.33/libc-2.33.so rename to tests/gdb-tests/tests/binaries/glibcs/2.33/libc-2.33.so diff --git a/tests/binaries/glibcs/2.33/libc.so.6 b/tests/gdb-tests/tests/binaries/glibcs/2.33/libc.so.6 similarity index 100% rename from tests/binaries/glibcs/2.33/libc.so.6 rename to tests/gdb-tests/tests/binaries/glibcs/2.33/libc.so.6 diff --git a/tests/binaries/glibcs/README.md b/tests/gdb-tests/tests/binaries/glibcs/README.md similarity index 100% rename from tests/binaries/glibcs/README.md rename to tests/gdb-tests/tests/binaries/glibcs/README.md diff --git a/tests/binaries/gosample.x64.go b/tests/gdb-tests/tests/binaries/gosample.x64.go similarity index 100% rename from tests/binaries/gosample.x64.go rename to tests/gdb-tests/tests/binaries/gosample.x64.go diff --git a/tests/binaries/gosample.x86.go b/tests/gdb-tests/tests/binaries/gosample.x86.go similarity index 100% rename from tests/binaries/gosample.x86.go rename to tests/gdb-tests/tests/binaries/gosample.x86.go diff --git a/tests/binaries/heap_bins.c b/tests/gdb-tests/tests/binaries/heap_bins.c similarity index 100% rename from tests/binaries/heap_bins.c rename to tests/gdb-tests/tests/binaries/heap_bins.c diff --git a/tests/binaries/heap_bugs.c b/tests/gdb-tests/tests/binaries/heap_bugs.c similarity index 100% rename from tests/binaries/heap_bugs.c rename to tests/gdb-tests/tests/binaries/heap_bugs.c diff --git a/tests/binaries/heap_find_fake_fast.c b/tests/gdb-tests/tests/binaries/heap_find_fake_fast.c similarity index 100% rename from tests/binaries/heap_find_fake_fast.c rename to tests/gdb-tests/tests/binaries/heap_find_fake_fast.c diff --git a/tests/binaries/heap_malloc_chunk.c b/tests/gdb-tests/tests/binaries/heap_malloc_chunk.c similarity index 100% rename from tests/binaries/heap_malloc_chunk.c rename to tests/gdb-tests/tests/binaries/heap_malloc_chunk.c diff --git a/tests/binaries/heap_vis.c b/tests/gdb-tests/tests/binaries/heap_vis.c similarity index 100% rename from tests/binaries/heap_vis.c rename to tests/gdb-tests/tests/binaries/heap_vis.c diff --git a/tests/binaries/makefile b/tests/gdb-tests/tests/binaries/makefile similarity index 100% rename from tests/binaries/makefile rename to tests/gdb-tests/tests/binaries/makefile diff --git a/tests/binaries/memory.asm b/tests/gdb-tests/tests/binaries/memory.asm similarity index 100% rename from tests/binaries/memory.asm rename to tests/gdb-tests/tests/binaries/memory.asm diff --git a/tests/binaries/reference-binary.c b/tests/gdb-tests/tests/binaries/reference-binary.c similarity index 100% rename from tests/binaries/reference-binary.c rename to tests/gdb-tests/tests/binaries/reference-binary.c diff --git a/tests/binaries/telescope_binary.c b/tests/gdb-tests/tests/binaries/telescope_binary.c similarity index 100% rename from tests/binaries/telescope_binary.c rename to tests/gdb-tests/tests/binaries/telescope_binary.c diff --git a/tests/binaries/use-fds.c b/tests/gdb-tests/tests/binaries/use-fds.c similarity index 100% rename from tests/binaries/use-fds.c rename to tests/gdb-tests/tests/binaries/use-fds.c diff --git a/tests/heap/test_find_fake_fast.py b/tests/gdb-tests/tests/heap/test_find_fake_fast.py similarity index 100% rename from tests/heap/test_find_fake_fast.py rename to tests/gdb-tests/tests/heap/test_find_fake_fast.py diff --git a/tests/heap/test_heap.py b/tests/gdb-tests/tests/heap/test_heap.py similarity index 100% rename from tests/heap/test_heap.py rename to tests/gdb-tests/tests/heap/test_heap.py diff --git a/tests/heap/test_heap_bins.py b/tests/gdb-tests/tests/heap/test_heap_bins.py similarity index 100% rename from tests/heap/test_heap_bins.py rename to tests/gdb-tests/tests/heap/test_heap_bins.py diff --git a/tests/heap/test_try_free.py b/tests/gdb-tests/tests/heap/test_try_free.py similarity index 100% rename from tests/heap/test_try_free.py rename to tests/gdb-tests/tests/heap/test_try_free.py diff --git a/tests/heap/test_vis_heap_chunks.py b/tests/gdb-tests/tests/heap/test_vis_heap_chunks.py similarity index 100% rename from tests/heap/test_vis_heap_chunks.py rename to tests/gdb-tests/tests/heap/test_vis_heap_chunks.py diff --git a/tests/test_attachp.py b/tests/gdb-tests/tests/test_attachp.py similarity index 100% rename from tests/test_attachp.py rename to tests/gdb-tests/tests/test_attachp.py diff --git a/tests/test_command_distance.py b/tests/gdb-tests/tests/test_command_distance.py similarity index 100% rename from tests/test_command_distance.py rename to tests/gdb-tests/tests/test_command_distance.py diff --git a/tests/test_command_errno.py b/tests/gdb-tests/tests/test_command_errno.py similarity index 100% rename from tests/test_command_errno.py rename to tests/gdb-tests/tests/test_command_errno.py diff --git a/tests/test_command_ignore.py b/tests/gdb-tests/tests/test_command_ignore.py similarity index 100% rename from tests/test_command_ignore.py rename to tests/gdb-tests/tests/test_command_ignore.py diff --git a/tests/test_command_procinfo.py b/tests/gdb-tests/tests/test_command_procinfo.py similarity index 100% rename from tests/test_command_procinfo.py rename to tests/gdb-tests/tests/test_command_procinfo.py diff --git a/tests/test_command_telescope.py b/tests/gdb-tests/tests/test_command_telescope.py similarity index 100% rename from tests/test_command_telescope.py rename to tests/gdb-tests/tests/test_command_telescope.py diff --git a/tests/test_command_vmmap.py b/tests/gdb-tests/tests/test_command_vmmap.py similarity index 96% rename from tests/test_command_vmmap.py rename to tests/gdb-tests/tests/test_command_vmmap.py index c6e698976..8e27e9bb0 100644 --- a/tests/test_command_vmmap.py +++ b/tests/gdb-tests/tests/test_command_vmmap.py @@ -15,7 +15,7 @@ def get_proc_maps(): Mapped address spaces: Start Addr End Addr Size Offset objfile - 0x400000 0x401000 0x1000 0x0 /opt/pwndbg/tests/binaries/crash_simple.out + 0x400000 0x401000 0x1000 0x0 /opt/pwndbg/tests/gdb-tests/tests/binaries/crash_simple.out 0x7ffff7ffa000 0x7ffff7ffd000 0x3000 0x0 [vvar] 0x7ffff7ffd000 0x7ffff7fff000 0x2000 0x0 [vdso] 0x7ffffffde000 0x7ffffffff000 0x21000 0x0 [stack] @@ -42,7 +42,7 @@ def test_command_vmmap_on_coredump_on_crash_simple_binary(start_binary): """ Example vmmap when debugging binary: LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA - 0x400000 0x401000 r-xp 1000 0 /opt/pwndbg/tests/binaries/crash_simple.out + 0x400000 0x401000 r-xp 1000 0 /opt/pwndbg/tests/gdb-tests/tests/binaries/crash_simple.out 0x7ffff7ffa000 0x7ffff7ffd000 r--p 3000 0 [vvar] 0x7ffff7ffd000 0x7ffff7fff000 r-xp 2000 0 [vdso] 0x7ffffffde000 0x7ffffffff000 rwxp 21000 0 [stack] @@ -50,7 +50,7 @@ def test_command_vmmap_on_coredump_on_crash_simple_binary(start_binary): The same vmmap when debugging coredump: LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA - 0x400000 0x401000 r-xp 1000 0 /opt/pwndbg/tests/binaries/crash_simple.out + 0x400000 0x401000 r-xp 1000 0 /opt/pwndbg/tests/gdb-tests/tests/binaries/crash_simple.out 0x7ffff7ffd000 0x7ffff7fff000 r-xp 2000 1158 load2 0x7ffffffde000 0x7ffffffff000 rwxp 21000 3158 [stack] 0xffffffffff600000 0xffffffffff601000 r-xp 1000 24158 [vsyscall] diff --git a/tests/test_command_xor.py b/tests/gdb-tests/tests/test_command_xor.py similarity index 100% rename from tests/test_command_xor.py rename to tests/gdb-tests/tests/test_command_xor.py diff --git a/tests/test_commands.py b/tests/gdb-tests/tests/test_commands.py similarity index 100% rename from tests/test_commands.py rename to tests/gdb-tests/tests/test_commands.py diff --git a/tests/test_commands_next.py b/tests/gdb-tests/tests/test_commands_next.py similarity index 100% rename from tests/test_commands_next.py rename to tests/gdb-tests/tests/test_commands_next.py diff --git a/tests/test_context_commands.py b/tests/gdb-tests/tests/test_context_commands.py similarity index 94% rename from tests/test_context_commands.py rename to tests/gdb-tests/tests/test_context_commands.py index f7823f7b4..58f4ecb28 100644 --- a/tests/test_context_commands.py +++ b/tests/gdb-tests/tests/test_context_commands.py @@ -54,7 +54,9 @@ def test_context_disasm_show_fd_filepath(start_binary): line_call_read, line_fd, line_buf, line_nbytes, *_rest = lines_after_call_read line_fd = line_fd.strip() - assert re.match(r"fd:\s+0x3 \([a-z/]*pwndbg/tests/binaries/use-fds.out\)", line_fd) + assert re.match( + r"fd:\s+0x3 \([a-z/]*pwndbg/tests/gdb-tests/tests/binaries/use-fds.out\)", line_fd + ) line_buf = line_buf.strip() assert re.match(r"buf:\s+0x[0-9a-f]+ ◂— 0x0", line_buf) diff --git a/tests/test_emulate.py b/tests/gdb-tests/tests/test_emulate.py similarity index 100% rename from tests/test_emulate.py rename to tests/gdb-tests/tests/test_emulate.py diff --git a/tests/test_go.py b/tests/gdb-tests/tests/test_go.py similarity index 100% rename from tests/test_go.py rename to tests/gdb-tests/tests/test_go.py diff --git a/tests/test_hexdump.py b/tests/gdb-tests/tests/test_hexdump.py similarity index 100% rename from tests/test_hexdump.py rename to tests/gdb-tests/tests/test_hexdump.py diff --git a/tests/test_loads.py b/tests/gdb-tests/tests/test_loads.py similarity index 100% rename from tests/test_loads.py rename to tests/gdb-tests/tests/test_loads.py diff --git a/tests/test_memory.py b/tests/gdb-tests/tests/test_memory.py similarity index 100% rename from tests/test_memory.py rename to tests/gdb-tests/tests/test_memory.py diff --git a/tests/test_misc.py b/tests/gdb-tests/tests/test_misc.py similarity index 100% rename from tests/test_misc.py rename to tests/gdb-tests/tests/test_misc.py diff --git a/tests/test_mprotect.py b/tests/gdb-tests/tests/test_mprotect.py similarity index 100% rename from tests/test_mprotect.py rename to tests/gdb-tests/tests/test_mprotect.py diff --git a/tests/test_triggers.py b/tests/gdb-tests/tests/test_triggers.py similarity index 100% rename from tests/test_triggers.py rename to tests/gdb-tests/tests/test_triggers.py diff --git a/tests/test_windbg.py b/tests/gdb-tests/tests/test_windbg.py similarity index 100% rename from tests/test_windbg.py rename to tests/gdb-tests/tests/test_windbg.py diff --git a/tests/utils.py b/tests/gdb-tests/tests/utils.py similarity index 96% rename from tests/utils.py rename to tests/gdb-tests/tests/utils.py index 85d08f909..06d87ad28 100644 --- a/tests/utils.py +++ b/tests/gdb-tests/tests/utils.py @@ -19,7 +19,7 @@ def run_gdb_with_script(binary="", core="", pybefore=None, pyafter=None, timeout for cmd in pybefore: command += ["--eval-command", cmd] - command += ["--command", "gdbinit.py"] + command += ["--command", "../../gdbinit.py"] if binary: command += [binary]