Skip to content

bpo-32138: Skip on Android test_faulthandler tests that raise SIGSEGV#4604

Merged
xdegaye merged 2 commits into
python:masterfrom
xdegaye:bpo-32138
Nov 29, 2017
Merged

bpo-32138: Skip on Android test_faulthandler tests that raise SIGSEGV#4604
xdegaye merged 2 commits into
python:masterfrom
xdegaye:bpo-32138

Conversation

@xdegaye

@xdegaye xdegaye commented Nov 28, 2017

Copy link
Copy Markdown
Contributor

Remove the test.support.requires_android_level decorator.

https://bugs.python.org/issue32138

Remove the test.support.requires_android_level decorator.
@xdegaye xdegaye added the tests Tests in the Lib/test dir label Nov 28, 2017
@xdegaye xdegaye requested a review from vstinner November 28, 2017 10:15
Comment thread Lib/test/support/__init__.py Outdated
except AttributeError:
# sys.getandroidapilevel() is only available on Android
is_android = False
is_android = True if hasattr(sys, 'getandroidapilevel') else False

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just "hasattr(sys, 'getandroidapilevel')"??

else:
return unittest.skip("resource {0!r} is not enabled".format(resource))

def requires_android_level(level, reason):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to keep it. I'm in touch with a developer who wants to support older Android versions, and in the future, we may have to use it again for features only working on newer Android versions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer not to clutter test.support with dead code and it is easy to restore requires_android_level with git show <sha1> | git apply -R.

Comment thread Lib/test/test_faulthandler.py Outdated
'access violation')

@requires_raise
@unittest.skipIf(is_android, 'raising SIGSEGV on Android is unreliable')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please write a function like the current requires_raise() for Android, since you copied/pasted this line many times. Something like:

def skip_on_android():
    return unittest.skipIf(is_android, 'raising SIGSEGV on Android is unreliable')

Maybe "skip_segfault_on_android"?

Add a comment on this function mentionning "bpo-32138" and explain that raise(SIGSEGV) doesn't crash on Android (but does nothing if I understood correctly).

Then just use @skip_on_android.

@bedevere-bot

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@xdegaye

xdegaye commented Nov 28, 2017

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again.

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@vstinner: please review the changes made to this pull request.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

return '^' + regex + '$'

def skip_segfault_on_android(test):
# Issue #32138: Raising SIGSEGV on Android may not cause a crash.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thank you :-)

@vstinner

Copy link
Copy Markdown
Member

Thanks for the update, the PR is now much better!

@xdegaye xdegaye merged commit ef83806 into python:master Nov 29, 2017
@xdegaye xdegaye deleted the bpo-32138 branch November 29, 2017 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants