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

Improve interaction between ctrl-c and Test() #1879

Closed
fingolfin opened this issue Nov 8, 2017 · 0 comments · Fixed by #2900
Closed

Improve interaction between ctrl-c and Test() #1879

fingolfin opened this issue Nov 8, 2017 · 0 comments · Fixed by #2900
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements topic: tests issues or PRs related to tests

Comments

@fingolfin
Copy link
Member

Right now, pressing ctrl-c while Test(...) is running does not open a break prompt, nor does it abort Test(...). Instead, the user interrupt is treated like an error in the code being tested. This makes it difficult to abort certain long running tests; sometimes, if you are lucky, you can press ctrl-c quickly repeatedly to at least exit GAP, but even that can fail.

Perhaps we could teach Test() and friends to treat user interrupts differently -- i.e. if a user interrupt happens, either abort Test(), or (for bonus points) actually enter a break prompt (that might be difficult to pull of, though; it's not that important anyway).

To implement this, I imagine we'd modify (at least) the following places:
1 . READ_TEST_OR_LOOP, to teach it to abort upon user interrupt;
2. FuncREAD_STREAM_LOOP, to signal whether the operation completed normal, or was interrupted by the user (and possibly more), e.g. via its return value
3. RunTests in lib/test.gi then would track the return value of READ_STREAM_LOOP, and if it indicates a user interrupt, would take appropriate steps, e.g. abort itself, and possibly indicate that via a return value, too. Or perhaps better, it could just issue an Error("user interrupt detected") of its own, with the break loop re-enabled; then the user can choose whether to abort the test (via quit;), or to continue to the next test file (by doing a return;; then I imagine right after the Error, RunTests would return itself, so that processing the current file ends).

@fingolfin fingolfin added the kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements label Nov 8, 2017
@olexandr-konovalov olexandr-konovalov added the topic: tests issues or PRs related to tests label Feb 3, 2018
fingolfin added a commit to fingolfin/gap that referenced this issue Oct 5, 2018
This is a bit of a hack, but seems to work very well in practice.
You can even resume the test with `return` if you want (but the
interrupted line will still lead to diffs).

Resolves gap-system#1879
fingolfin added a commit to fingolfin/gap that referenced this issue Oct 6, 2018
This is a bit of a hack, but seems to work very well in practice.
You can even resume the test with `return` if you want (but the
interrupted line will still lead to diffs).

Resolves gap-system#1879
fingolfin added a commit to fingolfin/gap that referenced this issue Oct 7, 2018
This is a bit of a hack, but seems to work very well in practice.
You can even resume the test with `return` if you want (but the
interrupted line will still lead to diffs).

Resolves gap-system#1879
fingolfin added a commit that referenced this issue Oct 8, 2018
This is a bit of a hack, but seems to work very well in practice.
You can even resume the test with `return` if you want (but the
interrupted line will still lead to diffs).

Resolves #1879
ssiccha pushed a commit to ssiccha/gap that referenced this issue Mar 27, 2019
This is a bit of a hack, but seems to work very well in practice.
You can even resume the test with `return` if you want (but the
interrupted line will still lead to diffs).

Resolves gap-system#1879
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements topic: tests issues or PRs related to tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants