mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-07 01:06:45 +08:00
test_channel may fail unexpectedly
This commit is contained in:
parent
56861df8fe
commit
0b3a561c53
@ -209,14 +209,15 @@ void Unit::test_channel() {
|
|||||||
|
|
||||||
std::thread t1 {[&] {
|
std::thread t1 {[&] {
|
||||||
auto cc = wait_for_handshake(1);
|
auto cc = wait_for_handshake(1);
|
||||||
const char cp[] = "copy:";
|
const char cp[] = "copy:", re[] = "re-copy:";
|
||||||
bool unchecked = true;
|
bool unchecked = true;
|
||||||
for (std::size_t i = 0; i < datas.size(); ++i, unchecked = false) {
|
for (std::size_t i = 0; i < datas.size(); ++i, unchecked = false) {
|
||||||
ipc::buff_t dd;
|
ipc::buff_t dd;
|
||||||
do {
|
do {
|
||||||
dd = cc.recv();
|
dd = cc.recv();
|
||||||
} while (unchecked && (dd.size() > sizeof(cp)) &&
|
} while (unchecked &&
|
||||||
std::memcmp(dd.data(), cp, sizeof(cp) - 1) == 0);
|
(((dd.size() > sizeof(cp)) && std::memcmp(dd.data(), cp, sizeof(cp) - 1) == 0) ||
|
||||||
|
((dd.size() > sizeof(re)) && std::memcmp(dd.data(), re, sizeof(re) - 1) == 0)));
|
||||||
QCOMPARE(dd.size(), std::strlen(datas[i]) + 1);
|
QCOMPARE(dd.size(), std::strlen(datas[i]) + 1);
|
||||||
QVERIFY(std::memcmp(dd.data(), datas[i], dd.size()) == 0);
|
QVERIFY(std::memcmp(dd.data(), datas[i], dd.size()) == 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user