Ticket #9243 (closed enhancement: fixed)
sage-doctest should use powers of 2 for return codes
| Reported by: | ddrake | Owned by: | mvngu |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-4.5.2 |
| Component: | doctest coverage | Keywords: | |
| Cc: | wjp | Work issues: | |
| Report Upstream: | N/A | Reviewers: | Willem Jan Palenstijn, Mitesh Patel |
| Authors: | Dan Drake, Willem Jan Palenstijn | Merged in: | sage-4.5.2.alpha1 |
| Dependencies: | Stopgaps: |
Description
Right now, sage-doctest uses these return codes:
# Return value in process exit code: # 0: all tests passed # 1: file not found # 2: KeyboardInterrupt # 3: doctest process was terminated by a signal # 4: the doctesting framework raised an exception # 100: failed doctests
In #8641 and #9224, we make sure that the return code gets passed on to the user, and for multiple files, we `or' the return codes together. It would be much nicer for the user if we used powers of 2 for return codes, so that it's easy to see exactly what happened.
I recommend we change 3->4, 4->8, and 100->128 in sage-doctest.
Attachments
Change History
comment:2 Changed 3 years ago by ddrake
The new patch changes the absurdly accurate reporting of how long the tests took when you hit Ctrl-C; before we had "KeyboardInterrupt? -- interrupted after 2.2340259552 seconds!" and now it just uses one decimal place, instead of 10.
comment:3 Changed 3 years ago by mpatel
- Cc wjp added
When #9316 merges, will we need to use 256, too, or use a different collection scheme?
comment:4 Changed 3 years ago by wjp
Thanks for adding me to CC.
I like this patch. There's one more instance, though: test_file in sage-ptest uses 5 as its own internal error code for unhandled exception. We should probably change that to 32. (And keep that one reserved.)
If #9316 is rebased on top of this one (which I can do), it will use error code 64 for timeouts.
All 8 available bits are then in use, so if we want to add more error conditions after that, we'll have to re-think this, or merge some error flags together.
Meta-comment: there are now three doctest related patches that I'm aware of, and that should probably all be merged. I would suggest this order: #9243, #9316, #8641.
comment:6 Changed 3 years ago by wjp
I added a patch to address the internally used error code 5.
Positive review for the rest of the patch. Could someone review my small reviewer patch?


Patch up, please review. This depends on #8641. I added an exit code of 16 for "bad options"; previously, sage-doctest exited with code 1 for both "file not found" and "bad options".