-
Notifications
You must be signed in to change notification settings - Fork 84
Execute Integration Tests on QNX in CI #415
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
Changes from all commits
138cbad
febbefd
2525f31
04d15c3
42b7fa0
2ac5977
b28f7ab
f599281
a3d6a00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ cc_gtest_unit_test( | |
| name = "generated_api_test", | ||
| srcs = ["generated_api_test.cpp"], | ||
| features = COMPILER_WARNING_FEATURES, | ||
| target_compatible_with = ["@platforms//os:linux"], | ||
|
Contributor
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. Do we want to add a comment with the ticket to have QNX unit tests enabled? In this way it will be harder to forget about removing this once we have the ability to run them on QNX. |
||
| deps = [ | ||
| ":api", | ||
| "@score_baselibs//score/mw/log", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,6 +168,7 @@ cc_gtest_unit_test( | |
| srcs = [ | ||
| "command_line_parser_test.cpp", | ||
| ], | ||
| target_compatible_with = ["@platforms//os:linux"], | ||
|
Contributor
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. Do we want to add a comment with the ticket to have QNX unit tests enabled? In this way it will be harder to forget about removing this once we have the ability to run them on QNX. |
||
| deps = [ | ||
| ":command_line_parser", | ||
| ], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
| exports_files(["restore_qnx8_poll_workaround.patch"]) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| diff --git a/score/os/utils/abortable_blocking_reader.cpp b/score/os/utils/abortable_blocking_reader.cpp | ||
| --- a/score/os/utils/abortable_blocking_reader.cpp | ||
| +++ b/score/os/utils/abortable_blocking_reader.cpp | ||
| @@ -208,22 +208,23 @@ | ||
| return score::cpp::make_unexpected(Error::createFromErrno(EINVAL)); | ||
| } | ||
|
|
||
| - const auto data_available = WaitForData(file_descriptor); | ||
| - | ||
| - if (!data_available.has_value()) | ||
| + // Wait until data is available (or timeout/abort). This function loops internally on QNX8. | ||
| + const auto wait_status = WaitForData(file_descriptor); | ||
| + if (!wait_status.has_value()) | ||
| { | ||
| - return score::cpp::make_unexpected(data_available.error()); | ||
| + return score::cpp::make_unexpected(wait_status.error()); | ||
| } | ||
|
|
||
| // Suppressed here as it is safely used: | ||
| // Provided error check and safeguard to ensure file descriptor is valid before reading. | ||
| // NOLINTNEXTLINE(score-banned-function) see comment above | ||
| - const auto expected_length = unistd_->read(file_descriptor, buffer.data(), buffer.size()); | ||
| - if ((!expected_length.has_value()) || (expected_length.value() < 0)) | ||
| + const auto read_result = unistd_->read(file_descriptor, buffer.data(), buffer.size()); | ||
| + if ((!read_result.has_value()) || (read_result.value() < 0)) | ||
| { | ||
| - return score::cpp::make_unexpected(expected_length.error()); | ||
| + return score::cpp::make_unexpected(read_result.error()); | ||
| } | ||
| - return buffer.first(static_cast<std::size_t>(expected_length.value())); | ||
| + | ||
| + return buffer.first(static_cast<std::size_t>(read_result.value())); | ||
| } | ||
|
|
||
| void AbortableBlockingReader::SignalStop() noexcept | ||
| @@ -249,37 +250,57 @@ | ||
| const NonBlockingFileDescriptor& file_descriptor) noexcept | ||
| { | ||
| std::array<struct pollfd, 2> fds{}; | ||
| - constexpr std::int8_t kNoTimeout{-1}; | ||
| + | ||
| +#ifdef __QNXNTO__ | ||
| + // QNX8 workaround until Ticket-221150 is resolved : add finite timeout so we don't sleep forever if the | ||
| + // resource manager fails to wake pollers; keep true blocking elsewhere. | ||
| + constexpr std::int8_t kPollTimeoutMs = 50; // tuneable: 10–100 ms | ||
| +#else | ||
| + constexpr std::int8_t kPollTimeoutMs = -1; // infinite blocking on other OSes | ||
| +#endif | ||
|
|
||
| fds[0].fd = stop_read_file_descriptor_; | ||
| // Suppress "AUTOSAR C++14 M5-0-21" rule findings. This rule declares: "Bitwise operators shall only be | ||
| // applied to operands of unsigned underlying type." | ||
| // Rationale: Macro POLLIN does not affect the sign of the result. | ||
| // coverity[autosar_cpp14_m5_0_21_violation] | ||
| - fds[0].events = POLLIN; | ||
| + fds[0].events = POLLIN; // self-pipe for abort | ||
|
|
||
| fds[1].fd = file_descriptor.GetUnderlying(); | ||
| + // QNX8 often reports only POLLRDNORM for readable inotify fds. | ||
| // Rationale: see comment above | ||
| // coverity[autosar_cpp14_m5_0_21_violation] | ||
| - fds[1].events = POLLIN; | ||
| + fds[1].events = (POLLIN | POLLRDNORM); | ||
|
|
||
| - // coverity[autosar_cpp14_m5_0_6_violation] | ||
| - const auto poll_result = syspoll_->poll(fds.data(), fds.size(), kNoTimeout); | ||
| + while (true) | ||
| + { | ||
| + // coverity[autosar_cpp14_m5_0_6_violation] | ||
| + const auto poll_result = syspoll_->poll(fds.data(), fds.size(), kPollTimeoutMs); | ||
|
|
||
| - if (!poll_result.has_value()) | ||
| - { | ||
| - return score::cpp::make_unexpected(poll_result.error()); | ||
| - } | ||
| + if (!poll_result.has_value()) | ||
| + { | ||
| + return score::cpp::make_unexpected(poll_result.error()); | ||
| + } | ||
|
|
||
| - // Check return event flag for stop_read_file_descriptor_ | ||
| - // Rationale: see comment above | ||
| - // coverity[autosar_cpp14_m5_0_21_violation] | ||
| - if ((static_cast<std::uint32_t>(fds[0].revents) & static_cast<std::uint32_t>(POLLIN)) != 0U) | ||
| - { | ||
| - return score::cpp::make_unexpected(Error::createFromErrno(EINTR)); | ||
| - } | ||
| + // Check return event flag for stop_read_file_descriptor_ | ||
| + // Rationale: see comment above | ||
| + // coverity[autosar_cpp14_m5_0_21_violation] | ||
| + if ((static_cast<std::uint32_t>(fds[0].revents) & static_cast<std::uint32_t>(POLLIN)) != 0U) | ||
| + { | ||
| + return score::cpp::make_unexpected(Error::createFromErrno(EINTR)); | ||
| + } | ||
| + | ||
| + // If the watched fd is readable, we're ready; otherwise it was a timeout/spurious wake. | ||
| + // Rationale: see comment above | ||
| + // coverity[autosar_cpp14_m5_0_21_violation] | ||
| + if ((static_cast<std::uint32_t>(fds[1].revents) & | ||
| + (static_cast<std::uint32_t>(POLLIN) | static_cast<std::uint32_t>(POLLRDNORM))) != 0U) | ||
| + { | ||
| + return {}; | ||
| + } | ||
|
|
||
| - return {}; | ||
| + // No event yet — timeout or spurious wake. Loop again (QNX8 workaround). | ||
| + } | ||
| } | ||
|
|
||
| score::cpp::expected<std::pair<NonBlockingFileDescriptor, NonBlockingFileDescriptor>, Error> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK this fix should be available in 8.0.4, if we add this information here it will be easier to remember when to remove the patch.