diff --git a/tests/binaries/__init__.py b/tests/binaries/__init__.py index c548f6d73..5818befff 100644 --- a/tests/binaries/__init__.py +++ b/tests/binaries/__init__.py @@ -1,7 +1,7 @@ import os -from . import old_bash +from . import div_zero_binary path = os.path.dirname(__file__) diff --git a/tests/binaries/old_bash/__init__.py b/tests/binaries/div_zero_binary/__init__.py similarity index 100% rename from tests/binaries/old_bash/__init__.py rename to tests/binaries/div_zero_binary/__init__.py diff --git a/tests/binaries/div_zero_binary/binary b/tests/binaries/div_zero_binary/binary new file mode 100755 index 000000000..15db3508d Binary files /dev/null and b/tests/binaries/div_zero_binary/binary differ diff --git a/tests/binaries/div_zero_binary/binary.c b/tests/binaries/div_zero_binary/binary.c new file mode 100644 index 000000000..96aab9155 --- /dev/null +++ b/tests/binaries/div_zero_binary/binary.c @@ -0,0 +1,3 @@ +int main() { + return 1 / 0; +} diff --git a/tests/binaries/div_zero_binary/core b/tests/binaries/div_zero_binary/core new file mode 100644 index 000000000..079821ae5 Binary files /dev/null and b/tests/binaries/div_zero_binary/core differ diff --git a/tests/binaries/old_bash/binary b/tests/binaries/old_bash/binary deleted file mode 100755 index fc39dd3ec..000000000 Binary files a/tests/binaries/old_bash/binary and /dev/null differ diff --git a/tests/binaries/old_bash/core b/tests/binaries/old_bash/core deleted file mode 100644 index b36d4f3d9..000000000 Binary files a/tests/binaries/old_bash/core and /dev/null differ diff --git a/tests/test_loads.py b/tests/test_loads.py index 550cd7be8..3dc566bb3 100644 --- a/tests/test_loads.py +++ b/tests/test_loads.py @@ -55,8 +55,8 @@ HELLO = [ 'pwndbg: created $rebase, $ida gdb functions (can be used with print/break)' ] -BASH_BIN = tests.binaries.old_bash.get('binary') -BASH_CORE = tests.binaries.old_bash.get('core') +BINARY = tests.binaries.div_zero_binary.get('binary') +CORE = tests.binaries.div_zero_binary.get('core') launched_locally = not (os.environ.get('PWNDBG_TRAVIS_TEST_RUN')) @@ -68,10 +68,10 @@ def test_loads_pure_gdb_without_crashing(): @pytest.mark.skipif(launched_locally, reason='This test uses binaries compiled on travis builds.') def test_loads_binary_without_crashing(): - output = run_gdb_with_script(binary=BASH_BIN).splitlines() + output = run_gdb_with_script(binary=BINARY).splitlines() - expected = ['Reading symbols from %s...' % BASH_BIN, - '(No debugging symbols found in %s)' % BASH_BIN] + expected = ['Reading symbols from %s...' % BINARY, + '(No debugging symbols found in %s)' % BINARY] expected += HELLO assert all(item in output for item in expected) @@ -79,50 +79,15 @@ def test_loads_binary_without_crashing(): @pytest.mark.skipif(launched_locally, reason='This test uses binaries compiled on travis builds.') def test_loads_binary_with_core_without_crashing(): - output = run_gdb_with_script(binary=BASH_BIN, core=BASH_CORE).splitlines() + output = run_gdb_with_script(binary=BINARY, core=CORE).splitlines() expected = [ - 'Reading symbols from %s...' % BASH_BIN, - '(No debugging symbols found in %s)' % BASH_BIN, - '', - "warning: Can't open file /home/user/pwndbg/tests/corefiles/bash/binary " - 'during file-backed mapping note processing', '', - "warning: Can't open file /lib/x86_64-linux-gnu/libnss_files-2.19.so during " - 'file-backed mapping note processing', '', - "warning: Can't open file /lib/x86_64-linux-gnu/libnss_nis-2.19.so during " - 'file-backed mapping note processing', '', - "warning: Can't open file /lib/x86_64-linux-gnu/libnsl-2.19.so during " - 'file-backed mapping note processing', '', - "warning: Can't open file /lib/x86_64-linux-gnu/libnss_compat-2.19.so during " - 'file-backed mapping note processing', '', - "warning: Can't open file /lib/x86_64-linux-gnu/libc-2.19.so during " - 'file-backed mapping note processing', '', - "warning: Can't open file /lib/x86_64-linux-gnu/libdl-2.19.so during " - 'file-backed mapping note processing', '', - "warning: Can't open file /lib/x86_64-linux-gnu/ld-2.19.so during file-backed " - 'mapping note processing', - "[New LWP 13562]", '', - "warning: Unexpected size of section `.reg-xstate/13562' in core file.", '', - 'warning: .dynamic section for "/lib/x86_64-linux-gnu/libtinfo.so.5" is not ' - 'at the expected address (wrong library or version mismatch?)', '', - 'warning: .dynamic section for "/lib/x86_64-linux-gnu/libdl.so.2" is not at ' - 'the expected address (wrong library or version mismatch?)', '', - 'warning: .dynamic section for "/lib/x86_64-linux-gnu/libc.so.6" is not at ' - 'the expected address (wrong library or version mismatch?)', '', - 'warning: .dynamic section for "/lib64/ld-linux-x86-64.so.2" is not at the ' - 'expected address (wrong library or version mismatch?)', '', - 'warning: .dynamic section for "/lib/x86_64-linux-gnu/libnss_compat.so.2" is ' - 'not at the expected address (wrong library or version mismatch?)', '', - 'warning: .dynamic section for "/lib/x86_64-linux-gnu/libnsl.so.1" is not at ' - 'the expected address (wrong library or version mismatch?)', '', - 'warning: .dynamic section for "/lib/x86_64-linux-gnu/libnss_nis.so.2" is not ' - 'at the expected address (wrong library or version mismatch?)', '', - 'warning: .dynamic section for "/lib/x86_64-linux-gnu/libnss_files.so.2" is ' - 'not at the expected address (wrong library or version mismatch?)', - "Core was generated by `/home/user/pwndbg/tests/corefiles/bash/binary'.", - 'Program terminated with signal SIGINT, Interrupt.', '', - "warning: Unexpected size of section `.reg-xstate/13562' in core file.", - '#0 0x00007ffff76d36b0 in ?? ()', + 'Reading symbols from %s...' % BINARY, + '(No debugging symbols found in %s)' % BINARY, + '[New LWP 45429]', + "Core was generated by `./binary'.", + 'Program terminated with signal SIGFPE, Arithmetic exception.', + '#0 0x0000556e99b7913c in main ()', ] expected += HELLO @@ -131,13 +96,13 @@ def test_loads_binary_with_core_without_crashing(): @pytest.mark.skipif(launched_locally, reason='This test uses binaries compiled on travis builds.') def test_loads_core_without_crashing(): - output = run_gdb_with_script(core=BASH_CORE).splitlines() + output = run_gdb_with_script(core=CORE).splitlines() expected = [ - '''[New LWP 13562]''', - '''Core was generated by `/home/user/pwndbg/tests/corefiles/bash/binary'.''', - '''Program terminated with signal SIGINT, Interrupt.''', - '''#0 0x00007ffff76d36b0 in ?? ()''' + "[New LWP 45429]", + "Core was generated by `./binary'.", + 'Program terminated with signal SIGFPE, Arithmetic exception.', + '#0 0x0000556e99b7913c in ?? ()', ] expected += HELLO