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

test_synchronizedtextspec fails on s390x #247

Closed
lazka opened this issue Nov 26, 2015 · 6 comments
Closed

test_synchronizedtextspec fails on s390x #247

lazka opened this issue Nov 26, 2015 · 6 comments
Labels
bug

Comments

@lazka
Copy link
Member

@lazka lazka commented Nov 26, 2015

Originally reported by: Michele Baldessari (Bitbucket: mbaldessari, GitHub: mbaldessari)


FAIL: test_synchronizedtextspec (tests.test__id3specs.SpecSanityChecks)

Traceback (most recent call last):
File "/builddir/build/BUILD/mutagen-1.27/tests/test__id3specs.py", line 92, in test_synchronizedtextspec
s.write(f, [(u"A", 100)]), b"\xff\xfeA\x00\x00\x00\x00\x00\x00d")
AssertionError: '\xfe\xff\x00A\x00\x00\x00\x00\x00d' != '\xff\xfeA\x00\x00\x00\x00\x00\x00d'
]

Downstream bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1270298

Verified against 1.31 as well


@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Nov 26, 2015

Original comment by Christoph Reiter (Bitbucket: lazka, GitHub: lazka):


thanks

@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Nov 26, 2015

Original comment by Daniel Plachotich (Bitbucket: danpla, GitHub: danpla):


UTF-16 is byteorder-dependent, so we can't compare it directly to the fixed bytes in the tests. There must be an if with sys.byteorder.

@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Nov 28, 2015

Original comment by Michele Baldessari (Bitbucket: mbaldessari, GitHub: mbaldessari):


Ok, the following fixes the s390x build for me. Is this what you had in mind?

#!python

diff -up mutagen-1.31/tests/test__id3specs.py.bigendian mutagen-1.31/tests/test__id3specs.py
--- mutagen-1.31/tests/test__id3specs.py.bigendian      2015-11-28 10:50:20.704247897 +0100
+++ mutagen-1.31/tests/test__id3specs.py        2015-11-28 10:50:48.342241500 +0100
@@ -102,8 +102,13 @@ class SpecSanityChecks(TestCase):
         # utf-16
         f.encoding = 1
         self.assertEqual(s.read(f, s.write(f, values)), (values, b""))
-        self.assertEquals(
-            s.write(f, [(u"A", 100)]), b"\xff\xfeA\x00\x00\x00\x00\x00\x00d")
+        # utf-16 is byteorder dependent
+        if sys.byteorder == 'little':
+            self.assertEquals(
+                s.write(f, [(u"A", 100)]), b"\xff\xfeA\x00\x00\x00\x00\x00\x00d")
+        else:
+            self.assertEquals(
+                s.write(f, [(u"A", 100)]), b"\xfe\xff\x00A\x00\x00\x00\x00\x00d")

         # utf-16be
         f.encoding = 2
@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Nov 28, 2015

Original comment by Daniel Plachotich (Bitbucket: danpla, GitHub: danpla):


Yes. I had created the pull request #12.

@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Nov 28, 2015

Original comment by Michele Baldessari (Bitbucket: mbaldessari, GitHub: mbaldessari):


Ah perfect thanks, I had not seen the pull request.

cheers,
Michele

@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Nov 30, 2015

Original comment by Christoph Reiter (Bitbucket: lazka, GitHub: lazka):


test__id3specs: Fix SynchronizedTextSpec test on big-endian machines.

Fixes #247.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.