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

libregrtest: mark a test as failed if a thread logs an unexpected exception #88009

Closed
vstinner opened this issue Apr 14, 2021 · 4 comments
Closed
Labels
3.10 only security fixes tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

BPO 43843
Nosy @vstinner
PRs
  • bpo-43843: libregrtest uses threading.excepthook #25400
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-05-26.22:17:30.354>
    created_at = <Date 2021-04-14.11:20:23.190>
    labels = ['tests', '3.10']
    title = 'libregrtest: mark a test as failed if a thread logs an unexpected exception'
    updated_at = <Date 2021-05-26.22:17:30.353>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2021-05-26.22:17:30.353>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-05-26.22:17:30.354>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2021-04-14.11:20:23.190>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43843
    keywords = ['patch']
    message_count = 4.0
    messages = ['391059', '391188', '391189', '391208']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = ['25400']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue43843'
    versions = ['Python 3.10']

    @vstinner
    Copy link
    Member Author

    The Python test runner (libregrtest) should mark a test as failed if a thread logs an unexpected exception, as already done with unraisable exception.

    See for example bpo-43842 where test_logging logs the following exception, but the tes is marked as passed:

    Exception in thread Thread-25 (serve_forever):
    Traceback (most recent call last):
      File "/usr/home/vstinner/python/master/Lib/threading.py", line 990, in _bootstrap_inner
        self.run()
      File "/usr/home/vstinner/python/master/Lib/threading.py", line 928, in run
        self._target(*self._args, **self._kwargs)
      File "/usr/home/vstinner/python/master/Lib/test/test_logging.py", line 863, in serve_forever
        asyncore.loop(poll_interval, map=self._map)
      File "/usr/home/vstinner/python/master/Lib/asyncore.py", line 203, in loop
        poll_fun(timeout, map)
      File "/usr/home/vstinner/python/master/Lib/asyncore.py", line 144, in poll
        r, w, e = select.select(r, w, e, timeout)
    OSError: [Errno 9] Bad file descriptor

    Attached PR implements this change.

    @vstinner vstinner added 3.10 only security fixes tests Tests in the Lib/test dir labels Apr 14, 2021
    @vstinner
    Copy link
    Member Author

    New changeset b136b1a by Victor Stinner in branch 'master':
    bpo-43843: libregrtest uses threading.excepthook (GH-25400)
    b136b1a

    @vstinner
    Copy link
    Member Author

    test_concurrent_futures logs two warnings.

    s390x Debian 3.x:
    https://buildbot.python.org/all/#/builders/49/builds/1124

    AMD64 RHEL7 3.x:
    https://buildbot.python.org/all/#/builders/15/builds/1074

    0:03:18 load avg: 4.78 [302/427] test_concurrent_futures passed (2 min 46 sec) -- running: test_tokenize (37.8 sec), test_peg_generator (59.2 sec)
    Warning -- Uncaught thread exception: SystemExit
    Warning -- Uncaught thread exception: SystemExit

    @vstinner
    Copy link
    Member Author

    test_concurrent_futures logs two warnings: I created bpo-43867 for this one.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant