Skip to content

Conversation

@NestorDP
Copy link
Owner

Summary

  • Implement new test for read function return a errno

Changes

  • API changes
  • Behavior changes
  • Docs updated
  • Tests added/updated

Details

  • Crete function pointers to allow mook the ::poll and ::read functions

How to test

Screenshots/Logs (optional)

Checklist

  • Builds locally (Release + Debug)
  • All tests pass (if applicable)
  • Lint/format pass: make cppcheck / make cpplint / make uncrustify
  • Example(s) tested (if touched)
  • Documentation updated (README/docs)

Risks and rollbacks

@NestorDP NestorDP requested a review from Copilot October 25, 2025 11:23
@NestorDP NestorDP self-assigned this Oct 25, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces testing infrastructure to verify error handling in the read function by allowing system call injection, and improves error message clarity across the codebase.

  • Adds function pointer members (poll_, read_) to enable mocking system calls for testing
  • Implements new test ReadWithReadFail that verifies proper error handling for various errno values
  • Updates existing error messages for consistency and clarity (e.g., "100ms" → "100 milliseconds")

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
include/libserial/serial.hpp Adds function pointer members and test helper method to inject mock system calls
src/serial.cpp Replaces direct system calls with function pointers and improves error message formatting
test/test_serial_pty.cpp Adds comprehensive error scenario testing and replaces log statements with assertions
test/test_ports.cpp Removes unnecessary logging statement

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

❌ Patch coverage is 88.38710% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
test/test_serial_pty.cpp 85.21% 17 Missing ⚠️
src/serial.cpp 96.55% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@NestorDP NestorDP requested a review from Copilot October 25, 2025 12:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@NestorDP NestorDP requested a review from Copilot October 25, 2025 13:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@NestorDP NestorDP merged commit 01594b6 into main Oct 25, 2025
4 of 5 checks passed
@NestorDP NestorDP deleted the feat-read-with-read-fails branch October 25, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants