Ticket #9243 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

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

trac_9243.patch Download (3.8 KB) - added by ddrake 3 years ago.
apply to scripts repo
trac_9243_2.patch Download (1.1 KB) - added by wjp 3 years ago.
apply after trac_9243.patch

Change History

comment:1 Changed 3 years ago by ddrake

  • Status changed from new to needs_review

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".

Changed 3 years ago by ddrake

apply to scripts repo

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:5 Changed 3 years ago by wjp

Meta-meta-comment: sorry, I'm blind. This patch already depends on #8641 of course. I'll rebase #9316 to apply after #8641 and #9243.

Changed 3 years ago by wjp

apply after trac_9243.patch

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?

comment:7 Changed 3 years ago by mpatel

  • Status changed from needs_review to positive_review
  • Reviewers set to Willem Jan Palenstijn, Mitesh Patel
  • Authors set to Dan Drake, Willem Jan Palenstijn

To release manager: Apply both patches to 4.5.alpha4 + #8641.

comment:8 Changed 3 years ago by wjp

  • Milestone changed from sage-5.0 to sage-4.5.1

comment:9 Changed 3 years ago by ddrake

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-4.5.2.alpha1

Merged both patches in 4.5.2.alpha1.

Note: See TracTickets for help on using tickets.