| 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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import io | ||
| import os | ||
| import copy | ||
| import pickle | ||
| Expand Down Expand Up | @@ -68,6 +69,9 @@ | |
| """ | ||
|
|
||
|
|
||
| ELFFILE_HEADER = b"\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
|
|
||
|
|
||
| class PlatformTest(unittest.TestCase): | ||
| def clear_caches(self): | ||
| platform._platform_cache.clear() | ||
| Expand Down Expand Up | @@ -538,6 +542,49 @@ def test_parse_os_release(self): | |
| self.assertEqual(info, expected) | ||
| self.assertEqual(len(info["SPECIALS"]), 5) | ||
|
|
||
| def test_parse_musl_version(self): | ||
| output = """\ | ||
| musl libc (x86_64) | ||
| Version 1.2.3 | ||
| Dynamic Program Loader | ||
| Usage: /lib/ld-musl-x86_64.so.1 [options] [--] pathname [args] | ||
| """ | ||
| self.assertEqual(platform._parse_musl_version(output), "1.2") | ||
|
|
||
| @support.requires_subprocess() | ||
| @support.requires_musl() | ||
| def test_libc_ver_musl(self): | ||
| self.assertEqual(platform.libc_ver(), ("musl", "1.2")) | ||
|
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 QualityWill this always be 1.2?
Sorry, something went wrong.
All reactions
|
||
|
|
||
|
|
||
| @support.requires_musl() | ||
| class ELFFileTest(unittest.TestCase): | ||
|
|
||
| def test_get_interpreter(self): | ||
| with open(sys.executable, "rb") as f: | ||
| elffile = platform.ELFFile(f) | ||
| self.assertEqual(elffile.interpreter, "/lib/ld-musl-x86_64.so.1") | ||
|
|
||
| def test_init_invalid_magic(self): | ||
| BAD_ELFFILE_HEADER = b"\x7fBAD\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| f = io.BytesIO(BAD_ELFFILE_HEADER) | ||
| self.assertRaisesRegex( | ||
| platform.ELFInvalid, | ||
| "invalid magic:", | ||
| platform.ELFFile, | ||
| f, | ||
| ) | ||
|
|
||
| def test_init_parse_error(self): | ||
| EMPTY_ELF_HEADER = b"\x00" | ||
| f = io.BytesIO(EMPTY_ELF_HEADER) | ||
| self.assertRaisesRegex( | ||
| platform.ELFInvalid, | ||
| "unable to parse identification", | ||
| platform.ELFFile, | ||
| f, | ||
| ) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| unittest.main() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add musl support to ``platform.libc_ver`` function. |
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.