Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to coveralls github action instead of running commands manually #2480

Open
peace-maker opened this issue Oct 2, 2024 · 0 comments
Open
Labels

Comments

@peace-maker
Copy link
Member

We should consider using https://github.com/marketplace/actions/coveralls-github-action#complete-parallel-job-example instead of our own solution. That would have avoided the hidden-files problem when combining the coverage data manually.

peace-maker added a commit to peace-maker/pwntools that referenced this issue Dec 18, 2024
The handrolled coveralls upload cannot handle mixed operating systems.

Refs Gallopsled#2480
peace-maker added a commit that referenced this issue Jan 21, 2025
* Add `+LINUX` and `+WINDOWS` doctest options

This allows to selectively run tests only on a single platform. We can add `# doctest: +LINUX` comments to tests that cannot work on Windows and the other way around.

To easily skip a lot of tests the `doctest_additional_flags` global variable can be defined in a `testsetup`.

This is achieved by monkey patching sphinx doctest's DocTestBuilder to use our own DocTestRunner which removes examples from the tests that have flags that don't match the platform we're running on.

* Limit Sphinx version to secure platform patches

Avoid major versions which might change the API. We have to check if the platform optionflags still work on newer versions once they are available.

* CI: Run doctests with coverage on Windows

Disable all non-trivial tests on Windows for now. The goal is to reduce the amount of linux-only tests.

* Only apply platform patch on Python 3

* Disable uploading coverage on Windows

The handrolled coveralls upload cannot handle mixed operating systems.

Refs #2480

* Use threading.Timer for doctest timeout

To interrupt the code running on the main thread, we send a signal using `_thread.interrupt_main()`. By default this causes a KeyboardInterrupt exception, which might be handled explicitly.

To raise an explicit EndlessLoop exception inside the code that is taking too long, register a SIGABRT signal handler which raises the EndlessLoop exception. The exception from the signal handler is added to the call stack and handled by the code currently running. This allows to print a better stack trace on timeout.

It is the same concept as the old implementation using `signal.alarm` but platform agnostic.

https://anonbadger.wordpress.com/2018/12/15/python-signal-handlers-and-exceptions/

* Add POSIX optionflag

Run test on other UNIX systems too if they don't use Linux specifics.

Add a TODO optionflag too to mark platform restrictions that might be too strict and should be looked at.

* Enable tube and tube/sockets tests on Windows

* Use `signal.alarm` for timeouts if it's available

* Update CHANGELOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant