In test/syscalls/linux/msgqueue.cc:
- Fixed a TSAN data race in MsgSndRmWhileBlocking and MsgRcvRmWhileBlocking by
passing the message queue ID by-value into background threads instead of
evaluating queue.get() on the raw shared pointer.
- Fixed a multi-run global state bleed in MsgCtlMsgInfo by checking global
msgpool queue offsets relative to their existing background state rather than
hardcoding strict zeros.
PiperOrigin-RevId: 955474605
- Fix msgrcv(MSG_COPY) ignoring maxSize, by merging Queue.Copy() into
Queue.Receive().
- Fix msgrcv(MSG_NOERROR) of truncated messages overwriting the first byte
after the end of the received message.
- Fix msgrcv(MSG_NOERROR) of truncated messages incorrectly updating
Queue.byteCount.
- Remove Message.Size, which is completely redundant with len(Message.Text).
- Remove msgqueue.Blocker, which is redundant with context.Blocker and
context.Context after cl/415189675.
PiperOrigin-RevId: 853322832
This test flakes with <1% rate. There is a relevant comment
explaining that "timestamps only have a resolution of seconds"
and so we need to sleep for a second to actually see the timestamps
change. However, currently the tests sleeps *before* calculating
local time. Which beats the point. Move the local time declaration
before the sleep.
absl::ToTimeT() rounds down to the nearest second, discarding
nanoseconds field completely. I think the host kernel might be
rounding up the `msqid_ds` time fields.
Tested: 1000 runs of this test pass natively.
PiperOrigin-RevId: 455187650
Msgqueue tests were using fork() to run create a separate thread of
execution for passing messages back and forth over a queue. However,
the child process after a fork() may only use async-signal-safe
functions, which at a minimum exclude gtest asserts.
Instead, use threads.
PiperOrigin-RevId: 389073744