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

Fix the Python RPC tests on Big Endian architectures #1687

Merged
merged 47 commits into from
Nov 12, 2022

Conversation

peternewman
Copy link
Member

@peternewman peternewman commented Nov 22, 2020

  • New placeholder for NEWS
  • Fix a typo in NEWS
  • Fix the OS X builds on Travis
  • Add a missing semicolon to the build for if we don't have CLOCK_MONOTONIC

The above has all been moved into #1703

This is now mostly:

  • Fix the Python RPC tests on Big Endian architectures

Hopefully we don't ever have to use this unless I've made some huge mea culpa and we'll go straight to 0.11.0
@peternewman peternewman added this to the 0.10.9 milestone Nov 22, 2020
@peternewman peternewman changed the title New placeholder for NEWS Various minor tweaks Nov 23, 2020
@peternewman
Copy link
Member Author

peternewman commented Nov 23, 2020

We probably want to cherry-pick this commit into here too:
5286a69

Given the issues in Homebrew/homebrew-core#65415

Now also in #1703

@peternewman
Copy link
Member Author

@yoe 91cb697 should fix those test on Big Endian architecture, would you mind testing it somehow as I've only dummied it up by reversing stuff on an LE machine. @brucelowekamp care to take a look at it for any Python howlers I've introduced?

# The RPC header (version and size) is encoded in native format, so flip that
# part of the expected data where necessary (as our expected is from a
# little endian source
if sys.byteorder == 'big':
Copy link
Member Author

Choose a reason for hiding this comment

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

Technically we could just run it all of the time, as it wouldn't change the order on an LE machine, but that seemed a bit unnecessary

@brucelowekamp
Copy link
Contributor

@yoe 91cb697 should fix those test on Big Endian architecture, would you mind testing it somehow as I've only dummied it up by reversing stuff on an LE machine. @brucelowekamp care to take a look at it for any Python howlers I've introduced?

I don't know of any python concerns, but I do have to ask if this isn't a protocol error? It's sent out on the socket, so if you were to use the API across two endian machines, it wouldn't work? Looks like both the Python and C++ do the same thing, but still....

Bruce

@peternewman
Copy link
Member Author

I don't know of any python concerns, but I do have to ask if this isn't a protocol error? It's sent out on the socket, so if you were to use the API across two endian machines, it wouldn't work? Looks like both the Python and C++ do the same thing, but still....

I'd be tempted to agree with you @brucelowekamp and I did consider fixing it. However due to the limitations mentioned here:
http://docs.openlighting.org/ola/doc/latest/rpc_system.html#rpc_OLA_RPC

There won't/shouldn't be any inter-machine comms and hence any multi-endian issues. Whereas if we do fix it, then if someone runs an unfixed client against a fixed server, it won't work. Although given this is only on BE machines, I guess it's a fairly low risk. It will definitely be a breaking change though, so I'm not sure I'm personally convinced of the benefit apart from hypothetically. I guess we should at least flag the lines of code with a TODO and possibly consider making the change for 0.11.0 or similar.

Unfortunately @yoe found it didn't entirely work:

(10:52:23) wouter: PeterNewman4: your patches don't seem to resolve the issue
(10:52:31) wouter: that is, it kind of works, but things seem to hang
(10:52:58) wouter: and I also get a line saying "WARNING:root:Protocol mismatch: 3 != 1" when I run python/ola/RDMTest.py

Having had a better look, that code is in our codebase:

if version != self.PROTOCOL_VERSION:
ola_logger.warning('Protocol mismatch: %d != %d', version,
self.PROTOCOL_VERSION)
self._skip_message = True
self._expected_size = size

Given it's the RDM ones, presumably it's of course going to be because they have responses too and I haven't mangled those responses on the way back out, so it can't read them on BE architectures/thinks they're corrupt!

@peternewman
Copy link
Member Author

Okay @yoe this definitely cracks it. Here's a broken build on s390x (thanks to Travis):
https://travis-ci.org/github/OpenLightingProject/ola/jobs/748167069#L4381-L4475

And here's one with that fix applied on top (still on the same architecture):
https://travis-ci.org/github/peternewman/ola/builds/748170563

@yoe
Copy link
Contributor

yoe commented Dec 8, 2020 via email

@peternewman peternewman changed the title Various minor tweaks Fix the Python RPC tests on Big Endian architectures Dec 23, 2020
peternewman and others added 4 commits January 7, 2021 00:17
While this breaks the theoretical Python 2.6 support, other tests have already used the newer asserts. There's also a separate PR in to sort this backwards compatibility anyway.
…osed to be two calls, testFetchDmx covers what we want to test anyway
@peternewman peternewman merged commit 4e65521 into OpenLightingProject:0.10 Nov 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants