Commit Graph

22 Commits

Author SHA1 Message Date
OBarronCS 1438fc0616
Qemu user test structure (#2275)
* Initial version of qemu-user tests

* Refactor testing files to reduce file duplication, introduce qemu-user-tests

* lint and edit github actions workflow file. Move old qemu-user tests to seperate directory

* Add iproute2 so ss command is available

* test ubuntu 24

* funkiness with current working directory...

* Further remote old test_qemu.sh and integrate into a Pytest fixture

* lint

* Disable ASLR, add test for aarch64 jumps

* Use Popen.kill() function to make sure it closes.

Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>

* qemu.kill() on the other fixture as well

* comment

* comment

* lint

* system test path stuff

* remove old try-catch block

* revert

* revert path change

* Use os._exit to pass return code, and move qemu-user tests above system tests because they run significantly faster

* lint

* Flush stdout before os._exit

* Comment out flaky check for the address of main in old qemu tests

* rename qemu-user to cross-arch

* rename qemu-user to cross-arch and hotfix to not run pytest when
cross-arch is used

* remove todo comment

* another comment

* Test pwndbg.gdblib.symbol.address is not None and revert setarch -R

* Revert os.exit change

* Revert os.exit change

* Revert os.exit change

* readd os.exit in new exit places

* lint

* rebase

* delete file introduced in rebase

* break up tests into 3 files to invoke separately. Update GitHub workflow, remove code duplication in existing test

* code coverage

* fix code coverage

* lint

* test difference between Ubuntu 22 and 24 in Kernel tests

* lint

---------

Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
2024-08-17 01:49:45 +02:00
Gulshan Singh 6937566aa8
Manually set test script exit code (#2199) 2024-05-29 19:47:33 -07:00
Gulshan Singh d6abb33e02
Fix and re-enable unit tests (#2182)
* Add gdb_version to mock gdblib

* Re-enable unit tests

* Only collect unit test coverage if --cov is passed

* Source venv before running tests in github action

* Add venv path PATH in to Dockerfile

* Only check for "/ls" in `which` test
2024-05-29 00:33:37 -07:00
Aaron Adams 416ea74226
Refactor tests.py and small tweaks for running on nix (#2181) 2024-05-23 08:57:21 -07:00
intrigus-lgtm 427bf8c96e
Port gdb-tests from bash to python (#1916)
* [WIP] Port gdb-tests from bash to python

* Use threads instead of processes

* Port gdb tests to python

* Linting

* Fix coverage "again"

* Remove bash tests

---------

Co-authored-by: intrigus <abc123zeus@live.de>
2023-12-04 11:44:16 +01:00
Disconnect3d ffad9be01e
tests.sh: check for parallel_env requirement (closes #1606) (#1607)
* tests.sh: check for parallel_env requirement (closes #1606)

* fix shlint
2023-03-06 03:04:11 +01:00
Gulshan Singh 78065e8ba9 Fix config and theme commands 2022-10-19 13:18:06 -07:00
Gulshan Singh f0ea79575d Add unit-test for find_fake_fast command 2022-10-18 15:06:33 -07:00
Gulshan Singh e63d289b95 Move tests/ to tests/gdb-tests/ 2022-10-18 11:00:30 -07:00
disconnect3d b1772f166b fix test.sh lint issue 2022-09-23 00:26:45 +02:00
disconnect3d 75aa5a4316 add -h --help to tests.sh 2022-09-22 23:42:34 +02:00
Gulshan Singh cc50024417
Format shell scripts with shfmt (#1123)
* Add lint.sh script

* Format shell scripts with shfmt and add to lint.sh

Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
2022-09-05 13:24:52 +02:00
Gulshan Singh 7c53bdeaa8
Minor test cleanup (#1099)
* Silence nonnull warning when building heap_vis.c

* Fix checking ptrace_scope in test_attachp.py

* Fix .gitignore

* tests.sh cleanup

* Fixed coverage generation
2022-08-25 16:57:16 +02:00
Disconnect3d 890e314f2f
tests.sh: add [filter] and --pdb (#1092) 2022-08-24 00:05:57 +02:00
Artur Czepiel 4ee225b115
Make ZIGPATH configurable and provide defaults (#1090)
* Make ZIGPATH configurable and provide defaults

Mostly fixes docker/docker-compose environment where building zig into
$pwd/.zig doesn't work well because it is later overwritten by mounting
the volume in /pwndbg.

With current approach during the docker build zig is put in /opt/zig
instead, and when you run it without docker it's possible to configure a
different path (with sane defaults)

* remove Makefile

* add ZIGPATH to tests.sh for CI

* move ZIGPATH setting before make in tests
2022-08-23 23:02:12 +02:00
Gulshan Singh 8cb3d807c5
Fix test runner script for parallel make builds (#1083) 2022-08-22 14:37:46 +02:00
Arusekk 9c8df00462 Add basic coverage testing 2021-10-02 15:15:56 +02:00
Disconnect3d 6fd42dd5ab Add attachp command and tests for it 2021-09-21 03:20:08 +02:00
Israel Alberto RV bf49bf8356
Unit test fix (#868)
* Fixed the failed unit testing; Improved the Dockerfile, again.

* Fixed missing new line joiner in the Dockerfile.

* Fixed the default Python version from 2 to 3.

* Moved the installation of the nasm and golang packages to the setup script.

* Fixed the extra quotes which fails the sudo check.

* Added to the Git ignore file the output files assembled and linked in the test binaries.

* Removed the output files from test binaries.

* Added to the Git ignore file the virtual environment directory.

* Added sudo to the remove and link the Python3 binary.

* Added commands related to GO, to check why is failing.

* Fixed the installation of GO, only install if not exists in Ubuntu.

* Fixed the first test built in Assembler. Checks if it is working in GitHub.

* Fixed the problem with all the assembler tests; Extracted the asserts into methods, avoiding duplicates.

* Fixed some test, should be fail the Travis tests.

* Fixed one test for Travis.

* Fixed the asserts, now find all ecpected items into the output.

* Fixed the split message, joined again.

* Fixed the last error test for loads binary.

* Fixed one missing number in the comparison.

* Fixed the first Lint errors.

* Added comment in the Dockerfile.

The commented line about `git submodule`.

https://github.com/pwndbg/pwndbg/pull/868#discussion_r549075767

* Removed NASM and Go from the setup.

Created a new bash script to install them and added to the Dockerfile.

https://github.com/pwndbg/pwndbg/pull/868/files#r549075931

https://github.com/pwndbg/pwndbg/pull/868/files#r549076078

* Added the setup script in the GitHub test workflow.

https://github.com/pwndbg/pwndbg/pull/868/files#r549075931

https://github.com/pwndbg/pwndbg/pull/868/files#r549076078

* Testing the emulate cases.

It should be fail. I commented the emulation for the address 0x401000.

https://github.com/pwndbg/pwndbg/pull/868#discussion_r549111511

* Fixed the different start addresses in the assembler test.

https://github.com/pwndbg/pwndbg/pull/868#discussion_r549111511

https://github.com/pwndbg/pwndbg/pull/868#discussion_r549075485

* Experimenting with the python location.

Commented the remove python binary and added some logs.

https://github.com/pwndbg/pwndbg/pull/868#discussion_r549076170

* Removed the commands about delete Python and link the Python3.

https://github.com/pwndbg/pwndbg/pull/868#discussion_r549076170
2020-12-31 04:35:52 +01:00
Disconnect3d f2ebe4bce0
Fix nearpc following jumps when used w/o emulation (#499)
* Tests launcher: show passed and failed count

* Build nearpc, emulate, u, pdisass test binaries

* Add tests for emulate, nearpc, pdisass, u

* Refactored disasm and emulator

* Fix nearpc following jumps w/o emulation

* Prevent tests from calling start_binary twice

* Add test for emulate_disasm_loop

* Fix isort

* Add nasm to travis install

* Add --eval-command quit to tests invocation

This should prevent travis from staying in gdb/stalled build when something fails in weird way (like a file is missing)
```
[+] Building 'emulate_disasm.o'
make: nasm: Command not found
make: *** [emulate_disasm.o] Error 127
gdbinit.py: No such file or directory.
pytests_collect.py: No such file or directory.
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
```

* Add test binaries
2018-07-08 23:25:59 +02:00
Disconnect3d 87aa167599
Run each test in a separate GDB session (#498)
* it would be cool to have tests that run within GDB so that we don't have to parse GDB output and deal with weird problems
* we can't run all tests in one GDB session as `file x; entry; <some pwndbg command>; file y; entry; <some wndbg command>;` may have different results - it seems either us or GDB fails to cleanup everything properly
2018-07-08 19:03:03 +02:00
Disconnect3d e225ba9f64
Tests framework (#375)
* Add prototype of unit tests for pwndbg

* Add test for pwndbg [filter]

* Fix isort, e2e tests, add pytest requirement

* Add comment about not handling exceptions for unittests

* Fixes after rebase

* Fix test_loads_without_crashing

* e2e tests: no colors & loading pwndbg tests

* Fix isort

* Add example of no file loaded test

* Move tests to unit_tests, add binary, add memory tests

* Isort fixes

* Move from e2e/unit tests to tests

* Add info about tests to DEVELOPING.md

* Fix tests

* review fixes

* commands filtering test: check for contents, not for equality

* Add tests launcher bash script

* Change tests launcher name from unittests to pytests

* Cleanup; better test file paths

* Add theme param to disable colors

* Better test_loads

* Skip some tests locally that can run on travis

* Fix test_loads according to travis

* Fix travis tests
2018-04-05 04:10:23 +07:00