| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -552,6 +552,10 @@ def test_libc_ver(self): | |
| (b'GLIBC_2.9', ('glibc', '2.9')), | ||
| (b'libc.so.1.2.5', ('libc', '1.2.5')), | ||
| (b'libc_pthread.so.1.2.5', ('libc', '1.2.5_pthread')), | ||
| (b'/aports/main/musl/src/musl-1.2.5', ('musl', '1.2.5')), | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityCan you add tests on version with 2 numbers and 4 numbers? Like /aports/main/musl/src/musl-1.2 and /aports/main/musl/src/musl-1.2.5.1.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI could, but I don't believe musl will ever have such release numbers, so is it worth doing?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityParsing a binary file using a regular expression is a strange thing for me. So I prefer to have tests to make sure that the implementation is reliable. The question is more if the regex will match versions with 2 members (x.y) or 4 members (x.y.z.a), or if it only matchs version with 3 members (x.y.z).
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityFair enough, though the existing tests don't do that, nor do they test the no-match cases. I could add such tests, but at that point I'd want to rewrite this test method to split it up into multiple tests, and I don't think that's in scope for this PR :) I'll add the couple of extra checks, though.
Sorry, something went wrong.
All reactions
|
||
| # musl uses semver, but we accept some variations anyway: | ||
| (b'/aports/main/musl/src/musl-12.5', ('musl', '12.5')), | ||
| (b'/aports/main/musl/src/musl-1.2.5.7', ('musl', '1.2.5.7')), | ||
| (b'', ('', '')), | ||
| ): | ||
| with open(filename, 'wb') as fp: | ||
| Expand All | @@ -563,14 +567,29 @@ def test_libc_ver(self): | |
| expected) | ||
|
|
||
| # binary containing multiple versions: get the most recent, | ||
| # make sure that 1.9 is seen as older than 1.23.4 | ||
| chunksize = 16384 | ||
| with open(filename, 'wb') as f: | ||
| # test match at chunk boundary | ||
| f.write(b'x'*(chunksize - 10)) | ||
| f.write(b'GLIBC_1.23.4\0GLIBC_1.9\0GLIBC_1.21\0') | ||
| self.assertEqual(platform.libc_ver(filename, chunksize=chunksize), | ||
| ('glibc', '1.23.4')) | ||
| # make sure that eg 1.9 is seen as older than 1.23.4, and that | ||
| # the arguments don't count even if they are set. | ||
| chunksize = 200 | ||
| for data, expected in ( | ||
| (b'GLIBC_1.23.4\0GLIBC_1.9\0GLIBC_1.21\0', ('glibc', '1.23.4')), | ||
| (b'libc.so.2.4\0libc.so.9\0libc.so.23.1\0', ('libc', '23.1')), | ||
| (b'musl-1.4.1\0musl-2.1.1\0musl-2.0.1\0', ('musl', '2.1.1')), | ||
| (b'no match here, so defaults are used', ('test', '100.1.0')), | ||
| ): | ||
|
Comment thread
picnixz marked this conversation as resolved.
|
||
| with open(filename, 'wb') as f: | ||
| # test match at chunk boundary | ||
| f.write(b'x'*(chunksize - 10)) | ||
| f.write(data) | ||
| self.assertEqual( | ||
| expected, | ||
| platform.libc_ver( | ||
| filename, | ||
| lib='test', | ||
| version='100.1.0', | ||
| chunksize=chunksize, | ||
| ), | ||
| ) | ||
|
Comment thread
picnixz marked this conversation as resolved.
|
||
|
|
||
|
|
||
| def test_android_ver(self): | ||
| res = platform.android_ver() | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -544,10 +544,7 @@ def test_date_locale(self): | |
| self.roundtrip('%x', slice(0, 3), time.localtime(now - 366*24*3600)) | ||
|
|
||
| # NB: Dates before 1969 do not roundtrip on many locales, including C. | ||
| @unittest.skipIf( | ||
| support.is_emscripten or support.is_wasi, | ||
| "musl libc issue on Emscripten, bpo-46390" | ||
| ) | ||
| @unittest.skipIf(support.linked_to_musl(), "musl libc issue, bpo-46390") | ||
| @run_with_locales('LC_TIME', 'en_US', 'fr_FR', 'de_DE', 'ja_JP', | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityWe can add the linked_to_musl() check in run_with_locales() and run_with_locale(). This may be non-trivial, depending on arguments, a dummy run can be supported even if no suitable locale was found. For now, the proposed change is good as is.
Sorry, something went wrong.
All reactions
|
||
| 'eu_ES', 'ar_AE', 'my_MM', 'shn_MM') | ||
| def test_date_locale2(self): | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| :func:`platform.libc_ver` can now detect and report the version of ``musl`` | ||
| on Alpine Linux. |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI prefer the style I used because it lines up better with how python's statements work (first line only is outdented, lack of outdent signals return to outer logic block). This is accepted by PEP 8, are there additional style constrains on the cpython code base these days?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI haven't seen lots of use of hanging indents in the lib. There is no additional constraints but usually we try to be consistent with the surrounding code when possible.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.